From d063e65e37afd03e5a101623970a58e6199cc7e0 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Sat, 7 Nov 2026 16:47:57 +0000 Subject: [PATCH 1/3] Migrate baton-github to go-github v93 Co-authored-by: c1-squire-dev[bot] --- go.mod | 4 +- go.sum | 9 +- pkg/connector/api_token.go | 2 +- pkg/connector/app.go | 2 +- pkg/connector/app_test.go | 2 +- pkg/connector/connector.go | 11 +- .../enterprise_installations_test.go | 11 +- pkg/connector/enterprise_role.go | 2 +- pkg/connector/enterprise_role_test.go | 4 +- pkg/connector/go_github_test.go | 20 + pkg/connector/helpers.go | 2 +- pkg/connector/invitation.go | 4 +- pkg/connector/invitation_test.go | 4 +- pkg/connector/org.go | 4 +- pkg/connector/org_role.go | 20 +- pkg/connector/org_role_test.go | 5 +- pkg/connector/org_test.go | 3 +- pkg/connector/repository.go | 37 +- pkg/connector/repository_test.go | 33 +- pkg/connector/team.go | 4 +- pkg/connector/team_test.go | 3 +- pkg/connector/token_refresh.go | 14 +- pkg/connector/token_refresh_test.go | 12 +- pkg/connector/usage_event_feed.go | 2 +- pkg/connector/usage_event_feed_test.go | 28 +- pkg/connector/user.go | 2 +- pkg/connector/user_test.go | 3 +- pkg/customclient/client.go | 17 +- test/mocks/github.go | 12 +- .../go-github/v69/github/actions_oidc.go | 81 - .../github/actions_permissions_enterprise.go | 258 - .../v69/github/actions_permissions_orgs.go | 271 - .../v69/github/actions_required_workflows.go | 267 - .../go-github/v69/github/actions_secrets.go | 407 - .../go-github/v69/github/actions_variables.go | 341 - .../google/go-github/v69/github/billing.go | 218 - .../google/go-github/v69/github/codespaces.go | 266 - .../google/go-github/v69/github/copilot.go | 570 - .../go-github/v69/github/dependency_graph.go | 82 - .../google/go-github/v69/github/issues.go | 396 - .../go-github/v69/github/issues_labels.go | 253 - .../orgs_codesecurity_configurations.go | 284 - .../google/go-github/v69/github/orgs_rules.go | 140 - .../google/go-github/v69/github/packages.go | 143 - .../v69/github/repos_actions_permissions.go | 118 - .../go-github/v69/github/repos_releases.go | 476 - .../go-github/v69/github/repos_rules.go | 227 - .../go-github/v69/github/secret_scanning.go | 267 - .../go-github/v69/github/with_appengine.go | 20 - .../go-github/v69/github/without_appengine.go | 19 - .../google/go-github/{v69 => v93}/AUTHORS | 73 + .../google/go-github/{v69 => v93}/LICENSE | 0 .../go-github/{v69 => v93}/github/actions.go | 2 +- .../{v69 => v93}/github/actions_artifacts.go | 85 +- .../{v69 => v93}/github/actions_cache.go | 168 +- .../v93/github/actions_hosted_runners.go | 516 + .../go-github/v93/github/actions_oidc.go | 201 + .../github/actions_permissions_enterprise.go | 414 + .../v93/github/actions_permissions_orgs.go | 526 + .../go-github/v93/github/actions_policies.go | 299 + .../github/actions_runner_groups.go | 152 +- .../{v69 => v93}/github/actions_runners.go | 131 +- .../go-github/v93/github/actions_secrets.go | 530 + .../go-github/v93/github/actions_variables.go | 478 + .../github/actions_workflow_jobs.go | 36 +- .../github/actions_workflow_runs.go | 129 +- .../{v69 => v93}/github/actions_workflows.go | 113 +- .../go-github/{v69 => v93}/github/activity.go | 10 +- .../{v69 => v93}/github/activity_events.go | 54 +- .../github/activity_notifications.go | 76 +- .../{v69 => v93}/github/activity_star.go | 102 +- .../{v69 => v93}/github/activity_watching.go | 47 +- .../go-github/{v69 => v93}/github/admin.go | 36 +- .../{v69 => v93}/github/admin_orgs.go | 26 +- .../{v69 => v93}/github/admin_stats.go | 8 +- .../{v69 => v93}/github/admin_users.go | 45 +- .../go-github/v93/github/agent_tasks.go | 278 + .../google/go-github/v93/github/agents.go | 15 + .../go-github/v93/github/agents_secrets.go | 322 + .../go-github/v93/github/agents_variables.go | 307 + .../go-github/{v69 => v93}/github/apps.go | 151 +- .../{v69 => v93}/github/apps_hooks.go | 18 +- .../github/apps_hooks_deliveries.go | 22 +- .../{v69 => v93}/github/apps_installation.go | 50 +- .../{v69 => v93}/github/apps_manifest.go | 10 +- .../{v69 => v93}/github/apps_marketplace.go | 40 +- .../{v69 => v93}/github/attestations.go | 0 .../{v69 => v93}/github/authorizations.go | 48 +- .../google/go-github/v93/github/billing.go | 553 + .../go-github/{v69 => v93}/github/checks.go | 100 +- .../google/go-github/v93/github/classroom.go | 268 + .../go-github/v93/github/code_quality.go | 183 + .../{v69 => v93}/github/code_scanning.go | 154 +- .../{v69 => v93}/github/codesofconduct.go | 18 +- .../google/go-github/v93/github/codespaces.go | 593 + .../v93/github/codespaces_machines.go | 74 + .../go-github/v93/github/codespaces_orgs.go | 179 + .../{v69 => v93}/github/codespaces_secrets.go | 143 +- .../google/go-github/v93/github/copilot.go | 1783 + .../v93/github/copilot_cloud_agent.go | 51 + .../go-github/v93/github/credentials.go | 37 + .../{v69 => v93}/github/dependabot.go | 2 +- .../{v69 => v93}/github/dependabot_alerts.go | 45 +- .../{v69 => v93}/github/dependabot_secrets.go | 266 +- .../go-github/v93/github/dependency_graph.go | 246 + .../github/dependency_graph_snapshots.go | 61 +- .../go-github/{v69 => v93}/github/doc.go | 94 +- .../go-github/{v69 => v93}/github/emojis.go | 6 +- .../{v69 => v93}/github/enterprise.go | 2 +- .../enterprise_actions_hosted_runners.go | 344 + .../enterprise_actions_runner_groups.go | 124 +- .../github/enterprise_actions_runners.go | 50 +- .../v93/github/enterprise_app_installation.go | 268 + .../github/enterprise_audit_log.go | 6 +- .../v93/github/enterprise_audit_log_stream.go | 287 + .../v93/github/enterprise_billing.go | 227 + .../github/enterprise_billing_cost_centers.go | 233 + .../v93/github/enterprise_budgets.go | 271 + .../enterprise_code_security_and_analysis.go | 28 +- .../enterprise_codesecurity_configurations.go | 232 + .../v93/github/enterprise_licenses.go | 230 + .../github/enterprise_manage_ghes.go | 30 +- .../github/enterprise_manage_ghes_config.go | 98 +- .../enterprise_manage_ghes_maintenance.go | 16 +- .../github/enterprise_manage_ghes_ssh.go | 18 +- .../enterprise_network_configurations.go | 144 + .../enterprise_organization_properties.go | 189 + .../github/enterprise_properties.go | 32 +- .../{v69 => v93}/github/enterprise_rules.go | 53 +- .../go-github/v93/github/enterprise_scim.go | 481 + .../go-github/v93/github/enterprise_team.go | 420 + .../go-github/{v69 => v93}/github/event.go | 4 +- .../{v69 => v93}/github/event_types.go | 256 +- .../go-github/{v69 => v93}/github/gists.go | 138 +- .../{v69 => v93}/github/gists_comments.go | 54 +- .../go-github/{v69 => v93}/github/git.go | 2 +- .../{v69 => v93}/github/git_blobs.go | 30 +- .../{v69 => v93}/github/git_commits.go | 34 +- .../go-github/{v69 => v93}/github/git_refs.go | 112 +- .../go-github/{v69 => v93}/github/git_tags.go | 45 +- .../{v69 => v93}/github/git_trees.go | 42 +- .../{v69 => v93}/github/github-accessors.go | 51374 +++++++++++----- .../go-github/v93/github/github-iterators.go | 8532 +++ .../go-github/{v69 => v93}/github/github.go | 1356 +- .../{v69 => v93}/github/gitignore.go | 16 +- .../{v69 => v93}/github/interactions.go | 2 +- .../{v69 => v93}/github/interactions_orgs.go | 29 +- .../{v69 => v93}/github/interactions_repos.go | 29 +- .../{v69 => v93}/github/issue_import.go | 27 +- .../google/go-github/v93/github/issues.go | 582 + .../{v69 => v93}/github/issues_assignees.go | 28 +- .../{v69 => v93}/github/issues_comments.go | 95 +- .../v93/github/issues_dependencies.go | 110 + .../{v69 => v93}/github/issues_events.go | 20 +- .../go-github/v93/github/issues_labels.go | 267 + .../{v69 => v93}/github/issues_milestones.go | 70 +- .../{v69 => v93}/github/issues_timeline.go | 7 +- .../go-github/{v69 => v93}/github/licenses.go | 33 +- .../go-github/{v69 => v93}/github/markdown.go | 14 +- .../go-github/{v69 => v93}/github/messages.go | 80 +- .../go-github/{v69 => v93}/github/meta.go | 68 +- .../{v69 => v93}/github/migrations.go | 93 +- .../github/migrations_source_import.go | 86 +- .../{v69 => v93}/github/migrations_user.go | 57 +- .../go-github/{v69 => v93}/github/orgs.go | 97 +- .../github/orgs_actions_allowed.go | 12 +- .../github/orgs_actions_permissions.go | 12 +- .../go-github/v93/github/orgs_artifacts.go | 219 + .../{v69 => v93}/github/orgs_attestations.go | 8 +- .../{v69 => v93}/github/orgs_audit_log.go | 88 +- .../orgs_codesecurity_configurations.go | 382 + .../github/orgs_credential_authorizations.go | 15 +- .../github/orgs_custom_repository_roles.go | 87 +- .../{v69 => v93}/github/orgs_hooks.go | 57 +- .../github/orgs_hooks_configuration.go | 20 +- .../github/orgs_hooks_deliveries.go | 22 +- .../v93/github/orgs_immutable_releases.go | 174 + .../go-github/v93/github/orgs_issue_types.go | 99 + .../{v69 => v93}/github/orgs_members.go | 116 +- .../v93/github/orgs_network_configurations.go | 239 + .../github/orgs_organization_properties.go | 60 + .../github/orgs_organization_roles.go | 140 +- .../github/orgs_outside_collaborators.go | 22 +- .../{v69 => v93}/github/orgs_packages.go | 48 +- .../github/orgs_personal_access_tokens.go | 119 +- .../{v69 => v93}/github/orgs_properties.go | 132 +- .../google/go-github/v93/github/orgs_rules.go | 120 + .../github/orgs_security_managers.go | 18 +- .../github/orgs_users_blocking.go | 34 +- .../google/go-github/v93/github/packages.go | 319 + .../v93/github/private_registries.go | 362 + .../google/go-github/v93/github/projects.go | 1055 + .../go-github/{v69 => v93}/github/pulls.go | 309 +- .../{v69 => v93}/github/pulls_comments.go | 117 +- .../{v69 => v93}/github/pulls_reviewers.go | 34 +- .../{v69 => v93}/github/pulls_reviews.go | 105 +- .../go-github/v93/github/pulls_stacks.go | 270 + .../{v69 => v93}/github/pulls_threads.go | 0 .../{v69 => v93}/github/rate_limit.go | 25 +- .../{v69 => v93}/github/reactions.go | 232 +- .../go-github/{v69 => v93}/github/repos.go | 749 +- .../github/repos_actions_access.go | 20 +- .../github/repos_actions_allowed.go | 18 +- .../v93/github/repos_actions_permissions.go | 230 + .../{v69 => v93}/github/repos_attestations.go | 8 +- .../{v69 => v93}/github/repos_autolinks.go | 48 +- .../{v69 => v93}/github/repos_codeowners.go | 8 +- .../github/repos_collaborators.go | 47 +- .../{v69 => v93}/github/repos_comments.go | 103 +- .../{v69 => v93}/github/repos_commits.go | 55 +- .../github/repos_community_health.go | 8 +- .../{v69 => v93}/github/repos_contents.go | 193 +- .../repos_deployment_branch_policies.go | 72 +- .../repos_deployment_protection_rules.go | 61 +- .../{v69 => v93}/github/repos_deployments.go | 87 +- .../{v69 => v93}/github/repos_environments.go | 80 +- .../{v69 => v93}/github/repos_forks.go | 33 +- .../{v69 => v93}/github/repos_hooks.go | 100 +- .../github/repos_hooks_configuration.go | 22 +- .../github/repos_hooks_deliveries.go | 50 +- .../v93/github/repos_immutable_releases.go | 82 + .../{v69 => v93}/github/repos_invitations.go | 20 +- .../{v69 => v93}/github/repos_keys.go | 43 +- .../{v69 => v93}/github/repos_lfs.go | 12 +- .../{v69 => v93}/github/repos_merging.go | 26 +- .../{v69 => v93}/github/repos_pages.go | 102 +- .../github/repos_prereceive_hooks.go | 46 +- .../{v69 => v93}/github/repos_properties.go | 12 +- .../go-github/v93/github/repos_releases.go | 562 + .../go-github/v93/github/repos_rules.go | 303 + .../{v69 => v93}/github/repos_stats.go | 44 +- .../{v69 => v93}/github/repos_statuses.go | 35 +- .../{v69 => v93}/github/repos_tags.go | 35 +- .../{v69 => v93}/github/repos_traffic.go | 28 +- .../go-github/{v69 => v93}/github/rules.go | 455 +- .../go-github/{v69 => v93}/github/scim.go | 153 +- .../go-github/{v69 => v93}/github/search.go | 78 +- .../go-github/v93/github/secret_scanning.go | 401 + .../github/secret_scanning_custom_patterns.go | 424 + .../github/secret_scanning_pattern_configs.go | 163 + .../github/security_advisories.go | 59 +- .../go-github/{v69 => v93}/github/strings.go | 45 +- .../google/go-github/v93/github/sub_issue.go | 161 + .../go-github/{v69 => v93}/github/teams.go | 528 +- .../github/teams_discussion_comments.go | 108 +- .../{v69 => v93}/github/teams_discussions.go | 100 +- .../{v69 => v93}/github/teams_members.go | 89 +- .../{v69 => v93}/github/timestamp.go | 2 +- .../google/go-github/v93/github/url.go | 33 + .../go-github/{v69 => v93}/github/users.go | 120 +- .../github/users_administration.go | 40 +- .../{v69 => v93}/github/users_attestations.go | 8 +- .../{v69 => v93}/github/users_blocking.go | 28 +- .../{v69 => v93}/github/users_emails.go | 52 +- .../{v69 => v93}/github/users_followers.go | 39 +- .../{v69 => v93}/github/users_gpg_keys.go | 31 +- .../{v69 => v93}/github/users_keys.go | 41 +- .../{v69 => v93}/github/users_packages.go | 154 +- .../v93/github/users_social_accounts.go | 110 + .../github/users_ssh_signing_keys.go | 40 +- .../google/go-querystring/query/encode.go | 73 +- vendor/modules.txt | 10 +- 262 files changed, 70285 insertions(+), 24999 deletions(-) create mode 100644 pkg/connector/go_github_test.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_oidc.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_permissions_enterprise.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_permissions_orgs.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_required_workflows.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_secrets.go delete mode 100644 vendor/github.com/google/go-github/v69/github/actions_variables.go delete mode 100644 vendor/github.com/google/go-github/v69/github/billing.go delete mode 100644 vendor/github.com/google/go-github/v69/github/codespaces.go delete mode 100644 vendor/github.com/google/go-github/v69/github/copilot.go delete mode 100644 vendor/github.com/google/go-github/v69/github/dependency_graph.go delete mode 100644 vendor/github.com/google/go-github/v69/github/issues.go delete mode 100644 vendor/github.com/google/go-github/v69/github/issues_labels.go delete mode 100644 vendor/github.com/google/go-github/v69/github/orgs_codesecurity_configurations.go delete mode 100644 vendor/github.com/google/go-github/v69/github/orgs_rules.go delete mode 100644 vendor/github.com/google/go-github/v69/github/packages.go delete mode 100644 vendor/github.com/google/go-github/v69/github/repos_actions_permissions.go delete mode 100644 vendor/github.com/google/go-github/v69/github/repos_releases.go delete mode 100644 vendor/github.com/google/go-github/v69/github/repos_rules.go delete mode 100644 vendor/github.com/google/go-github/v69/github/secret_scanning.go delete mode 100644 vendor/github.com/google/go-github/v69/github/with_appengine.go delete mode 100644 vendor/github.com/google/go-github/v69/github/without_appengine.go rename vendor/github.com/google/go-github/{v69 => v93}/AUTHORS (88%) rename vendor/github.com/google/go-github/{v69 => v93}/LICENSE (100%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions.go (79%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_artifacts.go (69%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_cache.go (53%) create mode 100644 vendor/github.com/google/go-github/v93/github/actions_hosted_runners.go create mode 100644 vendor/github.com/google/go-github/v93/github/actions_oidc.go create mode 100644 vendor/github.com/google/go-github/v93/github/actions_permissions_enterprise.go create mode 100644 vendor/github.com/google/go-github/v93/github/actions_permissions_orgs.go create mode 100644 vendor/github.com/google/go-github/v93/github/actions_policies.go rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_runner_groups.go (69%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_runners.go (71%) create mode 100644 vendor/github.com/google/go-github/v93/github/actions_secrets.go create mode 100644 vendor/github.com/google/go-github/v93/github/actions_variables.go rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_workflow_jobs.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_workflow_runs.go (85%) rename vendor/github.com/google/go-github/{v69 => v93}/github/actions_workflows.go (67%) rename vendor/github.com/google/go-github/{v69 => v93}/github/activity.go (90%) rename vendor/github.com/google/go-github/{v69 => v93}/github/activity_events.go (79%) rename vendor/github.com/google/go-github/{v69 => v93}/github/activity_notifications.go (75%) rename vendor/github.com/google/go-github/{v69 => v93}/github/activity_star.go (55%) rename vendor/github.com/google/go-github/{v69 => v93}/github/activity_watching.go (77%) rename vendor/github.com/google/go-github/{v69 => v93}/github/admin.go (78%) rename vendor/github.com/google/go-github/{v69 => v93}/github/admin_orgs.go (80%) rename vendor/github.com/google/go-github/{v69 => v93}/github/admin_stats.go (96%) rename vendor/github.com/google/go-github/{v69 => v93}/github/admin_users.go (71%) create mode 100644 vendor/github.com/google/go-github/v93/github/agent_tasks.go create mode 100644 vendor/github.com/google/go-github/v93/github/agents.go create mode 100644 vendor/github.com/google/go-github/v93/github/agents_secrets.go create mode 100644 vendor/github.com/google/go-github/v93/github/agents_variables.go rename vendor/github.com/google/go-github/{v69 => v93}/github/apps.go (73%) rename vendor/github.com/google/go-github/{v69 => v93}/github/apps_hooks.go (58%) rename vendor/github.com/google/go-github/{v69 => v93}/github/apps_hooks_deliveries.go (69%) rename vendor/github.com/google/go-github/{v69 => v93}/github/apps_installation.go (70%) rename vendor/github.com/google/go-github/{v69 => v93}/github/apps_manifest.go (83%) rename vendor/github.com/google/go-github/{v69 => v93}/github/apps_marketplace.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/attestations.go (100%) rename vendor/github.com/google/go-github/{v69 => v93}/github/authorizations.go (89%) create mode 100644 vendor/github.com/google/go-github/v93/github/billing.go rename vendor/github.com/google/go-github/{v69 => v93}/github/checks.go (83%) create mode 100644 vendor/github.com/google/go-github/v93/github/classroom.go create mode 100644 vendor/github.com/google/go-github/v93/github/code_quality.go rename vendor/github.com/google/go-github/{v69 => v93}/github/code_scanning.go (83%) rename vendor/github.com/google/go-github/{v69 => v93}/github/codesofconduct.go (80%) create mode 100644 vendor/github.com/google/go-github/v93/github/codespaces.go create mode 100644 vendor/github.com/google/go-github/v93/github/codespaces_machines.go create mode 100644 vendor/github.com/google/go-github/v93/github/codespaces_orgs.go rename vendor/github.com/google/go-github/{v69 => v93}/github/codespaces_secrets.go (83%) create mode 100644 vendor/github.com/google/go-github/v93/github/copilot.go create mode 100644 vendor/github.com/google/go-github/v93/github/copilot_cloud_agent.go create mode 100644 vendor/github.com/google/go-github/v93/github/credentials.go rename vendor/github.com/google/go-github/{v69 => v93}/github/dependabot.go (79%) rename vendor/github.com/google/go-github/{v69 => v93}/github/dependabot_alerts.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/dependabot_secrets.go (52%) create mode 100644 vendor/github.com/google/go-github/v93/github/dependency_graph.go rename vendor/github.com/google/go-github/{v69 => v93}/github/dependency_graph_snapshots.go (61%) rename vendor/github.com/google/go-github/{v69 => v93}/github/doc.go (67%) rename vendor/github.com/google/go-github/{v69 => v93}/github/emojis.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise.go (94%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_actions_hosted_runners.go rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_actions_runner_groups.go (72%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_actions_runners.go (67%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_app_installation.go rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_audit_log.go (81%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_audit_log_stream.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_billing.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_billing_cost_centers.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_budgets.go rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_code_security_and_analysis.go (74%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_codesecurity_configurations.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_licenses.go rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_manage_ghes.go (86%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_manage_ghes_config.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_manage_ghes_maintenance.go (88%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_manage_ghes_ssh.go (83%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_network_configurations.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_organization_properties.go rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_properties.go (74%) rename vendor/github.com/google/go-github/{v69 => v93}/github/enterprise_rules.go (55%) create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_scim.go create mode 100644 vendor/github.com/google/go-github/v93/github/enterprise_team.go rename vendor/github.com/google/go-github/{v69 => v93}/github/event.go (93%) rename vendor/github.com/google/go-github/{v69 => v93}/github/event_types.go (90%) rename vendor/github.com/google/go-github/{v69 => v93}/github/gists.go (63%) rename vendor/github.com/google/go-github/{v69 => v93}/github/gists_comments.go (58%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git.go (80%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git_blobs.go (65%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git_commits.go (84%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git_refs.go (50%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git_tags.go (51%) rename vendor/github.com/google/go-github/{v69 => v93}/github/git_trees.go (70%) rename vendor/github.com/google/go-github/{v69 => v93}/github/github-accessors.go (56%) create mode 100644 vendor/github.com/google/go-github/v93/github/github-iterators.go rename vendor/github.com/google/go-github/{v69 => v93}/github/github.go (54%) rename vendor/github.com/google/go-github/{v69 => v93}/github/gitignore.go (76%) rename vendor/github.com/google/go-github/{v69 => v93}/github/interactions.go (92%) rename vendor/github.com/google/go-github/{v69 => v93}/github/interactions_orgs.go (72%) rename vendor/github.com/google/go-github/{v69 => v93}/github/interactions_repos.go (72%) rename vendor/github.com/google/go-github/{v69 => v93}/github/issue_import.go (86%) create mode 100644 vendor/github.com/google/go-github/v93/github/issues.go rename vendor/github.com/google/go-github/{v69 => v93}/github/issues_assignees.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/issues_comments.go (53%) create mode 100644 vendor/github.com/google/go-github/v93/github/issues_dependencies.go rename vendor/github.com/google/go-github/{v69 => v93}/github/issues_events.go (90%) create mode 100644 vendor/github.com/google/go-github/v93/github/issues_labels.go rename vendor/github.com/google/go-github/{v69 => v93}/github/issues_milestones.go (63%) rename vendor/github.com/google/go-github/{v69 => v93}/github/issues_timeline.go (97%) rename vendor/github.com/google/go-github/{v69 => v93}/github/licenses.go (75%) rename vendor/github.com/google/go-github/{v69 => v93}/github/markdown.go (84%) rename vendor/github.com/google/go-github/{v69 => v93}/github/messages.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/meta.go (71%) rename vendor/github.com/google/go-github/{v69 => v93}/github/migrations.go (75%) rename vendor/github.com/google/go-github/{v69 => v93}/github/migrations_source_import.go (82%) rename vendor/github.com/google/go-github/{v69 => v93}/github/migrations_user.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs.go (71%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_actions_allowed.go (61%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_actions_permissions.go (60%) create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_artifacts.go rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_attestations.go (75%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_audit_log.go (65%) create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_codesecurity_configurations.go rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_credential_authorizations.go (89%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_custom_repository_roles.go (60%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_hooks.go (60%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_hooks_configuration.go (54%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_hooks_deliveries.go (72%) create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_immutable_releases.go create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_issue_types.go rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_members.go (72%) create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_network_configurations.go create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_organization_properties.go rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_organization_roles.go (63%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_outside_collaborators.go (80%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_packages.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_personal_access_tokens.go (55%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_properties.go (63%) create mode 100644 vendor/github.com/google/go-github/v93/github/orgs_rules.go rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_security_managers.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/orgs_users_blocking.go (61%) create mode 100644 vendor/github.com/google/go-github/v93/github/packages.go create mode 100644 vendor/github.com/google/go-github/v93/github/private_registries.go create mode 100644 vendor/github.com/google/go-github/v93/github/projects.go rename vendor/github.com/google/go-github/{v69 => v93}/github/pulls.go (52%) rename vendor/github.com/google/go-github/{v69 => v93}/github/pulls_comments.go (57%) rename vendor/github.com/google/go-github/{v69 => v93}/github/pulls_reviewers.go (77%) rename vendor/github.com/google/go-github/{v69 => v93}/github/pulls_reviews.go (68%) create mode 100644 vendor/github.com/google/go-github/v93/github/pulls_stacks.go rename vendor/github.com/google/go-github/{v69 => v93}/github/pulls_threads.go (100%) rename vendor/github.com/google/go-github/{v69 => v93}/github/rate_limit.go (82%) rename vendor/github.com/google/go-github/{v69 => v93}/github/reactions.go (72%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos.go (79%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_actions_access.go (73%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_actions_allowed.go (71%) create mode 100644 vendor/github.com/google/go-github/v93/github/repos_actions_permissions.go rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_attestations.go (74%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_autolinks.go (67%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_codeowners.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_collaborators.go (80%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_comments.go (57%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_commits.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_community_health.go (91%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_contents.go (65%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_deployment_branch_policies.go (60%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_deployment_protection_rules.go (69%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_deployments.go (77%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_environments.go (79%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_forks.go (68%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_hooks.go (67%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_hooks_configuration.go (66%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_hooks_deliveries.go (70%) create mode 100644 vendor/github.com/google/go-github/v93/github/repos_immutable_releases.go rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_invitations.go (85%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_keys.go (62%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_lfs.go (77%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_merging.go (72%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_pages.go (75%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_prereceive_hooks.go (70%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_properties.go (80%) create mode 100644 vendor/github.com/google/go-github/v93/github/repos_releases.go create mode 100644 vendor/github.com/google/go-github/v93/github/repos_rules.go rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_stats.go (87%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_statuses.go (78%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_tags.go (51%) rename vendor/github.com/google/go-github/{v69 => v93}/github/repos_traffic.go (86%) rename vendor/github.com/google/go-github/{v69 => v93}/github/rules.go (74%) rename vendor/github.com/google/go-github/{v69 => v93}/github/scim.go (64%) rename vendor/github.com/google/go-github/{v69 => v93}/github/search.go (85%) create mode 100644 vendor/github.com/google/go-github/v93/github/secret_scanning.go create mode 100644 vendor/github.com/google/go-github/v93/github/secret_scanning_custom_patterns.go create mode 100644 vendor/github.com/google/go-github/v93/github/secret_scanning_pattern_configs.go rename vendor/github.com/google/go-github/{v69 => v93}/github/security_advisories.go (83%) rename vendor/github.com/google/go-github/{v69 => v93}/github/strings.go (56%) create mode 100644 vendor/github.com/google/go-github/v93/github/sub_issue.go rename vendor/github.com/google/go-github/{v69 => v93}/github/teams.go (64%) rename vendor/github.com/google/go-github/{v69 => v93}/github/teams_discussion_comments.go (65%) rename vendor/github.com/google/go-github/{v69 => v93}/github/teams_discussions.go (69%) rename vendor/github.com/google/go-github/{v69 => v93}/github/teams_members.go (66%) rename vendor/github.com/google/go-github/{v69 => v93}/github/timestamp.go (99%) create mode 100644 vendor/github.com/google/go-github/v93/github/url.go rename vendor/github.com/google/go-github/{v69 => v93}/github/users.go (67%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_administration.go (60%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_attestations.go (81%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_blocking.go (65%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_emails.go (53%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_followers.go (78%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_gpg_keys.go (77%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_keys.go (61%) rename vendor/github.com/google/go-github/{v69 => v93}/github/users_packages.go (59%) create mode 100644 vendor/github.com/google/go-github/v93/github/users_social_accounts.go rename vendor/github.com/google/go-github/{v69 => v93}/github/users_ssh_signing_keys.go (71%) diff --git a/go.mod b/go.mod index ffd6081e1..6b39ffbc1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/deckarep/golang-set/v2 v2.9.0 github.com/ennyjfrick/ruleguard-logfatal v0.0.2 github.com/golang-jwt/jwt/v5 v5.2.2 - github.com/google/go-github/v69 v69.2.0 + github.com/google/go-github/v93 v93.0.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/migueleliasweb/go-github-mock v1.1.0 github.com/quasilyte/go-ruleguard/dsl v0.3.23 @@ -72,7 +72,7 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect github.com/google/go-github/v64 v64.0.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect + github.com/google/go-querystring v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect diff --git a/go.sum b/go.sum index 25b2cc342..6ba476bbe 100644 --- a/go.sum +++ b/go.sum @@ -150,16 +150,15 @@ github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6 github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e h1:4bw4WeyTYPp0smaXiJZCNnLrvVBqirQVreixayXezGc= github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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/v64 v64.0.0 h1:4G61sozmY3eiPAjjoOHponXDBONm+utovTKbyUb2Qdg= github.com/google/go-github/v64 v64.0.0/go.mod h1:xB3vqMQNdHzilXBiO2I+M7iEFtHf+DP/omBOv6tQzVo= -github.com/google/go-github/v69 v69.2.0 h1:wR+Wi/fN2zdUx9YxSmYE0ktiX9IAR/BeePzeaUUbEHE= -github.com/google/go-github/v69 v69.2.0/go.mod h1:xne4jymxLR6Uj9b7J7PyTpkMYstEMMwGZa0Aehh1azM= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/go-github/v93 v93.0.0 h1:qElXPLv+XbSz1qrLdWyb0t3gSYGsWBTzr9T4/PZTCfk= +github.com/google/go-github/v93 v93.0.0/go.mod h1:l8I3rt4/mdjANKpg4Y84LEy9HJQCetUkZ8WTl2bPU8M= +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= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= diff --git a/pkg/connector/api_token.go b/pkg/connector/api_token.go index 7a6a7fea7..72426d02a 100644 --- a/pkg/connector/api_token.go +++ b/pkg/connector/api_token.go @@ -6,7 +6,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" ) func apiTokenResource(ctx context.Context, token *github.PersonalAccessToken) (*v2.Resource, error) { diff --git a/pkg/connector/app.go b/pkg/connector/app.go index 8f5cb7c1d..f6d4e610d 100644 --- a/pkg/connector/app.go +++ b/pkg/connector/app.go @@ -6,7 +6,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" ) // appResource builds a GitHub App resource from one organization installation. diff --git a/pkg/connector/app_test.go b/pkg/connector/app_test.go index c222477ae..a2186dff6 100644 --- a/pkg/connector/app_test.go +++ b/pkg/connector/app_test.go @@ -6,7 +6,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/stretchr/testify/require" ) diff --git a/pkg/connector/connector.go b/pkg/connector/connector.go index 22e16bfb0..cc7ad77bd 100644 --- a/pkg/connector/connector.go +++ b/pkg/connector/connector.go @@ -21,7 +21,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/connectorbuilder" "github.com/conductorone/baton-sdk/pkg/uhttp" jwtv5 "github.com/golang-jwt/jwt/v5" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "github.com/shurcooL/githubv4" "go.uber.org/zap" @@ -312,14 +312,13 @@ func newGitHubClient(ctx context.Context, instanceURL string, ts oauth2.TokenSou ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient) tc := oauth2.NewClient(ctx, ts) - gc := github.NewClient(tc) - + opts := []github.ClientOptionsFunc{github.WithHTTPClient(tc)} instanceURL = strings.TrimSuffix(instanceURL, "/") if instanceURL != "" && instanceURL != githubDotCom { - return gc.WithEnterpriseURLs(instanceURL, instanceURL) + opts = append(opts, github.WithEnterpriseURLs(instanceURL, instanceURL)) } - return gc, nil + return github.NewClient(opts...) } func NewLambdaConnector(ctx context.Context, ghc *cfg.Github, cliOpts *cli.ConnectorOpts) (connectorbuilder.ConnectorBuilderV2, []connectorbuilder.Opt, error) { @@ -758,7 +757,7 @@ func getJWTToken(appID string, privateKey string) (string, error) { } func findInstallation(ctx context.Context, c *github.Client, orgName string) (*github.Installation, error) { - installation, resp, err := c.Apps.FindOrganizationInstallation(ctx, orgName) + installation, resp, err := c.Apps.GetOrganizationInstallation(ctx, orgName) if err != nil { return nil, wrapGitHubError(err, resp, fmt.Sprintf("github-connector: failed to find installation for org %s", orgName)) } diff --git a/pkg/connector/enterprise_installations_test.go b/pkg/connector/enterprise_installations_test.go index 6cfb64d78..f580df7f3 100644 --- a/pkg/connector/enterprise_installations_test.go +++ b/pkg/connector/enterprise_installations_test.go @@ -8,7 +8,7 @@ import ( "net/url" "testing" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/stretchr/testify/require" "golang.org/x/oauth2" "google.golang.org/grpc/codes" @@ -34,11 +34,12 @@ func newGitHubAPITestClientAt(t *testing.T, handler http.Handler, basePath strin srv := httptest.NewServer(handler) t.Cleanup(srv.Close) - baseURL, err := url.Parse(srv.URL + basePath) + baseURL, err := url.Parse(srv.URL) require.NoError(t, err) + baseURL = baseURL.JoinPath(basePath) - client := github.NewClient(srv.Client()) - client.BaseURL = baseURL + client, err := github.NewClient(github.WithHTTPClient(srv.Client()), github.WithURLs(github.Ptr(baseURL.String()), nil)) + require.NoError(t, err) return client } @@ -340,7 +341,7 @@ func TestNewEnterpriseRoleClientsRejectsANonCloudInstance(t *testing.T) { _, err := newEnterpriseRoleClients( context.Background(), context.Background(), "https://github.acme.com", - github.NewClient(nil), nil, + newTestGitHubClient(t, nil), nil, []string{testEnterprise, "another-enterprise"}, nil, "example-org", ) diff --git a/pkg/connector/enterprise_role.go b/pkg/connector/enterprise_role.go index 54d49556b..d4849ea4f 100644 --- a/pkg/connector/enterprise_role.go +++ b/pkg/connector/enterprise_role.go @@ -16,7 +16,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/entitlement" "github.com/conductorone/baton-sdk/pkg/types/grant" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "github.com/shurcooL/githubv4" "go.uber.org/zap" diff --git a/pkg/connector/enterprise_role_test.go b/pkg/connector/enterprise_role_test.go index b251d383f..211a23395 100644 --- a/pkg/connector/enterprise_role_test.go +++ b/pkg/connector/enterprise_role_test.go @@ -15,7 +15,7 @@ import ( entitlementSdk "github.com/conductorone/baton-sdk/pkg/types/entitlement" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/shurcooL/githubv4" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -426,7 +426,7 @@ func newTestEnterpriseRoleBuilder( require.NoError(t, err) builder := EnterpriseRoleProvisioningBuilder( - github.NewClient(mgh.Server()), + newTestGitHubClient(t, mgh.Server()), nil, []string{testEnterprise}, func(context.Context, []string) (map[string]*customclient.EnterpriseAdminClient, error) { diff --git a/pkg/connector/go_github_test.go b/pkg/connector/go_github_test.go new file mode 100644 index 000000000..09a784417 --- /dev/null +++ b/pkg/connector/go_github_test.go @@ -0,0 +1,20 @@ +package connector + +import ( + "net/http" + "testing" + + "github.com/google/go-github/v93/github" + "github.com/stretchr/testify/require" +) + +func newTestGitHubClient(t *testing.T, httpClient *http.Client) *github.Client { + t.Helper() + var opts []github.ClientOptionsFunc + if httpClient != nil { + opts = append(opts, github.WithHTTPClient(httpClient)) + } + client, err := github.NewClient(opts...) + require.NoError(t, err) + return client +} diff --git a/pkg/connector/helpers.go b/pkg/connector/helpers.go index b4bc5f410..44c178e66 100644 --- a/pkg/connector/helpers.go +++ b/pkg/connector/helpers.go @@ -15,7 +15,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/session" "github.com/conductorone/baton-sdk/pkg/types/sessions" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/shurcooL/githubv4" "golang.org/x/text/cases" "golang.org/x/text/language" diff --git a/pkg/connector/invitation.go b/pkg/connector/invitation.go index 38ef9575f..c98b9c6bc 100644 --- a/pkg/connector/invitation.go +++ b/pkg/connector/invitation.go @@ -14,7 +14,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/connectorbuilder" "github.com/conductorone/baton-sdk/pkg/pagination" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" ) @@ -262,7 +262,7 @@ func (i *invitationResourceType) CreateAccount( return nil, nil, nil, fmt.Errorf("github-connectorv2: failed to get CreateUserParams: %w", err) } - invitation, resp, err := i.client.Organizations.CreateOrgInvitation(ctx, params.org, &github.CreateOrgInvitationOptions{ + invitation, resp, err := i.client.Organizations.CreateOrgInvitation(ctx, params.org, github.CreateOrgInvitationRequest{ Email: params.email, }) if err != nil { diff --git a/pkg/connector/invitation_test.go b/pkg/connector/invitation_test.go index 8fd3beea5..f8afa1e75 100644 --- a/pkg/connector/invitation_test.go +++ b/pkg/connector/invitation_test.go @@ -9,7 +9,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/pagination" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/migueleliasweb/go-github-mock/src/mock" "github.com/stretchr/testify/require" @@ -153,7 +153,7 @@ func TestInvitationListPagination(t *testing.T) { } newBuilder := func(httpClient *http.Client) *invitationResourceType { - gh := github.NewClient(httpClient) + gh := newTestGitHubClient(t, httpClient) return InvitationBuilder(InvitationBuilderParams{ client: gh, orgCache: newOrgNameCache(gh), diff --git a/pkg/connector/org.go b/pkg/connector/org.go index 4d17748da..331840182 100644 --- a/pkg/connector/org.go +++ b/pkg/connector/org.go @@ -14,7 +14,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/grant" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "google.golang.org/grpc/codes" @@ -316,7 +316,7 @@ func (o *orgResourceType) Grant(ctx context.Context, principal *v2.Resource, en // If user isn't a member, invite them to the org with the requested role if !isMember { - _, resp, err = o.client.Organizations.CreateOrgInvitation(ctx, orgName, &github.CreateOrgInvitationOptions{ + _, resp, err = o.client.Organizations.CreateOrgInvitation(ctx, orgName, github.CreateOrgInvitationRequest{ InviteeID: user.ID, Role: &requestedRole, }) diff --git a/pkg/connector/org_role.go b/pkg/connector/org_role.go index 329426861..b93e18c4c 100644 --- a/pkg/connector/org_role.go +++ b/pkg/connector/org_role.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "net/http" + "net/url" + "path" "strconv" "strings" @@ -13,7 +15,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/entitlement" "github.com/conductorone/baton-sdk/pkg/types/grant" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" ) @@ -323,12 +325,13 @@ func (o *orgRoleResourceType) Grant(ctx context.Context, principal *v2.Resource, } // First verify that the role exists - req, err := o.client.NewRequest("GET", fmt.Sprintf("orgs/%s/organization-roles/%d", orgName, roleID), nil) + rolePath := path.Join("orgs", url.PathEscape(orgName), "organization-roles", strconv.FormatInt(roleID, 10)) + req, err := o.client.NewRequest(ctx, "GET", rolePath, nil) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } - resp, err := o.client.Do(ctx, req, nil) + resp, err := o.client.Do(req, nil) if err != nil { return nil, fmt.Errorf("failed to get role existence: %w", err) } @@ -352,11 +355,12 @@ func (o *orgRoleResourceType) Grant(ctx context.Context, principal *v2.Resource, return nil, fmt.Errorf("failed to get user: %w", err) } - reqs, err := o.client.NewRequest("PUT", fmt.Sprintf("orgs/%s/organization-roles/users/%s/%d", orgName, user.GetLogin(), roleID), nil) + userRolePath := path.Join("orgs", url.PathEscape(orgName), "organization-roles", "users", url.PathEscape(user.GetLogin()), strconv.FormatInt(roleID, 10)) + reqs, err := o.client.NewRequest(ctx, "PUT", userRolePath, nil) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } - resp, err = o.client.Do(ctx, reqs, nil) + resp, err = o.client.Do(reqs, nil) if err != nil { if resp != nil { l.Error("failed to assign role", @@ -427,13 +431,13 @@ func (o *orgRoleResourceType) Revoke(ctx context.Context, grant *v2.Grant) (anno return nil, fmt.Errorf("failed to get user: %w", err) } - url := fmt.Sprintf("orgs/%s/organization-roles/users/%s/%d", orgName, user.GetLogin(), roleID) - req, err := o.client.NewRequest("DELETE", url, nil) + userRolePath := path.Join("orgs", url.PathEscape(orgName), "organization-roles", "users", url.PathEscape(user.GetLogin()), strconv.FormatInt(roleID, 10)) + req, err := o.client.NewRequest(ctx, "DELETE", userRolePath, nil) if err != nil { return nil, fmt.Errorf("failed to create request: %w", err) } - resp, err := o.client.Do(ctx, req, nil) + resp, err := o.client.Do(req, nil) if err != nil { return nil, fmt.Errorf("failed to revoke role: %w", err) } diff --git a/pkg/connector/org_role_test.go b/pkg/connector/org_role_test.go index 5d867d8e9..6e0dc12f5 100644 --- a/pkg/connector/org_role_test.go +++ b/pkg/connector/org_role_test.go @@ -8,7 +8,6 @@ import ( "github.com/conductorone/baton-sdk/pkg/pagination" entitlement2 "github.com/conductorone/baton-sdk/pkg/types/entitlement" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" "github.com/stretchr/testify/require" "github.com/conductorone/baton-github/test" @@ -23,7 +22,7 @@ func TestOrgRole(t *testing.T) { githubOrganization, _, _, githubUser, orgRole, _ := mgh.Seed() - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) cache := newOrgNameCache(githubClient) client := OrgRoleBuilder(githubClient, cache) @@ -91,7 +90,7 @@ func TestOrgRole(t *testing.T) { githubOrganization, _, _, _, orgRole, _ := mockGithub.Seed() - githubClient := github.NewClient(mockGithub.Server()) + githubClient := newTestGitHubClient(t, mockGithub.Server()) cache := newOrgNameCache(githubClient) client := OrgRoleBuilder(githubClient, cache) diff --git a/pkg/connector/org_test.go b/pkg/connector/org_test.go index de32fe239..c8b312c3c 100644 --- a/pkg/connector/org_test.go +++ b/pkg/connector/org_test.go @@ -10,7 +10,6 @@ import ( "github.com/conductorone/baton-sdk/pkg/pagination" "github.com/conductorone/baton-sdk/pkg/types/entitlement" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" "github.com/stretchr/testify/require" ) @@ -22,7 +21,7 @@ func TestOrganization(t *testing.T) { githubOrganization, _, _, githubUser, _, _ := mgh.Seed() - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) cache := newOrgNameCache(githubClient) client := OrgBuilder(githubClient, nil, cache, nil, false) diff --git a/pkg/connector/repository.go b/pkg/connector/repository.go index 85762ef72..443470de7 100644 --- a/pkg/connector/repository.go +++ b/pkg/connector/repository.go @@ -16,7 +16,7 @@ import ( resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/conductorone/baton-sdk/pkg/types/sessions" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "google.golang.org/grpc/codes" @@ -59,6 +59,29 @@ func roleNameToRepoPermission(roleName string) string { } } +func collaboratorPermissions(p *github.RepositoryPermissions) []string { + if p == nil { + return nil + } + var permissions []string + if p.GetPull() { + permissions = append(permissions, repoPermissionPull) + } + if p.GetTriage() { + permissions = append(permissions, repoPermissionTriage) + } + if p.GetPush() { + permissions = append(permissions, repoPermissionPush) + } + if p.GetMaintain() { + permissions = append(permissions, repoPermissionMaintain) + } + if p.GetAdmin() { + permissions = append(permissions, repoPermissionAdmin) + } + return permissions +} + // repositoryResource returns a new connector resource for a GitHub repository. func repositoryResource(ctx context.Context, repo *github.Repository, parentResourceID *v2.ResourceId) (*v2.Resource, error) { ret, err := resourceSdk.NewResource( @@ -275,11 +298,7 @@ func (o *repositoryResourceType) Grants( } for _, user := range users { - for permission, hasPermission := range user.Permissions { - if !hasPermission { - continue - } - + for _, permission := range collaboratorPermissions(user.Permissions) { ur, err := userResource(ctx, user, user.GetEmail(), nil) if err != nil { return nil, nil, err @@ -451,7 +470,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour repo.GetOwner().GetLogin(), repo.GetName(), user.GetLogin(), - &github.RepositoryAddCollaboratorOptions{Permission: permission}, + github.AddCollaboratorRequest{Permission: github.Ptr(permission)}, ) if er != nil { @@ -467,8 +486,8 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour return nil, wrapGitHubError(err, resp, "github-connector: failed to get team") } - resp, err = o.client.Teams.AddTeamRepoBySlug(ctx, org.GetLogin(), team.GetSlug(), repo.GetOwner().GetLogin(), repo.GetName(), &github.TeamAddTeamRepoOptions{ - Permission: permission, + resp, err = o.client.Teams.AddTeamRepoBySlug(ctx, org.GetLogin(), team.GetSlug(), repo.GetOwner().GetLogin(), repo.GetName(), github.AddTeamRepoRequest{ + Permission: github.Ptr(permission), }) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to add team to repository") diff --git a/pkg/connector/repository_test.go b/pkg/connector/repository_test.go index 88be6002a..488953943 100644 --- a/pkg/connector/repository_test.go +++ b/pkg/connector/repository_test.go @@ -10,13 +10,40 @@ import ( "github.com/conductorone/baton-sdk/pkg/pagination" entitlement2 "github.com/conductorone/baton-sdk/pkg/types/entitlement" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/stretchr/testify/require" "github.com/conductorone/baton-github/test" "github.com/conductorone/baton-github/test/mocks" ) +func TestCollaboratorPermissions(t *testing.T) { + tests := []struct { + name string + permissions *github.RepositoryPermissions + want []string + }{ + {name: "missing permissions"}, + { + name: "false flags do not grant access", + permissions: &github.RepositoryPermissions{Pull: github.Ptr(false)}, + }, + { + name: "all GitHub flags retain their entitlement names", + permissions: &github.RepositoryPermissions{ + Pull: github.Ptr(true), Triage: github.Ptr(true), Push: github.Ptr(true), + Maintain: github.Ptr(true), Admin: github.Ptr(true), + }, + want: []string{repoPermissionPull, repoPermissionTriage, repoPermissionPush, repoPermissionMaintain, repoPermissionAdmin}, + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.want, collaboratorPermissions(tc.permissions)) + }) + } +} + func TestRepository(t *testing.T) { ctx := context.Background() @@ -25,7 +52,7 @@ func TestRepository(t *testing.T) { githubOrganization, githubRepository, _, githubUser, _, _ := mgh.Seed() - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) cache := newOrgNameCache(githubClient) client := RepositoryBuilder(githubClient, cache, false, false) @@ -140,7 +167,7 @@ func TestRepositoryGrantsOrgBasePermissionExpansion(t *testing.T) { // Seed a direct collaborator so the collaborator page succeeds. mgh.AddRepositoryCollaborator(githubRepository.GetID(), githubUser.GetID()) - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) builder := RepositoryBuilder(githubClient, newOrgNameCache(githubClient), false, true /* directCollaboratorsOnly */) organization, err := organizationResource(ctx, githubOrganization, nil, false) diff --git a/pkg/connector/team.go b/pkg/connector/team.go index 0dc2eb242..981c07312 100644 --- a/pkg/connector/team.go +++ b/pkg/connector/team.go @@ -13,7 +13,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/types/grant" rType "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "go.uber.org/zap" "google.golang.org/grpc/codes" @@ -311,7 +311,7 @@ func (o *teamResourceType) Grant(ctx context.Context, principal *v2.Resource, en orgId, teamId, user.GetLogin(), - &github.TeamAddTeamMembershipOptions{Role: permission}, + github.AddTeamMembershipRequest{Role: github.Ptr(permission)}, ) if er != nil { diff --git a/pkg/connector/team_test.go b/pkg/connector/team_test.go index 5856f421c..85fb52695 100644 --- a/pkg/connector/team_test.go +++ b/pkg/connector/team_test.go @@ -8,7 +8,6 @@ import ( "github.com/conductorone/baton-sdk/pkg/pagination" entitlement2 "github.com/conductorone/baton-sdk/pkg/types/entitlement" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" "github.com/stretchr/testify/require" "github.com/conductorone/baton-github/test" @@ -23,7 +22,7 @@ func TestTeam(t *testing.T) { githubOrganization, _, githubTeam, githubUser, _, _ := mgh.Seed() - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) cache := newOrgNameCache(githubClient) client := TeamBuilder(githubClient, cache, false) diff --git a/pkg/connector/token_refresh.go b/pkg/connector/token_refresh.go index 4af900a66..a3fe214d5 100644 --- a/pkg/connector/token_refresh.go +++ b/pkg/connector/token_refresh.go @@ -9,7 +9,7 @@ import ( "github.com/conductorone/baton-github/pkg/customclient" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "github.com/shurcooL/githubv4" "go.uber.org/zap" @@ -144,13 +144,13 @@ func newGitHubAppHTTPClient(ctx context.Context, rts *refreshableTokenSource) (* func newGitHubAppClients(instanceURL string, httpClient *http.Client) (*github.Client, *githubv4.Client, error) { instanceURL = strings.TrimSuffix(instanceURL, "/") - gc := github.NewClient(httpClient) + opts := []github.ClientOptionsFunc{github.WithHTTPClient(httpClient)} if instanceURL != "" && instanceURL != githubDotCom { - var err error - gc, err = gc.WithEnterpriseURLs(instanceURL, instanceURL) - if err != nil { - return nil, nil, err - } + opts = append(opts, github.WithEnterpriseURLs(instanceURL, instanceURL)) + } + gc, err := github.NewClient(opts...) + if err != nil { + return nil, nil, err } gqlHTTPClient := &http.Client{ diff --git a/pkg/connector/token_refresh_test.go b/pkg/connector/token_refresh_test.go index 2b841870c..b62ac3baa 100644 --- a/pkg/connector/token_refresh_test.go +++ b/pkg/connector/token_refresh_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/stretchr/testify/require" "golang.org/x/oauth2" ) @@ -273,9 +273,9 @@ func TestTokenRefreshTransport_EndToEndViaGitHubClient(t *testing.T) { rts := newRefreshableTokenSource(validToken("initial"), src) var ( - callCount atomic.Int32 - seenTokens sync.Map - serverMu sync.Mutex + callCount atomic.Int32 + seenTokens sync.Map + serverMu sync.Mutex ) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { serverMu.Lock() @@ -299,8 +299,8 @@ func TestTokenRefreshTransport_EndToEndViaGitHubClient(t *testing.T) { rts: rts, }, } - gc := github.NewClient(httpClient) - parsed, err := gc.WithEnterpriseURLs(server.URL, server.URL) + gc := newTestGitHubClient(t, httpClient) + parsed, err := gc.Clone(github.WithEnterpriseURLs(server.URL, server.URL)) require.NoError(t, err) _, _, err = parsed.Repositories.ListCollaborators(context.Background(), "x", "y", &github.ListCollaboratorsOptions{}) diff --git a/pkg/connector/usage_event_feed.go b/pkg/connector/usage_event_feed.go index f0905c35f..89301158b 100644 --- a/pkg/connector/usage_event_feed.go +++ b/pkg/connector/usage_event_feed.go @@ -13,7 +13,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/annotations" "github.com/conductorone/baton-sdk/pkg/pagination" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "go.uber.org/zap" "google.golang.org/protobuf/types/known/timestamppb" ) diff --git a/pkg/connector/usage_event_feed_test.go b/pkg/connector/usage_event_feed_test.go index e42c3be30..ab02661f4 100644 --- a/pkg/connector/usage_event_feed_test.go +++ b/pkg/connector/usage_event_feed_test.go @@ -10,7 +10,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/pagination" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/migueleliasweb/go-github-mock/src/mock" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/timestamppb" @@ -156,7 +156,7 @@ func TestUsageEventFeed_ListEvents_GracefulDegradation(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, nil) require.NoError(t, err) @@ -177,7 +177,7 @@ func TestUsageEventFeed_ListEvents_SkipsOrgOn404(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, nil) require.NoError(t, err) @@ -198,7 +198,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnServerError(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, nil) require.Error(t, err, "a 5xx should abort the call, not be swallowed as a successful empty pass") @@ -220,7 +220,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnRateLimit(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, nil) require.Error(t, err, "a rate-limited 403 (Remaining: 0) should abort, not be treated as a permission error") @@ -248,7 +248,7 @@ func TestUsageEventFeed_ListEvents_FiltersToSinceBoundary(t *testing.T) { mock.WithRequestMatch(mock.GetOrgsAuditLogByOrg, entries), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, timestamppb.New(since), nil) require.NoError(t, err) @@ -272,7 +272,7 @@ func TestUsageEventFeed_ListEvents_ZeroEarliestEventFallsBackToDefaultLookback(t ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) // A zero timestamppb.Timestamp mirrors a degenerate caller-supplied // start-at, which must not be trusted as a real boundary. @@ -317,7 +317,7 @@ func TestUsageEventFeed_ListEvents_ContinuesPastAnAllFilteredPage(t *testing.T) ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, timestamppb.New(since), nil) require.NoError(t, err) @@ -364,7 +364,7 @@ func TestUsageEventFeed_ListEvents_ReturnsTightestRateLimit(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, _, annos, err := f.ListEvents(ctx, timestamppb.New(since), nil) require.NoError(t, err) @@ -411,7 +411,7 @@ func TestUsageEventFeed_ListEvents_AdvancesAcrossMultipleOrgs(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, timestamppb.New(since), nil) require.NoError(t, err) @@ -460,7 +460,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedCursor(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, &pagination.StreamToken{Cursor: cursorStr}) require.NoError(t, err) @@ -503,7 +503,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedAfterCursor(t *testing.T) ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, &pagination.StreamToken{Cursor: cursorStr}) require.NoError(t, err) @@ -544,7 +544,7 @@ func TestUsageEventFeed_ListEvents_RecoversFromOutOfBoundsCursor(t *testing.T) { ), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) require.NotPanics(t, func() { events, state, _, err := f.ListEvents(ctx, nil, &pagination.StreamToken{Cursor: cursorStr}) @@ -562,7 +562,7 @@ func TestUsageEventFeed_ListEvents_NoOrgs(t *testing.T) { mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{}), ) - f := newUsageEventFeed(github.NewClient(httpClient), nil) + f := newUsageEventFeed(newTestGitHubClient(t, httpClient), nil) events, state, _, err := f.ListEvents(ctx, nil, nil) require.NoError(t, err) diff --git a/pkg/connector/user.go b/pkg/connector/user.go index 705507a58..908513c3d 100644 --- a/pkg/connector/user.go +++ b/pkg/connector/user.go @@ -13,7 +13,7 @@ import ( "github.com/conductorone/baton-sdk/pkg/session" "github.com/conductorone/baton-sdk/pkg/types/resource" "github.com/conductorone/baton-sdk/pkg/types/sessions" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" "github.com/shurcooL/githubv4" "go.uber.org/zap" diff --git a/pkg/connector/user_test.go b/pkg/connector/user_test.go index e2e4d0e58..67b5d00b9 100644 --- a/pkg/connector/user_test.go +++ b/pkg/connector/user_test.go @@ -8,7 +8,6 @@ import ( "github.com/conductorone/baton-github/test/mocks" "github.com/conductorone/baton-sdk/pkg/pagination" resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource" - "github.com/google/go-github/v69/github" "github.com/stretchr/testify/require" ) @@ -30,7 +29,7 @@ func TestUsersList(t *testing.T) { t.Error(err) } - githubClient := github.NewClient(mgh.Server()) + githubClient := newTestGitHubClient(t, mgh.Server()) graphQLClient := mocks.MockGraphQL() cache := newOrgNameCache(githubClient) client := UserBuilder( diff --git a/pkg/customclient/client.go b/pkg/customclient/client.go index 70ddc8885..4d5273647 100644 --- a/pkg/customclient/client.go +++ b/pkg/customclient/client.go @@ -9,7 +9,7 @@ import ( v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2" "github.com/conductorone/baton-sdk/pkg/uhttp" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" ) // githubMaxPageSize is the largest per_page the GitHub REST API accepts. @@ -29,29 +29,36 @@ func consumedLicensesPathParts(enterprise string) []string { type Client struct { *uhttp.BaseHttpClient // baseURL is the go-github client's base, so endpoints follow --instance-url. - baseURL *url.URL + baseURL string } func New(client *github.Client) *Client { return &Client{ BaseHttpClient: uhttp.NewBaseHttpClient(client.Client()), - baseURL: client.BaseURL, + baseURL: client.BaseURL(), } } // endpoint resolves path segments against the base URL, escaping each one // because url.JoinPath treats its arguments as already escaped. func (c *Client) endpoint(segments ...string) (string, error) { - if c.baseURL == nil { + if c.baseURL == "" { return "", fmt.Errorf("github client has no base URL") } + baseURL, err := url.Parse(c.baseURL) + if err != nil { + return "", fmt.Errorf("invalid GitHub API base URL: %w", err) + } + if baseURL.Scheme == "" || baseURL.Host == "" { + return "", fmt.Errorf("GitHub API base URL must have a scheme and host") + } escaped := make([]string, 0, len(segments)) for _, segment := range segments { escaped = append(escaped, url.PathEscape(segment)) } - return url.JoinPath(c.baseURL.String(), escaped...) + return baseURL.JoinPath(escaped...).String(), nil } // GetEnterpriseInstallation returns this app's installation on one enterprise. diff --git a/test/mocks/github.go b/test/mocks/github.go index 129e119f7..3746b2fd8 100644 --- a/test/mocks/github.go +++ b/test/mocks/github.go @@ -10,7 +10,7 @@ import ( "strings" mapset "github.com/deckarep/golang-set/v2" - "github.com/google/go-github/v69/github" + "github.com/google/go-github/v93/github" "github.com/migueleliasweb/go-github-mock/src/mock" ) @@ -113,12 +113,10 @@ func (mgh MockGitHub) Seed() ( Login: &organizationSlug, } githubUser := github.User{ - ID: &userId, - Login: &userIdStr, - Email: &email, - Permissions: map[string]bool{ - "permission0": true, - }, + ID: &userId, + Login: &userIdStr, + Email: &email, + Permissions: &github.RepositoryPermissions{Pull: github.Ptr(true)}, } githubRepository := github.Repository{ ID: &repositoryId, diff --git a/vendor/github.com/google/go-github/v69/github/actions_oidc.go b/vendor/github.com/google/go-github/v69/github/actions_oidc.go deleted file mode 100644 index 596aa9d98..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_oidc.go +++ /dev/null @@ -1,81 +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" -) - -// OIDCSubjectClaimCustomTemplate represents an OIDC subject claim customization template. -type OIDCSubjectClaimCustomTemplate struct { - UseDefault *bool `json:"use_default,omitempty"` - IncludeClaimKeys []string `json:"include_claim_keys,omitempty"` -} - -// GetOrgOIDCSubjectClaimCustomTemplate gets the subject claim customization template for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/oidc/customization/sub -func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) - return s.getOIDCSubjectClaimCustomTemplate(ctx, u) -} - -// GetRepoOIDCSubjectClaimCustomTemplate gets the subject claim customization template for a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/actions/oidc/customization/sub -func (s *ActionsService) GetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) - return s.getOIDCSubjectClaimCustomTemplate(ctx, u) -} - -func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, url string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - tmpl := new(OIDCSubjectClaimCustomTemplate) - resp, err := s.client.Do(ctx, req, tmpl) - if err != nil { - return nil, resp, err - } - - return tmpl, resp, nil -} - -// SetOrgOIDCSubjectClaimCustomTemplate sets the subject claim customization for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization -// -//meta:operation PUT /orgs/{org}/actions/oidc/customization/sub -func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) - return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) -} - -// SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository -// -//meta:operation PUT /repos/{owner}/{repo}/actions/oidc/customization/sub -func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) - return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) -} - -func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, template) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} diff --git a/vendor/github.com/google/go-github/v69/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v69/github/actions_permissions_enterprise.go deleted file mode 100644 index a6a85aa32..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_permissions_enterprise.go +++ /dev/null @@ -1,258 +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" -) - -// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. -type ActionsEnabledOnEnterpriseRepos struct { - TotalCount int `json:"total_count"` - Organizations []*Organization `json:"organizations"` -} - -// ActionsPermissionsEnterprise represents a policy for allowed actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions -type ActionsPermissionsEnterprise struct { - EnabledOrganizations *string `json:"enabled_organizations,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissionsEnterprise) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions -type DefaultWorkflowPermissionEnterprise struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsEnterprise) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissionsInEnterprise 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) { - u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) - req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) - if err != nil { - return nil, nil, err - } - - p := new(ActionsPermissionsEnterprise) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/organizations -func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) - 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 - } - - orgs := &ActionsEnabledOnEnterpriseRepos{} - resp, err := s.client.Do(ctx, req, orgs) - if err != nil { - return nil, resp, err - } - - return orgs, resp, nil -} - -// SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations -func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) - - req, err := s.client.NewRequest("PUT", u, struct { - IDs []int64 `json:"selected_organization_ids"` - }{IDs: organizationIDs}) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise -// -//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} -func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) - - 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 -} - -// RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise -// -//meta:operation DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} -func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) - - 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 -} - -// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) - if err != nil { - return nil, resp, err - } - - return actionsAllowed, resp, nil -} - -// EditActionsAllowedInEnterprise 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) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) - if err != nil { - return nil, nil, err - } - - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionEnterprise) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissionsInEnterprise 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) { - u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionEnterprise) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v69/github/actions_permissions_orgs.go deleted file mode 100644 index 2f555f249..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_permissions_orgs.go +++ /dev/null @@ -1,271 +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" -) - -// ActionsPermissions represents a policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsPermissions struct { - EnabledRepositories *string `json:"enabled_repositories,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissions) String() string { - return Stringify(a) -} - -// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. -type ActionsEnabledOnOrgRepos struct { - TotalCount int `json:"total_count"` - Repositories []*Repository `json:"repositories"` -} - -// ActionsAllowed represents selected actions that are allowed. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsAllowed struct { - GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` - VerifiedAllowed *bool `json:"verified_allowed,omitempty"` - PatternsAllowed []string `json:"patterns_allowed,omitempty"` -} - -func (a ActionsAllowed) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionOrganization represents the default permissions for GitHub Actions workflows for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type DefaultWorkflowPermissionOrganization struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions -func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissions 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) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - req, err := s.client.NewRequest("PUT", u, actionsPermissions) - if err != nil { - return nil, nil, err - } - - p := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/repositories -func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - 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 - } - - repos := &ActionsEnabledOnOrgRepos{} - resp, err := s.client.Do(ctx, req, repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/repositories -func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - - req, err := s.client.NewRequest("PUT", u, struct { - IDs []int64 `json:"selected_repository_ids"` - }{IDs: repositoryIDs}) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization -// -//meta:operation PUT /orgs/{org}/actions/permissions/repositories/{repository_id} -func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - 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 -} - -// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization -// -//meta:operation DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} -func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - 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 -} - -// GetActionsAllowed gets the actions that are allowed in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/selected-actions -func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) - if err != nil { - return nil, resp, err - } - - return actionsAllowed, resp, nil -} - -// EditActionsAllowed 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) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) - if err != nil { - return nil, nil, err - } - - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} - -// GetDefaultWorkflowPermissionsInOrganization gets the GitHub Actions default workflow permissions for an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization -// -//meta:operation GET /orgs/{org}/actions/permissions/workflow -func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string) (*DefaultWorkflowPermissionOrganization, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionOrganization) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissionsInOrganization 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) { - u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionOrganization) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/actions_required_workflows.go b/vendor/github.com/google/go-github/v69/github/actions_required_workflows.go deleted file mode 100644 index b89741a82..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_required_workflows.go +++ /dev/null @@ -1,267 +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" -) - -// OrgRequiredWorkflow represents a required workflow object at the org level. -type OrgRequiredWorkflow struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - Scope *string `json:"scope,omitempty"` - Ref *string `json:"ref,omitempty"` - State *string `json:"state,omitempty"` - SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Repository *Repository `json:"repository,omitempty"` -} - -// OrgRequiredWorkflows represents the required workflows for the org. -type OrgRequiredWorkflows struct { - TotalCount *int `json:"total_count,omitempty"` - RequiredWorkflows []*OrgRequiredWorkflow `json:"required_workflows,omitempty"` -} - -// CreateUpdateRequiredWorkflowOptions represents the input object used to create or update required workflows. -type CreateUpdateRequiredWorkflowOptions struct { - WorkflowFilePath *string `json:"workflow_file_path,omitempty"` - RepositoryID *int64 `json:"repository_id,omitempty"` - Scope *string `json:"scope,omitempty"` - SelectedRepositoryIDs *SelectedRepoIDs `json:"selected_repository_ids,omitempty"` -} - -// RequiredWorkflowSelectedRepos represents the repos that a required workflow is applied to. -type RequiredWorkflowSelectedRepos struct { - TotalCount *int `json:"total_count,omitempty"` - Repositories []*Repository `json:"repositories,omitempty"` -} - -// RepoRequiredWorkflow represents a required workflow object at the repo level. -type RepoRequiredWorkflow struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - State *string `json:"state,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - BadgeURL *string `json:"badge_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - SourceRepository *Repository `json:"source_repository,omitempty"` -} - -// RepoRequiredWorkflows represents the required workflows for a repo. -type RepoRequiredWorkflows struct { - TotalCount *int `json:"total_count,omitempty"` - RequiredWorkflows []*RepoRequiredWorkflow `json:"required_workflows,omitempty"` -} - -// ListOrgRequiredWorkflows lists the RequiredWorkflows for an org. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation GET /orgs/{org}/actions/required_workflows -func (s *ActionsService) ListOrgRequiredWorkflows(ctx context.Context, org string, opts *ListOptions) (*OrgRequiredWorkflows, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows", org) - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - requiredWorkflows := new(OrgRequiredWorkflows) - resp, err := s.client.Do(ctx, req, &requiredWorkflows) - if err != nil { - return nil, resp, err - } - - return requiredWorkflows, resp, nil -} - -// CreateRequiredWorkflow creates the required workflow in an org. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation POST /orgs/{org}/actions/required_workflows -func (s *ActionsService) CreateRequiredWorkflow(ctx context.Context, org string, createRequiredWorkflowOptions *CreateUpdateRequiredWorkflowOptions) (*OrgRequiredWorkflow, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows", org) - req, err := s.client.NewRequest("POST", url, createRequiredWorkflowOptions) - if err != nil { - return nil, nil, err - } - - orgRequiredWorkflow := new(OrgRequiredWorkflow) - resp, err := s.client.Do(ctx, req, orgRequiredWorkflow) - if err != nil { - return nil, resp, err - } - - return orgRequiredWorkflow, resp, nil -} - -// GetRequiredWorkflowByID get the RequiredWorkflows for an org by its ID. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation GET /orgs/{org}/actions/required_workflows/{workflow_id} -func (s *ActionsService) GetRequiredWorkflowByID(ctx context.Context, owner string, requiredWorkflowID int64) (*OrgRequiredWorkflow, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", owner, requiredWorkflowID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - requiredWorkflow := new(OrgRequiredWorkflow) - resp, err := s.client.Do(ctx, req, &requiredWorkflow) - if err != nil { - return nil, resp, err - } - - return requiredWorkflow, resp, nil -} - -// UpdateRequiredWorkflow updates a required workflow in an org. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation PATCH /orgs/{org}/actions/required_workflows/{workflow_id} -func (s *ActionsService) UpdateRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID int64, updateRequiredWorkflowOptions *CreateUpdateRequiredWorkflowOptions) (*OrgRequiredWorkflow, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", org, requiredWorkflowID) - req, err := s.client.NewRequest("PATCH", url, updateRequiredWorkflowOptions) - if err != nil { - return nil, nil, err - } - - orgRequiredWorkflow := new(OrgRequiredWorkflow) - resp, err := s.client.Do(ctx, req, orgRequiredWorkflow) - if err != nil { - return nil, resp, err - } - - return orgRequiredWorkflow, resp, nil -} - -// DeleteRequiredWorkflow deletes a required workflow in an org. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation DELETE /orgs/{org}/actions/required_workflows/{workflow_id} -func (s *ActionsService) DeleteRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", org, requiredWorkflowID) - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListRequiredWorkflowSelectedRepos lists the Repositories selected for a workflow. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation GET /orgs/{org}/actions/required_workflows/{workflow_id}/repositories -func (s *ActionsService) ListRequiredWorkflowSelectedRepos(ctx context.Context, org string, requiredWorkflowID int64, opts *ListOptions) (*RequiredWorkflowSelectedRepos, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories", org, requiredWorkflowID) - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - requiredWorkflowRepos := new(RequiredWorkflowSelectedRepos) - resp, err := s.client.Do(ctx, req, &requiredWorkflowRepos) - if err != nil { - return nil, resp, err - } - - return requiredWorkflowRepos, resp, nil -} - -// SetRequiredWorkflowSelectedRepos sets the Repositories selected for a workflow. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories -func (s *ActionsService) SetRequiredWorkflowSelectedRepos(ctx context.Context, org string, requiredWorkflowID int64, ids SelectedRepoIDs) (*Response, error) { - type repoIDs struct { - SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` - } - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories", org, requiredWorkflowID) - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// AddRepoToRequiredWorkflow adds the Repository to a required workflow. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} -func (s *ActionsService) AddRepoToRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID, repoID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories/%v", org, requiredWorkflowID, repoID) - req, err := s.client.NewRequest("PUT", url, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// RemoveRepoFromRequiredWorkflow removes the Repository from a required workflow. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation DELETE /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} -func (s *ActionsService) RemoveRepoFromRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID, repoID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories/%v", org, requiredWorkflowID, repoID) - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListRepoRequiredWorkflows lists the RequiredWorkflows for a repo. -// -// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows -// -//meta:operation GET /repos/{owner}/{repo}/actions/required_workflows -func (s *ActionsService) ListRepoRequiredWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*RepoRequiredWorkflows, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/required_workflows", owner, repo) - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - requiredWorkflows := new(RepoRequiredWorkflows) - resp, err := s.client.Do(ctx, req, &requiredWorkflows) - if err != nil { - return nil, resp, err - } - - return requiredWorkflows, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/actions_secrets.go b/vendor/github.com/google/go-github/v69/github/actions_secrets.go deleted file mode 100644 index cba85c100..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_secrets.go +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright 2020 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" - "strconv" -) - -// PublicKey represents the public key that should be used to encrypt secrets. -type PublicKey struct { - KeyID *string `json:"key_id"` - Key *string `json:"key"` -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -// This ensures GitHub Enterprise versions which return a numeric key id -// do not error out when unmarshaling. -func (p *PublicKey) UnmarshalJSON(data []byte) error { - var pk struct { - KeyID interface{} `json:"key_id"` - Key *string `json:"key"` - } - - if err := json.Unmarshal(data, &pk); err != nil { - return err - } - - p.Key = pk.Key - - switch v := pk.KeyID.(type) { - case nil: - return nil - case string: - p.KeyID = &v - case float64: - p.KeyID = Ptr(strconv.FormatFloat(v, 'f', -1, 64)) - default: - return fmt.Errorf("unable to unmarshal %T as a string", v) - } - - return nil -} - -func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - pubKey := new(PublicKey) - resp, err := s.client.Do(ctx, req, pubKey) - if err != nil { - return nil, resp, err - } - - return pubKey, resp, nil -} - -// GetRepoPublicKey gets a public key that should be used for secret encryption. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key -// -//meta:operation GET /repos/{owner}/{repo}/actions/secrets/public-key -func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo) - return s.getPublicKey(ctx, url) -} - -// GetOrgPublicKey gets a public key that should be used for secret encryption. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key -// -//meta:operation GET /orgs/{org}/actions/secrets/public-key -func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org) - return s.getPublicKey(ctx, url) -} - -// GetEnvPublicKey gets a public key that should be used for secret encryption. -// -// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-public-key -// -//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key -func (s *ActionsService) GetEnvPublicKey(ctx context.Context, repoID int, env string) (*PublicKey, *Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/secrets/public-key", repoID, env) - return s.getPublicKey(ctx, url) -} - -// Secret represents a repository action secret. -type Secret struct { - Name string `json:"name"` - CreatedAt Timestamp `json:"created_at"` - UpdatedAt Timestamp `json:"updated_at"` - Visibility string `json:"visibility,omitempty"` - SelectedRepositoriesURL string `json:"selected_repositories_url,omitempty"` -} - -// Secrets represents one item from the ListSecrets response. -type Secrets struct { - TotalCount int `json:"total_count"` - Secrets []*Secret `json:"secrets"` -} - -func (s *ActionsService) listSecrets(ctx context.Context, url string, opts *ListOptions) (*Secrets, *Response, error) { - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - secrets := new(Secrets) - resp, err := s.client.Do(ctx, req, &secrets) - if err != nil { - return nil, resp, err - } - - return secrets, resp, nil -} - -// ListRepoSecrets lists all secrets available in a repository -// without revealing their encrypted values. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-secrets -// -//meta:operation GET /repos/{owner}/{repo}/actions/secrets -func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo) - return s.listSecrets(ctx, url, opts) -} - -// ListRepoOrgSecrets lists all organization secrets available in a repository -// without revealing their encrypted values. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets -// -//meta:operation GET /repos/{owner}/{repo}/actions/organization-secrets -func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/organization-secrets", owner, repo) - return s.listSecrets(ctx, url, opts) -} - -// ListOrgSecrets lists all secrets available in an organization -// without revealing their encrypted values. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-organization-secrets -// -//meta:operation GET /orgs/{org}/actions/secrets -func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets", org) - return s.listSecrets(ctx, url, opts) -} - -// ListEnvSecrets lists all secrets available in an environment. -// -// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#list-environment-secrets -// -//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets -func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/secrets", repoID, env) - return s.listSecrets(ctx, url, opts) -} - -func (s *ActionsService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - secret := new(Secret) - resp, err := s.client.Do(ctx, req, secret) - if err != nil { - return nil, resp, err - } - - return secret, resp, nil -} - -// GetRepoSecret gets a single repository secret without revealing its encrypted value. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-secret -// -//meta:operation GET /repos/{owner}/{repo}/actions/secrets/{secret_name} -func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) - return s.getSecret(ctx, url) -} - -// GetOrgSecret gets a single organization secret without revealing its encrypted value. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-secret -// -//meta:operation GET /orgs/{org}/actions/secrets/{secret_name} -func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) - return s.getSecret(ctx, url) -} - -// GetEnvSecret gets a single environment secret without revealing its encrypted value. -// -// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-secret -// -//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} -func (s *ActionsService) GetEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Secret, *Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) - return s.getSecret(ctx, url) -} - -// SelectedRepoIDs are the repository IDs that have access to the actions secrets. -type SelectedRepoIDs []int64 - -// EncryptedSecret represents a secret that is encrypted using a public key. -// -// The value of EncryptedValue must be your secret, encrypted with -// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages) -// using the public key retrieved using the GetPublicKey method. -type EncryptedSecret struct { - Name string `json:"-"` - KeyID string `json:"key_id"` - EncryptedValue string `json:"encrypted_value"` - Visibility string `json:"visibility,omitempty"` - SelectedRepositoryIDs SelectedRepoIDs `json:"selected_repository_ids,omitempty"` -} - -func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret -// -//meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) - return s.putSecret(ctx, url, eSecret) -} - -// CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret -// -//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) - return s.putSecret(ctx, url, eSecret) -} - -// CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. -// -// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#create-or-update-an-environment-secret -// -//meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} -func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) - return s.putSecret(ctx, url, eSecret) -} - -func (s *ActionsService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// DeleteRepoSecret deletes a secret in a repository using the secret name. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret -// -//meta:operation DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} -func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) - return s.deleteSecret(ctx, url) -} - -// DeleteOrgSecret deletes a secret in an organization using the secret name. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret -// -//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name} -func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) - return s.deleteSecret(ctx, url) -} - -// DeleteEnvSecret deletes a secret in an environment using the secret name. -// -// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#delete-an-environment-secret -// -//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} -func (s *ActionsService) DeleteEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) - return s.deleteSecret(ctx, url) -} - -// SelectedReposList represents the list of repositories selected for an organization secret. -type SelectedReposList struct { - TotalCount *int `json:"total_count,omitempty"` - Repositories []*Repository `json:"repositories,omitempty"` -} - -func (s *ActionsService) listSelectedReposForSecret(ctx context.Context, url string, opts *ListOptions) (*SelectedReposList, *Response, error) { - u, err := addOptions(url, 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(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) - if err != nil { - return nil, resp, err - } - - return result, resp, nil -} - -// ListSelectedReposForOrgSecret lists all repositories that have access to a secret. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret -// -//meta:operation GET /orgs/{org}/actions/secrets/{secret_name}/repositories -func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) - return s.listSelectedReposForSecret(ctx, url, opts) -} - -func (s *ActionsService) setSelectedReposForSecret(ctx context.Context, url string, ids SelectedRepoIDs) (*Response, error) { - type repoIDs struct { - SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` - } - - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// SetSelectedReposForOrgSecret sets the repositories that have access to a secret. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret -// -//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories -func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) - return s.setSelectedReposForSecret(ctx, url, ids) -} - -func (s *ActionsService) addSelectedRepoToSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// AddSelectedRepoToOrgSecret adds a repository to an organization secret. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret -// -//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} -func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) - return s.addSelectedRepoToSecret(ctx, url) -} - -func (s *ActionsService) removeSelectedRepoFromSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret. -// -// GitHub API docs: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret -// -//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} -func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) - return s.removeSelectedRepoFromSecret(ctx, url) -} diff --git a/vendor/github.com/google/go-github/v69/github/actions_variables.go b/vendor/github.com/google/go-github/v69/github/actions_variables.go deleted file mode 100644 index bca46b6df..000000000 --- a/vendor/github.com/google/go-github/v69/github/actions_variables.go +++ /dev/null @@ -1,341 +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" -) - -// ActionsVariable represents a repository action variable. -type ActionsVariable struct { - Name string `json:"name"` - Value string `json:"value"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Visibility *string `json:"visibility,omitempty"` - // Used by ListOrgVariables and GetOrgVariables - SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` - // Used by UpdateOrgVariable and CreateOrgVariable - SelectedRepositoryIDs *SelectedRepoIDs `json:"selected_repository_ids,omitempty"` -} - -// ActionsVariables represents one item from the ListVariables response. -type ActionsVariables struct { - TotalCount int `json:"total_count"` - Variables []*ActionsVariable `json:"variables"` -} - -func (s *ActionsService) listVariables(ctx context.Context, url string, opts *ListOptions) (*ActionsVariables, *Response, error) { - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - variables := new(ActionsVariables) - resp, err := s.client.Do(ctx, req, &variables) - if err != nil { - return nil, resp, err - } - - return variables, resp, nil -} - -// ListRepoVariables lists all variables available in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-variables -// -//meta:operation GET /repos/{owner}/{repo}/actions/variables -func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) - return s.listVariables(ctx, url, opts) -} - -// ListRepoOrgVariables lists all organization variables available in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-organization-variables -// -//meta:operation GET /repos/{owner}/{repo}/actions/organization-variables -func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/organization-variables", owner, repo) - return s.listVariables(ctx, url, opts) -} - -// ListOrgVariables lists all variables available in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-organization-variables -// -//meta:operation GET /orgs/{org}/actions/variables -func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables", org) - return s.listVariables(ctx, url, opts) -} - -// ListEnvVariables lists all variables available in an environment. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-environment-variables -// -//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables -func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env) - return s.listVariables(ctx, url, opts) -} - -func (s *ActionsService) getVariable(ctx context.Context, url string) (*ActionsVariable, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - variable := new(ActionsVariable) - resp, err := s.client.Do(ctx, req, variable) - if err != nil { - return nil, resp, err - } - - return variable, resp, nil -} - -// GetRepoVariable gets a single repository variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-a-repository-variable -// -//meta:operation GET /repos/{owner}/{repo}/actions/variables/{name} -func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) - return s.getVariable(ctx, url) -} - -// GetOrgVariable gets a single organization variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-organization-variable -// -//meta:operation GET /orgs/{org}/actions/variables/{name} -func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) - return s.getVariable(ctx, url) -} - -// GetEnvVariable gets a single environment variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-environment-variable -// -//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} -func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*ActionsVariable, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName) - return s.getVariable(ctx, url) -} - -func (s *ActionsService) postVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest("POST", url, variable) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// CreateRepoVariable creates a repository variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-a-repository-variable -// -//meta:operation POST /repos/{owner}/{repo}/actions/variables -func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) - return s.postVariable(ctx, url, variable) -} - -// CreateOrgVariable creates an organization variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-organization-variable -// -//meta:operation POST /orgs/{org}/actions/variables -func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables", org) - return s.postVariable(ctx, url, variable) -} - -// CreateEnvVariable creates an environment variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-environment-variable -// -//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables -func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env) - return s.postVariable(ctx, url, variable) -} - -func (s *ActionsService) patchVariable(ctx context.Context, url string, variable *ActionsVariable) (*Response, error) { - req, err := s.client.NewRequest("PATCH", url, variable) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// UpdateRepoVariable updates a repository variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-a-repository-variable -// -//meta:operation PATCH /repos/{owner}/{repo}/actions/variables/{name} -func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, variable.Name) - return s.patchVariable(ctx, url, variable) -} - -// UpdateOrgVariable updates an organization variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-organization-variable -// -//meta:operation PATCH /orgs/{org}/actions/variables/{name} -func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, variable.Name) - return s.patchVariable(ctx, url, variable) -} - -// UpdateEnvVariable updates an environment variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-environment-variable -// -//meta:operation PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} -func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name) - return s.patchVariable(ctx, url, variable) -} - -func (s *ActionsService) deleteVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// DeleteRepoVariable deletes a variable in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-a-repository-variable -// -//meta:operation DELETE /repos/{owner}/{repo}/actions/variables/{name} -func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) - return s.deleteVariable(ctx, url) -} - -// DeleteOrgVariable deletes a variable in an organization. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-organization-variable -// -//meta:operation DELETE /orgs/{org}/actions/variables/{name} -func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) - return s.deleteVariable(ctx, url) -} - -// DeleteEnvVariable deletes a variable in an environment. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-environment-variable -// -//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} -func (s *ActionsService) DeleteEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName) - return s.deleteVariable(ctx, url) -} - -func (s *ActionsService) listSelectedReposForVariable(ctx context.Context, url string, opts *ListOptions) (*SelectedReposList, *Response, error) { - u, err := addOptions(url, 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(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) - if err != nil { - return nil, resp, err - } - - return result, resp, nil -} - -// ListSelectedReposForOrgVariable lists all repositories that have access to a variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable -// -//meta:operation GET /orgs/{org}/actions/variables/{name}/repositories -func (s *ActionsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) - return s.listSelectedReposForVariable(ctx, url, opts) -} - -func (s *ActionsService) setSelectedReposForVariable(ctx context.Context, url string, ids SelectedRepoIDs) (*Response, error) { - type repoIDs struct { - SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` - } - - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// SetSelectedReposForOrgVariable sets the repositories that have access to a variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable -// -//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories -func (s *ActionsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) - return s.setSelectedReposForVariable(ctx, url, ids) -} - -func (s *ActionsService) addSelectedRepoToVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// AddSelectedRepoToOrgVariable adds a repository to an organization variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable -// -//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} -func (s *ActionsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) - return s.addSelectedRepoToVariable(ctx, url) -} - -func (s *ActionsService) removeSelectedRepoFromVariable(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// RemoveSelectedRepoFromOrgVariable removes a repository from an organization variable. -// -// GitHub API docs: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable -// -//meta:operation DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} -func (s *ActionsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) - return s.removeSelectedRepoFromVariable(ctx, url) -} diff --git a/vendor/github.com/google/go-github/v69/github/billing.go b/vendor/github.com/google/go-github/v69/github/billing.go deleted file mode 100644 index 09b1a5d01..000000000 --- a/vendor/github.com/google/go-github/v69/github/billing.go +++ /dev/null @@ -1,218 +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"` -} - -// 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 -} diff --git a/vendor/github.com/google/go-github/v69/github/codespaces.go b/vendor/github.com/google/go-github/v69/github/codespaces.go deleted file mode 100644 index 608370503..000000000 --- a/vendor/github.com/google/go-github/v69/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/v69/github/copilot.go b/vendor/github.com/google/go-github/v69/github/copilot.go deleted file mode 100644 index b9adfcb4e..000000000 --- a/vendor/github.com/google/go-github/v69/github/copilot.go +++ /dev/null @@ -1,570 +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" - "encoding/json" - "errors" - "fmt" - "time" -) - -// CopilotService provides access to the Copilot-related functions -// in the GitHub API. -// -// GitHub API docs: https://docs.github.com/en/rest/copilot/ -type CopilotService service - -// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription. -type CopilotOrganizationDetails struct { - SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"` - PublicCodeSuggestions string `json:"public_code_suggestions"` - CopilotChat string `json:"copilot_chat"` - SeatManagementSetting string `json:"seat_management_setting"` -} - -// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization. -type CopilotSeatBreakdown struct { - Total int `json:"total"` - AddedThisCycle int `json:"added_this_cycle"` - PendingCancellation int `json:"pending_cancellation"` - PendingInvitation int `json:"pending_invitation"` - ActiveThisCycle int `json:"active_this_cycle"` - InactiveThisCycle int `json:"inactive_this_cycle"` -} - -// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization. -type ListCopilotSeatsResponse struct { - TotalSeats int64 `json:"total_seats"` - Seats []*CopilotSeatDetails `json:"seats"` -} - -// CopilotSeatDetails represents the details of a Copilot for Business seat. -type CopilotSeatDetails struct { - // Assignee can either be a User, Team, or Organization. - Assignee interface{} `json:"assignee"` - AssigningTeam *Team `json:"assigning_team,omitempty"` - PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"` - LastActivityAt *Timestamp `json:"last_activity_at,omitempty"` - LastActivityEditor *string `json:"last_activity_editor,omitempty"` - CreatedAt *Timestamp `json:"created_at"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - PlanType *string `json:"plan_type,omitempty"` -} - -// SeatAssignments represents the number of seats assigned. -type SeatAssignments struct { - SeatsCreated int `json:"seats_created"` -} - -// SeatCancellations represents the number of seats cancelled. -type SeatCancellations struct { - SeatsCancelled int `json:"seats_cancelled"` -} - -// CopilotMetricsListOptions represents the optional parameters to the CopilotService get metrics methods. -type CopilotMetricsListOptions struct { - Since *time.Time `url:"since,omitempty"` - Until *time.Time `url:"until,omitempty"` - - ListOptions -} - -// CopilotIDECodeCompletionsLanguage represents Copilot usage metrics for completions in the IDE for a language. -type CopilotIDECodeCompletionsLanguage struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` -} - -// CopilotIDECodeCompletionsModelLanguage represents Copilot usage metrics for completions in the IDE for a model and language. -type CopilotIDECodeCompletionsModelLanguage struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalCodeSuggestions int `json:"total_code_suggestions"` - TotalCodeAcceptances int `json:"total_code_acceptances"` - TotalCodeLinesSuggested int `json:"total_code_lines_suggested"` - TotalCodeLinesAccepted int `json:"total_code_lines_accepted"` -} - -// CopilotIDECodeCompletionsModel represents Copilot usage metrics for completions in the IDE for a model. -type CopilotIDECodeCompletionsModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - Languages []*CopilotIDECodeCompletionsModelLanguage `json:"languages"` -} - -// CopilotIDECodeCompletionsEditor represents Copilot usage metrics for completions in the IDE for an editor. -type CopilotIDECodeCompletionsEditor struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotIDECodeCompletionsModel `json:"models"` -} - -// CopilotIDECodeCompletions represents Copilot usage metrics for Copilot code completions in the IDE, categorized by editor, model and language. -type CopilotIDECodeCompletions struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Languages []*CopilotIDECodeCompletionsLanguage `json:"languages"` - Editors []*CopilotIDECodeCompletionsEditor `json:"editors"` -} - -// CopilotIDEChatModel represents Copilot usage metrics for chatting with a model in the IDE. -type CopilotIDEChatModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalChats int `json:"total_chats"` - TotalChatInsertionEvents int `json:"total_chat_insertion_events"` - TotalChatCopyEvents int `json:"total_chat_copy_events"` -} - -// CopilotIDEChatEditor represents Copilot usage metrics for chatting with a model in the IDE, categorized by editor and model. -type CopilotIDEChatEditor struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotIDEChatModel `json:"models"` -} - -// CopilotIDEChat represents Copilot usage metrics for Copilot Chat in the IDE, categorized by editor and model. -type CopilotIDEChat struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Editors []*CopilotIDEChatEditor `json:"editors"` -} - -// CopilotDotcomChatModel represents Copilot usage metrics for chatting with a model in the webbrowser. -type CopilotDotcomChatModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalEngagedUsers int `json:"total_engaged_users"` - TotalChats int `json:"total_chats"` -} - -// CopilotDotcomChat represents Copilot usage metrics for Copilot Chat in the webbrowser, categorized by model. -type CopilotDotcomChat struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotDotcomChatModel `json:"models"` -} - -// CopilotDotcomPullRequestsModel represents Copilot usage metrics for pull requests in the webbrowser, categorized by model. -type CopilotDotcomPullRequestsModel struct { - Name string `json:"name"` - IsCustomModel bool `json:"is_custom_model"` - CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` - TotalPRSummariesCreated int `json:"total_pr_summaries_created"` - TotalEngagedUsers int `json:"total_engaged_users"` -} - -// CopilotDotcomPullRequestsRepository represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository. -type CopilotDotcomPullRequestsRepository struct { - Name string `json:"name"` - TotalEngagedUsers int `json:"total_engaged_users"` - Models []*CopilotDotcomPullRequestsModel `json:"models"` -} - -// CopilotDotcomPullRequests represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository and model. -type CopilotDotcomPullRequests struct { - TotalEngagedUsers int `json:"total_engaged_users"` - Repositories []*CopilotDotcomPullRequestsRepository `json:"repositories"` -} - -// CopilotMetrics represents Copilot usage metrics for a given day. -type CopilotMetrics struct { - Date string `json:"date"` - TotalActiveUsers *int `json:"total_active_users,omitempty"` - TotalEngagedUsers *int `json:"total_engaged_users,omitempty"` - CopilotIDECodeCompletions *CopilotIDECodeCompletions `json:"copilot_ide_code_completions,omitempty"` - CopilotIDEChat *CopilotIDEChat `json:"copilot_ide_chat,omitempty"` - CopilotDotcomChat *CopilotDotcomChat `json:"copilot_dotcom_chat,omitempty"` - CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"` -} - -func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { - // Using an alias to avoid infinite recursion when calling json.Unmarshal - type alias CopilotSeatDetails - var seatDetail alias - - if err := json.Unmarshal(data, &seatDetail); err != nil { - return err - } - - cp.AssigningTeam = seatDetail.AssigningTeam - cp.PendingCancellationDate = seatDetail.PendingCancellationDate - cp.LastActivityAt = seatDetail.LastActivityAt - cp.LastActivityEditor = seatDetail.LastActivityEditor - cp.CreatedAt = seatDetail.CreatedAt - cp.UpdatedAt = seatDetail.UpdatedAt - cp.PlanType = seatDetail.PlanType - - switch v := seatDetail.Assignee.(type) { - case map[string]interface{}: - jsonData, err := json.Marshal(seatDetail.Assignee) - if err != nil { - return err - } - - if v["type"] == nil { - return errors.New("assignee type field is not set") - } - - if t, ok := v["type"].(string); ok && t == "User" { - user := &User{} - if err := json.Unmarshal(jsonData, user); err != nil { - return err - } - cp.Assignee = user - } else if t, ok := v["type"].(string); ok && t == "Team" { - team := &Team{} - if err := json.Unmarshal(jsonData, team); err != nil { - return err - } - cp.Assignee = team - } else if t, ok := v["type"].(string); ok && t == "Organization" { - organization := &Organization{} - if err := json.Unmarshal(jsonData, organization); err != nil { - return err - } - cp.Assignee = organization - } else { - return fmt.Errorf("unsupported assignee type %v", v["type"]) - } - default: - return fmt.Errorf("unsupported assignee type %T", v) - } - - return nil -} - -// GetUser gets the User from the CopilotSeatDetails if the assignee is a user. -func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok } - -// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team. -func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok } - -// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization. -func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { - o, ok := cp.Assignee.(*Organization) - return o, ok -} - -// GetCopilotBilling gets Copilot for Business billing information and settings for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-information-and-settings-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/billing -func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var copilotDetails *CopilotOrganizationDetails - resp, err := s.client.Do(ctx, req, &copilotDetails) - if err != nil { - return nil, resp, err - } - - return copilotDetails, resp, nil -} - -// ListCopilotSeats lists Copilot for Business seat assignments for an organization. -// -// To paginate through all seats, populate 'Page' with the number of the last page. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/billing/seats -func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/seats", 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 copilotSeats *ListCopilotSeatsResponse - resp, err := s.client.Do(ctx, req, &copilotSeats) - if err != nil { - return nil, resp, err - } - - return copilotSeats, resp, nil -} - -// ListCopilotEnterpriseSeats lists Copilot for Business seat assignments for an enterprise. -// -// To paginate through all seats, populate 'Page' with the number of the last page. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/copilot/billing/seats -func (s *CopilotService) ListCopilotEnterpriseSeats(ctx context.Context, enterprise string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { - u := fmt.Sprintf("enterprises/%v/copilot/billing/seats", 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 copilotSeats *ListCopilotSeatsResponse - resp, err := s.client.Do(ctx, req, &copilotSeats) - if err != nil { - return nil, resp, err - } - - return copilotSeats, resp, nil -} - -// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-teams-to-the-copilot-subscription-for-an-organization -// -//meta:operation POST /orgs/{org}/copilot/billing/selected_teams -func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) - - body := struct { - SelectedTeams []string `json:"selected_teams"` - }{ - SelectedTeams: teamNames, - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - var seatAssignments *SeatAssignments - resp, err := s.client.Do(ctx, req, &seatAssignments) - if err != nil { - return nil, resp, err - } - - return seatAssignments, resp, nil -} - -// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-teams-from-the-copilot-subscription-for-an-organization -// -//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams -func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) - - body := struct { - SelectedTeams []string `json:"selected_teams"` - }{ - SelectedTeams: teamNames, - } - - req, err := s.client.NewRequest("DELETE", u, body) - if err != nil { - return nil, nil, err - } - - var seatCancellations *SeatCancellations - resp, err := s.client.Do(ctx, req, &seatCancellations) - if err != nil { - return nil, resp, err - } - - return seatCancellations, resp, nil -} - -// AddCopilotUsers adds users to the Copilot for Business subscription for an organization -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization -// -//meta:operation POST /orgs/{org}/copilot/billing/selected_users -func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) - - body := struct { - SelectedUsernames []string `json:"selected_usernames"` - }{ - SelectedUsernames: users, - } - - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - var seatAssignments *SeatAssignments - resp, err := s.client.Do(ctx, req, &seatAssignments) - if err != nil { - return nil, resp, err - } - - return seatAssignments, resp, nil -} - -// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization -// -//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users -func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) - - body := struct { - SelectedUsernames []string `json:"selected_usernames"` - }{ - SelectedUsernames: users, - } - - req, err := s.client.NewRequest("DELETE", u, body) - if err != nil { - return nil, nil, err - } - - var seatCancellations *SeatCancellations - resp, err := s.client.Do(ctx, req, &seatCancellations) - if err != nil { - return nil, resp, err - } - - return seatCancellations, resp, nil -} - -// GetSeatDetails gets Copilot for Business seat assignment details for a user. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-assignment-details-for-a-user -// -//meta:operation GET /orgs/{org}/members/{username}/copilot -func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { - u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var seatDetails *CopilotSeatDetails - resp, err := s.client.Do(ctx, req, &seatDetails) - if err != nil { - return nil, resp, err - } - - return seatDetails, resp, nil -} - -// GetEnterpriseMetrics gets Copilot usage metrics for an enterprise. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise -// -//meta:operation GET /enterprises/{enterprise}/copilot/metrics -func (s *CopilotService) GetEnterpriseMetrics(ctx context.Context, enterprise string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("enterprises/%v/copilot/metrics", 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 metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetEnterpriseTeamMetrics gets Copilot usage metrics for an enterprise team. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise-team -// -//meta:operation GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics -func (s *CopilotService) GetEnterpriseTeamMetrics(ctx context.Context, enterprise, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("enterprises/%v/team/%v/copilot/metrics", enterprise, team) - 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 metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetOrganizationMetrics gets Copilot usage metrics for an organization. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization -// -//meta:operation GET /orgs/{org}/copilot/metrics -func (s *CopilotService) GetOrganizationMetrics(ctx context.Context, org string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("orgs/%v/copilot/metrics", 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 metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} - -// GetOrganizationTeamMetrics gets Copilot usage metrics for an organization team. -// -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-metrics-for-a-team -// -//meta:operation GET /orgs/{org}/team/{team_slug}/copilot/metrics -func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { - u := fmt.Sprintf("orgs/%v/team/%v/copilot/metrics", org, team) - 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 metrics []*CopilotMetrics - resp, err := s.client.Do(ctx, req, &metrics) - if err != nil { - return nil, resp, err - } - - return metrics, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/dependency_graph.go b/vendor/github.com/google/go-github/v69/github/dependency_graph.go deleted file mode 100644 index 86a1fe48b..000000000 --- a/vendor/github.com/google/go-github/v69/github/dependency_graph.go +++ /dev/null @@ -1,82 +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" -) - -type DependencyGraphService service - -// SBOM represents a software bill of materials, which describes the -// packages/libraries that a repository depends on. -type SBOM struct { - SBOM *SBOMInfo `json:"sbom,omitempty"` -} - -// CreationInfo represents when the SBOM was created and who created it. -type CreationInfo struct { - Created *Timestamp `json:"created,omitempty"` - Creators []string `json:"creators,omitempty"` -} - -// RepoDependencies represents the dependencies of a repo. -type RepoDependencies struct { - SPDXID *string `json:"SPDXID,omitempty"` - // Package name - Name *string `json:"name,omitempty"` - VersionInfo *string `json:"versionInfo,omitempty"` - DownloadLocation *string `json:"downloadLocation,omitempty"` - FilesAnalyzed *bool `json:"filesAnalyzed,omitempty"` - LicenseConcluded *string `json:"licenseConcluded,omitempty"` - LicenseDeclared *string `json:"licenseDeclared,omitempty"` -} - -// SBOMInfo represents a software bill of materials (SBOM) using SPDX. -// SPDX is an open standard for SBOMs that -// identifies and catalogs components, licenses, copyrights, security -// references, and other metadata relating to software. -type SBOMInfo struct { - SPDXID *string `json:"SPDXID,omitempty"` - SPDXVersion *string `json:"spdxVersion,omitempty"` - CreationInfo *CreationInfo `json:"creationInfo,omitempty"` - - // Repo name - Name *string `json:"name,omitempty"` - DataLicense *string `json:"dataLicense,omitempty"` - DocumentDescribes []string `json:"documentDescribes,omitempty"` - DocumentNamespace *string `json:"documentNamespace,omitempty"` - - // List of packages dependencies - Packages []*RepoDependencies `json:"packages,omitempty"` -} - -func (s SBOM) String() string { - return Stringify(s) -} - -// GetSBOM fetches the software bill of materials for a repository. -// -// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom -func (s *DependencyGraphService) GetSBOM(ctx context.Context, owner, repo string) (*SBOM, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var sbom *SBOM - resp, err := s.client.Do(ctx, req, &sbom) - if err != nil { - return nil, resp, err - } - - return sbom, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/issues.go b/vendor/github.com/google/go-github/v69/github/issues.go deleted file mode 100644 index 6d3a6b15c..000000000 --- a/vendor/github.com/google/go-github/v69/github/issues.go +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright 2013 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" - "time" -) - -// IssuesService handles communication with the issue related -// methods of the GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/issues/ -type IssuesService service - -// Issue represents a GitHub issue on a repository. -// -// Note: As far as the GitHub API is concerned, every pull request is an issue, -// but not every issue is a pull request. Some endpoints, events, and webhooks -// may also return pull requests via this struct. If PullRequestLinks is nil, -// this is an issue, and if PullRequestLinks is not nil, this is a pull request. -// The IsPullRequest helper method can be used to check that. -type Issue struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - // StateReason can be one of: "completed", "not_planned", "reopened". - StateReason *string `json:"state_reason,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - User *User `json:"user,omitempty"` - Labels []*Label `json:"labels,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Comments *int `json:"comments,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ClosedBy *User `json:"closed_by,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - EventsURL *string `json:"events_url,omitempty"` - LabelsURL *string `json:"labels_url,omitempty"` - RepositoryURL *string `json:"repository_url,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` - Repository *Repository `json:"repository,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Draft *bool `json:"draft,omitempty"` - Type *IssueType `json:"type,omitempty"` - - // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata - TextMatches []*TextMatch `json:"text_matches,omitempty"` - - // ActiveLockReason is populated only when LockReason is provided while locking the issue. - // Possible values are: "off-topic", "too heated", "resolved", and "spam". - ActiveLockReason *string `json:"active_lock_reason,omitempty"` -} - -func (i Issue) String() string { - return Stringify(i) -} - -// IsPullRequest reports whether the issue is also a pull request. It uses the -// method recommended by GitHub's API documentation, which is to check whether -// PullRequestLinks is non-nil. -func (i Issue) IsPullRequest() bool { - return i.PullRequestLinks != nil -} - -// IssueRequest represents a request to create/edit an issue. -// It is separate from Issue above because otherwise Labels -// and Assignee fail to serialize to the correct JSON. -type IssueRequest struct { - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - Labels *[]string `json:"labels,omitempty"` - Assignee *string `json:"assignee,omitempty"` - State *string `json:"state,omitempty"` - // StateReason can be 'completed' or 'not_planned'. - StateReason *string `json:"state_reason,omitempty"` - Milestone *int `json:"milestone,omitempty"` - Assignees *[]string `json:"assignees,omitempty"` -} - -// IssueListOptions specifies the optional parameters to the IssuesService.List -// and IssuesService.ListByOrg methods. -type IssueListOptions struct { - // Filter specifies which issues to list. Possible values are: assigned, - // created, mentioned, subscribed, 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 -} - -// 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 receiveing 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"` -} - -// 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. -// -// 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" - } - return s.listIssues(ctx, u, opts) -} - -// ListByOrg fetches the issues in the specified organization for the -// authenticated user. -// -// 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) { - 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 - } - - 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) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// IssueListByRepoOptions specifies the optional parameters to the -// IssuesService.ListByRepo method. -type IssueListByRepoOptions struct { - // Milestone limits issues for the specified milestone. Possible values are - // a milestone number, "none" for issues with no milestone, "*" for issues - // with any milestone. - Milestone string `url:"milestone,omitempty"` - - // State filters issues based on their state. Possible values are: open, - // closed, all. Default is "open". - State string `url:"state,omitempty"` - - // Assignee filters issues based on their assignee. Possible values are a - // user name, "none" for issues that are not assigned, "*" for issues with - // any assigned user. - Assignee string `url:"assignee,omitempty"` - - // Creator filters issues based on their creator. - Creator string `url:"creator,omitempty"` - - // Mentioned filters issues to those mentioned a specific user. - Mentioned string `url:"mentioned,omitempty"` - - // Labels filters issues based on their label. - Labels []string `url:"labels,omitempty,comma"` - - // 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 -} - -// ListByRepo lists the issues for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#list-repository-issues -// -//meta:operation GET /repos/{owner}/{repo}/issues -func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", 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", mediaTypeReactionsPreview) - - var issues []*Issue - resp, err := s.client.Do(ctx, req, &issues) - if err != nil { - return nil, resp, err - } - - return issues, resp, nil -} - -// Get a single issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue -// -//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", 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) - resp, err := s.client.Do(ctx, req, issue) - if err != nil { - return nil, resp, err - } - - return issue, resp, nil -} - -// Create a new issue on the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#create-an-issue -// -//meta:operation POST /repos/{owner}/{repo}/issues -func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) - req, err := s.client.NewRequest("POST", u, issue) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// Edit (update) an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue -// -//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, issue) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// RemoveMilestone removes a milestone from an issue. -// -// This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue -// -//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} -func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) - req, err := s.client.NewRequest("PATCH", u, &struct { - Milestone *Milestone `json:"milestone"` - }{}) - if err != nil { - return nil, nil, err - } - - i := new(Issue) - resp, err := s.client.Do(ctx, req, i) - if err != nil { - return nil, resp, err - } - - return i, resp, nil -} - -// LockIssueOptions specifies the optional parameters to the -// IssuesService.Lock method. -type LockIssueOptions struct { - // LockReason specifies the reason to lock this issue. - // Providing a lock reason can help make it clearer to contributors why an issue - // was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam". - LockReason string `json:"lock_reason,omitempty"` -} - -// Lock an issue's conversation. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#lock-an-issue -// -//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock -func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, opts) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// Unlock an issue's conversation. -// -// GitHub API docs: https://docs.github.com/rest/issues/issues#unlock-an-issue -// -//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock -func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) - 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/v69/github/issues_labels.go b/vendor/github.com/google/go-github/v69/github/issues_labels.go deleted file mode 100644 index b97b00f3e..000000000 --- a/vendor/github.com/google/go-github/v69/github/issues_labels.go +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2013 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" -) - -// Label represents a GitHub label on an Issue. -type Label struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Color *string `json:"color,omitempty"` - Description *string `json:"description,omitempty"` - Default *bool `json:"default,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (l Label) String() string { - return Stringify(l) -} - -// ListLabels lists all labels for a repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/labels -func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels", 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 labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} - -// GetLabel gets a single label. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#get-a-label -// -//meta:operation GET /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - label := new(Label) - resp, err := s.client.Do(ctx, req, label) - if err != nil { - return nil, resp, err - } - - return label, resp, nil -} - -// CreateLabel creates a new label on the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#create-a-label -// -//meta:operation POST /repos/{owner}/{repo}/labels -func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) - req, err := s.client.NewRequest("POST", u, label) - if err != nil { - return nil, nil, err - } - - l := new(Label) - resp, err := s.client.Do(ctx, req, l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// EditLabel edits a label. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#update-a-label -// -//meta:operation PATCH /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("PATCH", u, label) - if err != nil { - return nil, nil, err - } - - l := new(Label) - resp, err := s.client.Do(ctx, req, l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// DeleteLabel deletes a label. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#delete-a-label -// -//meta:operation DELETE /repos/{owner}/{repo}/labels/{name} -func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListLabelsByIssue lists all labels for an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue -// -//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - 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 labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} - -// AddLabelsToIssue adds labels to an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue -// -//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("POST", u, labels) - if err != nil { - return nil, nil, err - } - - var l []*Label - resp, err := s.client.Do(ctx, req, &l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// RemoveLabelForIssue removes a label for an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue -// -//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} -func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ReplaceLabelsForIssue replaces all labels for an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue -// -//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, labels) - if err != nil { - return nil, nil, err - } - - var l []*Label - resp, err := s.client.Do(ctx, req, &l) - if err != nil { - return nil, resp, err - } - - return l, resp, nil -} - -// RemoveLabelsForIssue removes all labels for an issue. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue -// -//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels -func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) -} - -// ListLabelsForMilestone lists labels for every issue in a milestone. -// -// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone -// -//meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels -func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) - 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 labels []*Label - resp, err := s.client.Do(ctx, req, &labels) - if err != nil { - return nil, resp, err - } - - return labels, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v69/github/orgs_codesecurity_configurations.go deleted file mode 100644 index b25845a4e..000000000 --- a/vendor/github.com/google/go-github/v69/github/orgs_codesecurity_configurations.go +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright 2024 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" -) - -// DependencyGraphAutosubmitActionOptions represents the options for the DependencyGraphAutosubmitAction. -type DependencyGraphAutosubmitActionOptions struct { - LabeledRunners *bool `json:"labeled_runners,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"` - AdvancedSecurity *string `json:"advanced_security,omitempty"` - DependencyGraph *string `json:"dependency_graph,omitempty"` - DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` - DependencyGraphAutosubmitActionOptions *DependencyGraphAutosubmitActionOptions `json:"dependency_graph_autosubmit_action_options,omitempty"` - DependabotAlerts *string `json:"dependabot_alerts,omitempty"` - DependabotSecurityUpdates *string `json:"dependabot_security_updates,omitempty"` - CodeScanningDefaultSetup *string `json:"code_scanning_default_setup,omitempty"` - SecretScanning *string `json:"secret_scanning,omitempty"` - SecretScanningPushProtection *string `json:"secret_scanning_push_protection,omitempty"` - SecretScanningValidityChecks *string `json:"secret_scanning_validity_checks,omitempty"` - SecretScanningNonProviderPatterns *string `json:"secret_scanning_non_provider_patterns,omitempty"` - PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` - Enforcement *string `json:"enforcement,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// 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"` -} - -// RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. -type RepositoryCodeSecurityConfiguration struct { - State *string `json:"state,omitempty"` - Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` -} - -// GetCodeSecurityConfigurations 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) { - u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - - 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 for an organization. -// -// 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) { - u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - - req, err := s.client.NewRequest("POST", u, c) - 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 -} - -// GetDefaultCodeSecurityConfigurations 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) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/defaults", org) - - 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 -} - -// DetachCodeSecurityConfigurationsFromRepositories detaches code security configuration from an organization's repositories. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#detach-configurations-from-repositories -// -//meta:operation DELETE /orgs/{org}/code-security/configurations/detach -func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories(ctx context.Context, org string, repoIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/detach", org) - type selectedRepoIDs struct { - SelectedIDs []int64 `json:"selected_repository_ids"` - } - req, err := s.client.NewRequest("DELETE", u, selectedRepoIDs{SelectedIDs: repoIDs}) - if err != nil { - return nil, err - } - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - return resp, nil -} - -// GetCodeSecurityConfiguration gets a code security configuration available in an organization. -// -// 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) - - 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 for an organization. -// -// 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) - - req, err := s.client.NewRequest("PATCH", u, c) - 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 for an organization. -// -// 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) - - 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 -} - -// AttachCodeSecurityConfigurationsToRepositories 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) - type selectedRepoIDs struct { - Scope string `json:"scope"` - SelectedIDs []int64 `json:"selected_repository_ids,omitempty"` - } - req, err := s.client.NewRequest("POST", u, selectedRepoIDs{Scope: scope, SelectedIDs: repoIDs}) - 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 the default for an organization. -// -// 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) - type configParam struct { - DefaultForNewRepos string `json:"default_for_new_repos"` - } - req, err := s.client.NewRequest("PUT", u, configParam{DefaultForNewRepos: newReposParam}) - if err != nil { - return nil, nil, err - } - var c *CodeSecurityConfigurationWithDefaultForNewRepos - resp, err := s.client.Do(ctx, req, &c) - if err != nil { - return nil, resp, err - } - return c, resp, nil -} - -// GetRepositoriesForCodeSecurityConfiguration 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) - - 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) - if err != nil { - return nil, resp, err - } - return repositories, resp, nil -} - -// GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. -// -// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-the-code-security-configuration-associated-with-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/code-security-configuration -func (s *OrganizationsService) GetCodeSecurityConfigurationForRepository(ctx context.Context, org, repo string) (*RepositoryCodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/code-security-configuration", org, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - var repoConfig *RepositoryCodeSecurityConfiguration - resp, err := s.client.Do(ctx, req, &repoConfig) - if err != nil { - return nil, resp, err - } - return repoConfig, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_rules.go b/vendor/github.com/google/go-github/v69/github/orgs_rules.go deleted file mode 100644 index 8cb2e5d1f..000000000 --- a/vendor/github.com/google/go-github/v69/github/orgs_rules.go +++ /dev/null @@ -1,140 +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" -) - -// GetAllRepositoryRulesets gets all the repository rulesets for the specified organization. -// -// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets -// -//meta:operation GET /orgs/{org}/rulesets -func (s *OrganizationsService) GetAllRepositoryRulesets(ctx context.Context, org string) ([]*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var rulesets []*RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rulesets) - if err != nil { - return nil, resp, err - } - - return rulesets, resp, nil -} - -// CreateRepositoryRuleset creates a repository ruleset for the specified organization. -// -// GitHub API docs: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset -// -//meta:operation POST /orgs/{org}/rulesets -func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets", org) - - req, err := s.client.NewRequest("POST", u, ruleset) - 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 -} - -// GetRepositoryRuleset gets a repository ruleset for the specified organization. -// -// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset -// -//meta:operation GET /orgs/{org}/rulesets/{ruleset_id} -func (s *OrganizationsService) GetRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateRepositoryRuleset updates a repository ruleset for the specified organization. -// -// 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) UpdateRepositoryRuleset(ctx context.Context, org string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - req, err := s.client.NewRequest("PUT", u, ruleset) - 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 -} - -// 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 -// -//meta:operation DELETE /orgs/{org}/rulesets/{ruleset_id} -func (s *OrganizationsService) DeleteRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - 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/v69/github/packages.go b/vendor/github.com/google/go-github/v69/github/packages.go deleted file mode 100644 index ef7df0740..000000000 --- a/vendor/github.com/google/go-github/v69/github/packages.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2020 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 - -// Package represents a GitHub package. -type Package struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - PackageType *string `json:"package_type,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Owner *User `json:"owner,omitempty"` - PackageVersion *PackageVersion `json:"package_version,omitempty"` - Registry *PackageRegistry `json:"registry,omitempty"` - URL *string `json:"url,omitempty"` - VersionCount *int64 `json:"version_count,omitempty"` - Visibility *string `json:"visibility,omitempty"` - Repository *Repository `json:"repository,omitempty"` -} - -func (p Package) String() string { - return Stringify(p) -} - -// PackageVersion represents a GitHub package version. -type PackageVersion struct { - ID *int64 `json:"id,omitempty"` - Version *string `json:"version,omitempty"` - Summary *string `json:"summary,omitempty"` - Body *string `json:"body,omitempty"` - BodyHTML *string `json:"body_html,omitempty"` - Release *PackageRelease `json:"release,omitempty"` - Manifest *string `json:"manifest,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - TargetOID *string `json:"target_oid,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - PackageFiles []*PackageFile `json:"package_files,omitempty"` - Author *User `json:"author,omitempty"` - InstallationCommand *string `json:"installation_command,omitempty"` - Metadata *PackageMetadata `json:"metadata,omitempty"` - PackageHTMLURL *string `json:"package_html_url,omitempty"` - Name *string `json:"name,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (pv PackageVersion) String() string { - return Stringify(pv) -} - -// PackageRelease represents a GitHub package version release. -type PackageRelease struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - ID *int64 `json:"id,omitempty"` - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - Name *string `json:"name,omitempty"` - Draft *bool `json:"draft,omitempty"` - Author *User `json:"author,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PublishedAt *Timestamp `json:"published_at,omitempty"` -} - -func (r PackageRelease) String() string { - return Stringify(r) -} - -// PackageFile represents a GitHub package version release file. -type PackageFile struct { - DownloadURL *string `json:"download_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - SHA256 *string `json:"sha256,omitempty"` - SHA1 *string `json:"sha1,omitempty"` - MD5 *string `json:"md5,omitempty"` - ContentType *string `json:"content_type,omitempty"` - State *string `json:"state,omitempty"` - Author *User `json:"author,omitempty"` - Size *int64 `json:"size,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -func (pf PackageFile) String() string { - return Stringify(pf) -} - -// PackageRegistry represents a GitHub package registry. -type PackageRegistry struct { - AboutURL *string `json:"about_url,omitempty"` - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` - URL *string `json:"url,omitempty"` - Vendor *string `json:"vendor,omitempty"` -} - -func (r PackageRegistry) String() string { - return Stringify(r) -} - -// PackageListOptions represents the optional list options for a package. -type PackageListOptions struct { - // Visibility of packages "public", "internal" or "private". - Visibility *string `url:"visibility,omitempty"` - - // PackageType represents the type of package. - // It can be one of "npm", "maven", "rubygems", "nuget", "docker", or "container". - PackageType *string `url:"package_type,omitempty"` - - // State of package either "active" or "deleted". - State *string `url:"state,omitempty"` - - ListOptions -} - -// PackageMetadata represents metadata from a package. -type PackageMetadata struct { - PackageType *string `json:"package_type,omitempty"` - Container *PackageContainerMetadata `json:"container,omitempty"` -} - -func (r PackageMetadata) String() string { - return Stringify(r) -} - -// PackageContainerMetadata represents container metadata for docker container packages. -type PackageContainerMetadata struct { - Tags []string `json:"tags,omitempty"` -} - -func (r PackageContainerMetadata) String() string { - return Stringify(r) -} diff --git a/vendor/github.com/google/go-github/v69/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v69/github/repos_actions_permissions.go deleted file mode 100644 index 9abd32a78..000000000 --- a/vendor/github.com/google/go-github/v69/github/repos_actions_permissions.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2022 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" -) - -// ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type ActionsPermissionsRepository struct { - Enabled *bool `json:"enabled,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissionsRepository) String() string { - return Stringify(a) -} - -// DefaultWorkflowPermissionRepository represents the default permissions for GitHub Actions workflows for a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions -type DefaultWorkflowPermissionRepository struct { - DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` - CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` -} - -// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/actions/permissions -func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditActionsPermissions 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) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) - req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissionsRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions in a repository. -// -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/actions/permissions/workflow -func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(DefaultWorkflowPermissionRepository) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil -} - -// EditDefaultWorkflowPermissions 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) { - u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) - req, err := s.client.NewRequest("PUT", u, permissions) - if err != nil { - return nil, nil, err - } - - p := new(DefaultWorkflowPermissionRepository) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/repos_releases.go b/vendor/github.com/google/go-github/v69/github/repos_releases.go deleted file mode 100644 index 6023f6327..000000000 --- a/vendor/github.com/google/go-github/v69/github/repos_releases.go +++ /dev/null @@ -1,476 +0,0 @@ -// Copyright 2013 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" - "errors" - "fmt" - "io" - "mime" - "net/http" - "os" - "path/filepath" - "strings" -) - -// RepositoryRelease represents a GitHub release in a repository. -type RepositoryRelease struct { - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - // MakeLatest can be one of: "true", "false", or "legacy". - MakeLatest *string `json:"make_latest,omitempty"` - DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` - - // The following fields are not used in EditRelease: - GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"` - - // The following fields are not used in CreateRelease or EditRelease: - ID *int64 `json:"id,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PublishedAt *Timestamp `json:"published_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - AssetsURL *string `json:"assets_url,omitempty"` - Assets []*ReleaseAsset `json:"assets,omitempty"` - UploadURL *string `json:"upload_url,omitempty"` - ZipballURL *string `json:"zipball_url,omitempty"` - TarballURL *string `json:"tarball_url,omitempty"` - Author *User `json:"author,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (r RepositoryRelease) String() string { - return Stringify(r) -} - -// RepositoryReleaseNotes represents a GitHub-generated release notes. -type RepositoryReleaseNotes struct { - Name string `json:"name"` - Body string `json:"body"` -} - -// 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"` -} - -// ReleaseAsset represents a GitHub release asset in a repository. -type ReleaseAsset struct { - ID *int64 `json:"id,omitempty"` - URL *string `json:"url,omitempty"` - Name *string `json:"name,omitempty"` - Label *string `json:"label,omitempty"` - State *string `json:"state,omitempty"` - ContentType *string `json:"content_type,omitempty"` - Size *int `json:"size,omitempty"` - DownloadCount *int `json:"download_count,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - BrowserDownloadURL *string `json:"browser_download_url,omitempty"` - Uploader *User `json:"uploader,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -func (r ReleaseAsset) String() string { - return Stringify(r) -} - -// ListReleases lists the releases for a repository. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#list-releases -// -//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, 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 releases []*RepositoryRelease - resp, err := s.client.Do(ctx, req, &releases) - if err != nil { - return nil, resp, err - } - return releases, resp, nil -} - -// GetRelease fetches a single release. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release -// -//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) - return s.getSingleRelease(ctx, u) -} - -// GetLatestRelease fetches the latest published release for the repository. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-the-latest-release -// -//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) - return s.getSingleRelease(ctx, u) -} - -// GetReleaseByTag fetches a release with the specified tag. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name -// -//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) - return s.getSingleRelease(ctx, u) -} - -// GenerateReleaseNotes generates the release notes for the given tag. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release -// -//meta:operation POST /repos/{owner}/{repo}/releases/generate-notes -func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - r := new(RepositoryReleaseNotes) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - - return r, resp, nil -} - -func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) - if err != nil { - return nil, nil, err - } - - release := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, release) - if err != nil { - return nil, resp, err - } - return release, resp, nil -} - -// repositoryReleaseRequest is a subset of RepositoryRelease and -// is used internally by CreateRelease and EditRelease to pass -// only the known fields for these endpoints. -// -// See https://github.com/google/go-github/issues/992 for more -// information. -type repositoryReleaseRequest struct { - TagName *string `json:"tag_name,omitempty"` - TargetCommitish *string `json:"target_commitish,omitempty"` - Name *string `json:"name,omitempty"` - Body *string `json:"body,omitempty"` - Draft *bool `json:"draft,omitempty"` - Prerelease *bool `json:"prerelease,omitempty"` - MakeLatest *string `json:"make_latest,omitempty"` - GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"` - DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` -} - -// CreateRelease adds a new release for a repository. -// -// Note that only a subset of the release fields are used. -// See RepositoryRelease for more information. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#create-a-release -// -//meta:operation POST /repos/{owner}/{repo}/releases -func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) - - releaseReq := &repositoryReleaseRequest{ - TagName: release.TagName, - TargetCommitish: release.TargetCommitish, - Name: release.Name, - Body: release.Body, - Draft: release.Draft, - Prerelease: release.Prerelease, - MakeLatest: release.MakeLatest, - DiscussionCategoryName: release.DiscussionCategoryName, - GenerateReleaseNotes: release.GenerateReleaseNotes, - } - - req, err := s.client.NewRequest("POST", u, releaseReq) - if err != nil { - return nil, nil, err - } - - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - return r, resp, nil -} - -// EditRelease edits a repository release. -// -// Note that only a subset of the release fields are used. -// See RepositoryRelease for more information. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#update-a-release -// -//meta:operation PATCH /repos/{owner}/{repo}/releases/{release_id} -func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) - - releaseReq := &repositoryReleaseRequest{ - TagName: release.TagName, - TargetCommitish: release.TargetCommitish, - Name: release.Name, - Body: release.Body, - Draft: release.Draft, - Prerelease: release.Prerelease, - MakeLatest: release.MakeLatest, - DiscussionCategoryName: release.DiscussionCategoryName, - } - - req, err := s.client.NewRequest("PATCH", u, releaseReq) - if err != nil { - return nil, nil, err - } - - r := new(RepositoryRelease) - resp, err := s.client.Do(ctx, req, r) - if err != nil { - return nil, resp, err - } - return r, resp, nil -} - -// DeleteRelease delete a single release from a repository. -// -// GitHub API docs: https://docs.github.com/rest/releases/releases#delete-a-release -// -//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) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// ListReleaseAssets lists the release's assets. -// -// GitHub API docs: https://docs.github.com/rest/releases/assets#list-release-assets -// -//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, 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 assets []*ReleaseAsset - resp, err := s.client.Do(ctx, req, &assets) - if err != nil { - return nil, resp, err - } - return assets, resp, nil -} - -// GetReleaseAsset fetches a single release asset. -// -// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset -// -//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) - - req, err := s.client.NewRequest("GET", u, nil) - 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 -} - -// DownloadReleaseAsset downloads a release asset or returns a redirect URL. -// -// DownloadReleaseAsset returns an io.ReadCloser that reads the contents of the -// specified release asset. It is the caller's responsibility to close the ReadCloser. -// If a redirect is returned, the redirect URL will be returned as a string instead -// of the io.ReadCloser. Exactly one of rc and redirectURL will be zero. -// -// followRedirectsClient can be passed to download the asset from a redirected -// location. Specifying any http.Client is possible, but passing http.DefaultClient -// is recommended, except when the specified repository is private, in which case -// it's necessary to pass an http.Client that performs authenticated requests. -// If nil is passed the redirectURL will be returned instead. -// -// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset -// -//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) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, "", err - } - req.Header.Set("Accept", defaultMediaType) - - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") - } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - - req = withContext(ctx, req) - resp, err := s.client.client.Do(req) - if err != nil { - if !strings.Contains(err.Error(), "disable redirect") { - return nil, "", err - } - if followRedirectsClient != nil { - rc, err := s.downloadReleaseAssetFromURL(ctx, followRedirectsClient, loc) - return rc, "", err - } - return nil, loc, nil // Intentionally return no error with valid redirect URL. - } - - if err := CheckResponse(resp); err != nil { - _ = resp.Body.Close() - return nil, "", err - } - - return resp.Body, "", nil -} - -func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, followRedirectsClient *http.Client, url string) (rc io.ReadCloser, err error) { - req, err := http.NewRequest("GET", url, nil) - if err != nil { - return nil, err - } - req = withContext(ctx, req) - req.Header.Set("Accept", defaultMediaType) - resp, err := followRedirectsClient.Do(req) - if err != nil { - return nil, err - } - if err := CheckResponse(resp); err != nil { - _ = resp.Body.Close() - return nil, err - } - return resp.Body, nil -} - -// EditReleaseAsset edits a repository release asset. -// -// GitHub API docs: https://docs.github.com/rest/releases/assets#update-a-release-asset -// -//meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} -func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) - - req, err := s.client.NewRequest("PATCH", u, release) - 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 -} - -// DeleteReleaseAsset delete a single release asset from a repository. -// -// GitHub API docs: https://docs.github.com/rest/releases/assets#delete-a-release-asset -// -//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) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - return s.client.Do(ctx, req, nil) -} - -// UploadReleaseAsset creates an asset by uploading a file into a release repository. -// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. -// -// 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) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - stat, err := file.Stat() - if err != nil { - return nil, nil, err - } - if stat.IsDir() { - return nil, nil, errors.New("the asset to upload can't be a directory") - } - - mediaType := mime.TypeByExtension(filepath.Ext(file.Name())) - if opts.MediaType != "" { - mediaType = opts.MediaType - } - - req, err := s.client.NewUploadRequest(u, file, stat.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/v69/github/repos_rules.go b/vendor/github.com/google/go-github/v69/github/repos_rules.go deleted file mode 100644 index d38e35cdd..000000000 --- a/vendor/github.com/google/go-github/v69/github/repos_rules.go +++ /dev/null @@ -1,227 +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" -) - -// 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 -// -//meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} -func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string) (*BranchRules, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var rules *BranchRules - resp, err := s.client.Do(ctx, req, &rules) - if err != nil { - return nil, resp, err - } - - return rules, resp, nil -} - -// GetAllRulesets gets all the repository rulesets for the specified repository. -// If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets -// -//meta:operation GET /repos/{owner}/{repo}/rulesets -func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, includesParents bool) ([]*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets?includes_parents=%v", owner, repo, includesParents) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var ruleset []*RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// CreateRuleset creates a repository ruleset for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset -// -//meta:operation POST /repos/{owner}/{repo}/rulesets -func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) - - req, err := s.client.NewRequest("POST", u, ruleset) - 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 -} - -// GetRuleset gets a repository ruleset for the specified repository. -// If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. -// -// GitHub API docs: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset -// -//meta:operation GET /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v?includes_parents=%v", owner, repo, rulesetID, includesParents) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateRuleset updates a repository ruleset for the specified repository. -// -// 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) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - req, err := s.client.NewRequest("PUT", u, ruleset) - 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 -} - -// 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 -// -//meta:operation DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} -func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - 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/v69/github/secret_scanning.go b/vendor/github.com/google/go-github/v69/github/secret_scanning.go deleted file mode 100644 index 35322cf66..000000000 --- a/vendor/github.com/google/go-github/v69/github/secret_scanning.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2022 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" -) - -// SecretScanningService handles communication with the secret scanning related -// methods of the GitHub API. -type SecretScanningService service - -// SecretScanningAlert represents a GitHub secret scanning alert. -type SecretScanningAlert struct { - Number *int `json:"number,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - LocationsURL *string `json:"locations_url,omitempty"` - State *string `json:"state,omitempty"` - Resolution *string `json:"resolution,omitempty"` - ResolvedAt *Timestamp `json:"resolved_at,omitempty"` - ResolvedBy *User `json:"resolved_by,omitempty"` - SecretType *string `json:"secret_type,omitempty"` - SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` - Secret *string `json:"secret,omitempty"` - Repository *Repository `json:"repository,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` - PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` - PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` - ResolutionComment *string `json:"resolution_comment,omitempty"` -} - -// SecretScanningAlertLocation represents the location for a secret scanning alert. -type SecretScanningAlertLocation struct { - Type *string `json:"type,omitempty"` - Details *SecretScanningAlertLocationDetails `json:"details,omitempty"` -} - -// SecretScanningAlertLocationDetails represents the location details for a secret scanning alert. -type SecretScanningAlertLocationDetails struct { - Path *string `json:"path,omitempty"` - Startline *int `json:"start_line,omitempty"` - EndLine *int `json:"end_line,omitempty"` - StartColumn *int `json:"start_column,omitempty"` - EndColumn *int `json:"end_column,omitempty"` - BlobSHA *string `json:"blob_sha,omitempty"` - BlobURL *string `json:"blob_url,omitempty"` - CommitSHA *string `json:"commit_sha,omitempty"` - CommitURL *string `json:"commit_url,omitempty"` - PullRequestCommentURL *string `json:"pull_request_comment_url,omitempty"` -} - -// SecretScanningAlertListOptions specifies optional parameters to the SecretScanningService.ListAlertsForEnterprise method. -type SecretScanningAlertListOptions struct { - // State of the secret scanning alerts to list. Set to open or resolved to only list secret scanning alerts in a specific state. - State string `url:"state,omitempty"` - - // A comma-separated list of secret types to return. By default all secret types are returned. - SecretType string `url:"secret_type,omitempty"` - - // A comma-separated list of resolutions. Only secret scanning alerts with one of these resolutions are listed. - // Valid resolutions are false_positive, wont_fix, revoked, pattern_edited, pattern_deleted or used_in_tests. - Resolution string `url:"resolution,omitempty"` - - // The direction to sort the results by. Possible values are: asc, desc. Default: desc. - Direction string `url:"direction,omitempty"` - - // The property by which to sort the results. Possible values are: created, updated. Default: created. - Sort string `url:"sort,omitempty"` - - ListCursorOptions - - // List options can vary on the Enterprise type. - // On Enterprise Cloud, Secret Scan alerts support requesting by page number - // along with providing a cursor for an "after" param. - // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization - // Whereas on Enterprise Server, pagination is by index. - // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization - ListOptions -} - -// SecretScanningAlertUpdateOptions specifies optional parameters to the SecretScanningService.UpdateAlert method. -type SecretScanningAlertUpdateOptions struct { - // State is required and sets the state of the secret scanning alert. - // Can be either "open" or "resolved". - // You must provide resolution when you set the state to "resolved". - State string `json:"state"` - - // Required when the state is "resolved" and represents the reason for resolving the alert. - // Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests". - Resolution *string `json:"resolution,omitempty"` - - // An optional comment when closing an alert. - ResolutionComment *string `json:"resolution_comment,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 -// -//meta:operation GET /enterprises/{enterprise}/secret-scanning/alerts -func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { - u := fmt.Sprintf("enterprises/%v/secret-scanning/alerts", 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 alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) - if err != nil { - return nil, resp, err - } - - return alerts, resp, nil -} - -// ListAlertsForOrg lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. -// -// 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#list-secret-scanning-alerts-for-an-organization -// -//meta:operation GET /orgs/{org}/secret-scanning/alerts -func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { - u := fmt.Sprintf("orgs/%v/secret-scanning/alerts", 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 alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) - if err != nil { - return nil, resp, err - } - - return alerts, resp, nil -} - -// ListAlertsForRepo lists secret scanning alerts for a private repository, from newest to oldest. -// -// 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#list-secret-scanning-alerts-for-a-repository -// -//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts -func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts", 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 alerts []*SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alerts) - if err != nil { - return nil, resp, err - } - - return alerts, resp, nil -} - -// GetAlert gets a single secret scanning alert detected in a private 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#get-a-secret-scanning-alert -// -//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} -func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string, number int64) (*SecretScanningAlert, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var alert *SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alert) - if err != nil { - return nil, resp, err - } - - return alert, resp, nil -} - -// UpdateAlert updates the status of a secret scanning alert in a private 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#update-a-secret-scanning-alert -// -//meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} -func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, opts *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) - - req, err := s.client.NewRequest("PATCH", u, opts) - if err != nil { - return nil, nil, err - } - - var alert *SecretScanningAlert - resp, err := s.client.Do(ctx, req, &alert) - if err != nil { - return nil, resp, err - } - - return alert, resp, nil -} - -// ListLocationsForAlert lists all locations for a given secret scanning alert for a private 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#list-locations-for-a-secret-scanning-alert -// -//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations -func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner, repo string, number int64, opts *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v/locations", owner, repo, number) - 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 locations []*SecretScanningAlertLocation - resp, err := s.client.Do(ctx, req, &locations) - if err != nil { - return nil, resp, err - } - - return locations, resp, nil -} diff --git a/vendor/github.com/google/go-github/v69/github/with_appengine.go b/vendor/github.com/google/go-github/v69/github/with_appengine.go deleted file mode 100644 index 9bb95b8c8..000000000 --- a/vendor/github.com/google/go-github/v69/github/with_appengine.go +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -//go:build appengine - -// This file provides glue for making github work on App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - // No-op because App Engine adds context to a request differently. - return req -} diff --git a/vendor/github.com/google/go-github/v69/github/without_appengine.go b/vendor/github.com/google/go-github/v69/github/without_appengine.go deleted file mode 100644 index bfdb18ecb..000000000 --- a/vendor/github.com/google/go-github/v69/github/without_appengine.go +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -//go:build !appengine - -// This file provides glue for making github work without App Engine. - -package github - -import ( - "context" - "net/http" -) - -func withContext(ctx context.Context, req *http.Request) *http.Request { - return req.WithContext(ctx) -} diff --git a/vendor/github.com/google/go-github/v69/AUTHORS b/vendor/github.com/google/go-github/v93/AUTHORS similarity index 88% rename from vendor/github.com/google/go-github/v69/AUTHORS rename to vendor/github.com/google/go-github/v93/AUTHORS index a6104ffa9..54a889c77 100644 --- a/vendor/github.com/google/go-github/v69/AUTHORS +++ b/vendor/github.com/google/go-github/v93/AUTHORS @@ -12,13 +12,16 @@ 2BFL 413x 6543 <6543@obermui.de> +Aaron LaBrie Abed Kibbe Abhijit Hota Abhinav Gupta abhishek Abhishek Sharma Abhishek Veeramalla +Abinand P aboy +Adam Guthrie Adam Kohring Aditya Mahendrakar adrienzieba @@ -28,6 +31,7 @@ Ahmed Hagy Aidan Aidan Steele Ainsley Chong +Ajay Kemparaj ajz01 Akeda Bagus Akhil Mohan @@ -46,10 +50,12 @@ Ali Farooq Alin Balutoiu Allan Guwatudde Allen Sun +Aman Verma Amey Sakhadeo Anders Janmyr Andreas Deininger Andreas Garnæs +Andreas Jaggi Andrew Gillis Andrew Ryabchun Andrew Svoboda @@ -58,6 +64,7 @@ Andy Grunwald Andy Hume Andy Lindeman angie pinilla +Anish Pallati Anish Rajan anjanashenoy Anshuman Bhartiya @@ -70,9 +77,11 @@ aprp apurwaj2 Aravind Arda Kuyumcu +Arpad Ray Ary Arıl Bozoluk Asier Marruedo +Austen Stone Austin Burdine Austin Dizzy Azuka Okuleye @@ -97,12 +106,14 @@ Bradley Falzon Bradley McAllister Brandon Butler Brandon Cook +Brandon Everett Brandon Stubbs Brett Kuhlman Brett Logan Brian Egizi Bryan Boreham Bryan Peterson +Bulut M. Cami Diez Carl Johnson Carlos Alexandro Becker @@ -110,6 +121,7 @@ Carlos Tadeu Panato Junior Casey ChandanChainani chandresh-pancholi +Changyong Um Charles Fenwick Elliott Charlie Yan Chmouel Boudjnah @@ -125,7 +137,10 @@ Christian Muehlhaeuser Christoph Jerolimov Christoph Sassenberg CI Monk +Claus Näveke Clemens W +cointem +Colby Williams Colin Misare Craig Gumbley Craig Peterson @@ -133,6 +148,7 @@ Cristian Maglie Cyb3r Jak3 Daehyeok Mun Dalton Hubble +Dan Moseley Daniel Lanner Daniel Leavitt Daniel Nilsson @@ -151,10 +167,12 @@ Davide Zipeto Dennis Webb Derek Jobst DeviousLab +Dhananjay Mishra Dhi Aurrahman Diego Lapiduz Diogo Vilela Dion Gionet Mallet +Divika-23 Dmitri Shuralyov dmnlk Don Petersen @@ -168,6 +186,7 @@ Elliott Beach Emerson Wood Emil V Emma Sax +Emmanuel Roullit Eng Zer Jun Enrico Candino eperm @@ -178,6 +197,8 @@ Erwan Finot erwinvaneyk Evan Anderson Evan Elias +evilgensec +Eyal Kapon Fabian Holler Fabrice Fatema-Moaiyadi @@ -201,6 +222,7 @@ Glen Mailer Gnahz Google Inc. Grachev Mikhail +Gregor Jasny Gregory Oschwald griffin_stewie guangwu @@ -214,11 +236,13 @@ haya14busa haya14busa Henrik Lundström Hiroki Ito +hnkƶ Hubot Jr Huy Tr huydx i2bskn Iain Steers +Iehana Fu Ikko Ashimine Ilia Choly Ioannis Georgoulas @@ -230,7 +254,9 @@ Jacob Valdemar Jake Krammer Jake Scaltreto Jake White +Jam Balaya Jameel Haffejee +James Alseth James Bowes James Cockbain James Loh @@ -239,7 +265,9 @@ James Turley Jamie West Jan Guth Jan Kosecki +Jan Niklas Dittmar Jan Å vábík +Jason Brill Jason Field Javier Campanini Jef LeCompte @@ -251,9 +279,12 @@ Jesse Newland Jihoon Chung Jille Timmermans Jimmi Dyson +Jiří Žižkovský +jlaportebot Joan Saum JoannaaKL Joe Tsai +Joel Jeske John Barton John Engelman John Jones @@ -264,6 +295,7 @@ Jordan Sussman Jorge Ferrero Jorge Gómez Reus Joshua Bezaleel Abednego +Joshua French João Cerqueira JP Phillips jpbelanger-mtl @@ -298,9 +330,11 @@ Kshitij Saraogi Kumar Saurabh Kyle Kurz kyokomi +kyungseopk1m Lachlan Cooper Lars Lehtonen Laurent Verdoïa +Leonard Sheng Sheng Lee leopoldwang Liam Galvin Liam Stanley @@ -321,6 +355,10 @@ Léo Salé M. Ryan Rigdon Magnus Kulke Maksim Zhylinski +Manas Sivakumar +Manav Sharma +MangoMaker +Manuel Bergler Marc Binder Marcelo Carlos Mark Tareshawty @@ -331,6 +369,8 @@ Marwan Sulaiman Masayuki Izumi Mat Geist Matheus Santos Araújo +MathewClegg +Mathieu Sévégny Matija Horvat Matin Rahmanian Matt @@ -344,15 +384,19 @@ Matt Simons Matthew Reidy Maxime Bury Michael Meng +Michael Recachinas Michael Spiegel Michael Tiller MichaÅ‚ Glapa Michelangelo Morrillo Miguel Elias dos Santos +Mike Ball Mike Chen Miles Crabill Mishin Nikolai +Mohamad Al-Zawahreh mohammad ali <2018cs92@student.uet.edu.pk> +mohammadmseet-hue Mohammed AlDujaili Mohammed Nafees Mudit @@ -363,6 +407,7 @@ Nadav Kaner Naoki Kanatani Nathan VanBenschoten Navaneeth Suresh +Naveen Bharath Nayeem Hasan Neal Caffery Neil O'Toole @@ -378,10 +423,12 @@ Noah Hanjun Lee Noah Zoschke Noble Varghese ns-cweber +Nurzhan Muratkhan nxya Ole Orhagen Oleg Kovalov Oleksandr Redko +omerd OndÅ™ej Kupka Ori Talmor Osama Faqhruldin @@ -399,6 +446,8 @@ Patrick Marabeas Patrik Nordlén Pavel Dvoinos Pavel Shtanko +Pavlos Tzianos +Pedja Muatovic Pete Wagner Petr Shevtsov Pierce McEntagart @@ -415,6 +464,7 @@ Rackspace US, Inc. Radek Simko RadliÅ„ski Ignacy Rafael Aramizu Gomes +Raisa Kabir Rajat Jindal Rajendra arora Rajkumar @@ -433,14 +483,18 @@ Riaje Ricco Førgaard Richard de Vries Rob Figueiredo +Roger Peppe Rohit Upadhyay Rojan Dinc +Roman Wu Roming22 Ronak Jain Ronan Pelliard Ross Gustafson Ruben Vereecken Rufina Talalaeva +Runye Zhang +Rupok Ghosh Russell Boley Ryan Leung Ryan Lower @@ -455,13 +509,16 @@ Sam Minnée Sandeep Sukhani Sander Knape Sander van Harmelen +sanjay s Sanket Payghan Sarah Funkhouser Sarasa Kisaragi Sasha Melentyev +Scott Dawson Sean Wang Sebastian Mandrean Sebastian Mæland Pedersen +sellskin Sergei Popinevskii Sergey Romanov Sergio Garcia @@ -474,6 +531,8 @@ Shawn Smith Shibasis Patel Sho Okada Shrikrishna Singh +Shubhadeep Dhar +Silas Alberti Simon Davis sona-tar soniachikh @@ -485,6 +544,7 @@ Steve Hipwell Steve Teuber Stian Eikeland Suhaib Mujahid +Sushant Poudel sushmita wable Sven Palberg Szymon Kodrebski @@ -500,17 +560,22 @@ Theo Henson Theofilos Petsios Thomas Aidan Curran Thomas Bruyelle +Tim Tim Rogers +Timo Sand Timothy O'Brien Timothée Peignier Tingluo Huang tkhandel Tobias Gesellchen +Tom Bamford Tom Payne Tomasz Adam Skrzypczak +tomatotomata tomfeigin Travis Tomsu Trey Tacon +Trung Huynh Chi tsbkw ttacon Vaibhav Singh @@ -519,7 +584,9 @@ Victor Castell Victor Vrantchan Victory Osikwemhe vikkyomkar +Ville Skyttä Vivek +Vivek Kumar Sahu Vlad Ungureanu Wasim Thabraze Weslei Juan Moser Pereira @@ -531,18 +598,24 @@ William Bailey William Cooke Xabi xibz +Yahia Mohamed Yann Malet Yannick Utard Yarden Shoham +Yavor Lulchev Yicheng Qin +Yoo_LCD +Yordis Prieto Yosuke Akatsuka Yumikiyo Osanai Yurii Soldak Yusef Mohamadi Yusuke Kuoka +Yuto Kimura Zach Latta Ze Peng zhouhaibing089 +zyfy29 六开箱 缘生 蒋航 diff --git a/vendor/github.com/google/go-github/v69/LICENSE b/vendor/github.com/google/go-github/v93/LICENSE similarity index 100% rename from vendor/github.com/google/go-github/v69/LICENSE rename to vendor/github.com/google/go-github/v93/LICENSE diff --git a/vendor/github.com/google/go-github/v69/github/actions.go b/vendor/github.com/google/go-github/v93/github/actions.go similarity index 79% rename from vendor/github.com/google/go-github/v69/github/actions.go rename to vendor/github.com/google/go-github/v93/github/actions.go index 4b88a1e11..575a637a2 100644 --- a/vendor/github.com/google/go-github/v69/github/actions.go +++ b/vendor/github.com/google/go-github/v93/github/actions.go @@ -8,5 +8,5 @@ package github // ActionsService handles communication with the actions related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/actions/ +// GitHub API docs: https://docs.github.com/rest/actions?apiVersion=2022-11-28 type ActionsService service diff --git a/vendor/github.com/google/go-github/v69/github/actions_artifacts.go b/vendor/github.com/google/go-github/v93/github/actions_artifacts.go similarity index 69% rename from vendor/github.com/google/go-github/v69/github/actions_artifacts.go rename to vendor/github.com/google/go-github/v93/github/actions_artifacts.go index 2b560fa05..9cc3c64b3 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_artifacts.go +++ b/vendor/github.com/google/go-github/v93/github/actions_artifacts.go @@ -14,7 +14,7 @@ import ( // ArtifactWorkflowRun represents a GitHub artifact's workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28 type ArtifactWorkflowRun struct { ID *int64 `json:"id,omitempty"` RepositoryID *int64 `json:"repository_id,omitempty"` @@ -27,24 +27,28 @@ type ArtifactWorkflowRun struct { // data between jobs in a workflow and provide storage for data // once a workflow is complete. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28 type Artifact struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - SizeInBytes *int64 `json:"size_in_bytes,omitempty"` - URL *string `json:"url,omitempty"` - ArchiveDownloadURL *string `json:"archive_download_url,omitempty"` - Expired *bool `json:"expired,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ExpiresAt *Timestamp `json:"expires_at,omitempty"` - WorkflowRun *ArtifactWorkflowRun `json:"workflow_run,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + SizeInBytes *int64 `json:"size_in_bytes,omitempty"` + URL *string `json:"url,omitempty"` + ArchiveDownloadURL *string `json:"archive_download_url,omitempty"` + Expired *bool `json:"expired,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ExpiresAt *Timestamp `json:"expires_at,omitempty"` + // Digest is the SHA256 digest of the artifact. + // This field will only be populated on artifacts uploaded with upload-artifact v4 or newer. + // For older versions, this field will be null. + Digest *string `json:"digest,omitempty"` + WorkflowRun *ArtifactWorkflowRun `json:"workflow_run,omitempty"` } // ArtifactList represents a list of GitHub artifacts. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#artifacts type ArtifactList struct { TotalCount *int64 `json:"total_count,omitempty"` Artifacts []*Artifact `json:"artifacts,omitempty"` @@ -60,9 +64,24 @@ type ListArtifactsOptions struct { ListOptions } +// ArtifactPeriod represents the period for which the artifact and +// log of a workflow run is retained. +type ArtifactPeriod struct { + Days *int `json:"days,omitempty"` + MaximumAllowedDays *int `json:"maximum_allowed_days,omitempty"` +} + +func (a ArtifactPeriod) String() string { return Stringify(a) } + +// ArtifactPeriodOpt is used to specify the retention period of +// artifacts and logs in a workflow run. +type ArtifactPeriodOpt struct { + Days int `json:"days"` +} + // ListArtifacts lists all artifacts that belong to a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#list-artifacts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListArtifactsOptions) (*ArtifactList, *Response, error) { @@ -72,13 +91,13 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifactList := new(ArtifactList) - resp, err := s.client.Do(ctx, req, artifactList) + var artifactList *ArtifactList + resp, err := s.client.Do(req, &artifactList) if err != nil { return nil, resp, err } @@ -88,7 +107,7 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, // ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#list-workflow-run-artifacts // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) { @@ -98,13 +117,13 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifactList := new(ArtifactList) - resp, err := s.client.Do(ctx, req, artifactList) + var artifactList *ArtifactList + resp, err := s.client.Do(req, &artifactList) if err != nil { return nil, resp, err } @@ -114,19 +133,19 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re // GetArtifact gets a specific artifact for a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#get-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#get-an-artifact // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - artifact := new(Artifact) - resp, err := s.client.Do(ctx, req, artifact) + var artifact *Artifact + resp, err := s.client.Do(req, &artifact) if err != nil { return nil, resp, err } @@ -136,13 +155,13 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar // DownloadArtifact gets a redirect URL to download an archive for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#download-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#download-an-artifact // //meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.downloadArtifactWithRateLimit(ctx, u, maxRedirects) } @@ -169,12 +188,12 @@ func (s *ActionsService) downloadArtifactWithoutRateLimit(ctx context.Context, u } func (s *ActionsService) downloadArtifactWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -190,16 +209,16 @@ func (s *ActionsService) downloadArtifactWithRateLimit(ctx context.Context, u st // DeleteArtifact deletes a workflow run artifact. // -// GitHub API docs: https://docs.github.com/rest/actions/artifacts#delete-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts?apiVersion=2022-11-28#delete-an-artifact // //meta:operation DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/actions_cache.go b/vendor/github.com/google/go-github/v93/github/actions_cache.go similarity index 53% rename from vendor/github.com/google/go-github/v69/github/actions_cache.go rename to vendor/github.com/google/go-github/v93/github/actions_cache.go index 852e9860f..41e777f96 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_cache.go +++ b/vendor/github.com/google/go-github/v93/github/actions_cache.go @@ -12,7 +12,7 @@ import ( // ActionsCache represents a GitHub action cache. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#about-the-cache-api +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#about-the-cache-api type ActionsCache struct { ID *int64 `json:"id,omitempty" url:"-"` Ref *string `json:"ref,omitempty" url:"ref"` @@ -25,7 +25,7 @@ type ActionsCache struct { // ActionsCacheList represents a list of GitHub actions Cache. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository type ActionsCacheList struct { TotalCount int `json:"total_count"` ActionsCaches []*ActionsCache `json:"actions_caches,omitempty"` @@ -33,7 +33,7 @@ type ActionsCacheList struct { // ActionsCacheUsage represents a GitHub Actions Cache Usage object. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsage struct { FullName string `json:"full_name"` ActiveCachesSizeInBytes int64 `json:"active_caches_size_in_bytes"` @@ -42,7 +42,7 @@ type ActionsCacheUsage struct { // ActionsCacheUsageList represents a list of repositories with GitHub Actions cache usage for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsageList struct { TotalCount int `json:"total_count"` RepoCacheUsage []*ActionsCacheUsage `json:"repository_cache_usages,omitempty"` @@ -50,15 +50,33 @@ type ActionsCacheUsageList struct { // TotalCacheUsage represents total GitHub actions cache usage of an organization or enterprise. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise type TotalCacheUsage struct { TotalActiveCachesUsageSizeInBytes int64 `json:"total_active_caches_size_in_bytes"` TotalActiveCachesCount int `json:"total_active_caches_count"` } +// ActionsCacheRetentionLimit represents the GitHub Actions cache retention limit for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-retention-limit-for-an-organization +type ActionsCacheRetentionLimit struct { + // MaxCacheRetentionDays is the maximum duration, in days, for which caches + // in a repository may be retained. + MaxCacheRetentionDays *int `json:"max_cache_retention_days,omitempty"` +} + +// ActionsCacheStorageLimit represents the GitHub Actions cache storage limit for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-storage-limit-for-an-organization +type ActionsCacheStorageLimit struct { + // MaxCacheSizeGB is the maximum size limit for the sum of all caches in a + // repository, in gigabytes. + MaxCacheSizeGB *int `json:"max_cache_size_gb,omitempty"` +} + // ActionsCacheListOptions represents a list of all possible optional Query parameters for ListCaches method. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository type ActionsCacheListOptions struct { ListOptions // The Git reference for the results you want to list. @@ -77,7 +95,7 @@ type ActionsCacheListOptions struct { // // Permissions: must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/caches func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opts *ActionsCacheListOptions) (*ActionsCacheList, *Response, error) { @@ -87,13 +105,13 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - actionCacheList := new(ActionsCacheList) - resp, err := s.client.Do(ctx, req, actionCacheList) + var actionCacheList *ActionsCacheList + resp, err := s.client.Do(req, &actionCacheList) if err != nil { return nil, resp, err } @@ -109,39 +127,39 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key // //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 } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteCachesByID deletes a GitHub Actions cache for a repository, using a cache ID. // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id // //meta:operation DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo string, cacheID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches/%v", owner, repo, cacheID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetCacheUsageForRepo gets GitHub Actions cache usage for a repository. The data fetched using this API is refreshed approximately every 5 minutes, @@ -150,18 +168,18 @@ func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo strin // Permissions: Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an // access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/cache/usage func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo string) (*ActionsCacheUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/cache/usage", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(ActionsCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *ActionsCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -175,7 +193,7 @@ func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo s // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_administration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#list-repositories-with-github-actions-cache-usage-for-an-organization // //meta:operation GET /orgs/{org}/actions/cache/usage-by-repository func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org string, opts *ListOptions) (*ActionsCacheUsageList, *Response, error) { @@ -185,13 +203,13 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(ActionsCacheUsageList) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *ActionsCacheUsageList + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -205,18 +223,18 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_administration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-organization // //meta:operation GET /orgs/{org}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/cache/usage", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(TotalCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *TotalCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } @@ -229,21 +247,105 @@ func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org strin // // Permissions: You must authenticate using an access token with the "admin:enterprise" scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForEnterprise(ctx context.Context, enterprise string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/cache/usage", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cacheUsage := new(TotalCacheUsage) - res, err := s.client.Do(ctx, req, cacheUsage) + var cacheUsage *TotalCacheUsage + res, err := s.client.Do(req, &cacheUsage) if err != nil { return nil, res, err } return cacheUsage, res, err } + +// GetCacheRetentionLimitForOrg gets the GitHub Actions cache retention limit for an organization. +// Repositories in the organization may not set a higher cache retention limit. +// +// Permissions: OAuth tokens and personal access tokens (classic) need the admin:organization scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-retention-limit-for-an-organization +// +//meta:operation GET /organizations/{org}/actions/cache/retention-limit +func (s *ActionsService) GetCacheRetentionLimitForOrg(ctx context.Context, org string) (*ActionsCacheRetentionLimit, *Response, error) { + u := fmt.Sprintf("organizations/%v/actions/cache/retention-limit", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var limit *ActionsCacheRetentionLimit + res, err := s.client.Do(req, &limit) + if err != nil { + return nil, res, err + } + + return limit, res, nil +} + +// SetCacheRetentionLimitForOrg sets the GitHub Actions cache retention limit for an organization. +// Repositories in the organization may not set a higher cache retention limit. +// +// Permissions: OAuth tokens and personal access tokens (classic) need the admin:organization scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#set-github-actions-cache-retention-limit-for-an-organization +// +//meta:operation PUT /organizations/{org}/actions/cache/retention-limit +func (s *ActionsService) SetCacheRetentionLimitForOrg(ctx context.Context, org string, body ActionsCacheRetentionLimit) (*Response, error) { + u := fmt.Sprintf("organizations/%v/actions/cache/retention-limit", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetCacheStorageLimitForOrg gets the GitHub Actions cache storage limit for an organization. +// Repositories in the organization may not set a higher cache storage limit. +// +// Permissions: OAuth tokens and personal access tokens (classic) need the admin:organization scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-storage-limit-for-an-organization +// +//meta:operation GET /organizations/{org}/actions/cache/storage-limit +func (s *ActionsService) GetCacheStorageLimitForOrg(ctx context.Context, org string) (*ActionsCacheStorageLimit, *Response, error) { + u := fmt.Sprintf("organizations/%v/actions/cache/storage-limit", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var limit *ActionsCacheStorageLimit + res, err := s.client.Do(req, &limit) + if err != nil { + return nil, res, err + } + + return limit, res, nil +} + +// SetCacheStorageLimitForOrg sets the GitHub Actions cache storage limit for an organization. +// Repositories in the organization may not set a higher cache storage limit. +// +// Permissions: OAuth tokens and personal access tokens (classic) need the admin:organization scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/rest/actions/cache?apiVersion=2022-11-28#set-github-actions-cache-storage-limit-for-an-organization +// +//meta:operation PUT /organizations/{org}/actions/cache/storage-limit +func (s *ActionsService) SetCacheStorageLimitForOrg(ctx context.Context, org string, body ActionsCacheStorageLimit) (*Response, error) { + u := fmt.Sprintf("organizations/%v/actions/cache/storage-limit", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_hosted_runners.go b/vendor/github.com/google/go-github/v93/github/actions_hosted_runners.go new file mode 100644 index 000000000..76930d52e --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_hosted_runners.go @@ -0,0 +1,516 @@ +// 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" + "errors" + "fmt" +) + +// HostedRunnerPublicIP represents the details of a public IP for GitHub-hosted runner. +type HostedRunnerPublicIP struct { + Enabled bool `json:"enabled"` // Whether public IP is enabled. + Prefix string `json:"prefix"` // The prefix for the public IP. Example: 20.80.208.150 + Length int `json:"length"` // The length of the IP prefix. Example: 28 +} + +// HostedRunnerMachineSpec represents the details of a particular machine specification for GitHub-hosted runner. +type HostedRunnerMachineSpec struct { + ID string `json:"id"` // The ID used for the `size` parameter when creating a new runner. Example: 8-core + CPUCores int `json:"cpu_cores"` // The number of cores. Example: 8 + MemoryGB int `json:"memory_gb"` // The available RAM for the machine spec. Example: 32 + StorageGB int `json:"storage_gb"` // The available SSD storage for the machine spec. Example: 300 +} + +// HostedRunner represents a single GitHub-hosted runner with additional details. +type HostedRunner struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + RunnerGroupID *int64 `json:"runner_group_id,omitempty"` + Platform *string `json:"platform,omitempty"` + ImageDetails *HostedRunnerImageDetail `json:"image_details,omitempty"` + MachineSizeDetails *HostedRunnerMachineSpec `json:"machine_size_details,omitempty"` + Status *string `json:"status,omitempty"` + MaximumRunners *int64 `json:"maximum_runners,omitempty"` + PublicIPEnabled *bool `json:"public_ip_enabled,omitempty"` + PublicIPs []*HostedRunnerPublicIP `json:"public_ips,omitempty"` + ImageGen *bool `json:"image_gen,omitempty"` + LastActiveOn *Timestamp `json:"last_active_on,omitempty"` +} + +// HostedRunnerImageDetail represents the image details of a GitHub-hosted runners. +type HostedRunnerImageDetail struct { + ID *string `json:"id"` // The ID of the image. Use this ID for the `image` parameter when creating a new larger runner. Example: ubuntu-20.04 + SizeGB *int64 `json:"size_gb"` // Image size in GB. Example: 86 + DisplayName *string `json:"display_name"` // Display name for this image. Example: 20.04 + Source *string `json:"source"` // The image provider. Example: github, partner, custom + Version *string `json:"version"` // The image version of the hosted runner pool. Example: latest +} + +// HostedRunners represents a collection of GitHub-hosted runners for an organization. +type HostedRunners struct { + TotalCount int `json:"total_count"` + Runners []*HostedRunner `json:"runners"` +} + +// ListHostedRunners lists all the GitHub-hosted runners for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-github-hosted-runners-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners +func (s *ActionsService) ListHostedRunners(ctx context.Context, org string, opts *ListOptions) (*HostedRunners, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil +} + +// HostedRunnerImage represents the image of GitHub-hosted runners. +type HostedRunnerImage struct { + // 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"` +} + +// 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"` +} + +// 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"` + ImageGen *bool `json:"image_gen,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 *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.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") + } + return nil +} + +// CreateHostedRunner creates a GitHub-hosted runner for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/hosted-runners +func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, body CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// HostedRunnerCustomImage represents a custom image definition for GitHub-hosted runners. +type HostedRunnerCustomImage struct { + ID int64 `json:"id"` + Platform string `json:"platform"` + Name string `json:"name"` + Source string `json:"source"` + VersionsCount int `json:"versions_count"` + TotalVersionsSize int `json:"total_versions_size"` + LatestVersion string `json:"latest_version"` + State string `json:"state"` +} + +// HostedRunnerCustomImages represents a collection of custom images for GitHub-hosted runners. +type HostedRunnerCustomImages struct { + TotalCount int `json:"total_count"` + Images []*HostedRunnerCustomImage `json:"images"` +} + +// HostedRunnerCustomImageVersion represents a version of a custom image for GitHub-hosted runners. +type HostedRunnerCustomImageVersion struct { + Version string `json:"version"` + SizeGB int `json:"size_gb"` + State string `json:"state"` + StateDetails string `json:"state_details"` + CreatedOn Timestamp `json:"created_on"` +} + +// HostedRunnerCustomImageVersions represents a collection of versions of a custom image. +type HostedRunnerCustomImageVersions struct { + TotalCount int `json:"total_count"` + ImageVersions []*HostedRunnerCustomImageVersion `json:"image_versions"` +} + +// HostedRunnerImageSpecs represents the details of a GitHub-hosted runner image. +type HostedRunnerImageSpecs struct { + ID string `json:"id"` + Platform string `json:"platform"` + SizeGB int `json:"size_gb"` + DisplayName string `json:"display_name"` + Source string `json:"source"` +} + +// HostedRunnerImages represents the response containing the total count and details of runner images. +type HostedRunnerImages struct { + TotalCount int `json:"total_count"` + Images []*HostedRunnerImageSpecs `json:"images"` +} + +// GetHostedRunnerGitHubOwnedImages gets the list of GitHub-owned images available for GitHub-hosted runners for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-owned-images-for-github-hosted-runners-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/github-owned +func (s *ActionsService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, org string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/github-owned", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// GetHostedRunnerPartnerImages gets the list of partner images available for GitHub-hosted runners for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-partner-images-for-github-hosted-runners-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/partner +func (s *ActionsService) GetHostedRunnerPartnerImages(ctx context.Context, org string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/partner", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// HostedRunnerPublicIPLimits represents the static public IP limits for GitHub-hosted runners. +type HostedRunnerPublicIPLimits struct { + PublicIPs *PublicIPUsage `json:"public_ips"` +} + +// PublicIPUsage provides details of static public IP limits for GitHub-hosted runners. +type PublicIPUsage struct { + Maximum int64 `json:"maximum"` // The maximum number of static public IP addresses that can be used for Hosted Runners. Example: 50 + CurrentUsage int64 `json:"current_usage"` // The current number of static public IP addresses in use by Hosted Runners. Example: 17 +} + +// GetHostedRunnerLimits gets the GitHub-hosted runners Static public IP Limits for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-limits-on-github-hosted-runners-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/limits +func (s *ActionsService) GetHostedRunnerLimits(ctx context.Context, org string) (*HostedRunnerPublicIPLimits, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/limits", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var publicIPLimits *HostedRunnerPublicIPLimits + resp, err := s.client.Do(req, &publicIPLimits) + if err != nil { + return nil, resp, err + } + + return publicIPLimits, resp, nil +} + +// HostedRunnerMachineSpecs represents the response containing the total count and details of machine specs for GitHub-hosted runners. +type HostedRunnerMachineSpecs struct { + TotalCount int `json:"total_count"` + MachineSpecs []*HostedRunnerMachineSpec `json:"machine_specs"` +} + +// GetHostedRunnerMachineSpecs gets the list of machine specs available for GitHub-hosted runners for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-hosted-runners-machine-specs-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/machine-sizes +func (s *ActionsService) GetHostedRunnerMachineSpecs(ctx context.Context, org string) (*HostedRunnerMachineSpecs, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/machine-sizes", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machineSpecs *HostedRunnerMachineSpecs + resp, err := s.client.Do(req, &machineSpecs) + if err != nil { + return nil, resp, err + } + + return machineSpecs, resp, nil +} + +// HostedRunnerPlatforms represents the response containing the total count and platforms for GitHub-hosted runners. +type HostedRunnerPlatforms struct { + TotalCount int `json:"total_count"` + Platforms []string `json:"platforms"` +} + +// GetHostedRunnerPlatforms gets list of platforms available for GitHub-hosted runners for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-platforms-for-github-hosted-runners-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/platforms +func (s *ActionsService) GetHostedRunnerPlatforms(ctx context.Context, org string) (*HostedRunnerPlatforms, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/platforms", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var platforms *HostedRunnerPlatforms + resp, err := s.client.Do(req, &platforms) + if err != nil { + return nil, resp, err + } + + return platforms, resp, nil +} + +// GetHostedRunner gets a GitHub-hosted runner in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-github-hosted-runner-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id} +func (s *ActionsService) GetHostedRunner(ctx context.Context, org string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// UpdateHostedRunner updates a GitHub-hosted runner for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-organization +// +//meta:operation PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id} +func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, body UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// DeleteHostedRunner deletes GitHub-hosted runner from an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-github-hosted-runner-for-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id} +func (s *ActionsService) DeleteHostedRunner(ctx context.Context, org string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// ListHostedRunnerCustomImages lists custom images for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-custom-images-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom +func (s *ActionsService) ListHostedRunnerCustomImages(ctx context.Context, org string) (*HostedRunnerCustomImages, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom", org) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var images *HostedRunnerCustomImages + resp, err := s.client.Do(req, &images) + if err != nil { + return nil, resp, err + } + + return images, resp, nil +} + +// GetHostedRunnerCustomImage gets a custom image definition for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-custom-image-definition-for-github-actions-hosted-runners +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *ActionsService) GetHostedRunnerCustomImage(ctx context.Context, org string, imageDefinitionID int64) (*HostedRunnerCustomImage, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var image *HostedRunnerCustomImage + resp, err := s.client.Do(req, &image) + if err != nil { + return nil, resp, err + } + + return image, resp, nil +} + +// DeleteHostedRunnerCustomImage deletes a custom image from the organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-custom-image-from-the-organization +// +//meta:operation DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *ActionsService) DeleteHostedRunnerCustomImage(ctx context.Context, org string, imageDefinitionID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListHostedRunnerCustomImageVersions lists image versions of a custom image for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#list-image-versions-of-a-custom-image-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions +func (s *ActionsService) ListHostedRunnerCustomImageVersions(ctx context.Context, org string, imageDefinitionID int64) (*HostedRunnerCustomImageVersions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions", org, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions *HostedRunnerCustomImageVersions + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// GetHostedRunnerCustomImageVersion gets an image version of a custom image for GitHub-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-image-version-of-a-custom-image-for-github-actions-hosted-runners +// +//meta:operation GET /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *ActionsService) GetHostedRunnerCustomImageVersion(ctx context.Context, org string, imageDefinitionID int64, version string) (*HostedRunnerCustomImageVersion, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions/%v", org, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var imageVersion *HostedRunnerCustomImageVersion + resp, err := s.client.Do(req, &imageVersion) + if err != nil { + return nil, resp, err + } + + return imageVersion, resp, nil +} + +// DeleteHostedRunnerCustomImageVersion deletes an image version of a custom image from the organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-an-image-version-of-custom-image-from-the-organization +// +//meta:operation DELETE /orgs/{org}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *ActionsService) DeleteHostedRunnerCustomImageVersion(ctx context.Context, org string, imageDefinitionID int64, version string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/images/custom/%v/versions/%v", org, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_oidc.go b/vendor/github.com/google/go-github/v93/github/actions_oidc.go new file mode 100644 index 000000000..d0cf78ffa --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_oidc.go @@ -0,0 +1,201 @@ +// 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" +) + +// OIDCSubjectClaimCustomTemplate represents an OIDC subject claim customization template. +type OIDCSubjectClaimCustomTemplate struct { + UseDefault *bool `json:"use_default,omitempty"` + IncludeClaimKeys []string `json:"include_claim_keys,omitempty"` + UseImmutableSubject *bool `json:"use_immutable_subject,omitempty"` + SubClaimPrefix *string `json:"sub_claim_prefix,omitempty"` +} + +// GetOrgOIDCSubjectClaimCustomTemplate gets the subject claim customization template for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/oidc/customization/sub +func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) + return s.getOIDCSubjectClaimCustomTemplate(ctx, u) +} + +// GetRepoOIDCSubjectClaimCustomTemplate gets the subject claim customization template for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/oidc/customization/sub +func (s *ActionsService) GetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) + return s.getOIDCSubjectClaimCustomTemplate(ctx, u) +} + +func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, url string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + var tmpl *OIDCSubjectClaimCustomTemplate + resp, err := s.client.Do(req, &tmpl) + if err != nil { + return nil, resp, err + } + + return tmpl, resp, nil +} + +// SetOrgOIDCSubjectClaimCustomTemplate sets the subject claim customization for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/oidc/customization/sub +func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, body OIDCSubjectClaimCustomTemplate) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) + return s.setOIDCSubjectClaimCustomTemplate(ctx, u, body) +} + +// SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/oidc/customization/sub +func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string, body OIDCSubjectClaimCustomTemplate) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) + return s.setOIDCSubjectClaimCustomTemplate(ctx, u, body) +} + +func (s *ActionsService) setOIDCSubjectClaimCustomTemplate(ctx context.Context, url string, body OIDCSubjectClaimCustomTemplate) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// InclusionSource represents whether the custom oidc property claim was defined at the organization or enterprise level. +type InclusionSource string + +// InclusionSource constants represent whether the inclusion was defined at the organization or enterprise level. +const ( + InclusionSourceEnterprise InclusionSource = "enterprise" + InclusionSourceOrganization InclusionSource = "organization" +) + +// OIDCCustomPropertyClaim represents an OIDC custom property claim for GitHub Actions. +type OIDCCustomPropertyClaim struct { + CustomPropertyName string `json:"custom_property_name"` +} + +// OIDCCustomPropertyClaimResponse represents the OIDC custom property claim along with the inclusion source (enterprise or organization) for GitHub Actions. +type OIDCCustomPropertyClaimResponse struct { + OIDCCustomPropertyClaim + InclusionSource InclusionSource `json:"inclusion_source"` +} + +// ListEnterpriseOIDCCustomPropertyClaims lists the custom property claims in oidc for enterprise actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#list-oidc-custom-property-inclusions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/oidc/customization/properties/repo +func (s *ActionsService) ListEnterpriseOIDCCustomPropertyClaims(ctx context.Context, enterprise string) ([]*OIDCCustomPropertyClaimResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/oidc/customization/properties/repo", enterprise) + return s.listOIDCCustomPropertyClaims(ctx, u) +} + +// ListOrgOIDCCustomPropertyClaims lists the custom property claims in oidc for organization actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#list-oidc-custom-property-inclusions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/oidc/customization/properties/repo +func (s *ActionsService) ListOrgOIDCCustomPropertyClaims(ctx context.Context, org string) ([]*OIDCCustomPropertyClaimResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/oidc/customization/properties/repo", org) + return s.listOIDCCustomPropertyClaims(ctx, u) +} + +func (s *ActionsService) listOIDCCustomPropertyClaims(ctx context.Context, url string) ([]*OIDCCustomPropertyClaimResponse, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + var props []*OIDCCustomPropertyClaimResponse + resp, err := s.client.Do(req, &props) + if err != nil { + return nil, resp, err + } + + return props, resp, nil +} + +// SetEnterpriseOIDCCustomPropertyClaim sets a new custom property claim in oidc for enterprise actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#create-an-oidc-custom-property-inclusion-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/oidc/customization/properties/repo +func (s *ActionsService) SetEnterpriseOIDCCustomPropertyClaim(ctx context.Context, enterprise string, body OIDCCustomPropertyClaim) (*OIDCCustomPropertyClaim, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/oidc/customization/properties/repo", enterprise) + return s.setOIDCCustomPropertyClaim(ctx, u, body) +} + +// SetOrgOIDCCustomPropertyClaim sets a new custom property claim in oidc for organization actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#create-an-oidc-custom-property-inclusion-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/oidc/customization/properties/repo +func (s *ActionsService) SetOrgOIDCCustomPropertyClaim(ctx context.Context, org string, body OIDCCustomPropertyClaim) (*OIDCCustomPropertyClaim, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/oidc/customization/properties/repo", org) + return s.setOIDCCustomPropertyClaim(ctx, u, body) +} + +func (s *ActionsService) setOIDCCustomPropertyClaim(ctx context.Context, url string, body OIDCCustomPropertyClaim) (*OIDCCustomPropertyClaim, *Response, error) { + req, err := s.client.NewRequest(ctx, "POST", url, body) + if err != nil { + return nil, nil, err + } + + var customProperty *OIDCCustomPropertyClaim + resp, err := s.client.Do(req, &customProperty) + if err != nil { + return nil, resp, err + } + return customProperty, resp, err +} + +// DeleteEnterpriseOIDCCustomPropertyClaim deletes a custom property claim in oidc for enterprise actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#delete-an-oidc-custom-property-inclusion-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/oidc/customization/properties/repo/{custom_property_name} +func (s *ActionsService) DeleteEnterpriseOIDCCustomPropertyClaim(ctx context.Context, enterprise, customProperty string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/oidc/customization/properties/repo/%v", enterprise, customProperty) + return s.deleteOIDCCustomPropertyClaim(ctx, u) +} + +// DeleteOrgOIDCCustomPropertyClaim deletes a custom property claim in oidc for organization actions. +// +// GitHub API docs: https://docs.github.com/rest/actions/oidc?apiVersion=2022-11-28#delete-an-oidc-custom-property-inclusion-for-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/oidc/customization/properties/repo/{custom_property_name} +func (s *ActionsService) DeleteOrgOIDCCustomPropertyClaim(ctx context.Context, enterprise, customProperty string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/oidc/customization/properties/repo/%v", enterprise, customProperty) + return s.deleteOIDCCustomPropertyClaim(ctx, u) +} + +func (s *ActionsService) deleteOIDCCustomPropertyClaim(ctx context.Context, url string) (*Response, error) { + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v93/github/actions_permissions_enterprise.go new file mode 100644 index 000000000..902da18c2 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_permissions_enterprise.go @@ -0,0 +1,414 @@ +// 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" +) + +// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. +type ActionsEnabledOnEnterpriseRepos struct { + TotalCount int `json:"total_count"` + Organizations []*Organization `json:"organizations"` +} + +// ActionsPermissionsEnterprise represents a policy for allowed actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissionsEnterprise struct { + EnabledOrganizations string `json:"enabled_organizations"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` +} + +func (a ActionsPermissionsEnterprise) String() string { + return Stringify(a) +} + +// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionEnterprise struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// SelfHostRunnerPermissionsEnterprise represents the settings for whether organizations in the enterprise are allowed to manage self-hosted runners at the repository level. +type SelfHostRunnerPermissionsEnterprise struct { + DisableSelfHostedRunnersForAllOrgs bool `json:"disable_self_hosted_runners_for_all_orgs"` +} + +func (a SelfHostRunnerPermissionsEnterprise) String() string { + return Stringify(a) +} + +// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions +func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissionsInEnterprise sets the permissions policy in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions +func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, body ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *ActionsPermissionsEnterprise + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#list-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/organizations +func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs *ActionsEnabledOnEnterpriseRepos + resp, err := s.client.Do(req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations +func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_organization_ids"` + }{IDs: organizationIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#enable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} +func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#disable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} +func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/selected-actions +func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// UpdateActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions +func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, body DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionEnterprise + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriodInEnterprise gets the artifact and log retention period for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) GetArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriodInEnterprise sets the artifact and log retention period for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, body ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetSelfHostedRunnerPermissionsInEnterprise gets the self-hosted runner permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-self-hosted-runners-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/self-hosted-runners +func (s *ActionsService) GetSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string) (*SelfHostRunnerPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *SelfHostRunnerPermissionsEnterprise + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateSelfHostedRunnerPermissionsInEnterprise sets the self-hosted runner permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, body SelfHostRunnerPermissionsEnterprise) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetPrivateRepoForkPRWorkflowSettingsInEnterprise gets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise sets the settings for whether workflows from fork pull requests can run on private repositories in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, body *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, body ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v93/github/actions_permissions_orgs.go new file mode 100644 index 000000000..c296f9c16 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_permissions_orgs.go @@ -0,0 +1,526 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsPermissions represents a policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissions struct { + EnabledRepositories string `json:"enabled_repositories"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` +} + +func (a ActionsPermissions) String() string { + return Stringify(a) +} + +// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. +type ActionsEnabledOnOrgRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ActionsAllowed represents selected actions that are allowed. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsAllowed struct { + GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` + VerifiedAllowed *bool `json:"verified_allowed,omitempty"` + // PatternsAllowed uses `omitzero` to allow an empty array to be sent in the request body in order to + // configure the organization to allow no 3rd-party actions. It needs to still omit a `nil` value so + // that it's possible to patch the other values without changing the allowed actions. + PatternsAllowed []string `json:"patterns_allowed,omitzero"` +} + +func (a ActionsAllowed) String() string { + return Stringify(a) +} + +// DefaultWorkflowPermissionOrganization represents the default permissions for GitHub Actions workflows for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionOrganization struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// SelfHostedRunnersSettingsOrganization represents the self-hosted runners permissions settings for repositories in an organization. +type SelfHostedRunnersSettingsOrganization struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +func (s SelfHostedRunnersSettingsOrganization) String() string { + return Stringify(s) +} + +// SelfHostedRunnersSettingsOrganizationOpt specifies the self-hosted runners permissions settings for repositories in an organization. +type SelfHostedRunnersSettingsOrganizationOpt struct { + EnabledRepositories string `json:"enabled_repositories"` +} + +// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions +func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions +func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, body ActionsPermissions) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *ActionsPermissions + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#list-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/repositories +func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repos *ActionsEnabledOnOrgRepos + resp, err := s.client.Do(req, &repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories +func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#enable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories/{repository_id} +func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#disable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} +func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowed gets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/selected-actions +func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// UpdateActionsAllowed sets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions +func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetDefaultWorkflowPermissionsInOrganization gets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionOrganization + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, body DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionOrganization + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriodInOrganization gets the artifact and log retention period for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) GetArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriodInOrganization sets the artifact and log retention period for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, body ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetSelfHostedRunnersSettingsInOrganization gets the self-hosted runners permissions settings for repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-self-hosted-runners-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/self-hosted-runners +func (s *ActionsService) GetSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string) (*SelfHostedRunnersSettingsOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *SelfHostedRunnersSettingsOrganization + resp, err := s.client.Do(req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// UpdateSelfHostedRunnersSettingsInOrganization sets the self-hosted runners permissions settings for repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-self-hosted-runners-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, body SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// SelfHostedRunnersAllowedRepos represents the repositories that are allowed to use self-hosted runners in an organization. +type SelfHostedRunnersAllowedRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ListRepositoriesSelfHostedRunnersAllowedInOrganization lists the repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#list-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/self-hosted-runners/repositories +func (s *ActionsService) ListRepositoriesSelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, opts *ListOptions) (*SelfHostedRunnersAllowedRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *SelfHostedRunnersAllowedRepos + resp, err := s.client.Do(req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// SetRepositoriesSelfHostedRunnersAllowedInOrganization allows the list of repositories to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners/repositories +func (s *ActionsService) SetRepositoriesSelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddRepositorySelfHostedRunnersAllowedInOrganization adds a repository to the list of repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#add-a-repository-to-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id} +func (s *ActionsService) AddRepositorySelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories/%v", org, repositoryID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveRepositorySelfHostedRunnersAllowedInOrganization removes a repository from the list of repositories that are allowed to use self-hosted runners in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#remove-a-repository-from-the-list-of-repositories-allowed-to-use-self-hosted-runners-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/permissions/self-hosted-runners/repositories/{repository_id} +func (s *ActionsService) RemoveRepositorySelfHostedRunnersAllowedInOrganization(ctx context.Context, org string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners/repositories/%v", org, repositoryID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetPrivateRepoForkPRWorkflowSettingsInOrganization gets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) GetPrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettingsInOrganization sets the settings for whether workflows from fork pull requests can run on private repositories in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, body *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetOrganizationForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string, body ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_policies.go b/vendor/github.com/google/go-github/v93/github/actions_policies.go new file mode 100644 index 000000000..345beb0a2 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_policies.go @@ -0,0 +1,299 @@ +// 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" +) + +// ActionsPolicyTarget represents a GitHub Actions policy target. +type ActionsPolicyTarget string + +// ActionsPolicyTargetActions is the target used by GitHub Actions policies. +const ActionsPolicyTargetActions ActionsPolicyTarget = "actions" + +// ActionsPolicyRuleType represents a GitHub Actions policy rule type. +type ActionsPolicyRuleType string + +// GitHub Actions policy rule types. +const ( + ActionsPolicyRuleTypeRestrictActionsActors ActionsPolicyRuleType = "restrict_actions_actors" + ActionsPolicyRuleTypeRestrictActionEvents ActionsPolicyRuleType = "restrict_action_events" +) + +// ActionsPolicyActorType represents the type of an actor allowed to trigger Actions workflows. +type ActionsPolicyActorType string + +// GitHub Actions policy actor types. +const ( + ActionsPolicyActorTypeUser ActionsPolicyActorType = "User" + ActionsPolicyActorTypeBot ActionsPolicyActorType = "Bot" + ActionsPolicyActorTypeTeam ActionsPolicyActorType = "Team" + ActionsPolicyActorTypeBusinessTeam ActionsPolicyActorType = "BusinessTeam" + ActionsPolicyActorTypeEnterpriseTeam ActionsPolicyActorType = "EnterpriseTeam" + ActionsPolicyActorTypeIntegrationInstallation ActionsPolicyActorType = "IntegrationInstallation" + ActionsPolicyActorTypeApp ActionsPolicyActorType = "App" + ActionsPolicyActorTypeRepositoryRole ActionsPolicyActorType = "RepositoryRole" +) + +// ActionsPolicy represents a GitHub Actions policy. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10 +type ActionsPolicy struct { + ID int64 `json:"id"` + Name string `json:"name"` + Target ActionsPolicyTarget `json:"target"` + SourceType RulesetSourceType `json:"source_type"` + Source string `json:"source"` + Enforcement RulesetEnforcement `json:"enforcement"` + Conditions *ActionsPolicyConditions `json:"conditions,omitempty"` + Rules []*ActionsPolicyRule `json:"rules,omitzero"` + NodeID *string `json:"node_id,omitempty"` + Links *RepositoryRulesetLinks `json:"_links,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateActionsPolicyRequest represents a request to create a GitHub Actions policy. +type CreateActionsPolicyRequest struct { + Name string `json:"name"` + Enforcement RulesetEnforcement `json:"enforcement"` + Conditions *ActionsPolicyConditions `json:"conditions,omitempty"` + Rules []*ActionsPolicyRule `json:"rules,omitzero"` +} + +// UpdateActionsPolicyRequest represents a request to update a GitHub Actions policy. +type UpdateActionsPolicyRequest struct { + Name *string `json:"name,omitempty"` + Enforcement *RulesetEnforcement `json:"enforcement,omitempty"` + Conditions *ActionsPolicyConditions `json:"conditions,omitempty"` + Rules []*ActionsPolicyRule `json:"rules,omitzero"` +} + +// ActionsPolicyConditions represents the conditions object in an Actions policy. +// Organization policies may use one repository selector and an optional workflow path selector. +// Policies inherited from higher levels can also contain organization selectors. +type ActionsPolicyConditions struct { + 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"` + WorkflowPath *ActionsPolicyWorkflowPathConditionParameters `json:"workflow_path,omitempty"` +} + +// ActionsPolicyWorkflowPathConditionParameters represents a workflow_path condition in an Actions policy. +type ActionsPolicyWorkflowPathConditionParameters struct { + Include []string `json:"include"` + Exclude []string `json:"exclude"` +} + +// ActionsPolicyRule represents a rule in an Actions policy. +type ActionsPolicyRule struct { + Type ActionsPolicyRuleType `json:"type"` + Parameters *ActionsPolicyRuleParameters `json:"parameters,omitempty"` +} + +// ActionsPolicyRuleParameters represents the parameters for an Actions policy rule. +// AllowedActors is used by restrict_actions_actors; AllowedEvents is used by restrict_action_events. +type ActionsPolicyRuleParameters struct { + AllowedActors []*ActionsPolicyActor `json:"allowed_actors,omitzero"` + AllowedEvents []string `json:"allowed_events,omitzero"` +} + +// ActionsPolicyActor represents an actor authorized to trigger Actions workflows. +type ActionsPolicyActor struct { + ID int64 `json:"id"` + Type ActionsPolicyActorType `json:"type"` +} + +// ActionsPolicyList represents a list of GitHub Actions policies. +type ActionsPolicyList struct { + TotalCount int `json:"total_count"` + Policies []*ActionsPolicy `json:"policies"` +} + +// ActionsPolicyListOptions specifies optional parameters for listing Actions policies. +type ActionsPolicyListOptions struct { + // HasParents controls whether policies configured at higher levels are included. + HasParents *bool `url:"has_parents,omitempty"` + ListOptions +} + +func (s *ActionsService) listPolicies(ctx context.Context, u string, opts *ActionsPolicyListOptions) (*ActionsPolicyList, *Response, error) { + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var policies *ActionsPolicyList + resp, err := s.client.Do(req, &policies) + if err != nil { + return nil, resp, err + } + + return policies, resp, nil +} + +func (s *ActionsService) createPolicy(ctx context.Context, u string, body CreateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var policy *ActionsPolicy + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +func (s *ActionsService) getPolicy(ctx context.Context, u string) (*ActionsPolicy, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var policy *ActionsPolicy + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +func (s *ActionsService) updatePolicy(ctx context.Context, u string, body UpdateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", u, body, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var policy *ActionsPolicy + resp, err := s.client.Do(req, &policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +func (s *ActionsService) deletePolicy(ctx context.Context, u string) (*Response, error) { + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + +// ListOrganizationPolicies lists all Actions policies for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#list-organization-actions-policies +// +//meta:operation GET /orgs/{org}/actions/policies +func (s *ActionsService) ListOrganizationPolicies(ctx context.Context, org string, opts *ActionsPolicyListOptions) (*ActionsPolicyList, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/policies", org) + return s.listPolicies(ctx, u, opts) +} + +// CreateOrganizationPolicy creates an Actions policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#create-an-organization-actions-policy +// +//meta:operation POST /orgs/{org}/actions/policies +func (s *ActionsService) CreateOrganizationPolicy(ctx context.Context, org string, body CreateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/policies", org) + return s.createPolicy(ctx, u, body) +} + +// GetOrganizationPolicy gets a specific Actions policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#get-an-organization-actions-policy +// +//meta:operation GET /orgs/{org}/actions/policies/{policy_id} +func (s *ActionsService) GetOrganizationPolicy(ctx context.Context, org string, policyID int64) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/policies/%v", org, policyID) + return s.getPolicy(ctx, u) +} + +// UpdateOrganizationPolicy updates an Actions policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#update-an-organization-actions-policy +// +//meta:operation PUT /orgs/{org}/actions/policies/{policy_id} +func (s *ActionsService) UpdateOrganizationPolicy(ctx context.Context, org string, policyID int64, body UpdateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/policies/%v", org, policyID) + return s.updatePolicy(ctx, u, body) +} + +// DeleteOrganizationPolicy deletes an Actions policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#delete-an-organization-actions-policy +// +//meta:operation DELETE /orgs/{org}/actions/policies/{policy_id} +func (s *ActionsService) DeleteOrganizationPolicy(ctx context.Context, org string, policyID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/policies/%v", org, policyID) + return s.deletePolicy(ctx, u) +} + +// ListRepositoryPolicies lists all Actions policies for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#list-repository-actions-policies +// +//meta:operation GET /repos/{owner}/{repo}/actions/policies +func (s *ActionsService) ListRepositoryPolicies(ctx context.Context, owner, repo string, opts *ActionsPolicyListOptions) (*ActionsPolicyList, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/policies", owner, repo) + return s.listPolicies(ctx, u, opts) +} + +// CreateRepositoryPolicy creates an Actions policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#create-a-repository-actions-policy +// +//meta:operation POST /repos/{owner}/{repo}/actions/policies +func (s *ActionsService) CreateRepositoryPolicy(ctx context.Context, owner, repo string, body CreateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/policies", owner, repo) + return s.createPolicy(ctx, u, body) +} + +// GetRepositoryPolicy gets a specific Actions policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#get-a-repository-actions-policy +// +//meta:operation GET /repos/{owner}/{repo}/actions/policies/{policy_id} +func (s *ActionsService) GetRepositoryPolicy(ctx context.Context, owner, repo string, policyID int64) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/policies/%v", owner, repo, policyID) + return s.getPolicy(ctx, u) +} + +// UpdateRepositoryPolicy updates an Actions policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#update-a-repository-actions-policy +// +//meta:operation PUT /repos/{owner}/{repo}/actions/policies/{policy_id} +func (s *ActionsService) UpdateRepositoryPolicy(ctx context.Context, owner, repo string, policyID int64, body UpdateActionsPolicyRequest) (*ActionsPolicy, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/policies/%v", owner, repo, policyID) + return s.updatePolicy(ctx, u, body) +} + +// DeleteRepositoryPolicy deletes an Actions policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/policies?apiVersion=2026-03-10#delete-a-repository-actions-policy +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/policies/{policy_id} +func (s *ActionsService) DeleteRepositoryPolicy(ctx context.Context, owner, repo string, policyID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/policies/%v", owner, repo, policyID) + return s.deletePolicy(ctx, u) +} diff --git a/vendor/github.com/google/go-github/v69/github/actions_runner_groups.go b/vendor/github.com/google/go-github/v93/github/actions_runner_groups.go similarity index 69% rename from vendor/github.com/google/go-github/v69/github/actions_runner_groups.go rename to vendor/github.com/google/go-github/v93/github/actions_runner_groups.go index b2ee32f61..168019b4e 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v93/github/actions_runner_groups.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/json" "fmt" ) @@ -18,6 +19,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"` @@ -33,7 +36,7 @@ type RunnerGroups struct { // CreateRunnerGroupRequest represents a request to create a Runner group for an organization. type CreateRunnerGroupRequest struct { - Name *string `json:"name,omitempty"` + Name string `json:"name"` Visibility *string `json:"visibility,omitempty"` // List of repository IDs that can access the runner group. SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` @@ -45,15 +48,36 @@ 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. type UpdateRunnerGroupRequest struct { - Name *string `json:"name,omitempty"` + Name string `json:"name"` Visibility *string `json:"visibility,omitempty"` 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"` + + // If true, send a null network_configuration_id to remove the network configuration. + // This takes precedence over NetworkConfigurationID. + RemoveNetworkConfiguration bool `json:"-"` +} + +// MarshalJSON implements the json.Marshaler interface. +func (r UpdateRunnerGroupRequest) MarshalJSON() ([]byte, error) { + type alias UpdateRunnerGroupRequest + if !r.RemoveNetworkConfiguration { + return json.Marshal(alias(r)) + } + return json.Marshal(&struct { + alias + NetworkConfigurationID *string `json:"network_configuration_id"` + }{ + alias: alias(r), + }) } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories @@ -80,7 +104,7 @@ type ListOrgRunnerGroupOptions struct { // ListOrganizationRunnerGroups lists all self-hosted runner groups configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) (*RunnerGroups, *Response, error) { @@ -90,13 +114,13 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := &RunnerGroups{} - resp, err := s.client.Do(ctx, req, &groups) + var groups *RunnerGroups + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -106,18 +130,18 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s // GetOrganizationRunnerGroup gets a specific self-hosted runner group for an organization using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -127,34 +151,34 @@ func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org str // DeleteOrganizationRunnerGroup deletes a self-hosted runner group from an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateOrganizationRunnerGroup creates a new self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-organization // //meta:operation POST /orgs/{org}/actions/runner-groups -func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, createReq CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { +func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, body CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -164,18 +188,18 @@ func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org // UpdateOrganizationRunnerGroup updates a self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-organization // //meta:operation PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} -func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, updateReq UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { +func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, body UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - runnerGroup := new(RunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *RunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -185,7 +209,7 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -195,13 +219,13 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - repos := &ListRepositories{} - resp, err := s.client.Do(ctx, req, &repos) + var repos *ListRepositories + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -212,57 +236,83 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or // SetRepositoryAccessRunnerGroup replaces the list of repositories that have access to a self-hosted runner group configured in an organization // with a new List of repositories. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-repository-access-for-a-self-hosted-runner-group-in-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories -func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, ids SetRepoAccessRunnerGroupRequest) (*Response, error) { +func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, body SetRepoAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRepositoryAccessRunnerGroup adds a repository to the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRepositoryAccessRunnerGroup removes a repository from the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) +} + +// ListRunnerGroupHostedRunners lists the GitHub-hosted runners in an organization runner group. +// +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-github-hosted-runners-in-a-group-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners +func (s *ActionsService) ListRunnerGroupHostedRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*HostedRunners, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/hosted-runners", org, groupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil } // ListRunnerGroupRunners lists self-hosted runners that are in a specific organization group. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-organization // //meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { @@ -272,13 +322,13 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -289,49 +339,49 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an organization runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners -func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { +func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, body SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-organization // //meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an organization. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-organization // //meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) RemoveRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/actions_runners.go b/vendor/github.com/google/go-github/v93/github/actions_runners.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/actions_runners.go rename to vendor/github.com/google/go-github/v93/github/actions_runners.go index c4ae48232..6113adce4 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_runners.go +++ b/vendor/github.com/google/go-github/v93/github/actions_runners.go @@ -22,18 +22,18 @@ type RunnerApplicationDownload struct { // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners/downloads func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -41,8 +41,8 @@ func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, own return rads, resp, nil } -// GenerateJITConfigRequest specifies body parameters to GenerateRepoJITConfig. -type GenerateJITConfigRequest struct { +// CreateJITConfigRequest specifies body parameters to CreateOrgJITConfig, CreateRepoJITConfig, and CreateJITConfig. +type CreateJITConfigRequest struct { Name string `json:"name"` RunnerGroupID int64 `json:"runner_group_id"` WorkFolder *string `json:"work_folder,omitempty"` @@ -58,20 +58,20 @@ type JITRunnerConfig struct { EncodedJITConfig *string `json:"encoded_jit_config,omitempty"` } -// GenerateOrgJITConfig generate a just-in-time configuration for an organization. +// CreateOrgJITConfig creates a just-in-time configuration for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig -func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *ActionsService) CreateOrgJITConfig(ctx context.Context, org string, body CreateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", org) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -79,20 +79,20 @@ func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, r return jitConfig, resp, nil } -// GenerateRepoJITConfig generates a just-in-time configuration for a repository. +// CreateRepoJITConfig creates a just-in-time configuration for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig -func (s *ActionsService) GenerateRepoJITConfig(ctx context.Context, owner, repo string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *ActionsService) CreateRepoJITConfig(ctx context.Context, owner, repo string, body CreateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/generate-jitconfig", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -108,19 +108,19 @@ type RegistrationToken struct { // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/registration-token func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -130,12 +130,15 @@ func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, rep // Runner represents a self-hosted runner registered with a repository. type Runner struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - OS *string `json:"os,omitempty"` - Status *string `json:"status,omitempty"` - Busy *bool `json:"busy,omitempty"` - Labels []*RunnerLabels `json:"labels,omitempty"` + ID *int64 `json:"id,omitempty"` + RunnerGroupID *int64 `json:"runner_group_id,omitempty"` + Name *string `json:"name,omitempty"` + OS *string `json:"os,omitempty"` + Status *string `json:"status,omitempty"` + Busy *bool `json:"busy,omitempty"` + Labels []*RunnerLabels `json:"labels,omitempty"` + Ephemeral *bool `json:"ephemeral,omitempty"` + Version *string `json:"version,omitempty"` } // RunnerLabels represents a collection of labels attached to each runner. @@ -159,7 +162,7 @@ type ListRunnersOptions struct { // ListRunners lists all the self-hosted runners for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -169,13 +172,13 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -185,18 +188,18 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op // GetRunner gets a specific self-hosted runner for a repository using its runner ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -212,19 +215,19 @@ type RemoveToken struct { // CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-remove-token-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/actions/runners/remove-token func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - removeToken := new(RemoveToken) - resp, err := s.client.Do(ctx, req, removeToken) + var removeToken *RemoveToken + resp, err := s.client.Do(req, &removeToken) if err != nil { return nil, resp, err } @@ -234,34 +237,34 @@ func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo stri // RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/downloads func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, org string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/downloads", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -271,19 +274,19 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context. // CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/registration-token func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, org string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", org) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -293,7 +296,7 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context // ListOrganizationRunners lists all the self-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -303,13 +306,13 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -319,18 +322,18 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -340,19 +343,19 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, // CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-remove-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/remove-token func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", org) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - removeToken := new(RemoveToken) - resp, err := s.client.Do(ctx, req, removeToken) + var removeToken *RemoveToken + resp, err := s.client.Do(req, &removeToken) if err != nil { return nil, resp, err } @@ -362,16 +365,16 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org // RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id. // -// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-an-organization // //meta:operation DELETE /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/actions_secrets.go b/vendor/github.com/google/go-github/v93/github/actions_secrets.go new file mode 100644 index 000000000..eaac66486 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_secrets.go @@ -0,0 +1,530 @@ +// Copyright 2020 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" + "net/url" + "strconv" +) + +// PublicKey represents the public key that should be used to encrypt secrets. +type PublicKey struct { + // KeyID is the identifier for the key. + KeyID *string `json:"key_id"` + // Key is the Base64 encoded public key. + Key *string `json:"key"` + // ID is the unique identifier of the key. + ID *int64 `json:"id,omitempty"` + // URL is the API URL for the key. + URL *string `json:"url,omitempty"` + // Title is the title of the key. + Title *string `json:"title,omitempty"` + // CreatedAt is the time when the key was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +// This ensures GitHub Enterprise versions which return a numeric key id +// do not error out when unmarshaling. +func (p *PublicKey) UnmarshalJSON(data []byte) error { + var pk struct { + KeyID any `json:"key_id"` + Key *string `json:"key"` + ID *int64 `json:"id"` + URL *string `json:"url"` + Title *string `json:"title"` + CreatedAt *Timestamp `json:"created_at"` + } + + if err := json.Unmarshal(data, &pk); err != nil { + return err + } + + p.Key = pk.Key + p.ID = pk.ID + p.URL = pk.URL + p.Title = pk.Title + p.CreatedAt = pk.CreatedAt + + switch v := pk.KeyID.(type) { + case nil: + return nil + case string: + p.KeyID = &v + case float64: + p.KeyID = new(strconv.FormatFloat(v, 'f', -1, 64)) + default: + return fmt.Errorf("unable to unmarshal %T as a string", v) + } + + return nil +} + +func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) + if err != nil { + return nil, resp, err + } + + return pubKey, resp, nil +} + +// GetRepoPublicKey gets a public key that should be used for secret encryption. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets/public-key +func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo) + return s.getPublicKey(ctx, url) +} + +// GetOrgPublicKey gets a public key that should be used for secret encryption. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-organization-public-key +// +//meta:operation GET /orgs/{org}/actions/secrets/public-key +func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { + url := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org) + return s.getPublicKey(ctx, url) +} + +// GetEnvPublicKey gets a public key that should be used for secret encryption. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-environment-public-key +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key +func (s *ActionsService) GetEnvPublicKey(ctx context.Context, owner, repo, env string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/secrets/public-key", owner, repo, url.PathEscape(env)) + return s.getPublicKey(ctx, u) +} + +// Secret represents a repository action secret. +type Secret struct { + Name string `json:"name"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + Visibility string `json:"visibility,omitempty"` + SelectedRepositoriesURL string `json:"selected_repositories_url,omitempty"` +} + +// Secrets represents one item from the ListSecrets response. +type Secrets struct { + TotalCount int `json:"total_count"` + Secrets []*Secret `json:"secrets"` +} + +// ListRepoSecrets lists all secrets available in a repository +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-repository-secrets +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets +func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// ListRepoOrgSecrets lists all organization secrets available in a repository +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-repository-organization-secrets +// +//meta:operation GET /repos/{owner}/{repo}/actions/organization-secrets +func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/organization-secrets", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// ListOrgSecrets lists all secrets available in an organization +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-organization-secrets +// +//meta:operation GET /orgs/{org}/actions/secrets +func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// ListEnvSecrets lists all secrets available in an environment. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-environment-secrets +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/secrets +func (s *ActionsService) ListEnvSecrets(ctx context.Context, owner, repo, env string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/secrets", owner, repo, url.PathEscape(env)) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// GetRepoSecret gets a single repository secret without revealing its encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-a-repository-secret +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets/{secret_name} +func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil +} + +// GetOrgSecret gets a single organization secret without revealing its encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-organization-secret +// +//meta:operation GET /orgs/{org}/actions/secrets/{secret_name} +func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil +} + +// GetEnvSecret gets a single environment secret without revealing its encrypted value. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#get-an-environment-secret +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} +func (s *ActionsService) GetEnvSecret(ctx context.Context, owner, repo, env, secretName string) (*Secret, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/secrets/%v", owner, repo, url.PathEscape(env), secretName) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil +} + +// SelectedRepoIDs are the repository IDs that have access to the actions secrets. +type SelectedRepoIDs []int64 + +// EncryptedSecret represents a secret that is encrypted using a public key. +// +// The value of EncryptedValue must be your secret, encrypted with +// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages) +// using the public key retrieved using the GetPublicKey method. +type EncryptedSecret struct { + Name string `json:"-"` + KeyID string `json:"key_id"` + EncryptedValue string `json:"encrypted_value"` + Visibility string `json:"visibility,omitempty"` + SelectedRepositoryIDs SelectedRepoIDs `json:"selected_repository_ids,omitempty"` +} + +// SecretOrgRequest represents a request to create or update a secret for an +// organization. +// +// The value of EncryptedValue must be your secret, encrypted with +// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages) +// using the public key retrieved using the GetPublicKey method. +type SecretOrgRequest struct { + KeyID string `json:"key_id"` + EncryptedValue string `json:"encrypted_value"` + Visibility string `json:"visibility"` + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitzero"` +} + +// SecretRequest represents a request to create or update a secret for a +// repository or a repository environment. +// +// The value of EncryptedValue must be your secret, encrypted with +// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages) +// using the public key retrieved using the GetPublicKey method. +type SecretRequest struct { + KeyID string `json:"key_id"` + EncryptedValue string `json:"encrypted_value"` +} + +// CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret +// +//meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} +func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo, name string, body SecretRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} +func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org, name string, body SecretOrgRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-environment-secret +// +//meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} +func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, owner, repo, env, name string, body SecretRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/secrets/%v", owner, repo, url.PathEscape(env), name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteRepoSecret deletes a secret in a repository using the secret name. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#delete-a-repository-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} +func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteOrgSecret deletes a secret in an organization using the secret name. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#delete-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name} +func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteEnvSecret deletes a secret in an environment using the secret name. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#delete-an-environment-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} +func (s *ActionsService) DeleteEnvSecret(ctx context.Context, owner, repo, env, secretName string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/secrets/%v", owner, repo, url.PathEscape(env), secretName) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// SelectedReposList represents the list of repositories selected for an organization secret. +type SelectedReposList struct { + TotalCount *int `json:"total_count,omitempty"` + Repositories []*Repository `json:"repositories,omitempty"` +} + +// ListSelectedReposForOrgSecret lists all repositories that have access to a secret. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret +// +//meta:operation GET /orgs/{org}/actions/secrets/{secret_name}/repositories +func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *SelectedReposList + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// SetSelectedReposForOrgSecret sets the repositories that have access to a secret. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories +func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) + + type repoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + + req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddSelectedRepoToOrgSecret adds a repository to an organization secret. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} +func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} +func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/actions_variables.go b/vendor/github.com/google/go-github/v93/github/actions_variables.go new file mode 100644 index 000000000..b617956e3 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/actions_variables.go @@ -0,0 +1,478 @@ +// 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" + "errors" + "fmt" + "net/url" +) + +// ActionsCreateOrgVariableRequest represents a request to create an +// organization variable. +type ActionsCreateOrgVariableRequest struct { + Name string `json:"name"` + Value string `json:"value"` + Visibility string `json:"visibility"` + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitzero"` +} + +// ActionsUpdateOrgVariableRequest represents a request to update an +// organization variable. +type ActionsUpdateOrgVariableRequest struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` + Visibility *string `json:"visibility,omitempty"` + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitzero"` +} + +// ActionsCreateVariableRequest represents a request to create a variable +// for a repository or repository environment variable. +type ActionsCreateVariableRequest struct { + Name string `json:"name"` + Value string `json:"value"` +} + +// ActionsUpdateVariableRequest represents a request to update a variable +// for a repository or repository environment variable. +type ActionsUpdateVariableRequest struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +// ActionsVariable represents a repository action variable. +type ActionsVariable struct { + Name string `json:"name"` + Value string `json:"value"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + + // Used by ListOrgVariables and GetOrgVariables + Visibility *string `json:"visibility,omitempty"` + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +// ActionsVariables represents one item from the ListVariables response. +type ActionsVariables struct { + TotalCount int `json:"total_count"` + Variables []*ActionsVariable `json:"variables"` +} + +// ListRepoVariables lists all variables available in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-repository-variables +// +//meta:operation GET /repos/{owner}/{repo}/actions/variables +func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// ListRepoOrgVariables lists all organization variables available in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-repository-organization-variables +// +//meta:operation GET /repos/{owner}/{repo}/actions/organization-variables +func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/organization-variables", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// ListOrgVariables lists all variables available in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-organization-variables +// +//meta:operation GET /orgs/{org}/actions/variables +func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// ListEnvVariables lists all variables available in an environment. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-environment-variables +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables +func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, url.PathEscape(env)) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// GetRepoVariable gets a single repository variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-a-repository-variable +// +//meta:operation GET /repos/{owner}/{repo}/actions/variables/{name} +func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) + if err != nil { + return nil, resp, err + } + + return variable, resp, nil +} + +// GetOrgVariable gets a single organization variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-an-organization-variable +// +//meta:operation GET /orgs/{org}/actions/variables/{name} +func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) + if err != nil { + return nil, resp, err + } + + return variable, resp, nil +} + +// GetEnvVariable gets a single environment variable. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#get-an-environment-variable +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*ActionsVariable, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, url.PathEscape(env), variableName) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) + if err != nil { + return nil, resp, err + } + + return variable, resp, nil +} + +// CreateRepoVariable creates a repository variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-a-repository-variable +// +//meta:operation POST /repos/{owner}/{repo}/actions/variables +func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, body ActionsCreateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateOrgVariable creates an organization variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-organization-variable +// +//meta:operation POST /orgs/{org}/actions/variables +func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, body ActionsCreateOrgVariableRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateEnvVariable creates an environment variable. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#create-an-environment-variable +// +//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables +func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, body ActionsCreateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, url.PathEscape(env)) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + +// UpdateRepoVariable updates a repository variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-a-repository-variable +// +//meta:operation PATCH /repos/{owner}/{repo}/actions/variables/{name} +func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo, name string, body ActionsUpdateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// UpdateOrgVariable updates an organization variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-an-organization-variable +// +//meta:operation PATCH /orgs/{org}/actions/variables/{name} +func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org, name string, body ActionsUpdateOrgVariableRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// UpdateEnvVariable updates an environment variable. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#update-an-environment-variable +// +//meta:operation PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env, name string, body ActionsUpdateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, url.PathEscape(env), name) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteRepoVariable deletes a variable in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-a-repository-variable +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/variables/{name} +func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteOrgVariable deletes a variable in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/actions/variables/{name} +func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteEnvVariable deletes a variable in an environment. +// +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#delete-an-environment-variable +// +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) DeleteEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, url.PathEscape(env), variableName) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListSelectedReposForOrgVariable lists all repositories that have access to a variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-variable +// +//meta:operation GET /orgs/{org}/actions/variables/{name}/repositories +func (s *ActionsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *SelectedReposList + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// SetSelectedReposForOrgVariable sets the repositories that have access to a variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-variable +// +//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories +func (s *ActionsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) + + type repoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + + req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddSelectedRepoToOrgVariable adds a repository to an organization variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#add-selected-repository-to-an-organization-variable +// +//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} +func (s *ActionsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + + u := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveSelectedRepoFromOrgVariable removes a repository from an organization variable. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} +func (s *ActionsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + + u := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/actions_workflow_jobs.go b/vendor/github.com/google/go-github/v93/github/actions_workflow_jobs.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/actions_workflow_jobs.go rename to vendor/github.com/google/go-github/v93/github/actions_workflow_jobs.go index 10067c8b2..9419cf897 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_workflow_jobs.go +++ b/vendor/github.com/google/go-github/v93/github/actions_workflow_jobs.go @@ -70,23 +70,23 @@ type ListWorkflowJobsOptions struct { // ListWorkflowJobs lists all jobs for a workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - jobs := new(Jobs) - resp, err := s.client.Do(ctx, req, &jobs) + var jobs *Jobs + resp, err := s.client.Do(req, &jobs) if err != nil { return nil, resp, err } @@ -96,23 +96,23 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // ListWorkflowJobsAttempt lists jobs for a workflow run Attempt. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run-attempt // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - jobs := new(Jobs) - resp, err := s.client.Do(ctx, req, &jobs) + var jobs *Jobs + resp, err := s.client.Do(req, &jobs) if err != nil { return nil, resp, err } @@ -122,19 +122,19 @@ func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, rep // GetWorkflowJobByID gets a specific job in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id} func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - job := new(WorkflowJob) - resp, err := s.client.Do(ctx, req, job) + var job *WorkflowJob + resp, err := s.client.Do(req, &job) if err != nil { return nil, resp, err } @@ -144,13 +144,13 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str // GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowJobLogsWithRateLimit(ctx, u, maxRedirects) } @@ -173,12 +173,12 @@ func (s *ActionsService) getWorkflowJobLogsWithoutRateLimit(ctx context.Context, } func (s *ActionsService) getWorkflowJobLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v93/github/actions_workflow_runs.go similarity index 85% rename from vendor/github.com/google/go-github/v69/github/actions_workflow_runs.go rename to vendor/github.com/google/go-github/v93/github/actions_workflow_runs.go index 20b9cfcd5..2e12ed9fc 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v93/github/actions_workflow_runs.go @@ -106,6 +106,7 @@ type PendingDeploymentsRequest struct { Comment string `json:"comment"` } +// ReferencedWorkflow represents a referenced workflow in a workflow run. type ReferencedWorkflow struct { Path *string `json:"path,omitempty"` SHA *string `json:"sha,omitempty"` @@ -143,13 +144,13 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runs := new(WorkflowRuns) - resp, err := s.client.Do(ctx, req, &runs) + var runs *WorkflowRuns + resp, err := s.client.Do(req, &runs) if err != nil { return nil, resp, err } @@ -159,43 +160,43 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // ListWorkflowRunsByID lists all workflow runs by workflow ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow // //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) } // ListWorkflowRunsByFileName lists all workflow runs by workflow file name. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow // //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) } // ListRepositoryWorkflowRuns lists all workflow runs for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runs := new(WorkflowRuns) - resp, err := s.client.Do(ctx, req, &runs) + var runs *WorkflowRuns + resp, err := s.client.Do(req, &runs) if err != nil { return nil, resp, err } @@ -206,19 +207,19 @@ func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, // GetWorkflowRunByID gets a specific workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - run := new(WorkflowRun) - resp, err := s.client.Do(ctx, req, run) + var run *WorkflowRun + resp, err := s.client.Do(req, &run) if err != nil { return nil, resp, err } @@ -229,7 +230,7 @@ func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo str // GetWorkflowRunAttempt gets a specific workflow run attempt. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run-attempt // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo string, runID int64, attemptNumber int, opts *WorkflowRunAttemptOptions) (*WorkflowRun, *Response, error) { @@ -239,13 +240,13 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - run := new(WorkflowRun) - resp, err := s.client.Do(ctx, req, run) + var run *WorkflowRun + resp, err := s.client.Do(req, &run) if err != nil { return nil, resp, err } @@ -256,13 +257,13 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo // GetWorkflowRunAttemptLogs gets a redirect URL to download a plain text file of logs for a workflow run for attempt number. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve a workflow run ID from the DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#download-workflow-run-attempt-logs // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs -func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) { +func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowRunAttemptLogsWithRateLimit(ctx, u, maxRedirects) } @@ -285,12 +286,12 @@ func (s *ActionsService) getWorkflowRunAttemptLogsWithoutRateLimit(ctx context.C } func (s *ActionsService) getWorkflowRunAttemptLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -305,84 +306,84 @@ 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 +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-workflow // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RerunFailedJobsByID re-runs all of the failed jobs and their dependent jobs in a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-failed-jobs-from-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun-failed-jobs", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RerunJobByID re-runs a job and its dependent jobs in a workflow run by ID. // // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-job-from-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, jobID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/rerun", owner, repo, jobID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CancelWorkflowRunByID cancels a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#cancel-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#download-workflow-run-logs // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) - if s.client.RateLimitRedirectionalEndpoints { + if s.client.rateLimitRedirectionalEndpoints { return s.getWorkflowRunLogsWithRateLimit(ctx, u, maxRedirects) } @@ -397,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")) @@ -405,12 +406,12 @@ func (s *ActionsService) getWorkflowRunLogsWithoutRateLimit(ctx context.Context, } func (s *ActionsService) getWorkflowRunLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } @@ -427,53 +428,53 @@ func (s *ActionsService) getWorkflowRunLogsWithRateLimit(ctx context.Context, u // DeleteWorkflowRun deletes a workflow run by ID. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#delete-a-workflow-run // //meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteWorkflowRunLogs deletes all logs for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#delete-workflow-run-logs // //meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-workflow-run-usage // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - workflowRunUsage := new(WorkflowRunUsage) - resp, err := s.client.Do(ctx, req, workflowRunUsage) + var workflowRunUsage *WorkflowRunUsage + resp, err := s.client.Do(req, &workflowRunUsage) if err != nil { return nil, resp, err } @@ -484,19 +485,19 @@ func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, rep // GetPendingDeployments get all deployment environments for a workflow run that are waiting for protection rules to pass. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#get-pending-deployments-for-a-workflow-run // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo string, runID int64) ([]*PendingDeployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var deployments []*PendingDeployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -507,19 +508,19 @@ func (s *ActionsService) GetPendingDeployments(ctx context.Context, owner, repo // PendingDeployments approve or reject pending deployments that are waiting on approval by a required reviewer. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-pending-deployments-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments -func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, request *PendingDeploymentsRequest) ([]*Deployment, *Response, error) { +func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, body PendingDeploymentsRequest) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var deployments []*Deployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -530,17 +531,17 @@ func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo str // ReviewCustomDeploymentProtectionRule approves or rejects custom deployment protection rules provided by a GitHub App for a workflow run. // You can use the helper function *DeploymentProtectionRuleEvent.GetRunID() to easily retrieve the workflow run ID from a DeploymentProtectionRuleEvent. // -// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#review-custom-deployment-protection-rules-for-a-workflow-run // //meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule -func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, request *ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) { +func (s *ActionsService) ReviewCustomDeploymentProtectionRule(ctx context.Context, owner, repo string, runID int64, body ReviewCustomDeploymentProtectionRuleRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/deployment_protection_rule", owner, repo, runID) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) return resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/actions_workflows.go b/vendor/github.com/google/go-github/v93/github/actions_workflows.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/actions_workflows.go rename to vendor/github.com/google/go-github/v93/github/actions_workflows.go index 0214e6abf..8c2610a4b 100644 --- a/vendor/github.com/google/go-github/v69/github/actions_workflows.go +++ b/vendor/github.com/google/go-github/v93/github/actions_workflows.go @@ -51,30 +51,71 @@ 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]interface{} `json:"inputs,omitempty"` + 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. +type WorkflowsPermissions struct { + RunWorkflowsFromForkPullRequests *bool `json:"run_workflows_from_fork_pull_requests,omitempty"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + RequireApprovalForForkPRWorkflows *bool `json:"require_approval_for_fork_pr_workflows,omitempty"` +} + +func (w WorkflowsPermissions) String() string { + return Stringify(w) +} + +// WorkflowsPermissionsOpt specifies options for editing workflows permissions in a repository. +type WorkflowsPermissionsOpt struct { + RunWorkflowsFromForkPullRequests bool `json:"run_workflows_from_fork_pull_requests"` + SendWriteTokensToWorkflows *bool `json:"send_write_tokens_to_workflows,omitempty"` + SendSecretsAndVariables *bool `json:"send_secrets_and_variables,omitempty"` + 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 +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - workflows := new(Workflows) - resp, err := s.client.Do(ctx, req, &workflows) + var workflows *Workflows + resp, err := s.client.Do(req, &workflows) if err != nil { return nil, resp, err } @@ -84,7 +125,7 @@ func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, // GetWorkflowByID gets a specific workflow by ID. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) { @@ -95,7 +136,7 @@ func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string // GetWorkflowByFileName gets a specific workflow by file name. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-a-workflow // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) { @@ -105,13 +146,13 @@ func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, } func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - workflow := new(Workflow) - resp, err := s.client.Do(ctx, req, workflow) + var workflow *Workflow + resp, err := s.client.Do(req, &workflow) if err != nil { return nil, resp, err } @@ -121,7 +162,7 @@ func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow // GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-workflow-usage // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) { @@ -132,7 +173,7 @@ func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo s // GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#get-workflow-usage // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) { @@ -142,13 +183,13 @@ func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, } func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*WorkflowUsage, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - workflowUsage := new(WorkflowUsage) - resp, err := s.client.Do(ctx, req, workflowUsage) + var workflowUsage *WorkflowUsage + resp, err := s.client.Do(req, &workflowUsage) if err != nil { return nil, resp, err } @@ -158,38 +199,44 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // CreateWorkflowDispatchEventByID manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, body CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) - return s.createWorkflowDispatchEvent(ctx, u, &event) + return s.createWorkflowDispatchEvent(ctx, u, &body) } // CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) { +func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, body CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) - return s.createWorkflowDispatchEvent(ctx, u, &event) + return s.createWorkflowDispatchEvent(ctx, u, &body) } -func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, event *CreateWorkflowDispatchEventRequest) (*Response, error) { - req, err := s.client.NewRequest("POST", url, event) +func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url string, body *CreateWorkflowDispatchEventRequest) (*WorkflowDispatchRunDetails, *Response, error) { + req, err := s.client.NewRequest(ctx, "POST", url, body) if err != nil { - return nil, err + return nil, nil, err + } + + var dispatchRunDetails *WorkflowDispatchRunDetails + resp, err := s.client.Do(req, &dispatchRunDetails) + if err != nil { + return nil, resp, err } - return s.client.Do(ctx, req, nil) + return dispatchRunDetails, resp, nil } // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { @@ -199,7 +246,7 @@ func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo str // EnableWorkflowByFileName enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#enable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { @@ -209,7 +256,7 @@ func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, re // DisableWorkflowByID disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { @@ -219,7 +266,7 @@ func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo st // DisableWorkflowByFileName disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows?apiVersion=2022-11-28#disable-a-workflow // //meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { @@ -228,10 +275,10 @@ func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, r } func (s *ActionsService) doNewPutRequest(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/activity.go b/vendor/github.com/google/go-github/v93/github/activity.go similarity index 90% rename from vendor/github.com/google/go-github/v69/github/activity.go rename to vendor/github.com/google/go-github/v93/github/activity.go index edf8cc439..f69bd3826 100644 --- a/vendor/github.com/google/go-github/v69/github/activity.go +++ b/vendor/github.com/google/go-github/v93/github/activity.go @@ -10,7 +10,7 @@ import "context" // ActivityService handles communication with the activity related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/activity/ +// GitHub API docs: https://docs.github.com/rest/activity?apiVersion=2022-11-28 type ActivityService service // FeedLink represents a link to a related resource. @@ -58,17 +58,17 @@ type FeedLinks struct { // Note: Private feeds are only returned when authenticating via Basic Auth // since current feed URIs use the older, non revocable auth tokens. // -// GitHub API docs: https://docs.github.com/rest/activity/feeds#get-feeds +// GitHub API docs: https://docs.github.com/rest/activity/feeds?apiVersion=2022-11-28#get-feeds // //meta:operation GET /feeds func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) { - req, err := s.client.NewRequest("GET", "feeds", nil) + req, err := s.client.NewRequest(ctx, "GET", "feeds", nil) if err != nil { return nil, nil, err } - f := &Feeds{} - resp, err := s.client.Do(ctx, req, f) + var f *Feeds + resp, err := s.client.Do(req, &f) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/activity_events.go b/vendor/github.com/google/go-github/v93/github/activity_events.go similarity index 79% rename from vendor/github.com/google/go-github/v69/github/activity_events.go rename to vendor/github.com/google/go-github/v93/github/activity_events.go index b12baa99e..83635fbb7 100644 --- a/vendor/github.com/google/go-github/v69/github/activity_events.go +++ b/vendor/github.com/google/go-github/v93/github/activity_events.go @@ -12,7 +12,7 @@ import ( // ListEvents drinks from the firehose of all public events across GitHub. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events // //meta:operation GET /events func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { @@ -21,13 +21,13 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -37,7 +37,7 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] // ListRepositoryEvents lists events for a repository. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-repository-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-repository-events // //meta:operation GET /repos/{owner}/{repo}/events func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { @@ -47,13 +47,13 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -63,7 +63,7 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo // ListIssueEventsForRepository lists issue events for a repository. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/events func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -73,13 +73,13 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -89,7 +89,7 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne // ListEventsForRepoNetwork lists public events for a network of repositories. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-network-of-repositories // //meta:operation GET /networks/{owner}/{repo}/events func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { @@ -99,13 +99,13 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -115,7 +115,7 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r // ListEventsForOrganization lists public events for an organization. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-organization-events +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-organization-events // //meta:operation GET /orgs/{org}/events func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { @@ -125,13 +125,13 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -142,8 +142,9 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str // ListEventsPerformedByUser lists the events performed by a user. If publicOnly is // 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 +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-events-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-for-a-user // //meta:operation GET /users/{username}/events //meta:operation GET /users/{username}/events/public @@ -159,13 +160,13 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -176,8 +177,9 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st // ListEventsReceivedByUser lists the events received by a user. If publicOnly is // 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 +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-events-received-by-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-public-events-received-by-a-user // //meta:operation GET /users/{username}/received_events //meta:operation GET /users/{username}/received_events/public @@ -193,13 +195,13 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -210,7 +212,7 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str // ListUserEventsForOrganization provides the user’s organization dashboard. You // must be authenticated as the user to view this. // -// GitHub API docs: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/events?apiVersion=2022-11-28#list-organization-events-for-the-authenticated-user // //meta:operation GET /users/{username}/events/orgs/{org} func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { @@ -220,13 +222,13 @@ func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*Event - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/activity_notifications.go b/vendor/github.com/google/go-github/v93/github/activity_notifications.go similarity index 75% rename from vendor/github.com/google/go-github/v69/github/activity_notifications.go rename to vendor/github.com/google/go-github/v93/github/activity_notifications.go index e712323ed..edd074dd2 100644 --- a/vendor/github.com/google/go-github/v69/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/v93/github/activity_notifications.go @@ -19,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API docs: https://docs.github.com/rest/activity#notification-reasons + // GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -49,7 +49,7 @@ type NotificationListOptions struct { // ListNotifications lists all notifications for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#list-notifications-for-the-authenticated-user // //meta:operation GET /notifications func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { @@ -59,13 +59,13 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) + resp, err := s.client.Do(req, ¬ifications) if err != nil { return nil, resp, err } @@ -76,7 +76,7 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat // ListRepositoryNotifications lists all notifications in a given repository // for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#list-repository-notifications-for-the-authenticated-user // //meta:operation GET /repos/{owner}/{repo}/notifications func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) { @@ -86,13 +86,13 @@ func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var notifications []*Notification - resp, err := s.client.Do(ctx, req, ¬ifications) + resp, err := s.client.Do(req, ¬ifications) if err != nil { return nil, resp, err } @@ -101,30 +101,32 @@ 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 +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-notifications-as-read // //meta:operation PUT /notifications func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead Timestamp) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, } - req, err := s.client.NewRequest("PUT", "notifications", opts) + req, err := s.client.NewRequest(ctx, "PUT", "notifications", opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // 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 +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-repository-notifications-as-read // //meta:operation PUT /repos/{owner}/{repo}/notifications func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead Timestamp) (*Response, error) { @@ -132,29 +134,29 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, o LastReadAt: lastRead, } u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetThread gets the specified notification thread. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#get-a-thread // //meta:operation GET /notifications/threads/{thread_id} func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - notification := new(Notification) - resp, err := s.client.Do(ctx, req, notification) + var notification *Notification + resp, err := s.client.Do(req, ¬ification) if err != nil { return nil, resp, err } @@ -164,53 +166,53 @@ func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notificati // MarkThreadRead marks the specified thread as read. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-read // //meta:operation PATCH /notifications/threads/{thread_id} func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("PATCH", u, nil) + req, err := s.client.NewRequest(ctx, "PATCH", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // MarkThreadDone marks the specified thread as done. // Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#mark-a-thread-as-done // //meta:operation DELETE /notifications/threads/{thread_id} -func (s *ActivityService) MarkThreadDone(ctx context.Context, id int64) (*Response, error) { +func (s *ActivityService) MarkThreadDone(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetThreadSubscription checks to see if the authenticated user is subscribed // to a thread. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#get-a-thread-subscription-for-the-authenticated-user // //meta:operation GET /notifications/threads/{thread_id}/subscription func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -221,19 +223,19 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) // SetThreadSubscription sets the subscription for the specified thread for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#set-a-thread-subscription // //meta:operation PUT /notifications/threads/{thread_id}/subscription -func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { +func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, body *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -244,15 +246,15 @@ func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, // DeleteThreadSubscription deletes the subscription for the specified thread // for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications?apiVersion=2022-11-28#delete-a-thread-subscription // //meta:operation DELETE /notifications/threads/{thread_id}/subscription func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/activity_star.go b/vendor/github.com/google/go-github/v93/github/activity_star.go similarity index 55% rename from vendor/github.com/google/go-github/v69/github/activity_star.go rename to vendor/github.com/google/go-github/v93/github/activity_star.go index cebdacf76..2c395ff2b 100644 --- a/vendor/github.com/google/go-github/v69/github/activity_star.go +++ b/vendor/github.com/google/go-github/v93/github/activity_star.go @@ -25,26 +25,25 @@ type Stargazer struct { // ListStargazers lists people who have starred the specified repo. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#list-stargazers +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-stargazers // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches - req.Header.Set("Accept", mediaTypeStarringPreview) + req.Header.Set("Accept", mediaTypeStarring) var stargazers []*Stargazer - resp, err := s.client.Do(ctx, req, &stargazers) + resp, err := s.client.Do(req, &stargazers) if err != nil { return nil, resp, err } @@ -52,6 +51,65 @@ func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string return stargazers, resp, nil } +// StargazerCount represents the number of users who have starred a repository. +type StargazerCount struct { + Count int `json:"count"` +} + +// GetStargazerCount gets the number of people who have starred the specified repo. +// +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#get-stargazer-count +// +//meta:operation GET /repos/{owner}/{repo}/stargazers/count +func (s *ActivityService) GetStargazerCount(ctx context.Context, owner, repo string) (*StargazerCount, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stargazers/count", owner, repo) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var count *StargazerCount + resp, err := s.client.Do(req, &count) + if err != nil { + return nil, resp, err + } + + return count, resp, nil +} + +// StargazerHistory represents the stars a repository received during one week. +type StargazerHistory struct { + Days []int `json:"days"` + Total int `json:"total"` + Week Timestamp `json:"week"` +} + +// ListStargazerHistory lists the stars of the specified repo grouped by week. +// +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#get-repository-star-history +// +//meta:operation GET /repos/{owner}/{repo}/stargazers/history +func (s *ActivityService) ListStargazerHistory(ctx context.Context, owner, repo string, opts *ListOptions) ([]*StargazerHistory, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stargazers/history", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var history []*StargazerHistory + resp, err := s.client.Do(req, &history) + if err != nil { + return nil, resp, err + } + + return history, resp, nil +} + // ActivityListStarredOptions specifies the optional parameters to the // ActivityService.ListStarred method. type ActivityListStarredOptions struct { @@ -60,7 +118,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,8 +127,9 @@ type ActivityListStarredOptions struct { // ListStarred lists all the repos starred by a user. Passing the empty string // 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 +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-repositories-starred-by-a-user +// +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#list-repositories-starred-by-the-authenticated-user // //meta:operation GET /user/starred //meta:operation GET /users/{username}/starred @@ -86,17 +145,16 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when APIs fully launch - acceptHeaders := []string{mediaTypeStarringPreview, mediaTypeTopicsPreview} + acceptHeaders := []string{mediaTypeStarring, mediaTypeTopicsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var repos []*StarredRepository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -106,47 +164,47 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac // IsStarred checks if a repository is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#check-if-a-repository-is-starred-by-the-authenticated-user // //meta:operation GET /user/starred/{owner}/{repo} func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } // Star a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#star-a-repository-for-the-authenticated-user // //meta:operation PUT /user/starred/{owner}/{repo} func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unstar a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring?apiVersion=2022-11-28#unstar-a-repository-for-the-authenticated-user // //meta:operation DELETE /user/starred/{owner}/{repo} func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/activity_watching.go b/vendor/github.com/google/go-github/v93/github/activity_watching.go similarity index 77% rename from vendor/github.com/google/go-github/v69/github/activity_watching.go rename to vendor/github.com/google/go-github/v93/github/activity_watching.go index 348590057..86cb4aa15 100644 --- a/vendor/github.com/google/go-github/v69/github/activity_watching.go +++ b/vendor/github.com/google/go-github/v93/github/activity_watching.go @@ -27,23 +27,23 @@ type Subscription struct { // ListWatchers lists watchers of a particular repo. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#list-watchers +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-watchers // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var watchers []*User - resp, err := s.client.Do(ctx, req, &watchers) + resp, err := s.client.Do(req, &watchers) if err != nil { return nil, resp, err } @@ -54,8 +54,9 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, // ListWatched lists the repositories the specified user is watching. Passing // 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 +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-repositories-watched-by-a-user +// +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#list-repositories-watched-by-the-authenticated-user // //meta:operation GET /user/subscriptions //meta:operation GET /users/{username}/subscriptions @@ -71,13 +72,13 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var watched []*Repository - resp, err := s.client.Do(ctx, req, &watched) + resp, err := s.client.Do(req, &watched) if err != nil { return nil, resp, err } @@ -89,19 +90,19 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // repository for the authenticated user. If the authenticated user is not // watching the repository, a nil Subscription is returned. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#get-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#get-a-repository-subscription // //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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { // if it's just a 404, don't return that as an error _, err = parseBoolResponse(err) @@ -118,19 +119,19 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // To ignore notifications made within a repository, set subscription.Ignored to true. // To stop watching a repository, use DeleteRepositorySubscription. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#set-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#set-a-repository-subscription // //meta:operation PUT /repos/{owner}/{repo}/subscription -func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) +func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, body *Subscription) (*Subscription, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) - req, err := s.client.NewRequest("PUT", u, subscription) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - sub := new(Subscription) - resp, err := s.client.Do(ctx, req, sub) + var sub *Subscription + resp, err := s.client.Do(req, &sub) if err != nil { return nil, resp, err } @@ -144,15 +145,15 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // This is used to stop watching a repository. To control whether or not to // receive notifications from a repository, use SetRepositorySubscription. // -// GitHub API docs: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#delete-a-repository-subscription // //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) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/admin.go b/vendor/github.com/google/go-github/v93/github/admin.go similarity index 78% rename from vendor/github.com/google/go-github/v69/github/admin.go rename to vendor/github.com/google/go-github/v93/github/admin.go index adf55d641..dd65fd5a3 100644 --- a/vendor/github.com/google/go-github/v69/github/admin.go +++ b/vendor/github.com/google/go-github/v93/github/admin.go @@ -14,7 +14,7 @@ import ( // GitHub API. These API routes are normally only accessible for GitHub // Enterprise installations. // -// GitHub API docs: https://docs.github.com/rest/enterprise-admin +// GitHub API docs: https://docs.github.com/rest/enterprise-admin?apiVersion=2022-11-28 type AdminService service // TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. @@ -36,6 +36,12 @@ func (m TeamLDAPMapping) String() string { return Stringify(m) } +// UpdateTeamLDAPMappingRequest represents a request to update the mapping +// between a GitHub team and an LDAP group. +type UpdateTeamLDAPMappingRequest struct { + LDAPDN string `json:"ldap_dn"` +} + // UserLDAPMapping represents the mapping between a GitHub user and an LDAP user. type UserLDAPMapping struct { ID *int64 `json:"id,omitempty"` @@ -62,6 +68,12 @@ func (m UserLDAPMapping) String() string { return Stringify(m) } +// UpdateUserLDAPMappingRequest represents a request to update the mapping +// between a GitHub user and an LDAP user. +type UpdateUserLDAPMappingRequest struct { + LDAPDN string `json:"ldap_dn"` +} + // Enterprise represents the GitHub enterprise profile. type Enterprise struct { ID *int `json:"id,omitempty"` @@ -82,18 +94,18 @@ 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.15/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping -func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { +func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, body UpdateUserLDAPMappingRequest) (*UserLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) - req, err := s.client.NewRequest("PATCH", u, mapping) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - m := new(UserLDAPMapping) - resp, err := s.client.Do(ctx, req, m) + var m *UserLDAPMapping + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -103,18 +115,18 @@ 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.15/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { - u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) - req, err := s.client.NewRequest("PATCH", u, mapping) +func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, teamID int64, body UpdateTeamLDAPMappingRequest) (*TeamLDAPMapping, *Response, error) { + u := fmt.Sprintf("admin/ldap/teams/%v/mapping", teamID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - m := new(TeamLDAPMapping) - resp, err := s.client.Do(ctx, req, m) + var m *TeamLDAPMapping + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/admin_orgs.go b/vendor/github.com/google/go-github/v93/github/admin_orgs.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/admin_orgs.go rename to vendor/github.com/google/go-github/v93/github/admin_orgs.go index 8b50756b0..b3bfd9b98 100644 --- a/vendor/github.com/google/go-github/v69/github/admin_orgs.go +++ b/vendor/github.com/google/go-github/v93/github/admin_orgs.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -22,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.15/rest/enterprise-admin/orgs#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -33,13 +34,13 @@ func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin s Admin: &admin, } - req, err := s.client.NewRequest("POST", u, orgReq) + req, err := s.client.NewRequest(ctx, "POST", u, orgReq) if err != nil { return nil, nil, err } - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } @@ -61,16 +62,23 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { + if org == nil { + return nil, nil, errors.New("organization must be provided") + } + if org.Login == nil { + return nil, nil, errors.New("login must be provided") + } + return s.RenameOrgByName(ctx, *org.Login, newName) } // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -80,13 +88,13 @@ func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) Login: &newName, } - req, err := s.client.NewRequest("PATCH", u, orgReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, orgReq) if err != nil { return nil, nil, err } - o := new(RenameOrgResponse) - resp, err := s.client.Do(ctx, req, o) + var o *RenameOrgResponse + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/admin_stats.go b/vendor/github.com/google/go-github/v93/github/admin_stats.go similarity index 96% rename from vendor/github.com/google/go-github/v69/github/admin_stats.go rename to vendor/github.com/google/go-github/v93/github/admin_stats.go index a6e406bec..00cdadbfc 100644 --- a/vendor/github.com/google/go-github/v69/github/admin_stats.go +++ b/vendor/github.com/google/go-github/v93/github/admin_stats.go @@ -152,18 +152,18 @@ 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.15/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { u := "enterprise/stats/all" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - m := new(AdminStats) - resp, err := s.client.Do(ctx, req, m) + var m *AdminStats + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/admin_users.go b/vendor/github.com/google/go-github/v93/github/admin_users.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/admin_users.go rename to vendor/github.com/google/go-github/v93/github/admin_users.go index 6877cef46..f9d63d83b 100644 --- a/vendor/github.com/google/go-github/v69/github/admin_users.go +++ b/vendor/github.com/google/go-github/v93/github/admin_users.go @@ -20,40 +20,40 @@ type CreateUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users -func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { +func (s *AdminService) CreateUser(ctx context.Context, body CreateUserRequest) (*User, *Response, error) { u := "admin/users" - req, err := s.client.NewRequest("POST", u, userReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - var user User - resp, err := s.client.Do(ctx, req, &user) + var user *User + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } - return &user, resp, nil + return user, resp, nil } // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { u := "admin/users/" + username - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -61,9 +61,10 @@ func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Respon return resp, nil } -// ImpersonateUserOptions represents the scoping for the OAuth token. -type ImpersonateUserOptions struct { - Scopes []string `json:"scopes,omitempty"` +// CreateUserImpersonationRequest represents the scoping for the OAuth token. +// Note that `Scopes` is a required field. +type CreateUserImpersonationRequest struct { + Scopes []string `json:"scopes"` } // OAuthAPP represents the GitHub Site Administrator OAuth app. @@ -95,19 +96,19 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) +func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, body CreateUserImpersonationRequest) (*UserAuthorization, *Response, error) { + u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - a := new(UserAuthorization) - resp, err := s.client.Do(ctx, req, a) + var a *UserAuthorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -117,18 +118,18 @@ 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.15/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/agent_tasks.go b/vendor/github.com/google/go-github/v93/github/agent_tasks.go new file mode 100644 index 000000000..8f4aa934b --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/agent_tasks.go @@ -0,0 +1,278 @@ +// 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" + "time" +) + +// AgentTasksService handles communication with the agent tasks +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28 +type AgentTasksService service + +// AgentTask represents a Copilot cloud agent task. +type AgentTask struct { + ID string `json:"id"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + Name *string `json:"name,omitempty"` + Creator *AgentTaskCreator `json:"creator,omitempty"` + CreatorType *string `json:"creator_type,omitempty"` + // UserCollaborators are the user objects of collaborators on this task. + // + // Deprecated: This field is deprecated by the GitHub API. + UserCollaborators []*User `json:"user_collaborators,omitempty"` + Owner *AgentTaskOwner `json:"owner,omitempty"` + Repository *AgentTaskRepository `json:"repository,omitempty"` + State string `json:"state"` + SessionCount *int `json:"session_count,omitempty"` + Artifacts []*AgentTaskArtifact `json:"artifacts,omitempty"` + ArchivedAt *Timestamp `json:"archived_at,omitempty"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Sessions []*AgentTaskSession `json:"sessions,omitempty"` +} + +// AgentTaskCreator represents an agent task creator. +type AgentTaskCreator struct { + ID *int64 `json:"id,omitempty"` +} + +// AgentTaskOwner represents an agent task owner. +type AgentTaskOwner struct { + ID *int64 `json:"id,omitempty"` +} + +// AgentTaskRepository represents an agent task repository. +type AgentTaskRepository struct { + ID *int64 `json:"id,omitempty"` +} + +// AgentTaskArtifact represents an artifact produced by an agent task. +type AgentTaskArtifact struct { + Provider string `json:"provider"` + Type string `json:"type"` + Data *AgentTaskArtifactData `json:"data,omitempty"` +} + +// AgentTaskArtifactData represents data associated with an agent task artifact. +type AgentTaskArtifactData struct { + ID *int64 `json:"id,omitempty"` + GlobalID *string `json:"global_id,omitempty"` + HeadRef *string `json:"head_ref,omitempty"` + BaseRef *string `json:"base_ref,omitempty"` +} + +// AgentTaskSession represents a session associated with an agent task. +type AgentTaskSession struct { + ID string `json:"id"` + Name *string `json:"name,omitempty"` + User *User `json:"user,omitempty"` + Owner *AgentTaskOwner `json:"owner,omitempty"` + Repository *AgentTaskRepository `json:"repository,omitempty"` + TaskID *string `json:"task_id,omitempty"` + State string `json:"state"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + Prompt *string `json:"prompt,omitempty"` + HeadRef *string `json:"head_ref,omitempty"` + BaseRef *string `json:"base_ref,omitempty"` + Model *string `json:"model,omitempty"` + Error *AgentTaskSessionError `json:"error,omitempty"` +} + +// AgentTaskSessionError represents error details for a failed agent task session. +type AgentTaskSessionError struct { + Message *string `json:"message,omitempty"` +} + +// AgentTaskList represents a list of agent tasks. +type AgentTaskList struct { + Tasks []*AgentTask `json:"tasks"` + TotalActiveCount *int `json:"total_active_count,omitempty"` + TotalArchivedCount *int `json:"total_archived_count,omitempty"` +} + +// AgentTaskListOptions specifies optional parameters to AgentTasksService.List. +type AgentTaskListOptions struct { + // Sort specifies the field to sort results by. Possible values are: updated_at, created_at. + Sort string `url:"sort,omitempty"` + + // Direction specifies the direction to sort results by. Possible values are: asc, desc. + Direction string `url:"direction,omitempty"` + + // State is a comma-separated list of task states to filter by. + // Possible values are: queued, in_progress, completed, failed, idle, + // waiting_for_user, timed_out, cancelled. + State string `url:"state,omitempty"` + + // IsArchived filters tasks by archived status. + IsArchived bool `url:"is_archived,omitempty"` + + // Since filters tasks updated at or after this time. + Since *time.Time `url:"since,omitempty"` + + ListOptions +} + +// AgentTaskListByRepoOptions specifies optional parameters to AgentTasksService.ListByRepo. +type AgentTaskListByRepoOptions struct { + AgentTaskListOptions + + // CreatorID filters tasks by creator user IDs. + CreatorID []int64 `url:"creator_id,omitempty"` +} + +// CreateAgentTaskRequest represents the parameters for creating an agent task. +type CreateAgentTaskRequest struct { + // Prompt is the user's prompt for the agent. + Prompt string `json:"prompt"` + + // Model is the model to use for this task. + Model *string `json:"model,omitempty"` + + // CreatePullRequest indicates whether to create a pull request. + CreatePullRequest *bool `json:"create_pull_request,omitempty"` + + // HeadRef is the head ref for the new branch or pull request. + HeadRef *string `json:"head_ref,omitempty"` + + // BaseRef is the base ref for the new branch or pull request. + BaseRef *string `json:"base_ref,omitempty"` +} + +// ListByRepo lists tasks for a repository. +// +// Note: This endpoint is in public preview and is subject to change. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28#list-tasks-for-repository +// +//meta:operation GET /agents/repos/{owner}/{repo}/tasks +func (s *AgentTasksService) ListByRepo(ctx context.Context, owner, repo string, opts *AgentTaskListByRepoOptions) (*AgentTaskList, *Response, error) { + u := fmt.Sprintf("agents/repos/%v/%v/tasks", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var tasks *AgentTaskList + resp, err := s.client.Do(req, &tasks) + if err != nil { + return nil, resp, err + } + + return tasks, resp, nil +} + +// Create starts a new Copilot cloud agent task for a repository. +// +// Note: This endpoint is in public preview and is subject to change. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28#start-a-task +// +//meta:operation POST /agents/repos/{owner}/{repo}/tasks +func (s *AgentTasksService) Create(ctx context.Context, owner, repo string, body CreateAgentTaskRequest) (*AgentTask, *Response, error) { + u := fmt.Sprintf("agents/repos/%v/%v/tasks", owner, repo) + + request, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var task *AgentTask + resp, err := s.client.Do(request, &task) + if err != nil { + return nil, resp, err + } + + return task, resp, nil +} + +// GetByRepoAndID gets a repository task by ID. +// +// Note: This endpoint is in public preview and is subject to change. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28#get-a-task-by-repo +// +//meta:operation GET /agents/repos/{owner}/{repo}/tasks/{task_id} +func (s *AgentTasksService) GetByRepoAndID(ctx context.Context, owner, repo, taskID string) (*AgentTask, *Response, error) { + u := fmt.Sprintf("agents/repos/%v/%v/tasks/%v", owner, repo, taskID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var task *AgentTask + resp, err := s.client.Do(req, &task) + if err != nil { + return nil, resp, err + } + + return task, resp, nil +} + +// List lists tasks for the authenticated user. +// +// Note: This endpoint is in public preview and is subject to change. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28#list-tasks +// +//meta:operation GET /agents/tasks +func (s *AgentTasksService) List(ctx context.Context, opts *AgentTaskListOptions) (*AgentTaskList, *Response, error) { + u := "agents/tasks" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var tasks *AgentTaskList + resp, err := s.client.Do(req, &tasks) + if err != nil { + return nil, resp, err + } + + return tasks, resp, nil +} + +// Get gets a task by ID for the authenticated user. +// +// Note: This endpoint is in public preview and is subject to change. +// +// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2022-11-28#get-a-task-by-id +// +//meta:operation GET /agents/tasks/{task_id} +func (s *AgentTasksService) Get(ctx context.Context, taskID string) (*AgentTask, *Response, error) { + u := fmt.Sprintf("agents/tasks/%v", taskID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var task *AgentTask + resp, err := s.client.Do(req, &task) + if err != nil { + return nil, resp, err + } + + return task, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/agents.go b/vendor/github.com/google/go-github/v93/github/agents.go new file mode 100644 index 000000000..7bcac5602 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/agents.go @@ -0,0 +1,15 @@ +// 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 + +// AgentsService handles communication with the Agents related +// methods of the GitHub API. +// +// The Agents endpoints are only served by the 2026-03-10 API version, so these +// methods send that version explicitly instead of the client's default. +// +// GitHub API docs: https://docs.github.com/rest/agents?apiVersion=2026-03-10 +type AgentsService service diff --git a/vendor/github.com/google/go-github/v93/github/agents_secrets.go b/vendor/github.com/google/go-github/v93/github/agents_secrets.go new file mode 100644 index 000000000..eecbf3785 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/agents_secrets.go @@ -0,0 +1,322 @@ +// 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" +) + +// GetRepoPublicKey gets a public key that should be used for Agents secret encryption. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/agents/secrets/public-key +func (s *AgentsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/secrets/public-key", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) + if err != nil { + return nil, resp, err + } + + return pubKey, resp, nil +} + +// GetOrgPublicKey gets a public key that should be used for Agents secret encryption. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#get-an-organization-public-key +// +//meta:operation GET /orgs/{org}/agents/secrets/public-key +func (s *AgentsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/public-key", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) + if err != nil { + return nil, resp, err + } + + return pubKey, resp, nil +} + +// ListRepoSecrets lists all Agents secrets available in a repository +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#list-repository-secrets +// +//meta:operation GET /repos/{owner}/{repo}/agents/secrets +func (s *AgentsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/secrets", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// ListOrgSecrets lists all Agents secrets available in an organization +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#list-organization-secrets +// +//meta:operation GET /orgs/{org}/agents/secrets +func (s *AgentsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// ListRepoOrgSecrets lists all organization Agents secrets available in a repository +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#list-repository-organization-secrets +// +//meta:operation GET /repos/{owner}/{repo}/agents/organization-secrets +func (s *AgentsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/organization-secrets", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil +} + +// GetRepoSecret gets a single repository Agents secret without revealing its encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#get-a-repository-secret +// +//meta:operation GET /repos/{owner}/{repo}/agents/secrets/{secret_name} +func (s *AgentsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil +} + +// GetOrgSecret gets a single organization Agents secret without revealing its encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#get-an-organization-secret +// +//meta:operation GET /orgs/{org}/agents/secrets/{secret_name} +func (s *AgentsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil +} + +// CreateOrUpdateRepoSecret creates or updates a repository Agents secret with an encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#create-or-update-a-repository-secret +// +//meta:operation PUT /repos/{owner}/{repo}/agents/secrets/{secret_name} +func (s *AgentsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo, name string, body SecretRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateOrUpdateOrgSecret creates or updates an organization Agents secret with an encrypted value. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#create-or-update-an-organization-secret +// +//meta:operation PUT /orgs/{org}/agents/secrets/{secret_name} +func (s *AgentsService) CreateOrUpdateOrgSecret(ctx context.Context, org, name string, body SecretOrgRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteRepoSecret deletes an Agents secret in a repository using the secret name. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#delete-a-repository-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/agents/secrets/{secret_name} +func (s *AgentsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteOrgSecret deletes an Agents secret in an organization using the secret name. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#delete-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/agents/secrets/{secret_name} +func (s *AgentsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListSelectedReposForOrgSecret lists all repositories that have access to an Agents secret. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#list-selected-repositories-for-an-organization-secret +// +//meta:operation GET /orgs/{org}/agents/secrets/{secret_name}/repositories +func (s *AgentsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v/repositories", org, name) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var result *SelectedReposList + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// SetSelectedReposForOrgSecret sets the repositories that have access to an Agents secret. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#set-selected-repositories-for-an-organization-secret +// +//meta:operation PUT /orgs/{org}/agents/secrets/{secret_name}/repositories +func (s *AgentsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v/repositories", org, name) + + type repoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + + req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddSelectedRepoToOrgSecret adds a repository to an organization Agents secret. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#add-selected-repository-to-an-organization-secret +// +//meta:operation PUT /orgs/{org}/agents/secrets/{secret_name}/repositories/{repository_id} +func (s *AgentsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveSelectedRepoFromOrgSecret removes a repository from an organization Agents secret. +// +// GitHub API docs: https://docs.github.com/rest/agents/secrets?apiVersion=2026-03-10#remove-selected-repository-from-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/agents/secrets/{secret_name}/repositories/{repository_id} +func (s *AgentsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/agents_variables.go b/vendor/github.com/google/go-github/v93/github/agents_variables.go new file mode 100644 index 000000000..d08129548 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/agents_variables.go @@ -0,0 +1,307 @@ +// 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" +) + +// ListRepoVariables lists all Agents variables available in a repository. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-variables +// +//meta:operation GET /repos/{owner}/{repo}/agents/variables +func (s *AgentsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/variables", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// ListRepoOrgVariables lists all organization Agents variables available in a repository. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-repository-organization-variables +// +//meta:operation GET /repos/{owner}/{repo}/agents/organization-variables +func (s *AgentsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/organization-variables", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// ListOrgVariables lists all Agents variables available in an organization. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-organization-variables +// +//meta:operation GET /orgs/{org}/agents/variables +func (s *AgentsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var variables *ActionsVariables + resp, err := s.client.Do(req, &variables) + if err != nil { + return nil, resp, err + } + + return variables, resp, nil +} + +// GetRepoVariable gets a single repository Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-a-repository-variable +// +//meta:operation GET /repos/{owner}/{repo}/agents/variables/{name} +func (s *AgentsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) + if err != nil { + return nil, resp, err + } + + return variable, resp, nil +} + +// GetOrgVariable gets a single organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#get-an-organization-variable +// +//meta:operation GET /orgs/{org}/agents/variables/{name} +func (s *AgentsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var variable *ActionsVariable + resp, err := s.client.Do(req, &variable) + if err != nil { + return nil, resp, err + } + + return variable, resp, nil +} + +// CreateRepoVariable creates a repository Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-a-repository-variable +// +//meta:operation POST /repos/{owner}/{repo}/agents/variables +func (s *AgentsService) CreateRepoVariable(ctx context.Context, owner, repo string, body ActionsCreateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/variables", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateOrgVariable creates an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#create-an-organization-variable +// +//meta:operation POST /orgs/{org}/agents/variables +func (s *AgentsService) CreateOrgVariable(ctx context.Context, org string, body ActionsCreateOrgVariableRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// UpdateRepoVariable updates a repository Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-a-repository-variable +// +//meta:operation PATCH /repos/{owner}/{repo}/agents/variables/{name} +func (s *AgentsService) UpdateRepoVariable(ctx context.Context, owner, repo, name string, body ActionsUpdateVariableRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// UpdateOrgVariable updates an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#update-an-organization-variable +// +//meta:operation PATCH /orgs/{org}/agents/variables/{name} +func (s *AgentsService) UpdateOrgVariable(ctx context.Context, org, name string, body ActionsUpdateOrgVariableRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteRepoVariable deletes a repository Agents variable using the variable name. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-a-repository-variable +// +//meta:operation DELETE /repos/{owner}/{repo}/agents/variables/{name} +func (s *AgentsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/agents/variables/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteOrgVariable deletes an organization Agents variable using the variable name. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#delete-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/agents/variables/{name} +func (s *AgentsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v", org, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListSelectedReposForOrgVariable lists all repositories that have access to an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#list-selected-repositories-for-an-organization-variable +// +//meta:operation GET /orgs/{org}/agents/variables/{name}/repositories +func (s *AgentsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories", org, name) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var result *SelectedReposList + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// SetSelectedReposForOrgVariable sets the repositories that have access to an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#set-selected-repositories-for-an-organization-variable +// +//meta:operation PUT /orgs/{org}/agents/variables/{name}/repositories +func (s *AgentsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories", org, name) + + type repoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + + req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// AddSelectedRepoToOrgVariable adds a repository to an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#add-selected-repository-to-an-organization-variable +// +//meta:operation PUT /orgs/{org}/agents/variables/{name}/repositories/{repository_id} +func (s *AgentsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// RemoveSelectedRepoFromOrgVariable removes a repository from an organization Agents variable. +// +// GitHub API docs: https://docs.github.com/rest/agents/variables?apiVersion=2026-03-10#remove-selected-repository-from-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/agents/variables/{name}/repositories/{repository_id} +func (s *AgentsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/agents/variables/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/apps.go b/vendor/github.com/google/go-github/v93/github/apps.go similarity index 73% rename from vendor/github.com/google/go-github/v69/github/apps.go rename to vendor/github.com/google/go-github/v93/github/apps.go index 3dd392d08..65bf88b3e 100644 --- a/vendor/github.com/google/go-github/v69/github/apps.go +++ b/vendor/github.com/google/go-github/v93/github/apps.go @@ -8,18 +8,20 @@ package github import ( "context" "fmt" + "net/http" ) // AppsService provides access to the installation related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/apps/ +// GitHub API docs: https://docs.github.com/rest/apps?apiVersion=2022-11-28 type AppsService service // App represents a GitHub App. type App struct { ID *int64 `json:"id,omitempty"` Slug *string `json:"slug,omitempty"` + ClientID *string `json:"client_id,omitempty"` NodeID *string `json:"node_id,omitempty"` Owner *User `json:"owner,omitempty"` Name *string `json:"name,omitempty"` @@ -56,6 +58,8 @@ type InstallationTokenOptions struct { Permissions *InstallationPermissions `json:"permissions,omitempty"` } +// InstallationTokenListRepoOptions allow restricting a token's access to a list of all repositories in an installation. +// It differs from InstallationTokenOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array. type InstallationTokenListRepoOptions struct { // The IDs of the repositories that the installation token can access. // Providing repository IDs restricts the access of an installation token to specific repositories. @@ -74,8 +78,8 @@ type InstallationTokenListRepoOptions struct { // // Permission names taken from: // -// https://docs.github.com/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app -// https://docs.github.com/rest/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/enterprise-server@3.22/rest/apps/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app type InstallationPermissions struct { Actions *string `json:"actions,omitempty"` ActionsVariables *string `json:"actions_variables,omitempty"` @@ -95,6 +99,19 @@ type InstallationPermissions struct { Deployments *string `json:"deployments,omitempty"` Discussions *string `json:"discussions,omitempty"` Emails *string `json:"emails,omitempty"` + EnterpriseAIControls *string `json:"enterprise_ai_controls,omitempty"` + EnterpriseCopilotMetrics *string `json:"enterprise_copilot_metrics,omitempty"` + EnterpriseCredentials *string `json:"enterprise_credentials,omitempty"` + EnterpriseCustomEnterpriseRoles *string `json:"enterprise_custom_enterprise_roles,omitempty"` + EnterpriseCustomOrgRoles *string `json:"enterprise_custom_org_roles,omitempty"` + EnterpriseCustomProperties *string `json:"enterprise_custom_properties,omitempty"` + EnterpriseCustomPropertiesForOrgs *string `json:"enterprise_custom_properties_for_organizations,omitempty"` + EnterpriseOrganizations *string `json:"enterprise_organizations,omitempty"` + EnterpriseOrganizationInstallations *string `json:"enterprise_organization_installations,omitempty"` + EnterpriseOrgInstallationRepos *string `json:"enterprise_organization_installation_repositories,omitempty"` + EnterprisePeople *string `json:"enterprise_people,omitempty"` + EnterpriseSSO *string `json:"enterprise_sso,omitempty"` + EnterpriseTeams *string `json:"enterprise_teams,omitempty"` Environments *string `json:"environments,omitempty"` Followers *string `json:"followers,omitempty"` Gists *string `json:"gists,omitempty"` @@ -113,6 +130,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"` @@ -126,6 +144,7 @@ type InstallationPermissions struct { OrganizationPersonalAccessTokenRequests *string `json:"organization_personal_access_token_requests,omitempty"` OrganizationPlan *string `json:"organization_plan,omitempty"` OrganizationPreReceiveHooks *string `json:"organization_pre_receive_hooks,omitempty"` + OrganizationPrivateRegistries *string `json:"organization_private_registries,omitempty"` OrganizationProjects *string `json:"organization_projects,omitempty"` OrganizationSecrets *string `json:"organization_secrets,omitempty"` OrganizationSelfHostedRunners *string `json:"organization_self_hosted_runners,omitempty"` @@ -166,6 +185,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"` @@ -211,8 +231,9 @@ func (i Installation) String() string { // You can find this on the settings page for your GitHub App // (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 +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-app +// +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-the-authenticated-app // //meta:operation GET /app //meta:operation GET /apps/{app_slug} @@ -224,13 +245,13 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, u = "app" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - app := new(App) - resp, err := s.client.Do(ctx, req, app) + var app *App + resp, err := s.client.Do(req, &app) if err != nil { return nil, resp, err } @@ -240,7 +261,7 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, // ListInstallationRequests lists the pending installation requests that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#list-installation-requests-for-the-authenticated-app // //meta:operation GET /app/installation-requests func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) { @@ -249,13 +270,13 @@ func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOp return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var i []*InstallationRequest - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -265,7 +286,7 @@ func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOp // ListInstallations lists the installations that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#list-installations-for-the-authenticated-app // //meta:operation GET /app/installations func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { @@ -274,13 +295,13 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var i []*Installation - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -290,7 +311,7 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) // GetInstallation returns the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-installation-for-the-authenticated-app // //meta:operation GET /app/installations/{installation_id} func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { @@ -299,7 +320,7 @@ func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installat // ListUserInstallations lists installations that are accessible to the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-app-installations-accessible-to-the-user-access-token // //meta:operation GET /user/installations func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { @@ -308,7 +329,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -316,7 +337,7 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio var i struct { Installations []*Installation `json:"installations"` } - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -326,67 +347,71 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio // SuspendInstallation suspends the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#suspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#suspend-an-app-installation // //meta:operation PUT /app/installations/{installation_id}/suspended func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UnsuspendInstallation unsuspends the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#unsuspend-an-app-installation // //meta:operation DELETE /app/installations/{installation_id}/suspended func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteInstallation deletes the specified installation. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#delete-an-installation-for-the-authenticated-app // //meta:operation DELETE /app/installations/{installation_id} func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) + if err != nil && (resp == nil || resp.StatusCode != http.StatusAccepted) { + return resp, err + } + return resp, nil } // CreateInstallationToken creates a new installation token. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens -func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) { +func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, body *InstallationTokenOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(InstallationToken) - resp, err := s.client.Do(ctx, req, t) + var t *InstallationToken + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -398,19 +423,19 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt // // It differs from CreateInstallationToken by taking InstallationTokenListRepoOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app // //meta:operation POST /app/installations/{installation_id}/access_tokens -func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, opts *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) { +func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id int64, body *InstallationTokenListRepoOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(InstallationToken) - resp, err := s.client.Do(ctx, req, t) + var t *InstallationToken + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -420,22 +445,23 @@ func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id i // CreateAttachment creates a new attachment on user comment containing a url. // +// Deprecated: This endpoint has been deprecated by GitHub. +// // GitHub API docs: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment // //meta:operation POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) - payload := &Attachment{Title: Ptr(title), Body: Ptr(body)} - req, err := s.client.NewRequest("POST", u, payload) + payload := &Attachment{Title: &title, Body: &body} + req, err := s.client.NewRequest(ctx, "POST", u, payload) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeContentAttachmentsPreview) - m := &Attachment{} - resp, err := s.client.Do(ctx, req, m) + var m *Attachment + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -443,50 +469,59 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i return m, resp, nil } -// FindOrganizationInstallation finds the organization's installation information. +// GetOrganizationInstallation finds the organization's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-an-organization-installation-for-the-authenticated-app // //meta:operation GET /orgs/{org}/installation -func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { +func (s *AppsService) GetOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) } -// FindRepositoryInstallation finds the repository's installation information. +// GetEnterpriseInstallation finds the enterprise's installation information. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/apps/apps?apiVersion=2022-11-28#get-an-enterprise-installation-for-the-authenticated-app +// +//meta:operation GET /enterprises/{enterprise}/installation +func (s *AppsService) GetEnterpriseInstallation(ctx context.Context, enterprise string) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("enterprises/%v/installation", enterprise)) +} + +// GetRepositoryInstallation finds the repository's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app // //meta:operation GET /repos/{owner}/{repo}/installation -func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { +func (s *AppsService) GetRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) } -// FindRepositoryInstallationByID finds the repository's installation information. +// GetRepositoryInstallationByID finds the repository's installation information. // -// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation". +// Note: GetRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation". // //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)) +func (s *AppsService) GetRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { + return s.getInstallation(ctx, fmt.Sprintf("repositories/%v/installation", id)) } -// FindUserInstallation finds the user's installation information. +// GetUserInstallation finds the user's installation information. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#get-a-user-installation-for-the-authenticated-app // //meta:operation GET /users/{username}/installation -func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { +func (s *AppsService) GetUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) } func (s *AppsService) getInstallation(ctx context.Context, url string) (*Installation, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - i := new(Installation) - resp, err := s.client.Do(ctx, req, i) + var i *Installation + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/apps_hooks.go b/vendor/github.com/google/go-github/v93/github/apps_hooks.go similarity index 58% rename from vendor/github.com/google/go-github/v69/github/apps_hooks.go rename to vendor/github.com/google/go-github/v93/github/apps_hooks.go index 6046827ef..6f0b35fb8 100644 --- a/vendor/github.com/google/go-github/v69/github/apps_hooks.go +++ b/vendor/github.com/google/go-github/v93/github/apps_hooks.go @@ -12,17 +12,17 @@ import ( // GetHookConfig returns the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-app // //meta:operation GET /app/hook/config func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) { - req, err := s.client.NewRequest("GET", "app/hook/config", nil) + req, err := s.client.NewRequest(ctx, "GET", "app/hook/config", nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, &config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -33,17 +33,17 @@ func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response // UpdateHookConfig updates the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-app // //meta:operation PATCH /app/hook/config -func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { - req, err := s.client.NewRequest("PATCH", "app/hook/config", config) +func (s *AppsService) UpdateHookConfig(ctx context.Context, body HookConfig) (*HookConfig, *Response, error) { + req, err := s.client.NewRequest(ctx, "PATCH", "app/hook/config", body) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/apps_hooks_deliveries.go b/vendor/github.com/google/go-github/v93/github/apps_hooks_deliveries.go similarity index 69% rename from vendor/github.com/google/go-github/v69/github/apps_hooks_deliveries.go rename to vendor/github.com/google/go-github/v93/github/apps_hooks_deliveries.go index 59800a0ae..e737bbae0 100644 --- a/vendor/github.com/google/go-github/v69/github/apps_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v93/github/apps_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists deliveries of an App webhook. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#list-deliveries-for-an-app-webhook // //meta:operation GET /app/hook/deliveries func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -21,13 +21,13 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -37,18 +37,18 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp // GetHookDelivery returns the App webhook delivery with the specified ID. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#get-a-delivery-for-an-app-webhook // //meta:operation GET /app/hook/deliveries/{delivery_id} func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v", deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -58,18 +58,18 @@ func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*H // RedeliverHookDelivery redelivers a delivery for an App webhook. // -// GitHub API docs: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-an-app-webhook // //meta:operation POST /app/hook/deliveries/{delivery_id}/attempts func (s *AppsService) RedeliverHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v/attempts", deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/apps_installation.go b/vendor/github.com/google/go-github/v93/github/apps_installation.go similarity index 70% rename from vendor/github.com/google/go-github/v69/github/apps_installation.go rename to vendor/github.com/google/go-github/v93/github/apps_installation.go index d430511d0..7fbcc260d 100644 --- a/vendor/github.com/google/go-github/v69/github/apps_installation.go +++ b/vendor/github.com/google/go-github/v93/github/apps_installation.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" ) // ListRepositories represents the response from the list repos endpoints. @@ -19,7 +18,7 @@ type ListRepositories struct { // ListRepos lists the repositories that are accessible to the authenticated installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-app-installation // //meta:operation GET /installation/repositories func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -28,22 +27,13 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories - - resp, err := s.client.Do(ctx, req, &r) + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -54,7 +44,7 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe // ListUserRepos lists repositories that are accessible // to the authenticated user for an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-user-access-token // //meta:operation GET /user/installations/{installation_id}/repositories func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) (*ListRepositories, *Response, error) { @@ -64,21 +54,13 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{ - mediaTypeTopicsPreview, - mediaTypeRepositoryVisibilityPreview, - mediaTypeRepositoryTemplatePreview, - } - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - var r *ListRepositories - resp, err := s.client.Do(ctx, req, &r) + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -88,18 +70,18 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt // AddRepository adds a single repository to an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#add-a-repository-to-an-app-installation // //meta:operation PUT /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -109,30 +91,30 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) ( // RemoveRepository removes a single repository from an installation. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#remove-a-repository-from-an-app-installation // //meta:operation DELETE /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RevokeInstallationToken revokes an installation token. // -// GitHub API docs: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations?apiVersion=2022-11-28#revoke-an-installation-access-token // //meta:operation DELETE /installation/token func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) { u := "installation/token" - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/apps_manifest.go b/vendor/github.com/google/go-github/v93/github/apps_manifest.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/apps_manifest.go rename to vendor/github.com/google/go-github/v93/github/apps_manifest.go index 5b6ff9af4..af6c9a5a5 100644 --- a/vendor/github.com/google/go-github/v69/github/apps_manifest.go +++ b/vendor/github.com/google/go-github/v93/github/apps_manifest.go @@ -31,18 +31,18 @@ type AppConfig struct { // CompleteAppManifest completes the App manifest handshake flow for the given // code. // -// GitHub API docs: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest +// GitHub API docs: https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-a-github-app-from-a-manifest // //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) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("app-manifests/%v/conversions", code) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - cfg := new(AppConfig) - resp, err := s.client.Do(ctx, req, cfg) + var cfg *AppConfig + resp, err := s.client.Do(req, &cfg) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/apps_marketplace.go b/vendor/github.com/google/go-github/v93/github/apps_marketplace.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/apps_marketplace.go rename to vendor/github.com/google/go-github/v93/github/apps_marketplace.go index 976775a79..ed545df09 100644 --- a/vendor/github.com/google/go-github/v69/github/apps_marketplace.go +++ b/vendor/github.com/google/go-github/v93/github/apps_marketplace.go @@ -13,7 +13,7 @@ import ( // MarketplaceService handles communication with the marketplace related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/apps#marketplace +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28 type MarketplaceService struct { client *Client // Stubbed controls whether endpoints that return stubbed data are used @@ -21,7 +21,7 @@ type MarketplaceService struct { // for testing your GitHub Apps. Stubbed data is hard-coded and will not // change based on actual subscriptions. // - // GitHub API docs: https://docs.github.com/rest/apps#testing-with-stubbed-endpoints + // GitHub API docs: https://docs.github.com/rest/apps?apiVersion=2022-11-28#testing-with-stubbed-endpoints Stubbed bool } @@ -89,8 +89,9 @@ 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 +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-plans +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-plans-stubbed // //meta:operation GET /marketplace_listing/plans //meta:operation GET /marketplace_listing/stubbed/plans @@ -101,13 +102,13 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var plans []*MarketplacePlan - resp, err := s.client.Do(ctx, req, &plans) + resp, err := s.client.Do(req, &plans) if err != nil { return nil, resp, err } @@ -117,8 +118,9 @@ 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 +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-accounts-for-a-plan +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-accounts-for-a-plan-stubbed // //meta:operation GET /marketplace_listing/plans/{plan_id}/accounts //meta:operation GET /marketplace_listing/stubbed/plans/{plan_id}/accounts @@ -129,13 +131,13 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var accounts []*MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &accounts) + resp, err := s.client.Do(req, &accounts) if err != nil { return nil, resp, err } @@ -145,21 +147,22 @@ 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 +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#get-a-subscription-plan-for-an-account +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#get-a-subscription-plan-for-an-account-stubbed // //meta:operation GET /marketplace_listing/accounts/{account_id} //meta:operation GET /marketplace_listing/stubbed/accounts/{account_id} func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) - req, err := s.client.NewRequest("GET", uri, nil) + req, err := s.client.NewRequest(ctx, "GET", uri, nil) if err != nil { return nil, nil, err } var account *MarketplacePlanAccount - resp, err := s.client.Do(ctx, req, &account) + resp, err := s.client.Do(req, &account) if err != nil { return nil, resp, err } @@ -169,8 +172,9 @@ 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 +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-subscriptions-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/apps/marketplace?apiVersion=2022-11-28#list-subscriptions-for-the-authenticated-user-stubbed // //meta:operation GET /user/marketplace_purchases //meta:operation GET /user/marketplace_purchases/stubbed @@ -185,13 +189,13 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var purchases []*MarketplacePurchase - resp, err := s.client.Do(ctx, req, &purchases) + resp, err := s.client.Do(req, &purchases) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/attestations.go b/vendor/github.com/google/go-github/v93/github/attestations.go similarity index 100% rename from vendor/github.com/google/go-github/v69/github/attestations.go rename to vendor/github.com/google/go-github/v93/github/attestations.go diff --git a/vendor/github.com/google/go-github/v69/github/authorizations.go b/vendor/github.com/google/go-github/v93/github/authorizations.go similarity index 89% rename from vendor/github.com/google/go-github/v69/github/authorizations.go rename to vendor/github.com/google/go-github/v93/github/authorizations.go index 8b8a67d55..ed61be095 100644 --- a/vendor/github.com/google/go-github/v69/github/authorizations.go +++ b/vendor/github.com/google/go-github/v93/github/authorizations.go @@ -50,7 +50,7 @@ const ( // This service requires HTTP Basic Authentication; it cannot be accessed using // an OAuth token. // -// GitHub API docs: https://docs.github.com/rest/oauth-authorizations +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations?apiVersion=2022-11-28 type AuthorizationsService service // Authorization represents an individual GitHub authorization. @@ -121,7 +121,7 @@ func (a AuthorizationRequest) String() string { // fields. That is, you may provide only one of "Scopes", or "AddScopes", or // "RemoveScopes". // -// GitHub API docs: https://docs.github.com/rest/oauth-authorizations#update-an-existing-authorization +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations?apiVersion=2022-11-28#update-an-existing-authorization type AuthorizationUpdateRequest struct { Scopes []string `json:"scopes,omitempty"` AddScopes []string `json:"add_scopes,omitempty"` @@ -143,7 +143,7 @@ func (a AuthorizationUpdateRequest) String() string { // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#check-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#check-a-token // //meta:operation POST /applications/{client_id}/token func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { @@ -153,14 +153,14 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("POST", u, reqBody) + req, err := s.client.NewRequest(ctx, "POST", u, reqBody) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -178,7 +178,7 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#reset-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#reset-a-token // //meta:operation PATCH /applications/{client_id}/token func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { @@ -188,14 +188,14 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("PATCH", u, reqBody) + req, err := s.client.NewRequest(ctx, "PATCH", u, reqBody) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -209,7 +209,7 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken // username is the OAuth application clientID, and the password is its // clientSecret. Invalid tokens will return a 404 Not Found. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-token // //meta:operation DELETE /applications/{client_id}/token func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) { @@ -219,20 +219,20 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("DELETE", u, reqBody) + req, err := s.client.NewRequest(ctx, "DELETE", u, reqBody) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteGrant deletes an OAuth application grant. Deleting an application's // grant will also delete all OAuth tokens associated with the application for // the user. // -// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-authorization // //meta:operation DELETE /applications/{client_id}/grant func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) { @@ -242,13 +242,13 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces AccessToken string `json:"access_token"` }{AccessToken: accessToken} - req, err := s.client.NewRequest("DELETE", u, reqBody) + req, err := s.client.NewRequest(ctx, "DELETE", u, reqBody) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeOAuthAppPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateImpersonation creates an impersonation OAuth token. @@ -257,18 +257,18 @@ 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.15/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations -func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { +func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, body *AuthorizationRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("POST", u, authReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - a := new(Authorization) - resp, err := s.client.Do(ctx, req, a) + var a *Authorization + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -279,15 +279,15 @@ 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.15/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := fmt.Sprintf("admin/users/%v/authorizations", username) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/billing.go b/vendor/github.com/google/go-github/v93/github/billing.go new file mode 100644 index 000000000..9782eeecb --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/billing.go @@ -0,0 +1,553 @@ +// 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?apiVersion=2022-11-28 +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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/billing/billing?apiVersion=2022-11-28#get-github-packages-billing-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/packages +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *PackagesBilling + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/billing/billing?apiVersion=2022-11-28#get-shared-storage-billing-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/shared-storage +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *StorageBilling + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *ActiveCommitters + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/billing/billing?apiVersion=2022-11-28#get-github-packages-billing-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/packages +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var packagesUserBilling *PackagesBilling + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/billing/billing?apiVersion=2022-11-28#get-shared-storage-billing-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/shared-storage +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var storageUserBilling *StorageBilling + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var usageReport *UsageReport + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var usageReport *UsageReport + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var premiumRequestUsageReport *PremiumRequestUsageReport + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var premiumRequestUsageReport *PremiumRequestUsageReport + resp, err := s.client.Do(req, &premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} + +// GetOrgAICreditUsage returns a report of the AI credit usage for an organization. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-ai-credit-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/ai_credit/usage +func (s *BillingService) GetOrgAICreditUsage(ctx context.Context, org string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/ai_credit/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var aiCreditUsage *PremiumRequestUsageReport + resp, err := s.client.Do(req, &aiCreditUsage) + if err != nil { + return nil, resp, err + } + + return aiCreditUsage, resp, nil +} + +// GetUserAICreditUsage returns a report of the AI credit usage for a user. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-ai-credit-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/ai_credit/usage +func (s *BillingService) GetUserAICreditUsage(ctx context.Context, username string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/ai_credit/usage", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var aiCreditUsage *PremiumRequestUsageReport + resp, err := s.client.Do(req, &aiCreditUsage) + if err != nil { + return nil, resp, err + } + + return aiCreditUsage, resp, nil +} + +// UsageSummaryOptions specifies optional parameters for the +// BillingService.GetOrganizationUsageSummary and BillingService.GetUserUsageSummary methods. +type UsageSummaryOptions struct { + Year int `url:"year,omitempty"` + Month int `url:"month,omitempty"` + Day int `url:"day,omitempty"` + Repository string `url:"repository,omitempty"` + Product string `url:"product,omitempty"` + SKU string `url:"sku,omitempty"` +} + +// UsageSummaryTimePeriod represents a time period for billing usage summary reports. +type UsageSummaryTimePeriod struct { + Year int `json:"year"` + Month *int `json:"month,omitempty"` + Day *int `json:"day,omitempty"` +} + +// UsageSummaryItem represents a single usage line item in a billing usage summary report. +type UsageSummaryItem struct { + Product string `json:"product"` + SKU string `json:"sku"` + 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"` +} + +// UsageSummaryReport represents the billing usage summary report response. +type UsageSummaryReport struct { + TimePeriod UsageSummaryTimePeriod `json:"timePeriod"` + Organization *string `json:"organization,omitempty"` + User *string `json:"user,omitempty"` + Repository *string `json:"repository,omitempty"` + Product *string `json:"product,omitempty"` + SKU *string `json:"sku,omitempty"` + UsageItems []*UsageSummaryItem `json:"usageItems"` +} + +// GetOrganizationUsageSummary returns a summary report of usage for an organization. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-summary-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/usage/summary +func (s *BillingService) GetOrganizationUsageSummary(ctx context.Context, org string, opts *UsageSummaryOptions) (*UsageSummaryReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/usage/summary", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *UsageSummaryReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetUserUsageSummary returns a summary report of usage for a user. +// +// GitHub API docs: https://docs.github.com/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-summary-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/usage/summary +func (s *BillingService) GetUserUsageSummary(ctx context.Context, user string, opts *UsageSummaryOptions) (*UsageSummaryReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/usage/summary", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *UsageSummaryReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/checks.go b/vendor/github.com/google/go-github/v93/github/checks.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/checks.go rename to vendor/github.com/google/go-github/v93/github/checks.go index 2f0f65bf9..83a222369 100644 --- a/vendor/github.com/google/go-github/v69/github/checks.go +++ b/vendor/github.com/google/go-github/v93/github/checks.go @@ -13,7 +13,7 @@ import ( // ChecksService provides access to the Checks API in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/checks/ +// GitHub API docs: https://docs.github.com/rest/checks?apiVersion=2022-11-28 type ChecksService service // CheckRun represents a GitHub check run on a repository associated with a GitHub app. @@ -101,20 +101,20 @@ func (c CheckSuite) String() string { // GetCheckRun gets a check-run for a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#get-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#get-a-check-run // //meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id} func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -124,20 +124,20 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che // GetCheckSuite gets a single check suite. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#get-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#get-a-check-suite // //meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id} func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) + var checkSuite *CheckSuite + resp, err := s.client.Do(req, &checkSuite) if err != nil { return nil, resp, err } @@ -168,20 +168,20 @@ type CheckRunAction struct { // CreateCheckRun creates a check run for repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#create-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run // //meta:operation POST /repos/{owner}/{repo}/check-runs -func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) { +func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, body CreateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -203,20 +203,20 @@ type UpdateCheckRunOptions struct { // UpdateCheckRun updates a check run for a specific commit in a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#update-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#update-a-check-run // //meta:operation PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} -func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) { +func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, body UpdateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkRun := new(CheckRun) - resp, err := s.client.Do(ctx, req, checkRun) + var checkRun *CheckRun + resp, err := s.client.Do(req, &checkRun) if err != nil { return nil, resp, err } @@ -226,7 +226,7 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, // ListCheckRunAnnotations lists the annotations for a check run. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-run-annotations +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-run-annotations // //meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) { @@ -236,7 +236,7 @@ func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -244,7 +244,7 @@ func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunAnnotations []*CheckRunAnnotation - resp, err := s.client.Do(ctx, req, &checkRunAnnotations) + resp, err := s.client.Do(req, &checkRunAnnotations) if err != nil { return nil, resp, err } @@ -269,8 +269,10 @@ type ListCheckRunsResults struct { } // ListCheckRunsForRef lists check runs for a specific ref. +// The ref can be a commit SHA, branch name `heads/`, or tag name `tags/`. +// For more information, see "Git References" in the Git documentation https://git-scm.com/book/en/v2/Git-Internals-Git-References. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-for-a-git-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-runs func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { @@ -280,7 +282,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -288,7 +290,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) + resp, err := s.client.Do(req, &checkRunResults) if err != nil { return nil, resp, err } @@ -298,7 +300,7 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re // ListCheckRunsCheckSuite lists check runs for a check suite. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-in-a-check-suite // //meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { @@ -308,7 +310,7 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -316,7 +318,7 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkRunResults *ListCheckRunsResults - resp, err := s.client.Do(ctx, req, &checkRunResults) + resp, err := s.client.Do(req, &checkRunResults) if err != nil { return nil, resp, err } @@ -326,26 +328,26 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo // ReRequestCheckRun triggers GitHub to rerequest an existing check run. // -// GitHub API docs: https://docs.github.com/rest/checks/runs#rerequest-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs?apiVersion=2022-11-28#rerequest-a-check-run // //meta:operation POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest func (s *ChecksService) ReRequestCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v/rerequest", owner, repo, checkRunID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListCheckSuiteOptions represents parameters to list check suites. type ListCheckSuiteOptions struct { CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run. - AppID *int `url:"app_id,omitempty"` // Filters check suites by GitHub App id. + AppID *int64 `url:"app_id,omitempty"` // Filters check suites by GitHub App id. ListOptions } @@ -357,8 +359,10 @@ type ListCheckSuiteResults struct { } // ListCheckSuitesForRef lists check suite for a specific ref. +// The ref can be a commit SHA, branch name `heads/`, or tag name `tags/`. +// For more information, see "Git References" in the Git documentation https://git-scm.com/book/en/v2/Git-Internals-Git-References. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#list-check-suites-for-a-git-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-suites func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { @@ -368,7 +372,7 @@ func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -376,7 +380,7 @@ func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkSuiteResults *ListCheckSuiteResults - resp, err := s.client.Do(ctx, req, &checkSuiteResults) + resp, err := s.client.Do(req, &checkSuiteResults) if err != nil { return nil, resp, err } @@ -408,12 +412,12 @@ type PreferenceList struct { // SetCheckSuitePreferences changes the default automatic flow when creating check suites. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#update-repository-preferences-for-check-suites // //meta:operation PATCH /repos/{owner}/{repo}/check-suites/preferences -func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { +func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, body CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } @@ -421,7 +425,7 @@ func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, rep req.Header.Set("Accept", mediaTypeCheckRunsPreview) var checkSuitePrefResults *CheckSuitePreferenceResults - resp, err := s.client.Do(ctx, req, &checkSuitePrefResults) + resp, err := s.client.Do(req, &checkSuitePrefResults) if err != nil { return nil, resp, err } @@ -429,7 +433,7 @@ func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, rep return checkSuitePrefResults, resp, nil } -// CreateCheckSuiteOptions sets up parameters to manually create a check suites. +// CreateCheckSuiteOptions sets up parameters to manually create a check suite. type CreateCheckSuiteOptions struct { HeadSHA string `json:"head_sha"` // The sha of the head commit. (Required.) HeadBranch *string `json:"head_branch,omitempty"` // The name of the head branch where the code changes are implemented. @@ -437,20 +441,20 @@ type CreateCheckSuiteOptions struct { // CreateCheckSuite manually creates a check suite for a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#create-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#create-a-check-suite // //meta:operation POST /repos/{owner}/{repo}/check-suites -func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { +func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, body CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - checkSuite := new(CheckSuite) - resp, err := s.client.Do(ctx, req, checkSuite) + var checkSuite *CheckSuite + resp, err := s.client.Do(req, &checkSuite) if err != nil { return nil, resp, err } @@ -460,19 +464,19 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string // ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. // -// GitHub API docs: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites?apiVersion=2022-11-28#rerequest-a-check-suite // //meta:operation POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } req.Header.Set("Accept", mediaTypeCheckRunsPreview) - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) return resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/classroom.go b/vendor/github.com/google/go-github/v93/github/classroom.go new file mode 100644 index 000000000..e0b00069b --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/classroom.go @@ -0,0 +1,268 @@ +// 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?apiVersion=2022-11-28 +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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignment *ClassroomAssignment + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classroom *Classroom + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classrooms []*Classroom + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignments []*ClassroomAssignment + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var acceptedAssignments []*AcceptedAssignment + resp, err := s.client.Do(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. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom?apiVersion=2022-11-28#closed---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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var grades []*AssignmentGrade + resp, err := s.client.Do(req, &grades) + if err != nil { + return nil, resp, err + } + + return grades, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/code_quality.go b/vendor/github.com/google/go-github/v93/github/code_quality.go new file mode 100644 index 000000000..69fa4c44e --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/code_quality.go @@ -0,0 +1,183 @@ +// 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" +) + +// CodeQualityFindingRule represents the rule associated with a code quality finding. +type CodeQualityFindingRule struct { + ID string `json:"id"` + Title string `json:"title"` + Description string `json:"description"` + Help *string `json:"help,omitempty"` + Severity string `json:"severity"` + Category string `json:"category"` +} + +// CodeQualityFindingLocation represents the location of a code quality finding. +type CodeQualityFindingLocation struct { + Path string `json:"path"` + StartLine *int `json:"start_line,omitempty"` + EndLine *int `json:"end_line,omitempty"` + StartColumn *int `json:"start_column,omitempty"` + EndColumn *int `json:"end_column,omitempty"` +} + +// CodeQualityFindingMessage represents the message of a code quality finding. +type CodeQualityFindingMessage struct { + Text string `json:"text"` + Markdown string `json:"markdown"` +} + +// CodeQualityFinding represents a single code quality finding. +type CodeQualityFinding struct { + Number int `json:"number"` + State string `json:"state"` + URL string `json:"url"` + Rule CodeQualityFindingRule `json:"rule"` + Location CodeQualityFindingLocation `json:"location"` + Message CodeQualityFindingMessage `json:"message"` + CreatedAt *Timestamp `json:"created_at,omitempty"` +} + +// ListCodeQualityFindingsOptions specifies the optional parameters to +// CodeQualityService.ListFindings. +type ListCodeQualityFindingsOptions struct { + State string `url:"state,omitempty"` + Direction string `url:"direction,omitempty"` + + ListCursorOptions +} + +// CodeQualityService handles communication with the code quality related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28 +type CodeQualityService service + +// CodeQualitySetupConfiguration represents a code quality setup configuration for a repository. +type CodeQualitySetupConfiguration struct { + State *string `json:"state,omitempty"` + Languages []string `json:"languages,omitempty"` + RunnerType *string `json:"runner_type,omitempty"` + RunnerLabel *string `json:"runner_label,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Schedule *string `json:"schedule,omitempty"` +} + +// CodeQualityUpdateSetupRequest specifies parameters to the +// CodeQualityService.UpdateSetup method. +type CodeQualityUpdateSetupRequest struct { + State *string `json:"state,omitempty"` + RunnerType *string `json:"runner_type,omitempty"` + RunnerLabel *string `json:"runner_label,omitempty"` + Languages []string `json:"languages,omitempty"` +} + +// CodeQualityUpdateSetupResponse represents a response from updating a code quality setup configuration. +type CodeQualityUpdateSetupResponse struct { + RunID *int64 `json:"run_id,omitempty"` + RunURL *string `json:"run_url,omitempty"` +} + +// GetSetup gets a code quality setup configuration for a repository. +// +// GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28#get-a-code-quality-setup-configuration +// +//meta:operation GET /repos/{owner}/{repo}/code-quality/setup +func (s *CodeQualityService) GetSetup(ctx context.Context, owner, repo string) (*CodeQualitySetupConfiguration, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-quality/setup", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var cfg *CodeQualitySetupConfiguration + resp, err := s.client.Do(req, &cfg) + if err != nil { + return nil, resp, err + } + + return cfg, resp, nil +} + +// UpdateSetup updates a code quality setup configuration for a repository. +// +// This method might return an AcceptedError and a status code of 202. This is because this is the status that GitHub +// returns to signify that it has now scheduled the update in a background task. +// +// GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28#update-a-code-quality-setup-configuration +// +//meta:operation PATCH /repos/{owner}/{repo}/code-quality/setup +func (s *CodeQualityService) UpdateSetup(ctx context.Context, owner, repo string, body CodeQualityUpdateSetupRequest) (*CodeQualityUpdateSetupResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-quality/setup", owner, repo) + + request, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var result *CodeQualityUpdateSetupResponse + resp, err := s.client.Do(request, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// ListFindings lists code quality findings for a repository. +// +// GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28#list-code-quality-findings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-quality/findings +func (s *CodeQualityService) ListFindings(ctx context.Context, owner, repo string, opts *ListCodeQualityFindingsOptions) ([]*CodeQualityFinding, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-quality/findings", owner, repo) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var findings []*CodeQualityFinding + resp, err := s.client.Do(req, &findings) + if err != nil { + return nil, resp, err + } + + return findings, resp, nil +} + +// GetFinding gets a single code quality finding for a repository. +// +// GitHub API docs: https://docs.github.com/rest/code-quality/code-quality?apiVersion=2022-11-28#get-a-code-quality-finding +// +//meta:operation GET /repos/{owner}/{repo}/code-quality/findings/{finding_number} +func (s *CodeQualityService) GetFinding(ctx context.Context, owner, repo string, findingNumber int) (*CodeQualityFinding, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-quality/findings/%v", owner, repo, findingNumber) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var finding *CodeQualityFinding + resp, err := s.client.Do(req, &finding) + if err != nil { + return nil, resp, err + } + + return finding, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/code_scanning.go b/vendor/github.com/google/go-github/v93/github/code_scanning.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/code_scanning.go rename to vendor/github.com/google/go-github/v93/github/code_scanning.go index 19a88241d..36f423577 100644 --- a/vendor/github.com/google/go-github/v69/github/code_scanning.go +++ b/vendor/github.com/google/go-github/v93/github/code_scanning.go @@ -17,7 +17,7 @@ import ( // CodeScanningService handles communication with the code scanning related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeScanningService service // Rule represents the complete details of GitHub Code Scanning alert type. @@ -69,7 +69,7 @@ type Tool struct { // Alert represents an individual GitHub Code Scanning Alert on a single repository. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type Alert struct { Number *int `json:"number,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -171,7 +171,7 @@ type AnalysesListOptions struct { // CodeQLDatabase represents a metadata about the CodeQL database. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeQLDatabase struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -186,7 +186,7 @@ type CodeQLDatabase struct { // ScanningAnalysis represents an individual GitHub Code Scanning ScanningAnalysis on a single repository. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type ScanningAnalysis struct { ID *int64 `json:"id,omitempty"` Ref *string `json:"ref,omitempty"` @@ -207,19 +207,20 @@ type ScanningAnalysis struct { // SarifAnalysis specifies the results of a code scanning job. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type SarifAnalysis struct { - CommitSHA *string `json:"commit_sha,omitempty"` - Ref *string `json:"ref,omitempty"` - Sarif *string `json:"sarif,omitempty"` + CommitSHA string `json:"commit_sha"` + Ref string `json:"ref"` + Sarif string `json:"sarif"` CheckoutURI *string `json:"checkout_uri,omitempty"` StartedAt *Timestamp `json:"started_at,omitempty"` ToolName *string `json:"tool_name,omitempty"` + Validate *bool `json:"validate,omitempty"` } // CodeScanningAlertState specifies the state of a code scanning alert. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type CodeScanningAlertState struct { // State sets the state of the code scanning alert and is a required field. // You must also provide DismissedReason when you set the state to "dismissed". @@ -235,7 +236,7 @@ type CodeScanningAlertState struct { // SarifID identifies a sarif analysis upload. // -// GitHub API docs: https://docs.github.com/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28 type SarifID struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -246,7 +247,7 @@ type SarifID struct { // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-alerts-for-an-organization // //meta:operation GET /orgs/{org}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *AlertListOptions) ([]*Alert, *Response, error) { @@ -256,13 +257,13 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*Alert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -276,7 +277,7 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-alerts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) { @@ -286,13 +287,13 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*Alert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -307,19 +308,19 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - a := new(Alert) - resp, err := s.client.Do(ctx, req, a) + var a *Alert + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -334,19 +335,19 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-alert // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} -func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, stateInfo *CodeScanningAlertState) (*Alert, *Response, error) { +func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, body *CodeScanningAlertState) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - a := new(Alert) - resp, err := s.client.Do(ctx, req, a) + var a *Alert + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } @@ -359,7 +360,7 @@ func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo strin // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-instances-of-a-code-scanning-alert // //meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, repo string, id int64, opts *AlertInstancesListOptions) ([]*MostRecentInstance, *Response, error) { @@ -369,13 +370,13 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alertInstances []*MostRecentInstance - resp, err := s.client.Do(ctx, req, &alertInstances) + resp, err := s.client.Do(req, &alertInstances) if err != nil { return nil, resp, err } @@ -389,19 +390,19 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data // //meta:operation POST /repos/{owner}/{repo}/code-scanning/sarifs -func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { +func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, body SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) - req, err := s.client.NewRequest("POST", u, sarif) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } // This will always return an error without unmarshaling the data - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) // Even though there was an error, we still return the response // in case the caller wants to inspect it further. // However, if the error is AcceptedError, decode it below before @@ -410,8 +411,8 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin if !errors.As(err, &acceptedError) { return nil, resp, err } - sarifID := new(SarifID) - decErr := json.Unmarshal(acceptedError.Raw, sarifID) + var sarifID *SarifID + decErr := json.Unmarshal(acceptedError.Raw, &sarifID) if decErr != nil { return nil, resp, decErr } @@ -433,19 +434,19 @@ type SARIFUpload struct { // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-information-about-a-sarif-upload // //meta:operation GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID string) (*SARIFUpload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs/%v", owner, repo, sarifID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - sarifUpload := new(SARIFUpload) - resp, err := s.client.Do(ctx, req, sarifUpload) + var sarifUpload *SARIFUpload + resp, err := s.client.Do(req, &sarifUpload) if err != nil { return nil, resp, err } @@ -459,7 +460,7 @@ func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-code-scanning-analyses-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, repo string, opts *AnalysesListOptions) ([]*ScanningAnalysis, *Response, error) { @@ -469,13 +470,13 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var analyses []*ScanningAnalysis - resp, err := s.client.Do(ctx, req, &analyses) + resp, err := s.client.Do(req, &analyses) if err != nil { return nil, resp, err } @@ -490,19 +491,19 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-analysis-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo string, id int64) (*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - analysis := new(ScanningAnalysis) - resp, err := s.client.Do(ctx, req, analysis) + var analysis *ScanningAnalysis + resp, err := s.client.Do(req, &analysis) if err != nil { return nil, resp, err } @@ -525,19 +526,19 @@ type DeleteAnalysis struct { // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#delete-a-code-scanning-analysis-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo string, id int64) (*DeleteAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, nil, err } - deleteAnalysis := new(DeleteAnalysis) - resp, err := s.client.Do(ctx, req, deleteAnalysis) + var deleteAnalysis *DeleteAnalysis + resp, err := s.client.Do(req, &deleteAnalysis) if err != nil { return nil, resp, err } @@ -550,19 +551,19 @@ func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo st // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#list-codeql-databases-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, repo string) ([]*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var codeqlDatabases []*CodeQLDatabase - resp, err := s.client.Do(ctx, req, &codeqlDatabases) + resp, err := s.client.Do(req, &codeqlDatabases) if err != nil { return nil, resp, err } @@ -575,19 +576,19 @@ func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, re // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-codeql-database-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language} func (s *CodeScanningService) GetCodeQLDatabase(ctx context.Context, owner, repo, language string) (*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases/%v", owner, repo, language) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - codeqlDatabase := new(CodeQLDatabase) - resp, err := s.client.Do(ctx, req, codeqlDatabase) + var codeqlDatabase *CodeQLDatabase + resp, err := s.client.Do(req, &codeqlDatabase) if err != nil { return nil, resp, err } @@ -595,6 +596,25 @@ func (s *CodeScanningService) GetCodeQLDatabase(ctx context.Context, owner, repo return codeqlDatabase, resp, nil } +// DeleteCodeQLDatabase deletes a CodeQL database for a language in a repository. +// +// You must use an access token with the repo scope to use this +// endpoint with private repos or the public_repo scope for public repos. +// +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#delete-a-codeql-database +// +//meta:operation DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language} +func (s *CodeScanningService) DeleteCodeQLDatabase(ctx context.Context, owner, repo, language string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases/%v", owner, repo, language) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // DefaultSetupConfiguration represents a code scanning default setup configuration. type DefaultSetupConfiguration struct { State *string `json:"state,omitempty"` @@ -609,19 +629,19 @@ type DefaultSetupConfiguration struct { // endpoint with private repos or the public_repo scope for public repos. GitHub Apps must have the repo write // permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#get-a-code-scanning-default-setup-configuration // //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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - cfg := new(DefaultSetupConfiguration) - resp, err := s.client.Do(ctx, req, cfg) + var cfg *DefaultSetupConfiguration + resp, err := s.client.Do(req, &cfg) if err != nil { return nil, resp, err } @@ -652,19 +672,19 @@ type UpdateDefaultSetupConfigurationResponse struct { // This method might return an AcceptedError and a status code of 202. This is because this is the status that GitHub // returns to signify that it has now scheduled the update of the pull request branch in a background task. // -// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-default-setup-configuration // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/default-setup -func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) +func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, body *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) - req, err := s.client.NewRequest("PATCH", u, options) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - a := new(UpdateDefaultSetupConfigurationResponse) - resp, err := s.client.Do(ctx, req, a) + var a *UpdateDefaultSetupConfigurationResponse + resp, err := s.client.Do(req, &a) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/codesofconduct.go b/vendor/github.com/google/go-github/v93/github/codesofconduct.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/codesofconduct.go rename to vendor/github.com/google/go-github/v93/github/codesofconduct.go index aba057417..882e732c3 100644 --- a/vendor/github.com/google/go-github/v69/github/codesofconduct.go +++ b/vendor/github.com/google/go-github/v93/github/codesofconduct.go @@ -27,20 +27,19 @@ func (c *CodeOfConduct) String() string { // List returns all codes of conduct. // -// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-all-codes-of-conduct +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct?apiVersion=2022-11-28#get-all-codes-of-conduct // //meta:operation GET /codes_of_conduct func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Response, error) { - req, err := s.client.NewRequest("GET", "codes_of_conduct", nil) + req, err := s.client.NewRequest(ctx, "GET", "codes_of_conduct", nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) var cs []*CodeOfConduct - resp, err := s.client.Do(ctx, req, &cs) + resp, err := s.client.Do(req, &cs) if err != nil { return nil, resp, err } @@ -57,21 +56,20 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // Get returns an individual code of conduct. // -// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct?apiVersion=2022-11-28#get-a-code-of-conduct // //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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("codes_of_conduct/%v", key) + req, err := s.client.NewRequest(ctx, "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) - resp, err := s.client.Do(ctx, req, coc) + var coc *CodeOfConduct + resp, err := s.client.Do(req, &coc) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/codespaces.go b/vendor/github.com/google/go-github/v93/github/codespaces.go new file mode 100644 index 000000000..3299096ee --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/codespaces.go @@ -0,0 +1,593 @@ +// 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?apiVersion=2022-11-28 +type CodespacesService service + +// Codespace represents a codespace. +// +// GitHub API docs: https://docs.github.com/rest/codespaces?apiVersion=2022-11-28 +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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// CreateCodespaceRequest represents a request to create a codespace in a repository. +type CreateCodespaceRequest 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"` +} + +// CreateCodespaceForUserRequest represents a request to create a codespace for the authenticated user. +type CreateCodespaceForUserRequest struct { + PullRequest *CodespacePullRequestOptions `json:"pull_request,omitempty"` + // RepositoryID represents the repository ID for this codespace. + RepositoryID *int64 `json:"repository_id,omitempty"` + 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"` +} + +// UpdateCodespaceRequest represents a request to update a codespace. +type UpdateCodespaceRequest struct { + // Machine represents a valid machine to transition this codespace to. + Machine *string `json:"machine,omitempty"` + // DisplayName represents the display name for this codespace. + DisplayName *string `json:"display_name,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"` +} + +// PublishCodespaceRequest represents a request to create a repository from an unpublished codespace. +type PublishCodespaceRequest 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?apiVersion=2022-11-28#create-a-codespace-in-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/codespaces +func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, body CreateCodespaceRequest) (*Codespace, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListDevContainerConfigurations lists devcontainer configurations in a repository for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var devcontainers *DevContainerConfigurations + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var attributes *CodespaceDefaultAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *CodespacePermissions + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-a-codespace-from-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces +func (s *CodespacesService) CreateFromPullRequest(ctx context.Context, owner, repo string, pullNumber int, body CreateCodespaceRequest) (*Codespace, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/codespaces", owner, repo, pullNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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 PullRequest to be set, but not both. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces +func (s *CodespacesService) Create(ctx context.Context, body CreateCodespaceForUserRequest) (*Codespace, *Response, error) { + u := "user/codespaces" + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-a-codespace-for-the-authenticated-user +// +//meta:operation PATCH /user/codespaces/{codespace_name} +func (s *CodespacesService) Update(ctx context.Context, codespaceName string, body UpdateCodespaceRequest) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v", codespaceName) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespace *CodespaceExport + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-a-repository-from-an-unpublished-codespace +// +//meta:operation POST /user/codespaces/{codespace_name}/publish +func (s *CodespacesService) Publish(ctx context.Context, codespaceName string, body PublishCodespaceRequest) (*Codespace, *Response, error) { + u := fmt.Sprintf("user/codespaces/%v/publish", codespaceName) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var codespace *Codespace + resp, err := s.client.Do(req, &codespace) + if err != nil { + return nil, resp, err + } + + return codespace, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/codespaces_machines.go b/vendor/github.com/google/go-github/v93/github/codespaces_machines.go new file mode 100644 index 000000000..155beadd7 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machines *CodespacesMachines + resp, err := s.client.Do(req, &machines) + if err != nil { + return nil, resp, err + } + + return machines, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/codespaces_orgs.go b/vendor/github.com/google/go-github/v93/github/codespaces_orgs.go new file mode 100644 index 000000000..429db12b9 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/codespaces_orgs.go @@ -0,0 +1,179 @@ +// 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(req, &codespaces) + if err != nil { + return nil, resp, err + } + + return codespaces, resp, nil +} + +// SetOrgAccessControl sets which users can access codespaces in an organization. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#manage-access-control-for-organization-codespaces +// +//meta:operation PUT /orgs/{org}/codespaces/access +func (s *CodespacesService) SetOrgAccessControl(ctx context.Context, org string, body CodespacesOrgAccessControlRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/codespaces/access", org) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddUsersToOrgAccess adds users to Codespaces access for an organization. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#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(ctx, "POST", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveUsersFromOrgAccess removes users from Codespaces access for an organization. +// +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/codespaces/organizations?apiVersion=2022-11-28#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(ctx, "DELETE", u, map[string][]string{"selected_usernames": usernames}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codespaces *ListCodespaces + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/codespaces_secrets.go b/vendor/github.com/google/go-github/v93/github/codespaces_secrets.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/codespaces_secrets.go rename to vendor/github.com/google/go-github/v93/github/codespaces_secrets.go index 438c27f8f..0e5c578a6 100644 --- a/vendor/github.com/google/go-github/v69/github/codespaces_secrets.go +++ b/vendor/github.com/google/go-github/v93/github/codespaces_secrets.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -16,7 +17,7 @@ import ( // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-secrets-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#list-secrets-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptions) (*Secrets, *Response, error) { @@ -31,7 +32,7 @@ func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptio // // Lists all Codespaces secrets available at the organization-level without revealing their encrypted values. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-organization-secrets // //meta:operation GET /orgs/{org}/codespaces/secrets func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { @@ -47,7 +48,7 @@ func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts // // Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#list-repository-secrets // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets func (s *CodespacesService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { @@ -60,13 +61,13 @@ func (s *CodespacesService) ListRepoSecrets(ctx context.Context, owner, repo str } func (s *CodespacesService) listSecrets(ctx context.Context, url string) (*Secrets, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var secrets *Secrets - resp, err := s.client.Do(ctx, req, &secrets) + resp, err := s.client.Do(req, &secrets) if err != nil { return nil, resp, err } @@ -80,7 +81,7 @@ func (s *CodespacesService) listSecrets(ctx context.Context, url string) (*Secre // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-public-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#get-public-key-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets/public-key func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, *Response, error) { @@ -91,7 +92,7 @@ func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, * // // Gets a public key for an organization, which is required in order to encrypt secrets. You need to encrypt the value of a secret before you can create or update secrets. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key // //meta:operation GET /orgs/{org}/codespaces/secrets/public-key func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { @@ -102,7 +103,7 @@ func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*P // // Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-public-key // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/public-key func (s *CodespacesService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { @@ -110,13 +111,13 @@ func (s *CodespacesService) GetRepoPublicKey(ctx context.Context, owner, repo st } func (s *CodespacesService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var publicKey *PublicKey - resp, err := s.client.Do(ctx, req, &publicKey) + resp, err := s.client.Do(req, &publicKey) if err != nil { return nil, resp, err } @@ -130,7 +131,7 @@ func (s *CodespacesService) getPublicKey(ctx context.Context, url string) (*Publ // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#get-a-secret-for-the-authenticated-user // //meta:operation GET /user/codespaces/secrets/{secret_name} func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Secret, *Response, error) { @@ -142,7 +143,7 @@ func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Se // // Gets an organization secret without revealing its encrypted value. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret // //meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { @@ -154,7 +155,7 @@ func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) // // Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-secret // //meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { @@ -163,13 +164,13 @@ func (s *CodespacesService) GetRepoSecret(ctx context.Context, owner, repo, name } func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var secret *Secret - resp, err := s.client.Do(ctx, req, &secret) + resp, err := s.client.Do(req, &secret) if err != nil { return nil, resp, err } @@ -183,45 +184,57 @@ func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must also have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#create-or-update-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#create-or-update-a-secret-for-the-authenticated-user // //meta:operation PUT /user/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecret *EncryptedSecret) (*Response, error) { - u := fmt.Sprintf("user/codespaces/secrets/%v", eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) +func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, body *EncryptedSecret) (*Response, error) { + if body == nil { + return nil, errors.New("encrypted secret must be provided") + } + + u := fmt.Sprintf("user/codespaces/secrets/%v", body.Name) + return s.createOrUpdateSecret(ctx, u, body) } // CreateOrUpdateOrgSecret creates or updates an orgs codespace secret // // Creates or updates an organization secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { - u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) +func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, body *EncryptedSecret) (*Response, error) { + if body == nil { + return nil, errors.New("encrypted secret must be provided") + } + + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, body.Name) + return s.createOrUpdateSecret(ctx, u, body) } // CreateOrUpdateRepoSecret creates or updates a repos codespace secret // // Creates or updates a repository secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} -func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, eSecret.Name) - return s.createOrUpdateSecret(ctx, u, eSecret) +func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, body *EncryptedSecret) (*Response, error) { + if body == nil { + return nil, errors.New("encrypted secret must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, body.Name) + return s.createOrUpdateSecret(ctx, u, body) } -func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string, eSecret *EncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) +func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string, body *EncryptedSecret) (*Response, error) { + req, err := s.client.NewRequest(ctx, "PUT", url, body) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -235,7 +248,7 @@ func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#delete-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#delete-a-secret-for-the-authenticated-user // //meta:operation DELETE /user/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) (*Response, error) { @@ -247,7 +260,7 @@ func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) ( // // Deletes an organization secret using the secret name. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret // //meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { @@ -259,7 +272,7 @@ func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name strin // // Deletes a secret in a repository using the secret name. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets?apiVersion=2022-11-28#delete-a-repository-secret // //meta:operation DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { @@ -268,12 +281,12 @@ func (s *CodespacesService) DeleteRepoSecret(ctx context.Context, owner, repo, n } func (s *CodespacesService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -286,7 +299,7 @@ func (s *CodespacesService) deleteSecret(ctx context.Context, url string) (*Resp // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#list-selected-repositories-for-a-user-secret // //meta:operation GET /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -303,7 +316,7 @@ func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, // // Lists all repositories that have been selected when the visibility for repository access to a secret is set to selected. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret // //meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { @@ -317,13 +330,13 @@ func (s *CodespacesService) ListSelectedReposForOrgSecret(ctx context.Context, o } func (s *CodespacesService) listSelectedReposForSecret(ctx context.Context, url string) (*SelectedReposList, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var repositories *SelectedReposList - resp, err := s.client.Do(ctx, req, &repositories) + resp, err := s.client.Do(req, &repositories) if err != nil { return nil, resp, err } @@ -336,7 +349,7 @@ func (s *CodespacesService) listSelectedReposForSecret(ctx context.Context, url // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#set-selected-repositories-for-a-user-secret // //meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, name string, ids SelectedRepoIDs) (*Response, error) { @@ -348,7 +361,7 @@ func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, n // // Replaces all repositories for an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { @@ -361,12 +374,12 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", url, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -378,10 +391,17 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st // // Adds a repository to the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on the referenced repository to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#add-a-selected-repository-to-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#add-a-selected-repository-to-a-user-secret // //meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) } @@ -390,21 +410,28 @@ func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, nam // // Adds a repository to an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) } func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, nil) + req, err := s.client.NewRequest(ctx, "PUT", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -416,10 +443,17 @@ func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url str // // Removes a repository from the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets?apiVersion=2022-11-28#remove-a-selected-repository-from-a-user-secret // //meta:operation DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) } @@ -428,21 +462,28 @@ func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context // // Removes a repository from an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret // //meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) } func (s *CodespacesService) removeSelectedRepoFromSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/copilot.go b/vendor/github.com/google/go-github/v93/github/copilot.go new file mode 100644 index 000000000..914c73242 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/copilot.go @@ -0,0 +1,1783 @@ +// 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" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "time" +) + +// CopilotService provides access to the Copilot-related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/copilot?apiVersion=2022-11-28 +type CopilotService service + +// CopilotSpace represents a Copilot Space. +type CopilotSpace struct { + ID int64 `json:"id"` + Number int `json:"number"` + Name string `json:"name"` + Description *string `json:"description,omitempty"` + GeneralInstructions *string `json:"general_instructions,omitempty"` + // Owner can either be a User or an Organization. + Owner any `json:"owner"` + Creator User `json:"creator"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + HTMLURL string `json:"html_url"` + APIURL string `json:"api_url"` + BaseRole string `json:"base_role"` + ResourcesAttributes []*CopilotSpaceResource `json:"resources_attributes,omitempty"` +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (c *CopilotSpace) UnmarshalJSON(data []byte) error { + // Define a new type without methods to avoid recursively calling UnmarshalJSON. + type alias CopilotSpace + var space alias + + if err := json.Unmarshal(data, &space); err != nil { + return err + } + + switch v := space.Owner.(type) { + case nil: + space.Owner = nil + case map[string]any: + if t, ok := v["type"].(string); ok && t == "User" { + space.Owner = &User{} + } else if t, ok := v["type"].(string); ok && t == "Organization" { + space.Owner = &Organization{} + } else if _, ok := v["hooks_url"]; ok { + space.Owner = &Organization{} + } else { + return fmt.Errorf("unsupported owner type %v", v["type"]) + } + if err := json.Unmarshal(data, &space); err != nil { + return err + } + default: + return fmt.Errorf("unsupported owner type %T", v) + } + *c = CopilotSpace(space) + return nil +} + +// CopilotSpaceResource represents a resource attached to a Copilot Space. +type CopilotSpaceResource struct { + ID *int64 `json:"id,omitempty"` + ResourceType *string `json:"resource_type,omitempty"` + Metadata *CopilotSpaceMetadata `json:"metadata,omitempty"` + CopilotChatAttachmentID *int64 `json:"copilot_chat_attachment_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// CreateCopilotSpaceResourceAttributes represents a resource to attach when creating a Copilot Space. +type CreateCopilotSpaceResourceAttributes struct { + ResourceType *string `json:"resource_type,omitempty"` + Metadata *CopilotSpaceMetadata `json:"metadata,omitempty"` +} + +// UpdateCopilotSpaceResourceAttributes represents a resource to attach, update, or remove when updating a Copilot Space. +type UpdateCopilotSpaceResourceAttributes struct { + ID *int64 `json:"id,omitempty"` + ResourceType *string `json:"resource_type,omitempty"` + Metadata *CopilotSpaceMetadata `json:"metadata,omitempty"` + Destroy *bool `json:"_destroy,omitempty"` +} + +// CopilotSpaceMetadata represents metadata specific to a Copilot Space resource type. +type CopilotSpaceMetadata struct { + RepositoryID *int64 `json:"repository_id,omitempty"` + FilePath *string `json:"file_path,omitempty"` + Text *string `json:"text,omitempty"` + Name *string `json:"name,omitempty"` + Number *int `json:"number,omitempty"` + CopilotChatAttachmentID *int64 `json:"copilot_chat_attachment_id,omitempty"` + MediaType *string `json:"media_type,omitempty"` + URL *string `json:"url,omitempty"` + Height *int `json:"height,omitempty"` + Width *int `json:"width,omitempty"` +} + +// CreateOrganizationCopilotSpaceRequest represents a request to create a Copilot Space. +type CreateOrganizationCopilotSpaceRequest struct { + Name string `json:"name"` + Description *string `json:"description,omitempty"` + GeneralInstructions *string `json:"general_instructions,omitempty"` + BaseRole *string `json:"base_role,omitempty"` + ResourcesAttributes []*CreateCopilotSpaceResourceAttributes `json:"resources_attributes,omitempty"` +} + +// UpdateOrganizationCopilotSpaceRequest represents a request to update a Copilot Space. +type UpdateOrganizationCopilotSpaceRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + GeneralInstructions *string `json:"general_instructions,omitempty"` + BaseRole *string `json:"base_role,omitempty"` + ResourcesAttributes []*UpdateCopilotSpaceResourceAttributes `json:"resources_attributes,omitempty"` +} + +// CopilotSpacesList represents a list of Copilot Spaces. +type CopilotSpacesList struct { + Spaces []*CopilotSpace `json:"spaces"` +} + +// ListOrganizationCopilotSpaces lists Copilot Spaces for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot-spaces/copilot-spaces?apiVersion=2022-11-28#list-organization-copilot-spaces +// +//meta:operation GET /orgs/{org}/copilot-spaces +func (s *CopilotService) ListOrganizationCopilotSpaces(ctx context.Context, org string, opts *ListCursorOptions) (*CopilotSpacesList, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot-spaces", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var spaces *CopilotSpacesList + resp, err := s.client.Do(req, &spaces) + if err != nil { + return nil, resp, err + } + + return spaces, resp, nil +} + +// GetOrganizationCopilotSpace gets a Copilot Space for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot-spaces/copilot-spaces?apiVersion=2022-11-28#get-an-organization-copilot-space +// +//meta:operation GET /orgs/{org}/copilot-spaces/{space_number} +func (s *CopilotService) GetOrganizationCopilotSpace(ctx context.Context, org string, spaceNumber int) (*CopilotSpace, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot-spaces/%v", org, spaceNumber) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var space *CopilotSpace + resp, err := s.client.Do(req, &space) + if err != nil { + return nil, resp, err + } + + return space, resp, nil +} + +// CreateOrganizationCopilotSpace creates a Copilot Space for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot-spaces/copilot-spaces?apiVersion=2022-11-28#create-an-organization-copilot-space +// +//meta:operation POST /orgs/{org}/copilot-spaces +func (s *CopilotService) CreateOrganizationCopilotSpace(ctx context.Context, org string, body CreateOrganizationCopilotSpaceRequest) (*CopilotSpace, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot-spaces", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var space *CopilotSpace + resp, err := s.client.Do(req, &space) + if err != nil { + return nil, resp, err + } + + return space, resp, nil +} + +// UpdateOrganizationCopilotSpace updates a Copilot Space for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot-spaces/copilot-spaces?apiVersion=2022-11-28#set-an-organization-copilot-space +// +//meta:operation PUT /orgs/{org}/copilot-spaces/{space_number} +func (s *CopilotService) UpdateOrganizationCopilotSpace(ctx context.Context, org string, spaceNumber int, body UpdateOrganizationCopilotSpaceRequest) (*CopilotSpace, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot-spaces/%v", org, spaceNumber) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var space *CopilotSpace + resp, err := s.client.Do(req, &space) + if err != nil { + return nil, resp, err + } + + return space, resp, nil +} + +// DeleteOrganizationCopilotSpace deletes a Copilot Space for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot-spaces/copilot-spaces?apiVersion=2022-11-28#delete-an-organization-copilot-space +// +//meta:operation DELETE /orgs/{org}/copilot-spaces/{space_number} +func (s *CopilotService) DeleteOrganizationCopilotSpace(ctx context.Context, org string, spaceNumber int) (*Response, error) { + u := fmt.Sprintf("orgs/%v/copilot-spaces/%v", org, spaceNumber) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription. +type CopilotOrganizationDetails struct { + SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"` + PublicCodeSuggestions string `json:"public_code_suggestions"` + CopilotChat string `json:"copilot_chat"` + SeatManagementSetting string `json:"seat_management_setting"` +} + +// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization. +type CopilotSeatBreakdown struct { + Total int `json:"total"` + AddedThisCycle int `json:"added_this_cycle"` + PendingCancellation int `json:"pending_cancellation"` + PendingInvitation int `json:"pending_invitation"` + ActiveThisCycle int `json:"active_this_cycle"` + InactiveThisCycle int `json:"inactive_this_cycle"` +} + +// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization. +type ListCopilotSeatsResponse struct { + TotalSeats int64 `json:"total_seats"` + Seats []*CopilotSeatDetails `json:"seats"` +} + +// CopilotSeatDetails represents the details of a Copilot for Business seat. +type CopilotSeatDetails struct { + // Assignee can either be a User, Team, or Organization. + Assignee any `json:"assignee"` + AssigningTeam *Team `json:"assigning_team,omitempty"` + PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"` + LastActivityAt *Timestamp `json:"last_activity_at,omitempty"` + LastActivityEditor *string `json:"last_activity_editor,omitempty"` + CreatedAt *Timestamp `json:"created_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + PlanType *string `json:"plan_type,omitempty"` +} + +// SeatAssignments represents the number of seats assigned. +type SeatAssignments struct { + SeatsCreated int `json:"seats_created"` +} + +// SeatCancellations represents the number of seats cancelled. +type SeatCancellations struct { + SeatsCancelled int `json:"seats_cancelled"` +} + +// CopilotMetricsListOptions represents the optional parameters to the CopilotService get metrics methods. +type CopilotMetricsListOptions struct { + Since *time.Time `url:"since,omitempty"` + Until *time.Time `url:"until,omitempty"` + + ListOptions +} + +// CopilotIDECodeCompletionsLanguage represents Copilot usage metrics for completions in the IDE for a language. +type CopilotIDECodeCompletionsLanguage struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` +} + +// CopilotIDECodeCompletionsModelLanguage represents Copilot usage metrics for completions in the IDE for a model and language. +type CopilotIDECodeCompletionsModelLanguage struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalCodeSuggestions int `json:"total_code_suggestions"` + TotalCodeAcceptances int `json:"total_code_acceptances"` + TotalCodeLinesSuggested int `json:"total_code_lines_suggested"` + TotalCodeLinesAccepted int `json:"total_code_lines_accepted"` +} + +// CopilotIDECodeCompletionsModel represents Copilot usage metrics for completions in the IDE for a model. +type CopilotIDECodeCompletionsModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + Languages []*CopilotIDECodeCompletionsModelLanguage `json:"languages"` +} + +// CopilotIDECodeCompletionsEditor represents Copilot usage metrics for completions in the IDE for an editor. +type CopilotIDECodeCompletionsEditor struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotIDECodeCompletionsModel `json:"models"` +} + +// CopilotIDECodeCompletions represents Copilot usage metrics for Copilot code completions in the IDE, categorized by editor, model and language. +type CopilotIDECodeCompletions struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Languages []*CopilotIDECodeCompletionsLanguage `json:"languages"` + Editors []*CopilotIDECodeCompletionsEditor `json:"editors"` +} + +// CopilotIDEChatModel represents Copilot usage metrics for chatting with a model in the IDE. +type CopilotIDEChatModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalChats int `json:"total_chats"` + TotalChatInsertionEvents int `json:"total_chat_insertion_events"` + TotalChatCopyEvents int `json:"total_chat_copy_events"` +} + +// CopilotIDEChatEditor represents Copilot usage metrics for chatting with a model in the IDE, categorized by editor and model. +type CopilotIDEChatEditor struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotIDEChatModel `json:"models"` +} + +// CopilotIDEChat represents Copilot usage metrics for Copilot Chat in the IDE, categorized by editor and model. +type CopilotIDEChat struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Editors []*CopilotIDEChatEditor `json:"editors"` +} + +// CopilotDotcomChatModel represents Copilot usage metrics for chatting with a model in the webbrowser. +type CopilotDotcomChatModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalEngagedUsers int `json:"total_engaged_users"` + TotalChats int `json:"total_chats"` +} + +// CopilotDotcomChat represents Copilot usage metrics for Copilot Chat in the webbrowser, categorized by model. +type CopilotDotcomChat struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotDotcomChatModel `json:"models"` +} + +// CopilotDotcomPullRequestsModel represents Copilot usage metrics for pull requests in the webbrowser, categorized by model. +type CopilotDotcomPullRequestsModel struct { + Name string `json:"name"` + IsCustomModel bool `json:"is_custom_model"` + CustomModelTrainingDate *string `json:"custom_model_training_date,omitempty"` + TotalPRSummariesCreated int `json:"total_pr_summaries_created"` + TotalEngagedUsers int `json:"total_engaged_users"` +} + +// CopilotDotcomPullRequestsRepository represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository. +type CopilotDotcomPullRequestsRepository struct { + Name string `json:"name"` + TotalEngagedUsers int `json:"total_engaged_users"` + Models []*CopilotDotcomPullRequestsModel `json:"models"` +} + +// CopilotDotcomPullRequests represents Copilot usage metrics for pull requests in the webbrowser, categorized by repository and model. +type CopilotDotcomPullRequests struct { + TotalEngagedUsers int `json:"total_engaged_users"` + Repositories []*CopilotDotcomPullRequestsRepository `json:"repositories"` +} + +// CopilotMetrics represents Copilot usage metrics for a given day. +type CopilotMetrics struct { + Date string `json:"date"` + TotalActiveUsers *int `json:"total_active_users,omitempty"` + TotalEngagedUsers *int `json:"total_engaged_users,omitempty"` + CopilotIDECodeCompletions *CopilotIDECodeCompletions `json:"copilot_ide_code_completions,omitempty"` + CopilotIDEChat *CopilotIDEChat `json:"copilot_ide_chat,omitempty"` + CopilotDotcomChat *CopilotDotcomChat `json:"copilot_dotcom_chat,omitempty"` + 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 + type alias CopilotSeatDetails + var seatDetail alias + + if err := json.Unmarshal(data, &seatDetail); err != nil { + return err + } + + cp.AssigningTeam = seatDetail.AssigningTeam + cp.PendingCancellationDate = seatDetail.PendingCancellationDate + cp.LastActivityAt = seatDetail.LastActivityAt + cp.LastActivityEditor = seatDetail.LastActivityEditor + cp.CreatedAt = seatDetail.CreatedAt + cp.UpdatedAt = seatDetail.UpdatedAt + cp.PlanType = seatDetail.PlanType + + switch v := seatDetail.Assignee.(type) { + case nil: + // Assignee can be null according to GitHub API specification. + // See: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization + // Note: Copilot API is in public preview and subject to change. + cp.Assignee = nil + case map[string]any: + jsonData, err := json.Marshal(seatDetail.Assignee) + if err != nil { + return err + } + + if v["type"] == nil { + return errors.New("assignee type field is not set") + } + + if t, ok := v["type"].(string); ok && t == "User" { + var user *User + if err := json.Unmarshal(jsonData, &user); err != nil { + return err + } + cp.Assignee = user + } else if t, ok := v["type"].(string); ok && t == "Team" { + var team *Team + if err := json.Unmarshal(jsonData, &team); err != nil { + return err + } + cp.Assignee = team + } else if t, ok := v["type"].(string); ok && t == "Organization" { + var organization *Organization + if err := json.Unmarshal(jsonData, &organization); err != nil { + return err + } + cp.Assignee = organization + } else { + return fmt.Errorf("unsupported assignee type %v", v["type"]) + } + default: + return fmt.Errorf("unsupported assignee type %T", v) + } + + return nil +} + +// GetUser gets the User from the CopilotSeatDetails if the assignee is a user. +func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok } + +// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team. +func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok } + +// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization. +func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { + o, ok := cp.Assignee.(*Organization) + return o, ok +} + +// GetCopilotBilling gets Copilot for Business billing information and settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-information-and-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing +func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotDetails *CopilotOrganizationDetails + resp, err := s.client.Do(req, &copilotDetails) + if err != nil { + return nil, resp, err + } + + return copilotDetails, resp, nil +} + +// ListCopilotSeats lists Copilot for Business seat assignments for an organization. +// +// To paginate through all seats, populate 'Page' with the number of the last page. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing/seats +func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotSeats *ListCopilotSeatsResponse + resp, err := s.client.Do(req, &copilotSeats) + if err != nil { + return nil, resp, err + } + + return copilotSeats, resp, nil +} + +// ListCopilotEnterpriseSeats lists Copilot for Business seat assignments for an enterprise. +// +// To paginate through all seats, populate 'Page' with the number of the last page. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-user-management?apiVersion=2022-11-28#list-all-copilot-seat-assignments-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/copilot/billing/seats +func (s *CopilotService) ListCopilotEnterpriseSeats(ctx context.Context, enterprise string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/billing/seats", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotSeats *ListCopilotSeatsResponse + resp, err := s.client.Do(req, &copilotSeats) + if err != nil { + return nil, resp, err + } + + return copilotSeats, resp, nil +} + +// ListOrganizationCopilotCodingAgentRepositoriesResponse represents the response from listing +// repositories enabled for the Copilot coding agent in an organization. +type ListOrganizationCopilotCodingAgentRepositoriesResponse struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ListOrganizationCodingAgentRepositories lists repositories enabled for the Copilot coding agent in an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-coding-agent-management?apiVersion=2022-11-28#list-repositories-enabled-for-copilot-cloud-agent-in-an-organization +// +//meta:operation GET /orgs/{org}/copilot/coding-agent/permissions/repositories +func (s *CopilotService) ListOrganizationCodingAgentRepositories(ctx context.Context, org string, opts *ListOptions) (*ListOrganizationCopilotCodingAgentRepositoriesResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/coding-agent/permissions/repositories", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *ListOrganizationCopilotCodingAgentRepositoriesResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// CopilotOrganizationContentExclusionDetails lists all Copilot content exclusion +// rules for an organization, keyed by repository full name. Each value is the +// list of file paths excluded from Copilot for that repository. +type CopilotOrganizationContentExclusionDetails map[string][]string + +// GetOrganizationContentExclusionDetails gets the Copilot content exclusion rules for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#get-copilot-content-exclusion-rules-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/content_exclusion +func (s *CopilotService) GetOrganizationContentExclusionDetails(ctx context.Context, org string) (CopilotOrganizationContentExclusionDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/content_exclusion", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + details := CopilotOrganizationContentExclusionDetails{} + resp, err := s.client.Do(req, &details) + if err != nil { + return nil, resp, err + } + + return details, resp, nil +} + +// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#add-teams-to-the-copilot-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#remove-teams-from-the-copilot-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// AddCopilotUsers adds users to the Copilot for Business subscription for an organization +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#add-users-to-the-copilot-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsernames []string `json:"selected_usernames"` + }{ + SelectedUsernames: users, + } + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#remove-users-from-the-copilot-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsernames []string `json:"selected_usernames"` + }{ + SelectedUsernames: users, + } + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// GetSeatDetails gets Copilot for Business seat assignment details for a user. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#get-copilot-seat-assignment-details-for-a-user +// +//meta:operation GET /orgs/{org}/members/{username}/copilot +func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var seatDetails *CopilotSeatDetails + resp, err := s.client.Do(req, &seatDetails) + if err != nil { + return nil, resp, err + } + + return seatDetails, resp, nil +} + +// GetEnterpriseMetrics gets Copilot usage metrics for an enterprise. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetEnterpriseDailyMetricsReport +// or GetEnterpriseMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics +func (s *CopilotService) GetEnterpriseMetrics(ctx context.Context, enterprise string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetEnterpriseTeamMetrics gets Copilot usage metrics for an enterprise team. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetEnterpriseDailyMetricsReport +// or GetEnterpriseMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-enterprise-team +// +//meta:operation GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics +func (s *CopilotService) GetEnterpriseTeamMetrics(ctx context.Context, enterprise, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("enterprises/%v/team/%v/copilot/metrics", enterprise, team) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetOrganizationMetrics gets Copilot usage metrics for an organization. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetOrganizationDailyMetricsReport +// or GetOrganizationMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/metrics +func (s *CopilotService) GetOrganizationMetrics(ctx context.Context, org string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetOrganizationTeamMetrics gets Copilot usage metrics for an organization team. +// +// Deprecated: This endpoint was closed down on April 2, 2026 for github.com. +// It may still be available for GitHub Enterprise Server. Use GetOrganizationDailyMetricsReport +// or GetOrganizationMetricsReport instead. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics?apiVersion=2022-11-28#get-copilot-metrics-for-a-team +// +//meta:operation GET /orgs/{org}/team/{team_slug}/copilot/metrics +func (s *CopilotService) GetOrganizationTeamMetrics(ctx context.Context, org, team string, opts *CopilotMetricsListOptions) ([]*CopilotMetrics, *Response, error) { + u := fmt.Sprintf("orgs/%v/team/%v/copilot/metrics", org, team) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var metrics []*CopilotMetrics + resp, err := s.client.Do(req, &metrics) + if err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// GetEnterpriseDailyMetricsReport gets a report containing Copilot metrics for a single day for an enterprise. +// +// Use DownloadDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadUserDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadUserPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadUserDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(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. +// +// Use DownloadUserPeriodicMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseRepositoriesDailyMetricsReport gets a report containing Copilot +// repository-level pull request metrics for a single day for an enterprise. +// +// Use DownloadRepositoryDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-enterprise-repository-report-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/repos-1-day +func (s *CopilotService) GetEnterpriseRepositoriesDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/repos-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationRepositoriesDailyMetricsReport gets a report containing Copilot +// repository-level pull request metrics for a single day for an organization. +// +// Use DownloadRepositoryDailyMetrics to decode the payloads served at the returned download links. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-repository-report-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/repos-1-day +func (s *CopilotService) GetOrganizationRepositoriesDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/repos-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetEnterpriseUserTeamsDailyMetricsReport gets a report containing Copilot +// user-team membership data for a single day for an enterprise. +// +// Use DownloadUserTeamsDailyMetrics to decode the payloads served at the returned download links. +// Join these records with per-user usage metrics on user_id, day, and enterprise_id to +// construct team-level metrics. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-enterprise-user-teams-report-for-a-specific-day +// +//meta:operation GET /enterprises/{enterprise}/copilot/metrics/reports/user-teams-1-day +func (s *CopilotService) GetEnterpriseUserTeamsDailyMetricsReport(ctx context.Context, enterprise string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/copilot/metrics/reports/user-teams-1-day", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetOrganizationUserTeamsDailyMetricsReport gets a report containing Copilot +// user-team membership data for a single day for an organization. +// +// Use DownloadUserTeamsDailyMetrics to decode the payloads served at the returned download links. +// Join these records with per-user usage metrics on user_id, day, and organization_id to +// construct team-level metrics. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-organization-user-teams-report-for-a-specific-day +// +//meta:operation GET /orgs/{org}/copilot/metrics/reports/user-teams-1-day +func (s *CopilotService) GetOrganizationUserTeamsDailyMetricsReport(ctx context.Context, org string, opts *CopilotMetricsReportOptions) (*CopilotDailyMetricsReport, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/metrics/reports/user-teams-1-day", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *CopilotDailyMetricsReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// DownloadCopilotMetrics downloads a Copilot metrics report from the provided download link +// and decodes it as a []*CopilotMetrics. +// +// Deprecated: Use DownloadDailyMetrics, +// DownloadPeriodicMetrics, DownloadUserDailyMetrics, DownloadUserPeriodicMetrics, +// DownloadRepositoryDailyMetrics, DownloadUserTeamsDailyMetrics instead. +// The payloads served at the download links returned by the new +// Get*MetricsReport endpoints on GitHub.com do not match the CopilotMetrics shape +// (see https://github.com/google/go-github/issues/4136). +// This method is retained +// for GitHub Enterprise Server installations that may still serve the legacy shape. +func (s *CopilotService) DownloadCopilotMetrics(ctx context.Context, url string) ([]*CopilotMetrics, *Response, error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + resp, err := s.client.BareDo(req) + if err != nil { + return nil, nil, err + } + defer resp.Body.Close() + + var metrics []*CopilotMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, resp, err + } + + return metrics, resp, nil +} + +// CopilotMetricsCopilotSuggestionByCommentType represents Copilot code review suggestion +// counts broken down by comment type in a pull_requests object. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#pull-request-activity-fields +type CopilotMetricsCopilotSuggestionByCommentType struct { + CommentType string `json:"comment_type"` + TotalCopilotSuggestions *int `json:"total_copilot_suggestions,omitempty"` + TotalCopilotAppliedSuggestions *int `json:"total_copilot_applied_suggestions,omitempty"` +} + +// CopilotMetricsPullRequests represents pull request totals in a Copilot metrics report. +type CopilotMetricsPullRequests struct { + TotalReviewed *int `json:"total_reviewed,omitempty"` + TotalCreated *int `json:"total_created,omitempty"` + TotalCreatedByCopilot *int `json:"total_created_by_copilot,omitempty"` + TotalReviewedByCopilot *int `json:"total_reviewed_by_copilot,omitempty"` + TotalMerged *int `json:"total_merged,omitempty"` + MedianMinutesToMerge *float64 `json:"median_minutes_to_merge,omitempty"` + TotalSuggestions *int `json:"total_suggestions,omitempty"` + TotalAppliedSuggestions *int `json:"total_applied_suggestions,omitempty"` + TotalMergedCreatedByCopilot *int `json:"total_merged_created_by_copilot,omitempty"` + MedianMinutesToMergeCopilotAuthored *float64 `json:"median_minutes_to_merge_copilot_authored,omitempty"` + TotalCopilotSuggestions *int `json:"total_copilot_suggestions,omitempty"` + TotalCopilotAppliedSuggestions *int `json:"total_copilot_applied_suggestions,omitempty"` + MedianMinutesToMergeCopilotReviewed *float64 `json:"median_minutes_to_merge_copilot_reviewed,omitempty"` + TotalMergedReviewedByCopilot *int `json:"total_merged_reviewed_by_copilot,omitempty"` + CopilotSuggestionsByCommentType []*CopilotMetricsCopilotSuggestionByCommentType `json:"copilot_suggestions_by_comment_type,omitempty"` +} + +// CopilotRepositoryDailyMetrics represents a single repository's per-day Copilot pull request +// metrics record from a repos-1-day report. Repository reports are served as newline-delimited JSON. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#repository-level-fields-api-only +type CopilotRepositoryDailyMetrics struct { + Day string `json:"day"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + OrganizationID *string `json:"organization_id,omitempty"` + RepoID int64 `json:"repo_id"` + RepoOwnerName string `json:"repo_owner_name"` + RepoName string `json:"repo_name"` + RepoVisibility string `json:"repo_visibility"` + PullRequests *CopilotMetricsPullRequests `json:"pull_requests,omitempty"` +} + +// CopilotMetricsCodeActivity captures the code-generation activity counts and lines-of-code (LOC) +// suggestion totals shared across the per-IDE, per-feature, per-language, and per-model breakdowns +// in a Copilot metrics report. +type CopilotMetricsCodeActivity struct { + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// CopilotMetricsChatPanel captures per-mode chat panel interaction counts shared across daily, +// periodic, and user metrics reports. Each field is a subset of user_initiated_interaction_count +// attributed to that chat panel mode. +type CopilotMetricsChatPanel struct { + ChatPanelAgentMode *int `json:"chat_panel_agent_mode,omitempty"` + ChatPanelAskMode *int `json:"chat_panel_ask_mode,omitempty"` + ChatPanelCustomMode *int `json:"chat_panel_custom_mode,omitempty"` + ChatPanelEditMode *int `json:"chat_panel_edit_mode,omitempty"` + ChatPanelUnknownMode *int `json:"chat_panel_unknown_mode,omitempty"` +} + +// CopilotMetricsIDE represents per-IDE aggregate totals in a Copilot metrics report. +type CopilotMetricsIDE struct { + IDE string `json:"ide"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsFeature represents per-feature aggregate totals in a Copilot metrics report. +type CopilotMetricsFeature struct { + Feature string `json:"feature"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsLanguageFeature represents per-language-feature totals in a Copilot metrics report. +type CopilotMetricsLanguageFeature struct { + Language string `json:"language"` + Feature string `json:"feature"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsLanguageModel represents per-language-model totals in a Copilot metrics report. +type CopilotMetricsLanguageModel struct { + Language string `json:"language"` + Model string `json:"model"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsModelFeature represents per-model-feature totals in a Copilot metrics report. +type CopilotMetricsModelFeature struct { + Model string `json:"model"` + Feature string `json:"feature"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity +} + +// CopilotMetricsCLIVersion represents the last known Copilot CLI version seen in a metrics report. +type CopilotMetricsCLIVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + CLIVersion string `json:"cli_version"` +} + +// CopilotMetricsCLITokenUsage represents Copilot CLI token totals in a metrics report. +type CopilotMetricsCLITokenUsage struct { + AvgTokensPerRequest *float64 `json:"avg_tokens_per_request,omitempty"` + OutputTokensSum *int `json:"output_tokens_sum,omitempty"` + PromptTokensSum *int `json:"prompt_tokens_sum,omitempty"` +} + +// CopilotMetricsCLI represents Copilot CLI totals in a metrics report. +type CopilotMetricsCLI struct { + SessionCount *int `json:"session_count,omitempty"` + RequestCount *int `json:"request_count,omitempty"` + PromptCount *int `json:"prompt_count,omitempty"` + TokenUsage *CopilotMetricsCLITokenUsage `json:"token_usage,omitempty"` + LastKnownCLIVersion *CopilotMetricsCLIVersion `json:"last_known_cli_version,omitempty"` +} + +// CopilotMetricsCopilotAppTokenUsage represents Copilot app token totals in a metrics report. +type CopilotMetricsCopilotAppTokenUsage struct { + AvgTokensPerRequest *float64 `json:"avg_tokens_per_request,omitempty"` + OutputTokensSum *int `json:"output_tokens_sum,omitempty"` + PromptTokensSum *int `json:"prompt_tokens_sum,omitempty"` +} + +// CopilotMetricsCopilotApp represents Copilot app totals in a metrics report. +// +// Unlike totals_by_cli, there is no last_known_app_version field. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#copilot-app-metrics-fields +type CopilotMetricsCopilotApp struct { + SessionCount *int `json:"session_count,omitempty"` + RequestCount *int `json:"request_count,omitempty"` + PromptCount *int `json:"prompt_count,omitempty"` + TokenUsage *CopilotMetricsCopilotAppTokenUsage `json:"token_usage,omitempty"` +} + +// CopilotMetricsThirdPartyAgent represents per-agent app totals in a Copilot usage metrics report. +// +// AgentID is the stable grouping key. AgentName is for display and can change. +// UserInitiatedInteractionCount is agent-app job starts; it is not the same as +// the top-level user_initiated_interaction_count on the parent metrics object. +// SessionCount is included on aggregated enterprise and organization reports +// and omitted from per-user reports. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#agent-apps-metrics-fields +type CopilotMetricsThirdPartyAgent struct { + AgentName string `json:"agent_name"` + AgentID string `json:"agent_id"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + SessionCount *int `json:"session_count,omitempty"` +} + +// CopilotMetricsAIAdoptionPhase represents a user's AI adoption phase classification +// in a Copilot usage metrics report. +// +// Phase assignment uses a trailing 28-day engagement window and may change day to day. +// Version identifies the classification model (for example, "v1"). +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#ai-adoption-phase-fields +type CopilotMetricsAIAdoptionPhase struct { + PhaseNumber int `json:"phase_number"` + Phase string `json:"phase"` + Version string `json:"version"` +} + +// CopilotMetricsAIAdoptionPhaseTotals represents aggregated per-phase averages in an +// enterprise or organization Copilot usage metrics report. +// +// Aggregated metrics report the average per user within each phase rather than the sum, +// except TotalEngagedUsers and TotalPullRequestsMerged. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#ai-adoption-phase-fields +type CopilotMetricsAIAdoptionPhaseTotals struct { + Phase string `json:"phase"` + PhaseNumber int `json:"phase_number"` + TotalEngagedUsers int `json:"total_engaged_users"` + AvgUserInitiatedInteractions float64 `json:"avg_user_initiated_interactions"` + AvgCodeGenerationActivities float64 `json:"avg_code_generation_activities"` + AvgCodeAcceptanceActivities float64 `json:"avg_code_acceptance_activities"` + AvgLOCAdded float64 `json:"avg_loc_added"` + AvgLOCDeleted float64 `json:"avg_loc_deleted"` + AvgPullRequestsReviewed float64 `json:"avg_pull_requests_reviewed"` + AvgPullRequestsCreated float64 `json:"avg_pull_requests_created"` + AvgPullRequestsMerged float64 `json:"avg_pull_requests_merged"` + TotalPullRequestsMerged int `json:"total_pull_requests_merged"` + AvgPullRequestsMedianMinutesToMerge float64 `json:"avg_pull_requests_median_minutes_to_merge"` + AvgPullRequestsMinutesToReview float64 `json:"avg_pull_requests_minutes_to_review"` + AvgPullRequestsReviewCycles float64 `json:"avg_pull_requests_review_cycles"` +} + +// CopilotDailyMetrics represents the payload downloaded from a 1-day Copilot usage metrics report. +type CopilotDailyMetrics struct { + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + DailyActiveCLIUsers *int `json:"daily_active_cli_users,omitempty"` + DailyActiveCopilotAppUsers *int `json:"daily_active_copilot_app_users,omitempty"` + DailyActiveUsers *int `json:"daily_active_users,omitempty"` + DailyActiveCopilotCloudAgentUsers *int `json:"daily_active_copilot_cloud_agent_users,omitempty"` + WeeklyActiveUsers *int `json:"weekly_active_users,omitempty"` + WeeklyActiveCopilotCloudAgentUsers *int `json:"weekly_active_copilot_cloud_agent_users,omitempty"` + MonthlyActiveUsers *int `json:"monthly_active_users,omitempty"` + MonthlyActiveChatUsers *int `json:"monthly_active_chat_users,omitempty"` + MonthlyActiveAgentUsers *int `json:"monthly_active_agent_users,omitempty"` + MonthlyActiveCopilotCloudAgentUsers *int `json:"monthly_active_copilot_cloud_agent_users,omitempty"` + DailyActiveCopilotCodeReviewUsers *int `json:"daily_active_copilot_code_review_users,omitempty"` + WeeklyActiveCopilotCodeReviewUsers *int `json:"weekly_active_copilot_code_review_users,omitempty"` + MonthlyActiveCopilotCodeReviewUsers *int `json:"monthly_active_copilot_code_review_users,omitempty"` + DailyPassiveCopilotCodeReviewUsers *int `json:"daily_passive_copilot_code_review_users,omitempty"` + WeeklyPassiveCopilotCodeReviewUsers *int `json:"weekly_passive_copilot_code_review_users,omitempty"` + MonthlyPassiveCopilotCodeReviewUsers *int `json:"monthly_passive_copilot_code_review_users,omitempty"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + TotalsByCopilotApp *CopilotMetricsCopilotApp `json:"totals_by_copilot_app,omitempty"` + TotalsBy3rdPartyAgent []*CopilotMetricsThirdPartyAgent `json:"totals_by_3rd_party_agent,omitempty"` + TotalsByAIAdoptionPhase []*CopilotMetricsAIAdoptionPhaseTotals `json:"totals_by_ai_adoption_phase,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` + PullRequests *CopilotMetricsPullRequests `json:"pull_requests,omitempty"` +} + +// CopilotPeriodicMetrics represents the payload downloaded from a multi-day (e.g. 28-day rolling) +// Copilot usage metrics report. The DayTotals field contains one CopilotDailyMetrics entry per day +// in the reporting window. Window-level metadata (ReportStartDay, ReportEndDay, CreatedAt) lives on +// this parent struct; each DayTotals entry only populates fields scoped to that day. +type CopilotPeriodicMetrics struct { + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + DayTotals []*CopilotDailyMetrics `json:"day_totals,omitempty"` +} + +// CopilotUserMetricsPluginVersion represents the last known plugin version used in an IDE by a Copilot user. +type CopilotUserMetricsPluginVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + Plugin string `json:"plugin"` + PluginVersion string `json:"plugin_version"` +} + +// CopilotUserMetricsIDEVersion represents the last known IDE version used by a Copilot user. +type CopilotUserMetricsIDEVersion struct { + SampledAt *Timestamp `json:"sampled_at,omitempty"` + IDEVersion string `json:"ide_version"` +} + +// CopilotUserMetricsIDE represents per-IDE totals for a single Copilot user in a user metrics report. +type CopilotUserMetricsIDE struct { + IDE string `json:"ide"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsCodeActivity + LastKnownPluginVersion *CopilotUserMetricsPluginVersion `json:"last_known_plugin_version,omitempty"` + LastKnownIDEVersion *CopilotUserMetricsIDEVersion `json:"last_known_ide_version,omitempty"` +} + +// CopilotUserTeamsDailyMetrics represents a user-team membership record from a user-teams-1-day +// report. These records are joined with per-user usage metrics to construct team-level metrics. +// Teams with fewer than 5 seated Copilot users are omitted from the report. +// User-teams reports are served as newline-delimited JSON. +// +// GitHub API docs: https://docs.github.com/en/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#user-teams-fields +type CopilotUserTeamsDailyMetrics struct { + UserID int64 `json:"user_id"` + UserLogin string `json:"user_login"` + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + TeamID int64 `json:"team_id"` + Slug string `json:"slug"` +} + +// CopilotUserDailyMetrics represents a single user's per-day Copilot usage metrics record from a +// 1-day user metrics report. User metrics reports are served as newline-delimited JSON. +type CopilotUserDailyMetrics struct { + UserID int `json:"user_id"` + UserLogin string `json:"user_login"` + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + AICreditsUsed *float64 `json:"ai_credits_used,omitempty"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotUserMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + TotalsByCopilotApp *CopilotMetricsCopilotApp `json:"totals_by_copilot_app,omitempty"` + TotalsBy3rdPartyAgent []*CopilotMetricsThirdPartyAgent `json:"totals_by_3rd_party_agent,omitempty"` + AIAdoptionPhase *CopilotMetricsAIAdoptionPhase `json:"ai_adoption_phase,omitempty"` + UsedAgent *bool `json:"used_agent,omitempty"` + UsedChat *bool `json:"used_chat,omitempty"` + UsedCLI *bool `json:"used_cli,omitempty"` + UsedCopilotApp *bool `json:"used_copilot_app,omitempty"` + UsedCopilotCloudAgent *bool `json:"used_copilot_cloud_agent,omitempty"` + UsedCopilotCodeReviewActive *bool `json:"used_copilot_code_review_active,omitempty"` + UsedCopilotCodeReviewPassive *bool `json:"used_copilot_code_review_passive,omitempty"` + UsedCopilotCodingAgent *bool `json:"used_copilot_coding_agent,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// CopilotUserPeriodicMetrics represents a single user's per-day Copilot usage metrics record from a +// multi-day (e.g. 28-day rolling) user metrics report. User metrics reports are served as +// newline-delimited JSON. +type CopilotUserPeriodicMetrics struct { + ReportStartDay string `json:"report_start_day"` + ReportEndDay string `json:"report_end_day"` + Day string `json:"day"` + OrganizationID *string `json:"organization_id,omitempty"` + EnterpriseID *string `json:"enterprise_id,omitempty"` + UserID int `json:"user_id"` + UserLogin string `json:"user_login"` + AICreditsUsed *float64 `json:"ai_credits_used,omitempty"` + UserInitiatedInteractionCount *int `json:"user_initiated_interaction_count,omitempty"` + CopilotMetricsChatPanel + CodeGenerationActivityCount *int `json:"code_generation_activity_count,omitempty"` + CodeAcceptanceActivityCount *int `json:"code_acceptance_activity_count,omitempty"` + TotalsByIDE []*CopilotUserMetricsIDE `json:"totals_by_ide,omitempty"` + TotalsByFeature []*CopilotMetricsFeature `json:"totals_by_feature,omitempty"` + TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"` + TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"` + TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"` + TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"` + TotalsByCopilotApp *CopilotMetricsCopilotApp `json:"totals_by_copilot_app,omitempty"` + TotalsBy3rdPartyAgent []*CopilotMetricsThirdPartyAgent `json:"totals_by_3rd_party_agent,omitempty"` + AIAdoptionPhase *CopilotMetricsAIAdoptionPhase `json:"ai_adoption_phase,omitempty"` + UsedAgent *bool `json:"used_agent,omitempty"` + UsedChat *bool `json:"used_chat,omitempty"` + UsedCLI *bool `json:"used_cli,omitempty"` + UsedCopilotApp *bool `json:"used_copilot_app,omitempty"` + UsedCopilotCloudAgent *bool `json:"used_copilot_cloud_agent,omitempty"` + UsedCopilotCodeReviewActive *bool `json:"used_copilot_code_review_active,omitempty"` + UsedCopilotCodeReviewPassive *bool `json:"used_copilot_code_review_passive,omitempty"` + UsedCopilotCodingAgent *bool `json:"used_copilot_coding_agent,omitempty"` + LOCSuggestedToAddSum *int `json:"loc_suggested_to_add_sum,omitempty"` + LOCSuggestedToDeleteSum *int `json:"loc_suggested_to_delete_sum,omitempty"` + LOCAddedSum *int `json:"loc_added_sum,omitempty"` + LOCDeletedSum *int `json:"loc_deleted_sum,omitempty"` +} + +// fetchMetricsReport performs a GET against the provided download URL and returns the raw +// http.Response. The caller is responsible for closing the body. +// +// The download URL is a value the caller reads out of a report response, which +// may name any host. No host check belongs here: the client attaches its +// credentials only to its configured API and upload origins, so a link that +// points elsewhere is fetched without them, as is any redirect target. +// +// This is a GET with no body of the caller's, so only the credential half of the +// origin rules applies to it; refusing a foreign host would break the ordinary +// path, since GitHub hands back report links on a host of its own choosing. The +// residual is that the body returned here is whatever that host served, and the +// Download*Metrics methods decode it as GitHub's report. A caller that must be +// sure the report is GitHub's should treat it as untrusted input. +func (s *CopilotService) fetchMetricsReport(ctx context.Context, url string) (*http.Response, *Response, error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + resp, err := s.client.client.Do(req) + if err != nil { + return nil, nil, err + } + + // CheckResponse substitutes resp.Body with a re-readable copy on error + // responses, so capture the original body first: it is the one that must + // be closed. + origBody := resp.Body + if err := CheckResponse(resp); err != nil { + _ = origBody.Close() + return nil, newResponse(resp), err + } + + return resp, newResponse(resp), nil +} + +// decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, +// returning a nil slice when the body is empty. +func decodeNDJSONMetrics[T any](r io.Reader) ([]*T, error) { + var records []*T + dec := json.NewDecoder(r) + for { + var rec *T + if err := dec.Decode(&rec); err != nil { + if errors.Is(err, io.EOF) { + break + } + return nil, err + } + records = append(records, rec) + } + return records, nil +} + +// DownloadDailyMetrics downloads the payload of a 1-day Copilot usage metrics report from a +// download link returned by GetEnterpriseDailyMetricsReport or GetOrganizationDailyMetricsReport. +func (s *CopilotService) DownloadDailyMetrics(ctx context.Context, url string) (*CopilotDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + var metrics *CopilotDailyMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, r, err + } + + return metrics, r, nil +} + +// DownloadPeriodicMetrics downloads the payload of a multi-day (e.g. 28-day rolling) Copilot +// usage metrics report from a download link returned by GetEnterpriseMetricsReport or +// GetOrganizationMetricsReport. +func (s *CopilotService) DownloadPeriodicMetrics(ctx context.Context, url string) (*CopilotPeriodicMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + var metrics *CopilotPeriodicMetrics + if err := json.NewDecoder(resp.Body).Decode(&metrics); err != nil { + return nil, r, err + } + + return metrics, r, nil +} + +// DownloadUserDailyMetrics downloads the payload of a 1-day Copilot user metrics report from a +// download link returned by GetEnterpriseUsersDailyMetricsReport or +// GetOrganizationUsersDailyMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotUserDailyMetrics record per line. +func (s *CopilotService) DownloadUserDailyMetrics(ctx context.Context, url string) ([]*CopilotUserDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotUserDailyMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} + +// DownloadUserPeriodicMetrics downloads the payload of a multi-day (e.g. 28-day rolling) Copilot +// user metrics report from a download link returned by GetEnterpriseUsersMetricsReport or +// GetOrganizationUsersMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotUserPeriodicMetrics record per +// user-day in the reporting window. +func (s *CopilotService) DownloadUserPeriodicMetrics(ctx context.Context, url string) ([]*CopilotUserPeriodicMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotUserPeriodicMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} + +// DownloadRepositoryDailyMetrics downloads the payload of a 1-day Copilot repository metrics +// report from a download link returned by GetEnterpriseRepositoriesDailyMetricsReport or +// GetOrganizationRepositoriesDailyMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotRepositoryDailyMetrics record per line. +func (s *CopilotService) DownloadRepositoryDailyMetrics(ctx context.Context, url string) ([]*CopilotRepositoryDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotRepositoryDailyMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} + +// DownloadUserTeamsDailyMetrics downloads the payload of a 1-day Copilot user-teams report from a +// download link returned by GetEnterpriseUserTeamsDailyMetricsReport or +// GetOrganizationUserTeamsDailyMetricsReport. +// +// The response is newline-delimited JSON, with one CopilotUserTeamsDailyMetrics record per line. +func (s *CopilotService) DownloadUserTeamsDailyMetrics(ctx context.Context, url string) ([]*CopilotUserTeamsDailyMetrics, *Response, error) { + resp, r, err := s.fetchMetricsReport(ctx, url) + if err != nil { + return nil, r, err + } + defer resp.Body.Close() + + records, err := decodeNDJSONMetrics[CopilotUserTeamsDailyMetrics](resp.Body) + if err != nil { + return nil, r, err + } + return records, r, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/copilot_cloud_agent.go b/vendor/github.com/google/go-github/v93/github/copilot_cloud_agent.go new file mode 100644 index 000000000..b323af5ef --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/copilot_cloud_agent.go @@ -0,0 +1,51 @@ +// 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" +) + +// CopilotCloudAgentConfiguration represents the Copilot cloud agent configuration for a repository. +type CopilotCloudAgentConfiguration struct { + MCPConfiguration any `json:"mcp_configuration"` + EnabledTools *CopilotCloudAgentEnabledTools `json:"enabled_tools"` + RequireActionsWorkflowApproval bool `json:"require_actions_workflow_approval"` + IsFirewallEnabled bool `json:"is_firewall_enabled"` + IsFirewallRecommendedAllowlistEnabled bool `json:"is_firewall_recommended_allowlist_enabled"` + CustomAllowlist []string `json:"custom_allowlist"` +} + +// CopilotCloudAgentEnabledTools represents the enabled review tools for Copilot cloud agent. +type CopilotCloudAgentEnabledTools struct { + Codeql bool `json:"codeql"` + CopilotCodeReview bool `json:"copilot_code_review"` + SecretScanning bool `json:"secret_scanning"` + DependencyVulnerabilityChecks bool `json:"dependency_vulnerability_checks"` +} + +// GetCloudAgentConfiguration gets the Copilot cloud agent configuration for a repository. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-cloud-agent-management?apiVersion=2022-11-28#get-copilot-cloud-agent-configuration-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/copilot/cloud-agent/configuration +func (s *CopilotService) GetCloudAgentConfiguration(ctx context.Context, owner, repo string) (*CopilotCloudAgentConfiguration, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/copilot/cloud-agent/configuration", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var config *CopilotCloudAgentConfiguration + resp, err := s.client.Do(req, &config) + if err != nil { + return nil, resp, err + } + + return config, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/credentials.go b/vendor/github.com/google/go-github/v93/github/credentials.go new file mode 100644 index 000000000..d785edc0d --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#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(ctx, "POST", u, reqBody) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/dependabot.go b/vendor/github.com/google/go-github/v93/github/dependabot.go similarity index 79% rename from vendor/github.com/google/go-github/v69/github/dependabot.go rename to vendor/github.com/google/go-github/v93/github/dependabot.go index 2a11a9c95..5e4f73544 100644 --- a/vendor/github.com/google/go-github/v69/github/dependabot.go +++ b/vendor/github.com/google/go-github/v93/github/dependabot.go @@ -8,5 +8,5 @@ package github // DependabotService handles communication with the Dependabot related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/dependabot/ +// GitHub API docs: https://docs.github.com/rest/dependabot?apiVersion=2022-11-28 type DependabotService service diff --git a/vendor/github.com/google/go-github/v69/github/dependabot_alerts.go b/vendor/github.com/google/go-github/v93/github/dependabot_alerts.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/dependabot_alerts.go rename to vendor/github.com/google/go-github/v93/github/dependabot_alerts.go index c274f07be..6cc37b2c3 100644 --- a/vendor/github.com/google/go-github/v69/github/dependabot_alerts.go +++ b/vendor/github.com/google/go-github/v93/github/dependabot_alerts.go @@ -23,12 +23,28 @@ type AdvisoryCVSS struct { VectorString *string `json:"vector_string,omitempty"` } +// AdvisoryCVSSSeverities represents the advisory pertaining to the Common Vulnerability Scoring System +// for each supported CVSS version. +type AdvisoryCVSSSeverities struct { + CVSSV3 *AdvisoryCVSS `json:"cvss_v3,omitempty"` + CVSSV4 *AdvisoryCVSS `json:"cvss_v4,omitempty"` +} + // AdvisoryCWEs represent the advisory pertaining to Common Weakness Enumeration. type AdvisoryCWEs struct { CWEID *string `json:"cwe_id,omitempty"` Name *string `json:"name,omitempty"` } +// AdvisoryEPSS represents the advisory pertaining to the Exploit Prediction Scoring System. +// +// For more information, see: +// https://github.blog/changelog/2024-10-10-epss-scores-in-the-github-advisory-database/ +type AdvisoryEPSS struct { + Percentage float64 `json:"percentage"` + Percentile float64 `json:"percentile"` +} + // DependabotSecurityAdvisory represents the GitHub Security Advisory. type DependabotSecurityAdvisory struct { GHSAID *string `json:"ghsa_id,omitempty"` @@ -37,8 +53,11 @@ type DependabotSecurityAdvisory struct { Description *string `json:"description,omitempty"` Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` Severity *string `json:"severity,omitempty"` + Classification *string `json:"classification,omitempty"` CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CVSSSeverities *AdvisoryCVSSSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` + EPSS *AdvisoryEPSS `json:"epss,omitempty"` Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` References []*AdvisoryReference `json:"references,omitempty"` PublishedAt *Timestamp `json:"published_at,omitempty"` @@ -99,13 +118,13 @@ func (s *DependabotService) listAlerts(ctx context.Context, url string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var alerts []*DependabotAlert - resp, err := s.client.Do(ctx, req, &alerts) + resp, err := s.client.Do(req, &alerts) if err != nil { return nil, resp, err } @@ -115,7 +134,7 @@ func (s *DependabotService) listAlerts(ctx context.Context, url string, opts *Li // ListRepoAlerts lists all Dependabot alerts of a repository. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#list-dependabot-alerts-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/dependabot/alerts func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { @@ -125,7 +144,7 @@ func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo stri // ListOrgAlerts lists all Dependabot alerts of an organization. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#list-dependabot-alerts-for-an-organization // //meta:operation GET /orgs/{org}/dependabot/alerts func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { @@ -135,18 +154,18 @@ func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts // GetRepoAlert gets a single repository Dependabot alert. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#get-a-dependabot-alert // //meta:operation GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string, number int) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } - alert := new(DependabotAlert) - resp, err := s.client.Do(ctx, req, alert) + var alert *DependabotAlert + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } @@ -156,18 +175,18 @@ func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string // UpdateAlert updates a Dependabot alert. // -// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts?apiVersion=2022-11-28#update-a-dependabot-alert // //meta:operation PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} -func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, stateInfo *DependabotAlertState) (*DependabotAlert, *Response, error) { +func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, body *DependabotAlertState) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) - req, err := s.client.NewRequest("PATCH", url, stateInfo) + req, err := s.client.NewRequest(ctx, "PATCH", url, body) if err != nil { return nil, nil, err } - alert := new(DependabotAlert) - resp, err := s.client.Do(ctx, req, alert) + var alert *DependabotAlert + resp, err := s.client.Do(req, &alert) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/dependabot_secrets.go b/vendor/github.com/google/go-github/v93/github/dependabot_secrets.go similarity index 52% rename from vendor/github.com/google/go-github/v69/github/dependabot_secrets.go rename to vendor/github.com/google/go-github/v93/github/dependabot_secrets.go index e85c805a6..03d3f9e2a 100644 --- a/vendor/github.com/google/go-github/v69/github/dependabot_secrets.go +++ b/vendor/github.com/google/go-github/v93/github/dependabot_secrets.go @@ -10,14 +10,21 @@ import ( "fmt" ) -func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*PublicKey, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) +// GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption. +// +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/public-key +func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/dependabot/secrets/public-key", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - pubKey := new(PublicKey) - resp, err := s.client.Do(ctx, req, pubKey) + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) if err != nil { return nil, resp, err } @@ -25,210 +32,225 @@ func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*Publ return pubKey, resp, nil } -// GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption. -// -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key -// -//meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/public-key -func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/public-key", owner, repo) - return s.getPublicKey(ctx, url) -} - // GetOrgPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-an-organization-public-key // //meta:operation GET /orgs/{org}/dependabot/secrets/public-key func (s *DependabotService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/public-key", org) - return s.getPublicKey(ctx, url) -} - -func (s *DependabotService) listSecrets(ctx context.Context, url string, opts *ListOptions) (*Secrets, *Response, error) { - u, err := addOptions(url, opts) - if err != nil { - return nil, nil, err - } + u := fmt.Sprintf("orgs/%v/dependabot/secrets/public-key", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - secrets := new(Secrets) - resp, err := s.client.Do(ctx, req, &secrets) + var pubKey *PublicKey + resp, err := s.client.Do(req, &pubKey) if err != nil { return nil, resp, err } - return secrets, resp, nil + return pubKey, resp, nil } // ListRepoSecrets lists all Dependabot secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-repository-secrets // //meta:operation GET /repos/{owner}/{repo}/dependabot/secrets func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/dependabot/secrets", owner, repo) - return s.listSecrets(ctx, url, opts) + u := fmt.Sprintf("repos/%v/%v/dependabot/secrets", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) + if err != nil { + return nil, resp, err + } + + return secrets, resp, nil } // ListOrgSecrets lists all Dependabot secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-organization-secrets // //meta:operation GET /orgs/{org}/dependabot/secrets func (s *DependabotService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets", org) - return s.listSecrets(ctx, url, opts) -} + u := fmt.Sprintf("orgs/%v/dependabot/secrets", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } -func (s *DependabotService) getSecret(ctx context.Context, url string) (*Secret, *Response, error) { - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - secret := new(Secret) - resp, err := s.client.Do(ctx, req, secret) + var secrets *Secrets + resp, err := s.client.Do(req, &secrets) if err != nil { return nil, resp, err } - return secret, resp, nil + return secrets, resp, nil } // GetRepoSecret gets a single repository Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-a-repository-secret // //meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { - url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) - return s.getSecret(ctx, url) + u := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secret *Secret + resp, err := s.client.Do(req, &secret) + if err != nil { + return nil, resp, err + } + + return secret, resp, nil } // GetOrgSecret gets a single organization Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#get-an-organization-secret // //meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) - return s.getSecret(ctx, url) -} + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) -// DependabotEncryptedSecret represents a secret that is encrypted using a public key for Dependabot. -// -// The value of EncryptedValue must be your secret, encrypted with -// LibSodium (see documentation here: https://libsodium.gitbook.io/doc/bindings_for_other_languages) -// using the public key retrieved using the GetPublicKey method. -type DependabotEncryptedSecret struct { - Name string `json:"-"` - KeyID string `json:"key_id"` - EncryptedValue string `json:"encrypted_value"` - Visibility string `json:"visibility,omitempty"` - SelectedRepositoryIDs DependabotSecretsSelectedRepoIDs `json:"selected_repository_ids,omitempty"` -} + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } -func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret *DependabotEncryptedSecret) (*Response, error) { - req, err := s.client.NewRequest("PUT", url, eSecret) + var secret *Secret + resp, err := s.client.Do(req, &secret) if err != nil { - return nil, err + return nil, resp, err } - return s.client.Do(ctx, req, nil) + return secret, resp, nil } // CreateOrUpdateRepoSecret creates or updates a repository Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret // //meta:operation PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} -func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *DependabotEncryptedSecret) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, eSecret.Name) - return s.putSecret(ctx, url, eSecret) +func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo, name string, body SecretRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) } // CreateOrUpdateOrgSecret creates or updates an organization Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name} -func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *DependabotEncryptedSecret) (*Response, error) { - repoIDs := make([]string, len(eSecret.SelectedRepositoryIDs)) - for i, secret := range eSecret.SelectedRepositoryIDs { - repoIDs[i] = fmt.Sprintf("%v", secret) - } - params := struct { - *DependabotEncryptedSecret - SelectedRepositoryIDs []string `json:"selected_repository_ids,omitempty"` - }{ - DependabotEncryptedSecret: eSecret, - SelectedRepositoryIDs: repoIDs, +func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org, name string, body SecretOrgRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) + + var bodyOverride any = body + if len(body.SelectedRepositoryIDs) > 0 { + repoIDs := make([]string, len(body.SelectedRepositoryIDs)) + for i, id := range body.SelectedRepositoryIDs { + repoIDs[i] = fmt.Sprintf("%v", id) + } + + bodyOverride = struct { + SecretOrgRequest + SelectedRepositoryIDs []string `json:"selected_repository_ids,omitzero"` + }{ + SecretOrgRequest: body, + SelectedRepositoryIDs: repoIDs, + } } - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, eSecret.Name) - req, err := s.client.NewRequest("PUT", url, params) + req, err := s.client.NewRequest(ctx, "PUT", u, bodyOverride) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) -} - -func (s *DependabotService) deleteSecret(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest("DELETE", url, nil) - if err != nil { - return nil, err - } - - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteRepoSecret deletes a Dependabot secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#delete-a-repository-secret // //meta:operation DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) - return s.deleteSecret(ctx, url) + u := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) } // DeleteOrgSecret deletes a Dependabot secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#delete-an-organization-secret // //meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) - return s.deleteSecret(ctx, url) + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) } // ListSelectedReposForOrgSecret lists all repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret // //meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) - u, err := addOptions(url, opts) + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) + u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(SelectedReposList) - resp, err := s.client.Do(ctx, req, result) + var result *SelectedReposList + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } @@ -236,54 +258,54 @@ func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, o return result, resp, nil } -// DependabotSecretsSelectedRepoIDs are the repository IDs that have access to the dependabot secrets. -type DependabotSecretsSelectedRepoIDs []int64 - // SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#set-selected-repositories-for-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories -func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids DependabotSecretsSelectedRepoIDs) (*Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) +func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) + type repoIDs struct { - SelectedIDs DependabotSecretsSelectedRepoIDs `json:"selected_repository_ids"` + SelectedIDs []int64 `json:"selected_repository_ids"` } - req, err := s.client.NewRequest("PUT", url, repoIDs{SelectedIDs: ids}) + req, err := s.client.NewRequest(ctx, "PUT", u, repoIDs{SelectedIDs: ids}) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddSelectedRepoToOrgSecret adds a repository to an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} -func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) - req, err := s.client.NewRequest("PUT", url, nil) +func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSelectedRepoFromOrgSecret removes a repository from an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret // //meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} -func (s *DependabotService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { - url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) - req, err := s.client.NewRequest("DELETE", url, nil) +func (s *DependabotService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, repoID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/dependency_graph.go b/vendor/github.com/google/go-github/v93/github/dependency_graph.go new file mode 100644 index 000000000..c50b573eb --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/dependency_graph.go @@ -0,0 +1,246 @@ +// 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" + "encoding/json" + "fmt" + "net/http" +) + +// DependencyGraphService handles communication with the dependency graph +// related methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph?apiVersion=2022-11-28 +type DependencyGraphService service + +// SBOM represents a software bill of materials, which describes the +// packages/libraries that a repository depends on. +type SBOM struct { + SBOM *SBOMInfo `json:"sbom,omitempty"` +} + +// CreationInfo represents when the SBOM was created and who created it. +type CreationInfo struct { + Created *Timestamp `json:"created,omitempty"` + Creators []string `json:"creators,omitempty"` +} + +// RepoDependencies represents the dependencies of a repo. +type RepoDependencies struct { + SPDXID *string `json:"SPDXID,omitempty"` + // Package name + Name *string `json:"name,omitempty"` + VersionInfo *string `json:"versionInfo,omitempty"` + DownloadLocation *string `json:"downloadLocation,omitempty"` + FilesAnalyzed *bool `json:"filesAnalyzed,omitempty"` + LicenseConcluded *string `json:"licenseConcluded,omitempty"` + LicenseDeclared *string `json:"licenseDeclared,omitempty"` + ExternalRefs []*PackageExternalRef `json:"externalRefs,omitempty"` +} + +// PackageExternalRef allows an Package to reference an external sources of additional information, +// like asset identifiers, or downloadable content that are relevant to the package, +// Example for identifiers (e.g., PURL/SWID/CPE) for a package in the SBOM. +// https://spdx.github.io/spdx-spec/v2.3/package-information/#721-external-reference-field +type PackageExternalRef struct { + // ReferenceCategory specifies the external reference categories such + // SECURITY", "PACKAGE-MANAGER", "PERSISTENT-ID", or "OTHER" + // Example: "PACKAGE-MANAGER" + ReferenceCategory string `json:"referenceCategory"` + + // ReferenceType specifies the type of external reference. + // For PACKAGE-MANAGER, it could be "purl"; other types include "cpe22Type", "swid", etc. + ReferenceType string `json:"referenceType"` + + // ReferenceLocator is the actual unique identifier or URI for the external reference. + // Example: "pkg:golang/github.com/spf13/cobra@1.8.1" + ReferenceLocator string `json:"referenceLocator"` +} + +// SBOMRelationship provides information about the relationship between two SPDX elements. +// Element could be packages or files in the SBOM. +// For example, to represent a relationship between two different Files, between a Package and a File, +// between two Packages, or between one SPDXDocument and another SPDXDocument. +// https://spdx.github.io/spdx-spec/v2.3/relationships-between-SPDX-elements/ +type SBOMRelationship struct { + // SPDXElementID is the identifier of the SPDX element that has a relationship. + // Example: "SPDXRef-github-interlynk-io-sbomqs-main-f43c98" + SPDXElementID string `json:"spdxElementId"` + + // RelatedSPDXElement is the identifier of the related SPDX element. + // Example: "SPDXRef-golang-github.comspf13-cobra-1.8.1-75c946" + RelatedSPDXElement string `json:"relatedSpdxElement"` + + // RelationshipType describes the type of relationship between the two elements. + // Such as "DEPENDS_ON", "DESCRIBES", "CONTAINS", etc., as defined by SPDX 2.3. + // Example: "DEPENDS_ON", "CONTAINS", "DESCRIBES", etc. + RelationshipType string `json:"relationshipType"` +} + +// SBOMInfo represents a software bill of materials (SBOM) using SPDX. +// SPDX is an open standard for SBOMs that +// identifies and catalogs components, licenses, copyrights, security +// references, and other metadata relating to software. +type SBOMInfo struct { + SPDXID *string `json:"SPDXID,omitempty"` + SPDXVersion *string `json:"spdxVersion,omitempty"` + CreationInfo *CreationInfo `json:"creationInfo,omitempty"` + + // Repo name + Name *string `json:"name,omitempty"` + DataLicense *string `json:"dataLicense,omitempty"` + DocumentDescribes []string `json:"documentDescribes,omitempty"` + DocumentNamespace *string `json:"documentNamespace,omitempty"` + + // List of packages dependencies + Packages []*RepoDependencies `json:"packages,omitempty"` + + // List of relationships between packages + Relationships []*SBOMRelationship `json:"relationships,omitempty"` +} + +func (s SBOM) String() string { + return Stringify(s) +} + +// GetSBOM fetches the software bill of materials for a repository. +// +// Deprecated: GitHub is retiring this endpoint on 11-13-2026 in favor of the +// asynchronous workflow. Use GenerateSBOM followed by FetchSBOM. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms?apiVersion=2022-11-28#export-a-software-bill-of-materials-sbom-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom +func (s *DependencyGraphService) GetSBOM(ctx context.Context, owner, repo string) (*SBOM, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var sbom *SBOM + resp, err := s.client.Do(req, &sbom) + if err != nil { + return nil, resp, err + } + + return sbom, resp, nil +} + +// SBOMGeneration represents the response to a request to generate +// a software bill of materials for a repository. +type SBOMGeneration struct { + // SBOMURL is the URL the generated SBOM can be fetched from once it's ready. + SBOMURL *string `json:"sbom_url,omitempty"` +} + +// GenerateSBOM requests the generation of a software bill of materials for a repository. +// +// Generation is asynchronous. Pass the UUID from the returned +// SBOMGeneration to FetchSBOM to retrieve the report once GitHub has built it. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms?apiVersion=2022-11-28#request-generation-of-a-software-bill-of-materials-sbom-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report +func (s *DependencyGraphService) GenerateSBOM(ctx context.Context, owner, repo string) (*SBOMGeneration, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom/generate-report", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var generation *SBOMGeneration + resp, err := s.client.Do(req, &generation) + if err != nil { + return nil, resp, err + } + + return generation, resp, nil +} + +// FetchSBOM downloads a software bill of materials or returns a redirect URL. +// +// sbomUUID is the final path segment of the SBOMURL returned by GenerateSBOM. +// +// If followRedirectsClient is nil, FetchSBOM returns the download URL in +// redirectURL and a nil sbom. Otherwise, it downloads the report and returns +// sbom with an empty redirectURL. +// +// Use http.DefaultClient or another client that does not add authentication +// headers when fetching the pre-signed download URL. +// +// While GitHub is generating the SBOM, FetchSBOM returns an *AcceptedError +// and status code 202. The request can be repeated later. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms?apiVersion=2022-11-28#fetch-a-software-bill-of-materials-sbom-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid} +func (s *DependencyGraphService) FetchSBOM(ctx context.Context, owner, repo, sbomUUID string, followRedirectsClient *http.Client) (sbom *SBOM, redirectURL string, resp *Response, err error) { + u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom/fetch-report/%v", owner, repo, sbomUUID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, "", nil, err + } + + loc, resp, err := s.client.bareDoUntilFound(req, 10) + if err != nil { + return nil, "", resp, err + } + defer resp.Body.Close() + + if loc == nil { + return nil, "", resp, fmt.Errorf("expected redirect, got status %v", resp.Status) + } + + if followRedirectsClient == nil { + return nil, loc.String(), resp, nil + } + + sbom, err = s.fetchSBOMFromURL(ctx, followRedirectsClient, loc.String()) + if err != nil { + return nil, "", resp, err + } + + return sbom, "", resp, nil +} + +// fetchSBOMFromURL downloads and decodes an SPDX report from a temporary download +// URL. +// +// The request must not carry s.client's credentials: the URL is pre-signed and +// its host rejects authenticated requests. +func (s *DependencyGraphService) fetchSBOMFromURL(ctx context.Context, followRedirectsClient *http.Client, url string) (*SBOM, error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, err + } + + resp, err := followRedirectsClient.Do(req) + if err != nil { + return nil, err + } + + // CheckResponse substitutes resp.Body with a re-readable copy on error responses, + // so capture the network body first: it is the one that must be closed. + origBody := resp.Body + defer origBody.Close() + + if err := CheckResponse(resp); err != nil { + return nil, err + } + + var info *SBOMInfo + if err := json.NewDecoder(resp.Body).Decode(&info); err != nil { + return nil, err + } + + return &SBOM{SBOM: info}, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/dependency_graph_snapshots.go b/vendor/github.com/google/go-github/v93/github/dependency_graph_snapshots.go similarity index 61% rename from vendor/github.com/google/go-github/v69/github/dependency_graph_snapshots.go rename to vendor/github.com/google/go-github/v93/github/dependency_graph_snapshots.go index 0606b9815..4354dda10 100644 --- a/vendor/github.com/google/go-github/v69/github/dependency_graph_snapshots.go +++ b/vendor/github.com/google/go-github/v93/github/dependency_graph_snapshots.go @@ -12,9 +12,18 @@ import ( // DependencyGraphSnapshotResolvedDependency represents a resolved dependency in a dependency graph snapshot. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotResolvedDependency struct { PackageURL *string `json:"package_url,omitempty"` + // User-defined metadata to store domain-specific information limited to 8 keys with scalar values. + // This metadata overrides auto-detected values from the package URL and GitHub's database. + // Common fields include: + // - "licenses": license information (e.g., "MIT", "Apache-2.0") + // - "name": package name + // - "version": package version + // - "manager": package manager (e.g., "npm", "pip", "maven") + // - "description": package description + Metadata map[string]any `json:"metadata,omitempty"` // Represents whether the dependency is requested directly by the manifest or is a dependency of another dependency. // Can have the following values: // - "direct": indicates that the dependency is requested directly by the manifest. @@ -30,54 +39,58 @@ type DependencyGraphSnapshotResolvedDependency struct { // DependencyGraphSnapshotJob represents the job that created the snapshot. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotJob struct { - Correlator *string `json:"correlator,omitempty"` - ID *string `json:"id,omitempty"` + Correlator string `json:"correlator"` + ID string `json:"id"` HTMLURL *string `json:"html_url,omitempty"` } // DependencyGraphSnapshotDetector represents a description of the detector used. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotDetector struct { - Name *string `json:"name,omitempty"` - Version *string `json:"version,omitempty"` - URL *string `json:"url,omitempty"` + Name string `json:"name"` + Version string `json:"version"` + URL string `json:"url"` } // DependencyGraphSnapshotManifestFile represents the file declaring the repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotManifestFile struct { SourceLocation *string `json:"source_location,omitempty"` } // DependencyGraphSnapshotManifest represents a collection of related dependencies declared in a file or representing a logical group of dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotManifest struct { - Name *string `json:"name,omitempty"` + Name string `json:"name"` File *DependencyGraphSnapshotManifestFile `json:"file,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` Resolved map[string]*DependencyGraphSnapshotResolvedDependency `json:"resolved,omitempty"` } -// DependencyGraphSnapshot represent a snapshot of a repository's dependencies. +// CreateDependencyGraphSnapshotRequest represents a request to create a snapshot of a repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository -type DependencyGraphSnapshot struct { +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository +// +//meta:schema request POST /repos/{owner}/{repo}/dependency-graph/snapshots +type CreateDependencyGraphSnapshotRequest struct { Version int `json:"version"` - Sha *string `json:"sha,omitempty"` - Ref *string `json:"ref,omitempty"` - Job *DependencyGraphSnapshotJob `json:"job,omitempty"` - Detector *DependencyGraphSnapshotDetector `json:"detector,omitempty"` - Scanned *Timestamp `json:"scanned,omitempty"` + SHA string `json:"sha"` + Ref string `json:"ref"` + Job DependencyGraphSnapshotJob `json:"job"` + Detector DependencyGraphSnapshotDetector `json:"detector"` + Scanned Timestamp `json:"scanned"` + Metadata map[string]any `json:"metadata,omitempty"` Manifests map[string]*DependencyGraphSnapshotManifest `json:"manifests,omitempty"` } // DependencyGraphSnapshotCreationData represents the dependency snapshot's creation result. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository type DependencyGraphSnapshotCreationData struct { ID int64 `json:"id"` CreatedAt *Timestamp `json:"created_at,omitempty"` @@ -92,19 +105,19 @@ type DependencyGraphSnapshotCreationData struct { // CreateSnapshot creates a new snapshot of a repository's dependencies. // -// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#create-a-snapshot-of-dependencies-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/dependency-graph/snapshots -func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, dependencyGraphSnapshot *DependencyGraphSnapshot) (*DependencyGraphSnapshotCreationData, *Response, error) { +func (s *DependencyGraphService) CreateSnapshot(ctx context.Context, owner, repo string, body CreateDependencyGraphSnapshotRequest) (*DependencyGraphSnapshotCreationData, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependency-graph/snapshots", owner, repo) - req, err := s.client.NewRequest("POST", url, dependencyGraphSnapshot) + req, err := s.client.NewRequest(ctx, "POST", url, body) if err != nil { return nil, nil, err } var snapshotCreationData *DependencyGraphSnapshotCreationData - resp, err := s.client.Do(ctx, req, &snapshotCreationData) + resp, err := s.client.Do(req, &snapshotCreationData) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/doc.go b/vendor/github.com/google/go-github/v93/github/doc.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/doc.go rename to vendor/github.com/google/go-github/v93/github/doc.go index 79d92d9ee..10fef426d 100644 --- a/vendor/github.com/google/go-github/v69/github/doc.go +++ b/vendor/github.com/google/go-github/v93/github/doc.go @@ -8,20 +8,25 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v69/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/v93/github" -Construct a new GitHub client, then use the various services on the client to +Construct a new GitHub client using [NewClient], then use the various services on the client to access different parts of the GitHub API. For example: - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } // list all organizations for user "willnorris" orgs, _, err := client.Organizations.List(ctx, "willnorris", nil) Some API methods have optional parameters that can be passed. For example: - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } // list public repositories for org "github" opt := &github.RepositoryListByOrgOptions{Type: "public"} @@ -29,34 +34,37 @@ Some API methods have optional parameters that can be passed. For example: The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at -https://docs.github.com/rest . +https://docs.github.com/rest?apiVersion=2022-11-28. -NOTE: Using the https://pkg.go.dev/context package, one can easily -pass cancelation signals and deadlines to various services of the client for -handling a request. In case there is no context available, then context.Background() +NOTE: Using the [context] package, one can easily +pass cancellation signals and deadlines to various services of the client for +handling a request. In case there is no context available, then [context.Background] can be used as a starting point. For more sample code snippets, head over to the https://github.com/google/go-github/tree/master/example directory. # Authentication -Use Client.WithAuthToken to configure your client to authenticate using an Oauth token +Use [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. - client := github.NewClient(nil).WithAuthToken("... your access token ...") + client, err := github.NewClient(github.WithAuthToken("... your access token ...")) + if err != nil { + // Handle error. + } -Note that when using an authenticated Client, all calls made by the client will +Note that when using an authenticated [Client], all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users. For API methods that require HTTP Basic Authentication, use the -BasicAuthTransport. +[BasicAuthTransport]. GitHub Apps authentication can be provided by the https://github.com/bradleyfalzon/ghinstallation package. It supports both authentication as an installation, using an installation access token, -and as an app, using a JWT. +and as an app, using a JWT. Use the [WithTransport] option to configure your client to use the appropriate transport. To authenticate as an installation: @@ -70,7 +78,10 @@ To authenticate as an installation: } // Use installation transport with client - client := github.NewClient(&http.Client{Transport: itr}) + client, err := github.NewClient(github.WithTransport(itr)) + if err != nil { + // Handle error. + } // Use client... } @@ -87,7 +98,10 @@ To authenticate as an app, using a JWT: } // Use app transport with client - client := github.NewClient(&http.Client{Transport: atr}) + client, err := github.NewClient(github.WithTransport(atr)) + if err != nil { + // Handle error. + } // Use client... } @@ -100,26 +114,26 @@ limited to 60 requests per hour, while authenticated clients can make up to clients are limited to 10 requests per minute, while authenticated clients can make up to 30 requests per minute. To receive the higher rate limit when making calls that are not issued on behalf of a user, -use UnauthenticatedRateLimitedTransport. +use [UnauthenticatedRateLimitedTransport]. -The returned Response.Rate value contains the rate limit information +The returned [Response].[Rate] value contains the rate limit information from the most recent API call. If a recent enough response isn't available, you can use RateLimits to fetch the most up-to-date rate limit data for the client. -To detect an API rate limit error, you can check if its type is *github.RateLimitError. -For secondary rate limits, you can check if its type is *github.AbuseRateLimitError: +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") } Learn more about GitHub rate limiting at -https://docs.github.com/rest/rate-limit . +https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28. # Accepted Status @@ -129,10 +143,10 @@ the GitHub side. Methods known to behave like this are documented specifying this behavior. To detect this condition of error, you can check if its type is -*github.AcceptedError: +*[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") } @@ -142,28 +156,29 @@ The GitHub REST API has good support for conditional HTTP requests via the ETag header which will help prevent you from burning through your rate limit, as well as help speed up your application. go-github does not handle conditional requests directly, but is instead designed to work with a -caching http.Transport. +caching [http.Transport]. -Typically, an RFC 7234 compliant HTTP cache such as https://github.com/gregjones/httpcache +Typically, an RFC 9111 compliant HTTP cache such as https://github.com/bartventer/httpcache is recommended. Alternatively, the https://github.com/bored-engineer/github-conditional-http-transport package relies on (undocumented) GitHub specific cache logic and is 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/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 -All structs for GitHub resources use pointer values for all non-repeated fields. -This allows distinguishing between unset fields and those set to a zero-value. -Helper functions have been provided to easily create these pointers for string, +Many resource and request structs use pointers for optional scalar fields. This +allows distinguishing between unset fields and those set to a zero-value. +Required fields such as [CreateRepositoryRequest.Name] use value types. +Use the new builtin to easily create these pointers for string, bool, and int values. For example: // create a new private repository named "foo" - repo := &github.Repository{ - Name: github.Ptr("foo"), - Private: github.Ptr(true), + repo := github.CreateRepositoryRequest{ + Name: "foo", + Private: new(true), } client.Repositories.Create(ctx, "", repo) @@ -173,12 +188,15 @@ Users who have worked with protocol buffers should find this pattern familiar. All requests for resource collections (repos, pull requests, issues, etc.) support pagination. Pagination options are described in the -github.ListOptions struct and passed to the list methods directly or as an +[ListOptions] struct and passed to the list methods directly or as an embedded type of a more specific list options struct (for example -github.PullRequestListOptions). Pages information is available via the -github.Response struct. +[PullRequestListOptions]). Pages information is available via the +[Response] struct. - client := github.NewClient(nil) + client, err := github.NewClient() + if err != nil { + // Handle error. + } opt := &github.RepositoryListByOrgOptions{ ListOptions: github.ListOptions{PerPage: 10}, diff --git a/vendor/github.com/google/go-github/v69/github/emojis.go b/vendor/github.com/google/go-github/v93/github/emojis.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/emojis.go rename to vendor/github.com/google/go-github/v93/github/emojis.go index b7a03dd98..0bf9ed143 100644 --- a/vendor/github.com/google/go-github/v69/github/emojis.go +++ b/vendor/github.com/google/go-github/v93/github/emojis.go @@ -14,17 +14,17 @@ type EmojisService service // List returns the emojis available to use on GitHub. // -// GitHub API docs: https://docs.github.com/rest/emojis/emojis#get-emojis +// GitHub API docs: https://docs.github.com/rest/emojis/emojis?apiVersion=2022-11-28#get-emojis // //meta:operation GET /emojis func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, error) { - req, err := s.client.NewRequest("GET", "emojis", nil) + req, err := s.client.NewRequest(ctx, "GET", "emojis", nil) if err != nil { return nil, nil, err } var emoji map[string]string - resp, err := s.client.Do(ctx, req, &emoji) + resp, err := s.client.Do(req, &emoji) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise.go b/vendor/github.com/google/go-github/v93/github/enterprise.go similarity index 94% rename from vendor/github.com/google/go-github/v69/github/enterprise.go rename to vendor/github.com/google/go-github/v93/github/enterprise.go index 2036f8bc7..f808a2926 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise.go @@ -8,5 +8,5 @@ package github // EnterpriseService provides access to the enterprise related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/enterprise-admin/ +// GitHub API docs: https://docs.github.com/rest/enterprise-admin?apiVersion=2022-11-28 type EnterpriseService service diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_actions_hosted_runners.go b/vendor/github.com/google/go-github/v93/github/enterprise_actions_hosted_runners.go new file mode 100644 index 000000000..7dbcc64d6 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_actions_hosted_runners.go @@ -0,0 +1,344 @@ +// 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" +) + +// ListHostedRunners lists all the GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-github-hosted-runners-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners +func (s *EnterpriseService) ListHostedRunners(ctx context.Context, enterprise string, opts *ListOptions) (*HostedRunners, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var runners *HostedRunners + resp, err := s.client.Do(req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil +} + +// CreateHostedRunner creates a GitHub-hosted runner for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#create-a-github-hosted-runner-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/hosted-runners +func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, body CreateHostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(&body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// GetHostedRunnerGitHubOwnedImages gets the list of GitHub-owned images available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-owned-images-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/github-owned +func (s *EnterpriseService) GetHostedRunnerGitHubOwnedImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/github-owned", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// GetHostedRunnerPartnerImages gets the list of partner images available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-partner-images-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/partner +func (s *EnterpriseService) GetHostedRunnerPartnerImages(ctx context.Context, enterprise string) (*HostedRunnerImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/partner", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunnerImages *HostedRunnerImages + resp, err := s.client.Do(req, &hostedRunnerImages) + if err != nil { + return nil, resp, err + } + + return hostedRunnerImages, resp, nil +} + +// GetHostedRunnerLimits gets the GitHub-hosted runners Static public IP Limits for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-limits-on-github-hosted-runners-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/limits +func (s *EnterpriseService) GetHostedRunnerLimits(ctx context.Context, enterprise string) (*HostedRunnerPublicIPLimits, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/limits", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var publicIPLimits *HostedRunnerPublicIPLimits + resp, err := s.client.Do(req, &publicIPLimits) + if err != nil { + return nil, resp, err + } + + return publicIPLimits, resp, nil +} + +// GetHostedRunnerMachineSpecs gets the list of machine specs available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-github-hosted-runners-machine-specs-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/machine-sizes +func (s *EnterpriseService) GetHostedRunnerMachineSpecs(ctx context.Context, enterprise string) (*HostedRunnerMachineSpecs, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/machine-sizes", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var machineSpecs *HostedRunnerMachineSpecs + resp, err := s.client.Do(req, &machineSpecs) + if err != nil { + return nil, resp, err + } + + return machineSpecs, resp, nil +} + +// GetHostedRunnerPlatforms gets list of platforms available for GitHub-hosted runners for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-platforms-for-github-hosted-runners-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/platforms +func (s *EnterpriseService) GetHostedRunnerPlatforms(ctx context.Context, enterprise string) (*HostedRunnerPlatforms, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/platforms", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var platforms *HostedRunnerPlatforms + resp, err := s.client.Do(req, &platforms) + if err != nil { + return nil, resp, err + } + + return platforms, resp, nil +} + +// GetHostedRunner gets a GitHub-hosted runner in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-a-github-hosted-runner-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) GetHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// UpdateHostedRunner updates a GitHub-hosted runner for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#update-a-github-hosted-runner-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, body UpdateHostedRunnerRequest) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// DeleteHostedRunner deletes GitHub-hosted runner from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-github-hosted-runner-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) DeleteHostedRunner(ctx context.Context, enterprise string, runnerID int64) (*HostedRunner, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var hostedRunner *HostedRunner + resp, err := s.client.Do(req, &hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// ListHostedRunnerCustomImages lists custom images for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-custom-images-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom +func (s *EnterpriseService) ListHostedRunnerCustomImages(ctx context.Context, enterprise string) (*HostedRunnerCustomImages, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom", enterprise) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var images *HostedRunnerCustomImages + resp, err := s.client.Do(req, &images) + if err != nil { + return nil, resp, err + } + + return images, resp, nil +} + +// GetHostedRunnerCustomImage gets a custom image definition for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-enterprise-custom-image-definition-for-github-actions-hosted-runners +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *EnterpriseService) GetHostedRunnerCustomImage(ctx context.Context, enterprise string, imageDefinitionID int64) (*HostedRunnerCustomImage, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var image *HostedRunnerCustomImage + resp, err := s.client.Do(req, &image) + if err != nil { + return nil, resp, err + } + + return image, resp, nil +} + +// DeleteHostedRunnerCustomImage deletes a custom image from the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-a-custom-image-from-the-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id} +func (s *EnterpriseService) DeleteHostedRunnerCustomImage(ctx context.Context, enterprise string, imageDefinitionID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListHostedRunnerCustomImageVersions lists image versions of a custom image for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#list-image-versions-of-a-custom-image-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions +func (s *EnterpriseService) ListHostedRunnerCustomImageVersions(ctx context.Context, enterprise string, imageDefinitionID int64) (*HostedRunnerCustomImageVersions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions", enterprise, imageDefinitionID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions *HostedRunnerCustomImageVersions + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// GetHostedRunnerCustomImageVersion gets an image version of a custom image for GitHub-hosted runners in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#get-an-image-version-of-an-enterprise-custom-image-for-github-actions-hosted-runners +// +//meta:operation GET /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *EnterpriseService) GetHostedRunnerCustomImageVersion(ctx context.Context, enterprise string, imageDefinitionID int64, version string) (*HostedRunnerCustomImageVersion, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions/%v", enterprise, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var imageVersion *HostedRunnerCustomImageVersion + resp, err := s.client.Do(req, &imageVersion) + if err != nil { + return nil, resp, err + } + + return imageVersion, resp, nil +} + +// DeleteHostedRunnerCustomImageVersion deletes an image version of a custom image from the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/hosted-runners?apiVersion=2022-11-28#delete-an-image-version-of-custom-image-from-the-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/hosted-runners/images/custom/{image_definition_id}/versions/{version} +func (s *EnterpriseService) DeleteHostedRunnerCustomImageVersion(ctx context.Context, enterprise string, imageDefinitionID int64, version string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/images/custom/%v/versions/%v", enterprise, imageDefinitionID, version) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_actions_runner_groups.go b/vendor/github.com/google/go-github/v93/github/enterprise_actions_runner_groups.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/enterprise_actions_runner_groups.go rename to vendor/github.com/google/go-github/v93/github/enterprise_actions_runner_groups.go index f171df757..871fd0224 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_actions_runner_groups.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/json" "fmt" ) @@ -24,6 +25,8 @@ type EnterpriseRunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedOrganizationsURL *string `json:"selected_organizations_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"` @@ -39,7 +42,7 @@ type EnterpriseRunnerGroups struct { // CreateEnterpriseRunnerGroupRequest represents a request to create a Runner group for an enterprise. type CreateEnterpriseRunnerGroupRequest struct { - Name *string `json:"name,omitempty"` + Name string `json:"name"` Visibility *string `json:"visibility,omitempty"` // List of organization IDs that can access the runner group. SelectedOrganizationIDs []int64 `json:"selected_organization_ids,omitempty"` @@ -51,6 +54,8 @@ type CreateEnterpriseRunnerGroupRequest 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"` } // UpdateEnterpriseRunnerGroupRequest represents a request to update a Runner group for an enterprise. @@ -60,6 +65,25 @@ type UpdateEnterpriseRunnerGroupRequest 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"` + + // If true, send a null network_configuration_id to remove the network configuration. + // This takes precedence over NetworkConfigurationID. + RemoveNetworkConfiguration bool `json:"-"` +} + +// MarshalJSON implements the json.Marshaler interface. +func (r UpdateEnterpriseRunnerGroupRequest) MarshalJSON() ([]byte, error) { + type alias UpdateEnterpriseRunnerGroupRequest + if !r.RemoveNetworkConfiguration { + return json.Marshal(alias(r)) + } + return json.Marshal(&struct { + alias + NetworkConfigurationID *string `json:"network_configuration_id"` + }{ + alias: alias(r), + }) } // SetOrgAccessRunnerGroupRequest represents a request to replace the list of organizations @@ -79,7 +103,7 @@ type ListEnterpriseRunnerGroupOptions struct { // ListRunnerGroups lists all self-hosted runner groups configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) (*EnterpriseRunnerGroups, *Response, error) { @@ -89,13 +113,13 @@ func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := &EnterpriseRunnerGroups{} - resp, err := s.client.Do(ctx, req, &groups) + var groups *EnterpriseRunnerGroups + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -105,18 +129,18 @@ func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise str // GetEnterpriseRunnerGroup gets a specific self-hosted runner group for an enterprise using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -126,34 +150,34 @@ func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterp // DeleteEnterpriseRunnerGroup deletes a self-hosted runner group from an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CreateEnterpriseRunnerGroup creates a new self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runner-groups -func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, createReq CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { +func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, body CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) - req, err := s.client.NewRequest("POST", u, createReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -163,18 +187,18 @@ func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, ent // UpdateEnterpriseRunnerGroup updates a self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} -func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, updateReq UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { +func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, body UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) - req, err := s.client.NewRequest("PATCH", u, updateReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - runnerGroup := new(EnterpriseRunnerGroup) - resp, err := s.client.Do(ctx, req, runnerGroup) + var runnerGroup *EnterpriseRunnerGroup + resp, err := s.client.Do(req, &runnerGroup) if err != nil { return nil, resp, err } @@ -184,7 +208,7 @@ func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, ent // ListOrganizationAccessRunnerGroup lists the organizations with access to a self-hosted runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*ListOrganizations, *Response, error) { @@ -194,13 +218,13 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - orgs := &ListOrganizations{} - resp, err := s.client.Do(ctx, req, &orgs) + var orgs *ListOrganizations + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -211,57 +235,57 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex // SetOrganizationAccessRunnerGroup replaces the list of organizations that have access to a self-hosted runner group configured in an enterprise // with a new List of organizations. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations -func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, ids SetOrgAccessRunnerGroupRequest) (*Response, error) { +func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, body SetOrgAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddOrganizationAccessRunnerGroup adds an organization to the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) AddOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveOrganizationAccessRunnerGroup removes an organization from the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) RemoveOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListRunnerGroupRunners lists self-hosted runners that are in a specific enterprise group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { @@ -271,13 +295,13 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -288,49 +312,49 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an enterprise runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners -func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { +func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, body SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) - req, err := s.client.NewRequest("PUT", u, ids) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) AddRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an enterprise. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) RemoveRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_actions_runners.go b/vendor/github.com/google/go-github/v93/github/enterprise_actions_runners.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/enterprise_actions_runners.go rename to vendor/github.com/google/go-github/v93/github/enterprise_actions_runners.go index fa345aea8..732dbcf5a 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_actions_runners.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_actions_runners.go @@ -12,18 +12,18 @@ import ( // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-runner-applications-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners/downloads func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, enterprise string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/downloads", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rads []*RunnerApplicationDownload - resp, err := s.client.Do(ctx, req, &rads) + resp, err := s.client.Do(req, &rads) if err != nil { return nil, resp, err } @@ -31,21 +31,21 @@ func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, return rads, resp, nil } -// GenerateEnterpriseJITConfig generates a just-in-time configuration for an enterprise. +// CreateJITConfig creates a just-in-time configuration for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runners/generate-jitconfig -func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { +func (s *EnterpriseService) CreateJITConfig(ctx context.Context, enterprise string, body CreateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/generate-jitconfig", enterprise) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - jitConfig := new(JITRunnerConfig) - resp, err := s.client.Do(ctx, req, jitConfig) + var jitConfig *JITRunnerConfig + resp, err := s.client.Do(req, &jitConfig) if err != nil { return nil, resp, err } @@ -55,19 +55,19 @@ func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, ent // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-enterprise // //meta:operation POST /enterprises/{enterprise}/actions/runners/registration-token func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterprise string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/registration-token", enterprise) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - registrationToken := new(RegistrationToken) - resp, err := s.client.Do(ctx, req, registrationToken) + var registrationToken *RegistrationToken + resp, err := s.client.Do(req, ®istrationToken) if err != nil { return nil, resp, err } @@ -75,9 +75,9 @@ 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 +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListRunnersOptions) (*Runners, *Response, error) { @@ -87,13 +87,13 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runners := &Runners{} - resp, err := s.client.Do(ctx, req, &runners) + var runners *Runners + resp, err := s.client.Do(req, &runners) if err != nil { return nil, resp, err } @@ -103,18 +103,18 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, // GetRunner gets a specific self-hosted runner configured in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#get-a-self-hosted-runner-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/actions/runners/{runner_id} func (s *EnterpriseService) GetRunner(ctx context.Context, enterprise string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - runner := new(Runner) - resp, err := s.client.Do(ctx, req, runner) + var runner *Runner + resp, err := s.client.Do(req, &runner) if err != nil { return nil, resp, err } @@ -124,16 +124,16 @@ func (s *EnterpriseService) GetRunner(ctx context.Context, enterprise string, ru // RemoveRunner forces the removal of a self-hosted runner from an enterprise using the runner id. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#delete-a-self-hosted-runner-from-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/actions/runners/{runner_id} func (s *EnterpriseService) RemoveRunner(ctx context.Context, enterprise string, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_app_installation.go b/vendor/github.com/google/go-github/v93/github/enterprise_app_installation.go new file mode 100644 index 000000000..1877e9285 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_app_installation.go @@ -0,0 +1,268 @@ +// 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*InstallableOrganization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repos []*AccessibleRepository + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var installation []*Installation + resp, err := s.client.Do(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?apiVersion=2022-11-28#install-a-github-app-on-an-enterprise-owned-organization +// +//meta:operation POST /enterprises/{enterprise}/apps/organizations/{org}/installations +func (s *EnterpriseService) InstallApp(ctx context.Context, enterprise, org string, body InstallAppRequest) (*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations", enterprise, org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var installation *Installation + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AppInstallationRepositoriesRequest specifies the parameters for +// EnterpriseService.AddRepositoriesToAppInstallation and +// EnterpriseService.RemoveRepositoriesFromAppInstallation. +type AppInstallationRepositoriesRequest struct { + // Repository names to add to or remove from the installation. + Repositories []string `json:"repositories"` +} + +// UpdateAppInstallationRepositoriesRequest specifies the parameters for +// EnterpriseService.UpdateAppInstallationRepositories. +type UpdateAppInstallationRepositoriesRequest struct { + // Can be "all" or "selected". + RepositorySelection string `json:"repository_selection"` + // Repository names to grant the installation access to. Only required + // when RepositorySelection is "selected". + Repositories []string `json:"repositories,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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(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?apiVersion=2022-11-28#toggle-installation-repository-access-between-selected-and-all-repositories +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories +func (s *EnterpriseService) UpdateAppInstallationRepositories(ctx context.Context, enterprise, org string, installationID int64, body UpdateAppInstallationRepositoriesRequest) (*Installation, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var r *Installation + resp, err := s.client.Do(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?apiVersion=2022-11-28#grant-repository-access-to-an-organization-installation +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/add +func (s *EnterpriseService) AddRepositoriesToAppInstallation(ctx context.Context, enterprise, org string, installationID int64, body AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/add", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(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?apiVersion=2022-11-28#remove-repository-access-from-an-organization-installation +// +//meta:operation PATCH /enterprises/{enterprise}/apps/organizations/{org}/installations/{installation_id}/repositories/remove +func (s *EnterpriseService) RemoveRepositoriesFromAppInstallation(ctx context.Context, enterprise, org string, installationID int64, body AppInstallationRepositoriesRequest) ([]*AccessibleRepository, *Response, error) { + u := fmt.Sprintf("enterprises/%v/apps/organizations/%v/installations/%v/repositories/remove", enterprise, org, installationID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var r []*AccessibleRepository + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_audit_log.go b/vendor/github.com/google/go-github/v93/github/enterprise_audit_log.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/enterprise_audit_log.go rename to vendor/github.com/google/go-github/v93/github/enterprise_audit_log.go index 058a7d177..afac46235 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_audit_log.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_audit_log.go @@ -12,7 +12,7 @@ import ( // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#get-the-audit-log-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/audit-log func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { @@ -22,13 +22,13 @@ func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var auditEntries []*AuditEntry - resp, err := s.client.Do(ctx, req, &auditEntries) + resp, err := s.client.Do(req, &auditEntries) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_audit_log_stream.go b/vendor/github.com/google/go-github/v93/github/enterprise_audit_log_stream.go new file mode 100644 index 000000000..72e377c9d --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_audit_log_stream.go @@ -0,0 +1,287 @@ +// 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" +) + +// AuditLogStream represents an audit log stream configuration for an enterprise. +type AuditLogStream struct { + ID int64 `json:"id"` + StreamType string `json:"stream_type"` + StreamDetails string `json:"stream_details"` + Enabled bool `json:"enabled"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` + PausedAt *Timestamp `json:"paused_at,omitempty"` +} + +// AuditLogStreamConfig represents a configuration for creating or updating an audit log stream. +type AuditLogStreamConfig struct { + Enabled bool `json:"enabled"` + StreamType string `json:"stream_type"` + VendorSpecific AuditLogStreamVendorConfig `json:"vendor_specific"` +} + +// AuditLogStreamVendorConfig is a sealed marker interface for vendor-specific audit log +// stream configurations. Only this package can define implementations. +type AuditLogStreamVendorConfig interface { + isAuditLogStreamVendorConfig() +} + +// AuditLogStreamKey represents the public key used to encrypt secrets for audit log streaming. +type AuditLogStreamKey struct { + KeyID string `json:"key_id"` + Key string `json:"key"` +} + +// AzureBlobConfig represents vendor-specific config for Azure Blob Storage. +type AzureBlobConfig struct { + KeyID string `json:"key_id"` + EncryptedSASURL string `json:"encrypted_sas_url"` + Container string `json:"container"` +} + +// AzureHubConfig represents vendor-specific config for Azure Event Hubs. +type AzureHubConfig struct { + Name string `json:"name"` + EncryptedConnstring string `json:"encrypted_connstring"` + KeyID string `json:"key_id"` +} + +// AmazonS3OIDCConfig represents vendor-specific config for Amazon S3 with OIDC authentication. +type AmazonS3OIDCConfig struct { + Bucket string `json:"bucket"` + Region string `json:"region"` + KeyID string `json:"key_id"` + AuthenticationType string `json:"authentication_type"` // Value: "oidc" + ArnRole string `json:"arn_role"` +} + +// AmazonS3AccessKeysConfig represents vendor-specific config for Amazon S3 with access key authentication. +type AmazonS3AccessKeysConfig struct { + Bucket string `json:"bucket"` + Region string `json:"region"` + KeyID string `json:"key_id"` + AuthenticationType string `json:"authentication_type"` // Value: "access_keys" + EncryptedSecretKey string `json:"encrypted_secret_key"` + EncryptedAccessKeyID string `json:"encrypted_access_key_id"` +} + +// SplunkConfig represents vendor-specific config for Splunk. +type SplunkConfig struct { + Domain string `json:"domain"` + Port uint16 `json:"port"` + KeyID string `json:"key_id"` + EncryptedToken string `json:"encrypted_token"` + SSLVerify bool `json:"ssl_verify"` +} + +// HecConfig represents vendor-specific config for an HTTPS Event Collector (HEC) endpoint. +type HecConfig struct { + Domain string `json:"domain"` + Port uint16 `json:"port"` + KeyID string `json:"key_id"` + EncryptedToken string `json:"encrypted_token"` + Path string `json:"path"` + SSLVerify bool `json:"ssl_verify"` +} + +// GoogleCloudConfig represents vendor-specific config for Google Cloud Storage. +type GoogleCloudConfig struct { + Bucket string `json:"bucket"` + KeyID string `json:"key_id"` + EncryptedJSONCredentials string `json:"encrypted_json_credentials"` +} + +// DatadogConfig represents vendor-specific config for Datadog. +type DatadogConfig struct { + EncryptedToken string `json:"encrypted_token"` + Site string `json:"site"` // One of: US, US3, US5, EU1, US1-FED, AP1 + KeyID string `json:"key_id"` +} + +// Implement the sealed marker interface for all vendor config types. +func (*AzureBlobConfig) isAuditLogStreamVendorConfig() {} +func (*AzureHubConfig) isAuditLogStreamVendorConfig() {} +func (*AmazonS3OIDCConfig) isAuditLogStreamVendorConfig() {} +func (*AmazonS3AccessKeysConfig) isAuditLogStreamVendorConfig() {} +func (*SplunkConfig) isAuditLogStreamVendorConfig() {} +func (*HecConfig) isAuditLogStreamVendorConfig() {} +func (*GoogleCloudConfig) isAuditLogStreamVendorConfig() {} +func (*DatadogConfig) isAuditLogStreamVendorConfig() {} + +// NewAzureBlobStreamConfig returns an AuditLogStreamConfig for Azure Blob Storage. +func NewAzureBlobStreamConfig(enabled bool, cfg *AzureBlobConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Azure Blob Storage", VendorSpecific: cfg} +} + +// NewAzureHubStreamConfig returns an AuditLogStreamConfig for Azure Event Hubs. +func NewAzureHubStreamConfig(enabled bool, cfg *AzureHubConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Azure Event Hubs", VendorSpecific: cfg} +} + +// NewAmazonS3OIDCStreamConfig returns an AuditLogStreamConfig for Amazon S3 with OIDC auth. +func NewAmazonS3OIDCStreamConfig(enabled bool, cfg *AmazonS3OIDCConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Amazon S3", VendorSpecific: cfg} +} + +// NewAmazonS3AccessKeysStreamConfig returns an AuditLogStreamConfig for Amazon S3 with access key auth. +func NewAmazonS3AccessKeysStreamConfig(enabled bool, cfg *AmazonS3AccessKeysConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Amazon S3", VendorSpecific: cfg} +} + +// NewSplunkStreamConfig returns an AuditLogStreamConfig for Splunk. +func NewSplunkStreamConfig(enabled bool, cfg *SplunkConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Splunk", VendorSpecific: cfg} +} + +// NewHecStreamConfig returns an AuditLogStreamConfig for an HTTPS Event Collector endpoint. +func NewHecStreamConfig(enabled bool, cfg *HecConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "HTTPS Event Collector", VendorSpecific: cfg} +} + +// NewGoogleCloudStreamConfig returns an AuditLogStreamConfig for Google Cloud Storage. +func NewGoogleCloudStreamConfig(enabled bool, cfg *GoogleCloudConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Google Cloud Storage", VendorSpecific: cfg} +} + +// NewDatadogStreamConfig returns an AuditLogStreamConfig for Datadog. +func NewDatadogStreamConfig(enabled bool, cfg *DatadogConfig) *AuditLogStreamConfig { + return &AuditLogStreamConfig{Enabled: enabled, StreamType: "Datadog", VendorSpecific: cfg} +} + +// GetAuditLogStreamKey retrieves the public key used to encrypt secrets for audit log streaming. +// Credentials must be encrypted with this key before being submitted via CreateAuditLogStream +// or UpdateAuditLogStream. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#get-the-audit-log-stream-key-for-encrypting-secrets +// +//meta:operation GET /enterprises/{enterprise}/audit-log/stream-key +func (s *EnterpriseService) GetAuditLogStreamKey(ctx context.Context, enterprise string) (*AuditLogStreamKey, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/stream-key", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var key *AuditLogStreamKey + resp, err := s.client.Do(req, &key) + if err != nil { + return nil, resp, err + } + + return key, resp, nil +} + +// ListAuditLogStreams lists the audit log stream configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#list-audit-log-stream-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/audit-log/streams +func (s *EnterpriseService) ListAuditLogStreams(ctx context.Context, enterprise string) ([]*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var streams []*AuditLogStream + resp, err := s.client.Do(req, &streams) + if err != nil { + return nil, resp, err + } + + return streams, resp, nil +} + +// GetAuditLogStream gets a single audit log stream configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#list-one-audit-log-streaming-configuration-via-a-stream-id +// +//meta:operation GET /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) GetAuditLogStream(ctx context.Context, enterprise string, streamID int64) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// CreateAuditLogStream creates an audit log streaming configuration for an enterprise. +// Credentials in the config must be encrypted using the key returned by GetAuditLogStreamKey. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#create-an-audit-log-streaming-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/audit-log/streams +func (s *EnterpriseService) CreateAuditLogStream(ctx context.Context, enterprise string, body AuditLogStreamConfig) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// UpdateAuditLogStream updates an existing audit log stream configuration for an enterprise. +// Credentials in the config must be encrypted using the key returned by GetAuditLogStreamKey. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#update-an-existing-audit-log-stream-configuration +// +//meta:operation PUT /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) UpdateAuditLogStream(ctx context.Context, enterprise string, streamID int64, body AuditLogStreamConfig) (*AuditLogStream, *Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var stream *AuditLogStream + resp, err := s.client.Do(req, &stream) + if err != nil { + return nil, resp, err + } + + return stream, resp, nil +} + +// DeleteAuditLogStream deletes an audit log stream configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log?apiVersion=2022-11-28#delete-an-audit-log-streaming-configuration-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/audit-log/streams/{stream_id} +func (s *EnterpriseService) DeleteAuditLogStream(ctx context.Context, enterprise string, streamID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/audit-log/streams/%v", enterprise, streamID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_billing.go b/vendor/github.com/google/go-github/v93/github/enterprise_billing.go new file mode 100644 index 000000000..4f16fd886 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_billing.go @@ -0,0 +1,227 @@ +// 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" +) + +// EnterpriseUsageReportOptions specifies optional parameters for the EnterpriseService.GetUsageReport method. +type EnterpriseUsageReportOptions struct { + Year int `url:"year,omitempty"` + Month int `url:"month,omitempty"` + Day int `url:"day,omitempty"` + CostCenterID string `url:"cost_center_id,omitempty"` +} + +// EnterprisePremiumRequestUsageReportOptions specifies optional parameters for the EnterpriseService.GetPremiumRequestUsageReport and EnterpriseService.GetAICreditUsage methods. +type EnterprisePremiumRequestUsageReportOptions struct { + EnterpriseUsageReportOptions + Organization string `url:"organization,omitempty"` + User string `url:"user,omitempty"` + Model string `url:"model,omitempty"` + Product string `url:"product,omitempty"` +} + +// EnterpriseUsageSummaryOptions specifies optional parameters for the EnterpriseService.GetUsageSummary method. +type EnterpriseUsageSummaryOptions struct { + EnterpriseUsageReportOptions + Organization string `url:"organization,omitempty"` + Repository string `url:"repository,omitempty"` + Product string `url:"product,omitempty"` + SKU string `url:"sku,omitempty"` +} + +// EnterpriseUsageTimePeriod represents a time period used in aggregated enterprise billing reports. +type EnterpriseUsageTimePeriod struct { + Year int `json:"year"` + Month *int `json:"month,omitempty"` + Day *int `json:"day,omitempty"` +} + +// EnterpriseAggregatedUsageItem represents a single usage line item in an enterprise billing premium request or AI credit report. +type EnterpriseAggregatedUsageItem 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"` +} + +// EnterpriseAggregatedUsageReport represents the aggregated billing usage report response for the premium request and AI credit endpoints. +type EnterpriseAggregatedUsageReport struct { + TimePeriod EnterpriseUsageTimePeriod `json:"timePeriod"` + Enterprise string `json:"enterprise"` + Organization *string `json:"organization,omitempty"` + User *string `json:"user,omitempty"` + Product *string `json:"product,omitempty"` + Model *string `json:"model,omitempty"` + CostCenter *BillingCostCenter `json:"costCenter,omitempty"` + UsageItems []*EnterpriseAggregatedUsageItem `json:"usageItems"` +} + +// EnterpriseUsageSummaryItem represents a single usage line item in an enterprise billing usage summary report. +type EnterpriseUsageSummaryItem struct { + Product string `json:"product"` + SKU string `json:"sku"` + 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"` +} + +// EnterpriseUsageSummaryReport represents the billing usage summary report response for the EnterpriseService.GetUsageSummary endpoint. +type EnterpriseUsageSummaryReport struct { + TimePeriod EnterpriseUsageTimePeriod `json:"timePeriod"` + Enterprise string `json:"enterprise"` + Organization *string `json:"organization,omitempty"` + Repository *string `json:"repository,omitempty"` + Product *string `json:"product,omitempty"` + SKU *string `json:"sku,omitempty"` + CostCenter *BillingCostCenter `json:"costCenter,omitempty"` + UsageItems []*EnterpriseUsageSummaryItem `json:"usageItems"` +} + +// BillingCostCenter represents a cost center reference embedded in enterprise billing usage reports. +type BillingCostCenter struct { + ID string `json:"id"` + Name string `json:"name"` +} + +// EnterpriseUsageItem represents a single usage line item in an enterprise billing platform report. +type EnterpriseUsageItem 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"` + OrganizationName string `json:"organizationName"` + RepositoryName *string `json:"repositoryName,omitempty"` +} + +// EnterpriseUsageReport represents the enterprise billing usage report response. +type EnterpriseUsageReport struct { + UsageItems []*EnterpriseUsageItem `json:"usageItems,omitempty"` +} + +// GetUsageReport returns a report of the total usage for an enterprise using the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-report-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/usage +func (s *EnterpriseService) GetUsageReport(ctx context.Context, enterprise string, opts *EnterpriseUsageReportOptions) (*EnterpriseUsageReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/usage", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *EnterpriseUsageReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetUsageSummary returns a summary report of usage for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/usage?apiVersion=2022-11-28#get-billing-usage-summary-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/usage/summary +func (s *EnterpriseService) GetUsageSummary(ctx context.Context, enterprise string, opts *EnterpriseUsageSummaryOptions) (*EnterpriseUsageSummaryReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/usage/summary", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *EnterpriseUsageSummaryReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetPremiumRequestUsageReport returns a report of the premium request usage for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/usage?apiVersion=2022-11-28#get-billing-premium-request-usage-report-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/premium_request/usage +func (s *EnterpriseService) GetPremiumRequestUsageReport(ctx context.Context, enterprise string, opts *EnterprisePremiumRequestUsageReportOptions) (*EnterpriseAggregatedUsageReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/premium_request/usage", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *EnterpriseAggregatedUsageReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} + +// GetAICreditUsage returns a report of the AI credit usage for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/usage?apiVersion=2022-11-28#get-billing-ai-credit-usage-report-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/ai_credit/usage +func (s *EnterpriseService) GetAICreditUsage(ctx context.Context, enterprise string, opts *EnterprisePremiumRequestUsageReportOptions) (*EnterpriseAggregatedUsageReport, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/ai_credit/usage", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var report *EnterpriseAggregatedUsageReport + resp, err := s.client.Do(req, &report) + if err != nil { + return nil, resp, err + } + + return report, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_billing_cost_centers.go b/vendor/github.com/google/go-github/v93/github/enterprise_billing_cost_centers.go new file mode 100644 index 000000000..824902604 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var costCenters *CostCenters + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-a-new-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) CreateCostCenter(ctx context.Context, enterprise string, body CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var result *CostCenter + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var costCenter *CostCenter + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-a-cost-center +// +//meta:operation PATCH /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) UpdateCostCenter(ctx context.Context, enterprise, costCenterID string, body CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var result *CostCenter + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var result *DeleteCostCenterResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#add-resources-to-a-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) AddResourcesToCostCenter(ctx context.Context, enterprise, costCenterID string, body CostCenterResourceRequest) (*AddResourcesToCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var result *AddResourcesToCostCenterResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, resources) + if err != nil { + return nil, nil, err + } + + var result *RemoveResourcesFromCostCenterResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_budgets.go b/vendor/github.com/google/go-github/v93/github/enterprise_budgets.go new file mode 100644 index 000000000..32fc9ea8a --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_budgets.go @@ -0,0 +1,271 @@ +// 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" +) + +// BudgetScope constants represent the scope of the budget. +const ( + BudgetScopeEnterprise = "enterprise" + BudgetScopeOrganization = "organization" + BudgetScopeRepository = "repository" + BudgetScopeCostCenter = "cost_center" +) + +// BudgetType constants represent the type of pricing for the budget. +const ( + BudgetTypeProductPricing = "ProductPricing" + BudgetTypeSkuPricing = "SkuPricing" +) + +// EnterpriseBudgetAlerting represents alerting settings for a GitHub enterprise budget. +type EnterpriseBudgetAlerting struct { + WillAlert *bool `json:"will_alert,omitempty"` + AlertRecipients []string `json:"alert_recipients,omitempty"` +} + +// EnterpriseBudget represents a GitHub enterprise budget. +type EnterpriseBudget struct { + ID *string `json:"id,omitempty"` + BudgetType *string `json:"budget_type,omitempty"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` + BudgetScope *string `json:"budget_scope,omitempty"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetAmount *int `json:"budget_amount,omitempty"` + PreventFurtherUsage *bool `json:"prevent_further_usage,omitempty"` + BudgetAlerting *EnterpriseBudgetAlerting `json:"budget_alerting,omitempty"` +} + +func (b EnterpriseBudget) String() string { + return Stringify(b) +} + +// EnterpriseListBudgets represents a collection of GitHub enterprise budgets. +type EnterpriseListBudgets struct { + Budgets []*EnterpriseBudget `json:"budgets"` + HasNextPage *bool `json:"has_next_page,omitempty"` + TotalCount *int `json:"total_count,omitempty"` +} + +// EnterpriseListBudgetsOptions specifies the optional parameters to the +// EnterpriseService.ListBudgets method. +type EnterpriseListBudgetsOptions struct { + Scope string `url:"scope,omitempty"` + User string `url:"user,omitempty"` + + ListOptions +} + +// EnterpriseBudgetUserState represents the budget status and consumption of an individual user. +type EnterpriseBudgetUserState struct { + User *string `json:"user,omitempty"` + ConsumedAmount float64 `json:"consumed_amount"` + TargetAmount float64 `json:"target_amount"` + OverrideBudgetID *string `json:"override_budget_id,omitempty"` +} + +func (u EnterpriseBudgetUserState) String() string { + return Stringify(u) +} + +// EnterpriseBudgetUserStates represents the response when retrieving user states for a budget. +type EnterpriseBudgetUserStates struct { + UserStates []*EnterpriseBudgetUserState `json:"user_states"` + HasNextPage bool `json:"has_next_page"` + TotalCount int `json:"total_count"` +} + +func (u EnterpriseBudgetUserStates) String() string { + return Stringify(u) +} + +// EnterpriseGetUserStatesOptions specifies the optional parameters to the +// EnterpriseService.GetUserStatesForBudget method. +type EnterpriseGetUserStatesOptions struct { + SortOrder int `url:"sort_order,omitempty"` + User string `url:"user,omitempty"` + ThresholdLowerBound float64 `url:"threshold_lower_bound,omitempty"` + ThresholdUpperBound float64 `url:"threshold_upper_bound,omitempty"` + + ListOptions +} + +// EnterpriseCreateBudget represents the payload to create a GitHub enterprise budget. +type EnterpriseCreateBudget struct { + BudgetAmount int `json:"budget_amount"` + PreventFurtherUsage bool `json:"prevent_further_usage"` + BudgetAlerting EnterpriseBudgetAlerting `json:"budget_alerting"` + BudgetScope string `json:"budget_scope"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetType string `json:"budget_type"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` +} + +// EnterpriseUpdateBudget represents the payload to update a GitHub enterprise budget. +type EnterpriseUpdateBudget struct { + BudgetAmount *int `json:"budget_amount,omitempty"` + PreventFurtherUsage *bool `json:"prevent_further_usage,omitempty"` + BudgetAlerting *EnterpriseBudgetAlerting `json:"budget_alerting,omitempty"` + BudgetScope *string `json:"budget_scope,omitempty"` + BudgetEntityName *string `json:"budget_entity_name,omitempty"` + BudgetType *string `json:"budget_type,omitempty"` + BudgetProductSKU *string `json:"budget_product_sku,omitempty"` +} + +// EnterpriseCreateOrUpdateBudgetResponse represents the response when creating or updating a budget. +type EnterpriseCreateOrUpdateBudgetResponse struct { + Message string `json:"message"` + Budget *EnterpriseBudget `json:"budget"` +} + +// EnterpriseDeleteBudgetResponse represents the response when deleting a budget. +type EnterpriseDeleteBudgetResponse struct { + Message string `json:"message"` + ID string `json:"id"` +} + +// ListBudgets gets all budgets for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#get-all-budgets +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/budgets +func (s *EnterpriseService) ListBudgets(ctx context.Context, enterprise string, opts *EnterpriseListBudgetsOptions) (*EnterpriseListBudgets, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var budgets *EnterpriseListBudgets + resp, err := s.client.Do(req, &budgets) + if err != nil { + return nil, resp, err + } + + return budgets, resp, nil +} + +// GetUserStatesForBudget gets user states for a multi-user budget in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#get-user-states-for-a-multi-user-budget +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/budgets/{budget_id}/user-states +func (s *EnterpriseService) GetUserStatesForBudget(ctx context.Context, enterprise, budgetID string, opts *EnterpriseGetUserStatesOptions) (*EnterpriseBudgetUserStates, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v/user-states", enterprise, budgetID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var userStates *EnterpriseBudgetUserStates + resp, err := s.client.Do(req, &userStates) + if err != nil { + return nil, resp, err + } + + return userStates, resp, nil +} + +// CreateBudget creates a new budget for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#create-a-budget +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/budgets +func (s *EnterpriseService) CreateBudget(ctx context.Context, enterprise string, body EnterpriseCreateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var createBudgetResponse *EnterpriseCreateOrUpdateBudgetResponse + resp, err := s.client.Do(req, &createBudgetResponse) + if err != nil { + return nil, resp, err + } + + return createBudgetResponse, resp, nil +} + +// GetBudget gets a budget by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#get-a-budget-by-id +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) GetBudget(ctx context.Context, enterprise, budgetID string) (*EnterpriseBudget, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var budget *EnterpriseBudget + resp, err := s.client.Do(req, &budget) + if err != nil { + return nil, resp, err + } + + return budget, resp, nil +} + +// UpdateBudget updates an existing budget for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#update-a-budget +// +//meta:operation PATCH /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) UpdateBudget(ctx context.Context, enterprise, budgetID string, body EnterpriseUpdateBudget) (*EnterpriseCreateOrUpdateBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var updateBudgetResponse *EnterpriseCreateOrUpdateBudgetResponse + resp, err := s.client.Do(req, &updateBudgetResponse) + if err != nil { + return nil, resp, err + } + + return updateBudgetResponse, resp, nil +} + +// DeleteBudget deletes a budget by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/budgets?apiVersion=2022-11-28#delete-a-budget +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/budgets/{budget_id} +func (s *EnterpriseService) DeleteBudget(ctx context.Context, enterprise, budgetID string) (*EnterpriseDeleteBudgetResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/budgets/%v", enterprise, budgetID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var deleteBudgetResponse *EnterpriseDeleteBudgetResponse + resp, err := s.client.Do(req, &deleteBudgetResponse) + if err != nil { + return nil, resp, err + } + + return deleteBudgetResponse, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_code_security_and_analysis.go b/vendor/github.com/google/go-github/v93/github/enterprise_code_security_and_analysis.go similarity index 74% rename from vendor/github.com/google/go-github/v69/github/enterprise_code_security_and_analysis.go rename to vendor/github.com/google/go-github/v93/github/enterprise_code_security_and_analysis.go index 159aeae4d..af6f51225 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_code_security_and_analysis.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_code_security_and_analysis.go @@ -21,19 +21,21 @@ type EnterpriseSecurityAnalysisSettings struct { // GetCodeSecurityAndAnalysis gets code security and analysis features for an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#get-code-security-and-analysis-features-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/code_security_and_analysis func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, enterprise string) (*EnterpriseSecurityAnalysisSettings, *Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - settings := new(EnterpriseSecurityAnalysisSettings) - resp, err := s.client.Do(ctx, req, settings) + var settings *EnterpriseSecurityAnalysisSettings + resp, err := s.client.Do(req, &settings) if err != nil { return nil, resp, err } @@ -43,17 +45,19 @@ func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, ente // UpdateCodeSecurityAndAnalysis updates code security and analysis features for new repositories in an enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#update-code-security-and-analysis-features-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/code_security_and_analysis -func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, settings *EnterpriseSecurityAnalysisSettings) (*Response, error) { +func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, body *EnterpriseSecurityAnalysisSettings) (*Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) - req, err := s.client.NewRequest("PATCH", u, settings) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -66,17 +70,19 @@ func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, e // Valid values for securityProduct: "advanced_security", "secret_scanning", "secret_scanning_push_protection". // Valid values for enablement: "enable_all", "disable_all". // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#enable-or-disable-a-security-feature // //meta:operation POST /enterprises/{enterprise}/{security_product}/{enablement} func (s *EnterpriseService) EnableDisableSecurityFeature(ctx context.Context, enterprise, securityProduct, enablement string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/%v/%v", enterprise, securityProduct, enablement) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_codesecurity_configurations.go b/vendor/github.com/google/go-github/v93/github/enterprise_codesecurity_configurations.go new file mode 100644 index 000000000..85619daad --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-a-code-security-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-a-custom-code-security-configuration-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, scopeType{Scope: scope}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "PUT", u, configParam{DefaultForNewRepos: defaultForNewRepos}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + var attachments []*RepositoryAttachment + resp, err := s.client.Do(req, &attachments) + if err != nil { + return nil, resp, err + } + return attachments, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_licenses.go b/vendor/github.com/google/go-github/v93/github/enterprise_licenses.go new file mode 100644 index 000000000..e1cc35c2f --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_licenses.go @@ -0,0 +1,230 @@ +// 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"` +} + +// VisualStudioSubscriptionAssignment represents a user's Visual Studio subscription assignment. +type VisualStudioSubscriptionAssignment struct { + VisualStudioSubscriptionEmail *string `json:"visual_studio_subscription_email,omitempty"` + SubscriptionID *string `json:"subscription_id,omitempty"` + Username *string `json:"username,omitempty"` + ManualMatch *bool `json:"manual_match,omitempty"` +} + +// VisualStudioSubscriptions represents a list of Visual Studio subscriptions for an enterprise. +type VisualStudioSubscriptions struct { + TotalCount *int `json:"total_count,omitempty"` + VisualStudioSubscriptions []*VisualStudioSubscriptionAssignment `json:"visual_studio_subscriptions,omitempty"` +} + +// VisualStudioSubscriptionAssignmentRequest represents the request body to add or update a subscription assignment. +type VisualStudioSubscriptionAssignmentRequest struct { + UserIdentifier *string `json:"user_identifier,omitempty"` +} + +// ListVisualStudioSubscriptionsOptions specifies the optional parameters to +// EnterpriseService.ListVisualStudioSubscriptions. +type ListVisualStudioSubscriptionsOptions struct { + ListOptions + + // IsUnmatchedOnly filters results to return only unmatched subscriptions. + IsUnmatchedOnly bool `url:"is_unmatched_only,omitempty"` +} + +// ListConsumedLicenses 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?apiVersion=2022-11-28#list-enterprise-consumed-licenses +// +//meta:operation GET /enterprises/{enterprise}/consumed-licenses +func (s *EnterpriseService) ListConsumedLicenses(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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var consumedLicenses *EnterpriseConsumedLicenses + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var syncStatus *EnterpriseLicenseSyncStatus + resp, err := s.client.Do(req, &syncStatus) + if err != nil { + return nil, resp, err + } + + return syncStatus, resp, nil +} + +// ListVisualStudioSubscriptions gets a list of Visual Studio subscriptions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#get-a-list-of-visual-studio-subscriptions-for-the-enterprise +// +//meta:operation GET /enterprises/{enterprise}/visual-studio-subscriptions +func (s *EnterpriseService) ListVisualStudioSubscriptions(ctx context.Context, enterprise string, opts *ListVisualStudioSubscriptionsOptions) (*VisualStudioSubscriptions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/visual-studio-subscriptions", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var subscriptions *VisualStudioSubscriptions + resp, err := s.client.Do(req, &subscriptions) + if err != nil { + return nil, resp, err + } + + return subscriptions, resp, nil +} + +// AddOrUpdateVisualStudioSubscriptionAssignment adds or updates a manual match between a user and a Visual Studio subscription. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#add-or-update-a-visual-studio-subscription-user-match +// +//meta:operation PUT /enterprises/{enterprise}/visual-studio-subscriptions/{visual_studio_subscription_id} +func (s *EnterpriseService) AddOrUpdateVisualStudioSubscriptionAssignment(ctx context.Context, enterprise, subscriptionID string, body VisualStudioSubscriptionAssignmentRequest) (*VisualStudioSubscriptionAssignment, *Response, error) { + u := fmt.Sprintf("enterprises/%v/visual-studio-subscriptions/%v", enterprise, subscriptionID) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var assignment *VisualStudioSubscriptionAssignment + resp, err := s.client.Do(req, &assignment) + if err != nil { + return nil, resp, err + } + + return assignment, resp, nil +} + +// DeleteVisualStudioSubscriptionAssignment deletes a manual match between a user and a Visual Studio subscription. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/licensing?apiVersion=2022-11-28#delete-a-visual-studio-subscription-user-match +// +//meta:operation DELETE /enterprises/{enterprise}/visual-studio-subscriptions/{visual_studio_subscription_id} +func (s *EnterpriseService) DeleteVisualStudioSubscriptionAssignment(ctx context.Context, enterprise, subscriptionID string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/visual-studio-subscriptions/%v", enterprise, subscriptionID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes.go b/vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes.go similarity index 86% rename from vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes.go rename to vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes.go index e14836eb0..93757b4cd 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes.go @@ -74,18 +74,18 @@ type ReleaseVersion struct { // CheckSystemRequirements checks if GHES system nodes meet the system requirements. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/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.22/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) { u := "manage/v1/checks/system-requirements" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - systemRequirements := new(SystemRequirements) - resp, err := s.client.Do(ctx, req, systemRequirements) + var systemRequirements *SystemRequirements + resp, err := s.client.Do(req, &systemRequirements) if err != nil { return nil, resp, err } @@ -95,18 +95,18 @@ 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.15/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.22/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) { u := "manage/v1/cluster/status" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - clusterStatus := new(ClusterStatus) - resp, err := s.client.Do(ctx, req, clusterStatus) + var clusterStatus *ClusterStatus + resp, err := s.client.Do(req, &clusterStatus) if err != nil { return nil, resp, err } @@ -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.15/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.22/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) { @@ -124,13 +124,13 @@ func (s *EnterpriseService) ReplicationStatus(ctx context.Context, opts *NodeQue if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(ClusterStatus) - resp, err := s.client.Do(ctx, req, status) + var status *ClusterStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -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.15/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -148,13 +148,13 @@ func (s *EnterpriseService) GetNodeReleaseVersions(ctx context.Context, opts *No if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var releaseVersions []*NodeReleaseVersion - resp, err := s.client.Do(ctx, req, &releaseVersions) + resp, err := s.client.Do(req, &releaseVersions) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_config.go b/vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_config.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_config.go rename to vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_config.go index 10fb8590e..e1c00ef01 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_config.go +++ b/vendor/github.com/google/go-github/v93/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. @@ -87,8 +87,10 @@ type LicenseStatus struct { ReferenceNumber *string `json:"referenceNumber,omitempty"` Seats *int `json:"seats,omitempty"` SSHAllowed *bool `json:"sshAllowed,omitempty"` - SupportKey *string `json:"supportKey,omitempty"` - UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` + // SupportKey is documented as a string, but the actual response is a bool. + // TODO: Remove this note once GitHub corrects the schema documentation. + SupportKey *bool `json:"supportKey,omitempty"` + UnlimitedSeating *bool `json:"unlimitedSeating,omitempty"` } // UploadLicenseOptions is a struct to hold the options for the UploadLicense API. @@ -305,7 +307,7 @@ type NodeDetails struct { // ConfigApplyEvents gets events from the command ghe-config-apply. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/manage-ghes#list-events-from-ghe-config-apply +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -313,13 +315,13 @@ func (s *EnterpriseService) ConfigApplyEvents(ctx context.Context, opts *ConfigA if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configApplyEvents := new(ConfigApplyEvents) - resp, err := s.client.Do(ctx, req, configApplyEvents) + var configApplyEvents *ConfigApplyEvents + resp, err := s.client.Do(req, &configApplyEvents) if err != nil { return nil, resp, err } @@ -330,39 +332,43 @@ 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.15/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-and-password +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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(ctx, "POST", u, payload) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // License gets the current license information for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information +// NOTE: The GitHub documentation incorrectly shows the return type as a list ([{...}]), +// but the actual response is a single object ({...}). +// TODO: Remove this note once GitHub corrects the schema documentation. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { +func (s *EnterpriseService) License(ctx context.Context) (*LicenseStatus, *Response, error) { u := "manage/v1/config/license" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - var licenseStatus []*LicenseStatus - resp, err := s.client.Do(ctx, req, &licenseStatus) + var licenseStatus *LicenseStatus + resp, err := s.client.Do(req, &licenseStatus) if err != nil { return nil, resp, err } @@ -372,7 +378,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.15/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -380,28 +386,28 @@ func (s *EnterpriseService) UploadLicense(ctx context.Context, license string) ( opts := &UploadLicenseOptions{ License: license, } - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // LicenseStatus gets the current license status for the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/manage-ghes#check-a-license +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := "manage/v1/config/license/check" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var checks []*LicenseCheck - resp, err := s.client.Do(ctx, req, &checks) + resp, err := s.client.Do(req, &checks) if err != nil { return nil, resp, err } @@ -412,7 +418,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.15/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -420,13 +426,13 @@ func (s *EnterpriseService) NodeMetadata(ctx context.Context, opts *NodeQueryOpt if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(NodeMetadataStatus) - resp, err := s.client.Do(ctx, req, status) + var status *NodeMetadataStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -436,18 +442,18 @@ 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.15/rest/enterprise-admin/manage-ghes#get-the-ghes-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := "manage/v1/config/settings" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - configSettings := new(ConfigSettings) - resp, err := s.client.Do(ctx, req, configSettings) + var configSettings *ConfigSettings + resp, err := s.client.Do(req, &configSettings) if err != nil { return nil, resp, err } @@ -457,37 +463,37 @@ 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.15/rest/enterprise-admin/manage-ghes#set-settings +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/manage-ghes#set-settings // //meta:operation PUT /manage/v1/config/settings -func (s *EnterpriseService) UpdateSettings(ctx context.Context, opts *ConfigSettings) (*Response, error) { +func (s *EnterpriseService) UpdateSettings(ctx context.Context, body *ConfigSettings) (*Response, error) { u := "manage/v1/config/settings" - if opts == nil { + if body == nil { return nil, errors.New("opts should not be nil") } - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConfigApply triggers a configuration apply run on the GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/manage-ghes#trigger-a-ghe-config-apply-run // //meta:operation POST /manage/v1/config/apply -func (s *EnterpriseService) ConfigApply(ctx context.Context, opts *ConfigApplyOptions) (*ConfigApplyOptions, *Response, error) { +func (s *EnterpriseService) ConfigApply(ctx context.Context, body *ConfigApplyOptions) (*ConfigApplyOptions, *Response, error) { u := "manage/v1/config/apply" - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - configApplyOptions := new(ConfigApplyOptions) - resp, err := s.client.Do(ctx, req, configApplyOptions) + var configApplyOptions *ConfigApplyOptions + resp, err := s.client.Do(req, &configApplyOptions) if err != nil { return nil, resp, err } @@ -497,18 +503,18 @@ 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.15/rest/enterprise-admin/manage-ghes#get-the-status-of-a-ghe-config-apply-run +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := "manage/v1/config/apply" - req, err := s.client.NewRequest("GET", u, opts) + req, err := s.client.NewRequest(ctx, "GET", u, opts) if err != nil { return nil, nil, err } - status := new(ConfigApplyStatus) - resp, err := s.client.Do(ctx, req, status) + var status *ConfigApplyStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_maintenance.go b/vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_maintenance.go similarity index 88% rename from vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_maintenance.go rename to vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_maintenance.go index 3b1de92df..07bb1f6df 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_maintenance.go +++ b/vendor/github.com/google/go-github/v93/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.15/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -54,13 +54,13 @@ func (s *EnterpriseService) GetMaintenanceStatus(ctx context.Context, opts *Node if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var status []*MaintenanceStatus - resp, err := s.client.Do(ctx, req, &status) + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } @@ -71,21 +71,21 @@ 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.15/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode // //meta:operation POST /manage/v1/maintenance -func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, opts *MaintenanceOptions) ([]*MaintenanceOperationStatus, *Response, error) { +func (s *EnterpriseService) CreateMaintenance(ctx context.Context, enable bool, body *MaintenanceOptions) ([]*MaintenanceOperationStatus, *Response, error) { u := "manage/v1/maintenance" - opts.Enabled = enable + body.Enabled = enable - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var i []*MaintenanceOperationStatus - resp, err := s.client.Do(ctx, req, &i) + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_ssh.go b/vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_ssh.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_ssh.go rename to vendor/github.com/google/go-github/v93/github/enterprise_manage_ghes_ssh.go index 77d252165..5542e2249 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_manage_ghes_ssh.go +++ b/vendor/github.com/google/go-github/v93/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.15/rest/enterprise-admin/manage-ghes#delete-a-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -39,13 +39,13 @@ func (s *EnterpriseService) DeleteSSHKey(ctx context.Context, key string) ([]*SS opts := &SSHKeyOptions{ Key: key, } - req, err := s.client.NewRequest("DELETE", u, opts) + req, err := s.client.NewRequest(ctx, "DELETE", u, opts) if err != nil { return nil, nil, err } var sshStatus []*SSHKeyStatus - resp, err := s.client.Do(ctx, req, &sshStatus) + resp, err := s.client.Do(req, &sshStatus) if err != nil { return nil, resp, err } @@ -55,18 +55,18 @@ 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.15/rest/enterprise-admin/manage-ghes#get-the-configured-ssh-keys +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := "manage/v1/access/ssh" - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var sshKeys []*ClusterSSHKey - resp, err := s.client.Do(ctx, req, &sshKeys) + resp, err := s.client.Do(req, &sshKeys) if err != nil { return nil, resp, err } @@ -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.15/rest/enterprise-admin/manage-ghes#set-a-new-ssh-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -84,13 +84,13 @@ func (s *EnterpriseService) CreateSSHKey(ctx context.Context, key string) ([]*SS opts := &SSHKeyOptions{ Key: key, } - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, opts) if err != nil { return nil, nil, err } var sshKeyResponse []*SSHKeyStatus - resp, err := s.client.Do(ctx, req, &sshKeyResponse) + resp, err := s.client.Do(req, &sshKeyResponse) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_network_configurations.go b/vendor/github.com/google/go-github/v93/github/enterprise_network_configurations.go new file mode 100644 index 000000000..5a87efdb6 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/enterprise_network_configurations.go @@ -0,0 +1,144 @@ +// 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" +) + +// ListEnterpriseNetworkConfigurations lists all hosted compute network configurations configured in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#list-hosted-compute-network-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/network-configurations +func (s *EnterpriseService) ListEnterpriseNetworkConfigurations(ctx context.Context, enterprise string, opts *ListOptions) (*NetworkConfigurations, *Response, error) { + u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var networks *NetworkConfigurations + resp, err := s.client.Do(req, &networks) + if err != nil { + return nil, resp, err + } + + return networks, resp, nil +} + +// CreateEnterpriseNetworkConfiguration creates a hosted compute network configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/network-configurations +func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) + if err != nil { + return nil, resp, err + } + + return network, resp, nil +} + +// GetEnterpriseNetworkConfiguration gets a hosted compute network configuration configured in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-configuration-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/network-configurations/{network_configuration_id} +func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*NetworkConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) + if err != nil { + return nil, resp, err + } + + return network, resp, nil +} + +// UpdateEnterpriseNetworkConfiguration updates a hosted compute network configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id} +func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var network *NetworkConfiguration + resp, err := s.client.Do(req, &network) + if err != nil { + return nil, resp, err + } + + return network, resp, nil +} + +// DeleteEnterpriseNetworkConfiguration deletes a hosted compute network configuration from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#delete-a-hosted-compute-network-configuration-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/network-configurations/{network_configuration_id} +func (s *EnterpriseService) DeleteEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetEnterpriseNetworkSettingsResource gets a hosted compute network settings resource configured for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-settings-resource-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/network-settings/{network_settings_id} +func (s *EnterpriseService) GetEnterpriseNetworkSettingsResource(ctx context.Context, enterprise, networkID string) (*NetworkSettingsResource, *Response, error) { + u := fmt.Sprintf("enterprises/%v/network-settings/%v", enterprise, networkID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var resource *NetworkSettingsResource + resp, err := s.client.Do(req, &resource) + if err != nil { + return nil, resp, err + } + + return resource, resp, err +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_organization_properties.go b/vendor/github.com/google/go-github/v93/github/enterprise_organization_properties.go new file mode 100644 index 000000000..4a9455366 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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"` +} + +// 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. + // OrganizationLogins specifies the organization names when updating multiple organizations. + OrganizationLogins []string `json:"organization_logins"` + // 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var schema *EnterpriseCustomPropertySchema + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-or-update-organization-custom-property-definitions-on-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertySchema(ctx context.Context, enterprise string, body EnterpriseCustomPropertySchema) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var property *CustomProperty + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-or-update-an-organization-custom-property-definition-on-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string, body CustomProperty) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*EnterpriseCustomPropertiesValues + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-or-update-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, enterprise string, body EnterpriseCustomPropertyValuesRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_properties.go b/vendor/github.com/google/go-github/v93/github/enterprise_properties.go similarity index 74% rename from vendor/github.com/google/go-github/v69/github/enterprise_properties.go rename to vendor/github.com/google/go-github/v93/github/enterprise_properties.go index bc5ab55a3..f8c53b6ea 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_properties.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_properties.go @@ -12,19 +12,19 @@ import ( // GetAllCustomProperties gets all custom properties that are defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#get-custom-properties-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#get-custom-properties-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/properties/schema func (s *EnterpriseService) GetAllCustomProperties(ctx context.Context, enterprise string) ([]*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema", enterprise) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -34,7 +34,7 @@ func (s *EnterpriseService) GetAllCustomProperties(ctx context.Context, enterpri // CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#create-or-update-custom-properties-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#create-or-update-custom-properties-for-an-enterprise // //meta:operation PATCH /enterprises/{enterprise}/properties/schema func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, enterprise string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { @@ -46,13 +46,13 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -62,19 +62,19 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, // GetCustomProperty gets a custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#get-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#get-a-custom-property-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/properties/schema/{custom_property_name} func (s *EnterpriseService) GetCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -84,19 +84,19 @@ func (s *EnterpriseService) GetCustomProperty(ctx context.Context, enterprise, c // CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#create-or-update-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/properties/schema/{custom_property_name} -func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, enterprise, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { +func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, enterprise, customPropertyName string, body *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -106,16 +106,16 @@ func (s *EnterpriseService) CreateOrUpdateCustomProperty(ctx context.Context, en // RemoveCustomProperty removes a custom property that is defined for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties#remove-a-custom-property-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties?apiVersion=2022-11-28#remove-a-custom-property-for-an-enterprise // //meta:operation DELETE /enterprises/{enterprise}/properties/schema/{custom_property_name} func (s *EnterpriseService) RemoveCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/enterprise_rules.go b/vendor/github.com/google/go-github/v93/github/enterprise_rules.go similarity index 55% rename from vendor/github.com/google/go-github/v69/github/enterprise_rules.go rename to vendor/github.com/google/go-github/v93/github/enterprise_rules.go index f43822337..b89567a34 100644 --- a/vendor/github.com/google/go-github/v69/github/enterprise_rules.go +++ b/vendor/github.com/google/go-github/v93/github/enterprise_rules.go @@ -12,19 +12,19 @@ import ( // CreateRepositoryRuleset creates a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#create-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#create-an-enterprise-repository-ruleset // //meta:operation POST /enterprises/{enterprise}/rulesets -func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets", enterprise) - req, err := s.client.NewRequest("POST", u, ruleset) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -34,19 +34,19 @@ func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterpr // GetRepositoryRuleset gets a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#get-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#get-an-enterprise-repository-ruleset // //meta:operation GET /enterprises/{enterprise}/rulesets/{ruleset_id} func (s *EnterpriseService) GetRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var ruleset *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &ruleset) + resp, err := s.client.Do(req, &ruleset) if err != nil { return nil, resp, err } @@ -56,19 +56,19 @@ func (s *EnterpriseService) GetRepositoryRuleset(ctx context.Context, enterprise // UpdateRepositoryRuleset updates a repository ruleset for the specified enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#update-an-enterprise-repository-ruleset +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#update-an-enterprise-repository-ruleset // //meta:operation PUT /enterprises/{enterprise}/rulesets/{ruleset_id} -func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { +func (s *EnterpriseService) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("PUT", u, ruleset) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var rs *RepositoryRuleset - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -76,43 +76,18 @@ 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 +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules?apiVersion=2022-11-28#delete-an-enterprise-repository-ruleset // //meta:operation DELETE /enterprises/{enterprise}/rulesets/{ruleset_id} func (s *EnterpriseService) DeleteRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, rulesetID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_scim.go b/vendor/github.com/google/go-github/v93/github/enterprise_scim.go new file mode 100644 index 000000000..2d675f0f2 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#supported-scim-group-attributes +type SCIMEnterpriseGroupAttributes struct { + DisplayName string `json:"displayName"` // 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"` // This identifier is generated by a SCIM provider. Must be unique per group. + 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 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?apiVersion=2022-11-28#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?apiVersion=2022-11-28#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?apiVersion=2022-11-28#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?apiVersion=2022-11-28#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?apiVersion=2022-11-28#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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groups *SCIMEnterpriseGroups + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var users *SCIMEnterpriseUsers + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-group +// +//meta:operation PUT /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) SetProvisionedSCIMGroup(ctx context.Context, enterprise, scimGroupID string, body SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groupNew *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-scim-information-for-a-provisioned-enterprise-user +// +//meta:operation PUT /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) SetProvisionedSCIMUser(ctx context.Context, enterprise, scimUserID string, body SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var userNew *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-group +// +//meta:operation PATCH /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} +func (s *EnterpriseService) UpdateSCIMGroupAttribute(ctx context.Context, enterprise, scimGroupID string, body SCIMEnterpriseAttribute) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups/%v", enterprise, scimGroupID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var group *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-an-attribute-for-a-scim-enterprise-user +// +//meta:operation PATCH /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} +func (s *EnterpriseService) UpdateSCIMUserAttribute(ctx context.Context, enterprise, scimUserID string, body SCIMEnterpriseAttribute) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users/%v", enterprise, scimUserID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var user *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#provision-a-scim-enterprise-group +// +//meta:operation POST /scim/v2/enterprises/{enterprise}/Groups +func (s *EnterpriseService) ProvisionSCIMGroup(ctx context.Context, enterprise string, body SCIMEnterpriseGroupAttributes) (*SCIMEnterpriseGroupAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var groupProvisioned *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#provision-a-scim-enterprise-user +// +//meta:operation POST /scim/v2/enterprises/{enterprise}/Users +func (s *EnterpriseService) ProvisionSCIMUser(ctx context.Context, enterprise string, body SCIMEnterpriseUserAttributes) (*SCIMEnterpriseUserAttributes, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Users", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var userProvisioned *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var group *SCIMEnterpriseGroupAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + req.Header.Set("Accept", mediaTypeSCIM) + + var user *SCIMEnterpriseUserAttributes + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/enterprise_team.go b/vendor/github.com/google/go-github/v93/github/enterprise_team.go new file mode 100644 index 000000000..fde014d7a --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var teams []*EnterpriseTeam + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-an-enterprise-team +// +//meta:operation POST /enterprises/{enterprise}/teams +func (s *EnterpriseService) CreateTeam(ctx context.Context, enterprise string, body EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams", enterprise) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var createdTeam *EnterpriseTeam + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var team *EnterpriseTeam + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-an-enterprise-team +// +//meta:operation PATCH /enterprises/{enterprise}/teams/{team_slug} +func (s *EnterpriseService) UpdateTeam(ctx context.Context, enterprise, teamSlug string, body EnterpriseTeamCreateOrUpdateRequest) (*EnterpriseTeam, *Response, error) { + u := fmt.Sprintf("enterprises/%v/teams/%v", enterprise, teamSlug) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var updatedTeam *EnterpriseTeam + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, map[string][]string{"usernames": username}) + if err != nil { + return nil, nil, err + } + + var members []*User + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var membership *User + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var member *User + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "POST", u, map[string][]string{"organization_slugs": organizationSlugs}) + if err != nil { + return nil, nil, err + } + + var orgs []*Organization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "PUT", u, nil) + if err != nil { + return nil, nil, err + } + + var organization *Organization + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/event.go b/vendor/github.com/google/go-github/v93/github/event.go similarity index 93% rename from vendor/github.com/google/go-github/v69/github/event.go rename to vendor/github.com/google/go-github/v93/github/event.go index e98606bce..446db7fa0 100644 --- a/vendor/github.com/google/go-github/v69/github/event.go +++ b/vendor/github.com/google/go-github/v93/github/event.go @@ -27,7 +27,7 @@ func (e Event) String() string { // ParsePayload parses the event payload. For recognized event types, // a value of the corresponding struct type will be returned. -func (e *Event) ParsePayload() (interface{}, error) { +func (e *Event) ParsePayload() (any, error) { // It would be nice if e.Type were the snake_case name of the event, // but the existing interface uses the struct name instead. payload := EventForType(typeToMessageMapping[e.GetType()]) @@ -44,7 +44,7 @@ func (e *Event) ParsePayload() (interface{}, error) { // // Deprecated: Use ParsePayload instead, which returns an error // rather than panics if JSON unmarshaling raw payload fails. -func (e *Event) Payload() (payload interface{}) { +func (e *Event) Payload() (payload any) { var err error payload, err = e.ParsePayload() if err != nil { diff --git a/vendor/github.com/google/go-github/v69/github/event_types.go b/vendor/github.com/google/go-github/v93/github/event_types.go similarity index 90% rename from vendor/github.com/google/go-github/v69/github/event_types.go rename to vendor/github.com/google/go-github/v93/github/event_types.go index 0df3b30c3..bd55539c7 100644 --- a/vendor/github.com/google/go-github/v69/github/event_types.go +++ b/vendor/github.com/google/go-github/v93/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"` @@ -354,6 +354,12 @@ type DiscussionCommentEvent struct { // CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent. type CommentDiscussion struct { + // AuthorAssociation is the comment author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/comments?apiVersion=2022-11-28#get-a-discussion-comment AuthorAssociation *string `json:"author_association,omitempty"` Body *string `json:"body,omitempty"` ChildCommentCount *int `json:"child_comment_count,omitempty"` @@ -403,9 +409,15 @@ type Discussion struct { Comments *int `json:"comments,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - ActiveLockReason *string `json:"active_lock_reason,omitempty"` - Body *string `json:"body,omitempty"` + // AuthorAssociation is the discussion author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Discussions REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/discussions/discussions?apiVersion=2022-11-28#get-a-discussion + AuthorAssociation *string `json:"author_association,omitempty"` + ActiveLockReason *string `json:"active_lock_reason,omitempty"` + Body *string `json:"body,omitempty"` } // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent. @@ -847,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"` @@ -858,8 +870,10 @@ type MergeGroup struct { // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#merge_group type MergeGroupEvent struct { - // The action that was performed. Currently, can only be checks_requested. + // The action that was performed. Possible values are: "checks_requested", "destroyed". Action *string `json:"action,omitempty"` + // Reason is populated when the action is "destroyed". Possible values: "merged", "invalidated", "dequeued". + Reason *string `json:"reason,omitempty"` // The merge group. MergeGroup *MergeGroup `json:"merge_group,omitempty"` @@ -1097,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". // @@ -1144,6 +1129,7 @@ type ProjectV2ItemEvent struct { // ProjectV2ItemChange represents a project v2 item change. type ProjectV2ItemChange struct { ArchivedAt *ArchivedAt `json:"archived_at,omitempty"` + FieldValue *FieldValue `json:"field_value,omitempty"` } // ArchivedAt represents an archiving date change. @@ -1152,17 +1138,14 @@ type ArchivedAt struct { To *Timestamp `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"` +// FieldValue represents an editing field value change. +type FieldValue struct { + FieldNodeID *string `json:"field_node_id,omitempty"` + FieldType *string `json:"field_type,omitempty"` + FieldName *string `json:"field_name,omitempty"` + ProjectNumber *int64 `json:"project_number,omitempty"` + From json.RawMessage `json:"from,omitempty"` + To json.RawMessage `json:"to,omitempty"` } // PublicEvent is triggered when a private repository is open sourced. @@ -1212,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. @@ -1226,18 +1210,21 @@ type PullRequestEvent struct { PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` } -// PullRequestReviewEvent is triggered when a review is submitted on a pull -// request. +// PullRequestReviewEvent is triggered when a review on a pull request is +// submitted, edited, or dismissed. // The Webhook event name is "pull_request_review". // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review type PullRequestReviewEvent struct { - // Action is always "submitted". + // Action is the action that was performed on the review. + // Possible values are: "submitted", "edited", "dismissed". Action *string `json:"action,omitempty"` Review *PullRequestReview `json:"review,omitempty"` PullRequest *PullRequest `json:"pull_request,omitempty"` // The following fields are only populated by Webhook events. + // Changes is populated in "edited" event deliveries. + Changes *EditChange `json:"changes,omitempty"` Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` @@ -1341,13 +1328,29 @@ type PullRequestTargetEvent struct { // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#push type PushEvent struct { - PushID *int64 `json:"push_id,omitempty"` - Head *string `json:"head,omitempty"` - Ref *string `json:"ref,omitempty"` - Size *int `json:"size,omitempty"` - Commits []*HeadCommit `json:"commits,omitempty"` - Before *string `json:"before,omitempty"` - DistinctSize *int `json:"distinct_size,omitempty"` + PushID *int64 `json:"push_id,omitempty"` + Head *string `json:"head,omitempty"` + Ref *string `json:"ref,omitempty"` + // Size is the number of commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get commit information. + // See: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-commits + Size *int `json:"size,omitempty"` + // Commits is the list of commits in the push event. + // + // 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?apiVersion=2022-11-28#list-commits + Commits []*HeadCommit `json:"commits,omitempty"` + Before *string `json:"before,omitempty"` + // DistinctSize is the number of distinct commits in the push. + // + // Deprecated: GitHub will remove commit counts from Events API payloads on October 7, 2025. + // Use the Compare REST API endpoint to get detailed comparison information. + // See: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits + DistinctSize *int `json:"distinct_size,omitempty"` // The following fields are only populated by Webhook events. Action *string `json:"action,omitempty"` @@ -1398,44 +1401,44 @@ func (h HeadCommit) String() string { // PushEventRepository represents the repo object in a PushEvent payload. type PushEventRepository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Owner *User `json:"owner,omitempty"` - Private *bool `json:"private,omitempty"` - Description *string `json:"description,omitempty"` - Fork *bool `json:"fork,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Homepage *string `json:"homepage,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - Size *int `json:"size,omitempty"` - StargazersCount *int `json:"stargazers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` - Language *string `json:"language,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - HasPages *bool `json:"has_pages,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - Organization *string `json:"organization,omitempty"` - URL *string `json:"url,omitempty"` - ArchiveURL *string `json:"archive_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Topics []string `json:"topics,omitempty"` - CustomProperties map[string]interface{} `json:"custom_properties,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Owner *User `json:"owner,omitempty"` + Private *bool `json:"private,omitempty"` + Description *string `json:"description,omitempty"` + Fork *bool `json:"fork,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Homepage *string `json:"homepage,omitempty"` + PullsURL *string `json:"pulls_url,omitempty"` + Size *int `json:"size,omitempty"` + StargazersCount *int `json:"stargazers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` + Language *string `json:"language,omitempty"` + HasIssues *bool `json:"has_issues,omitempty"` + HasDownloads *bool `json:"has_downloads,omitempty"` + HasWiki *bool `json:"has_wiki,omitempty"` + HasPages *bool `json:"has_pages,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + Organization *string `json:"organization,omitempty"` + URL *string `json:"url,omitempty"` + ArchiveURL *string `json:"archive_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + StatusesURL *string `json:"statuses_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` } // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. @@ -1444,25 +1447,69 @@ type PushEventRepoOwner struct { Email *string `json:"email,omitempty"` } +// RegistryPackageEvent represents activity related to GitHub Packages. +// The Webhook event name is "registry_package". +// +// This event is triggered when a GitHub Package is published or updated. +// +// GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#registry_package +type RegistryPackageEvent struct { + // Action is the action that was performed. + // Can be "published" or "updated". + Action *string `json:"action,omitempty"` + RegistryPackage *Package `json:"registry_package,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Enterprise *Enterprise `json:"enterprise,omitempty"` + Sender *User `json:"sender,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` +} + // ReleaseEvent is triggered when a release is published, unpublished, created, -// edited, deleted, or prereleased. +// edited, deleted, prereleased, or released. // The Webhook event name is "release". // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#release type ReleaseEvent struct { // Action is the action that was performed. Possible values are: "published", "unpublished", - // "created", "edited", "deleted", or "prereleased". + // "created", "edited", "deleted", "prereleased", or "released". Action *string `json:"action,omitempty"` Release *RepositoryRelease `json:"release,omitempty"` // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` + // Changes is populated in "edited" event deliveries. + Changes *ReleaseChanges `json:"changes,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + Installation *Installation `json:"installation,omitempty"` // The following field is only present when the webhook is triggered on // a repository belonging to an organization. Org *Organization `json:"organization,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an enterprise. + Enterprise *Enterprise `json:"enterprise,omitempty"` +} + +// ReleaseChanges represents changes made to a release. +type ReleaseChanges struct { + Body *ReleaseChangeFrom `json:"body,omitempty"` + Name *ReleaseChangeFrom `json:"name,omitempty"` + TagName *ReleaseChangeFrom `json:"tag_name,omitempty"` + MakeLatest *ReleaseChangeToBool `json:"make_latest,omitempty"` +} + +// ReleaseChangeFrom represents a release string field change containing the previous value. +type ReleaseChangeFrom struct { + From string `json:"from"` +} + +// ReleaseChangeToBool represents a boolean release field change containing the new value. +type ReleaseChangeToBool struct { + To bool `json:"to"` } // RepositoryEvent is triggered when a repository is created, archived, unarchived, @@ -1813,7 +1860,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 { @@ -1867,6 +1914,7 @@ type WorkflowRunEvent struct { // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CVSSSeverities *AdvisoryCVSSSeverities `json:"cvss_severities,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` GHSAID *string `json:"ghsa_id,omitempty"` Summary *string `json:"summary,omitempty"` @@ -1914,8 +1962,8 @@ type AdvisoryVulnerability struct { FirstPatchedVersion *FirstPatchedVersion `json:"first_patched_version,omitempty"` // PatchedVersions and VulnerableFunctions are used in the following APIs: - // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization - // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories + // - https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization + // - https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories PatchedVersions *string `json:"patched_versions,omitempty"` VulnerableFunctions []string `json:"vulnerable_functions,omitempty"` } @@ -1964,7 +2012,7 @@ type CodeScanningAlertEvent struct { // SponsorshipEvent represents a sponsorship event in GitHub. // -// GitHub API docs: https://docs.github.com/en/rest/overview/github-event-types?apiVersion=2022-11-28#sponsorshipevent +// GitHub API docs: https://docs.github.com/rest/overview/github-event-types?apiVersion=2022-11-28#sponsorshipevent type SponsorshipEvent struct { Action *string `json:"action,omitempty"` EffectiveDate *string `json:"effective_date,omitempty"` diff --git a/vendor/github.com/google/go-github/v69/github/gists.go b/vendor/github.com/google/go-github/v93/github/gists.go similarity index 63% rename from vendor/github.com/google/go-github/v69/github/gists.go rename to vendor/github.com/google/go-github/v93/github/gists.go index ee4314b98..a339286c0 100644 --- a/vendor/github.com/google/go-github/v69/github/gists.go +++ b/vendor/github.com/google/go-github/v93/github/gists.go @@ -14,7 +14,7 @@ import ( // GistsService handles communication with the Gist related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/gists +// GitHub API docs: https://docs.github.com/rest/gists?apiVersion=2022-11-28 type GistsService service // Gist represents a GitHub's gist. @@ -37,6 +37,22 @@ func (g Gist) String() string { return Stringify(g) } +// CreateGistRequest represents the input for creating a gist. +type CreateGistRequest struct { + Description *string `json:"description,omitempty"` + Public *bool `json:"public,omitempty"` + // Files is the set of files that make up the gist, keyed by filename. + Files map[GistFilename]*CreateGistFile `json:"files"` +} + +// UpdateGistRequest represents the input for updating a gist. +type UpdateGistRequest struct { + Description *string `json:"description,omitempty"` + // Files is the set of files to add, change or rename, keyed by filename. + // Mapping a filename to a nil value deletes that file from the gist. + Files map[GistFilename]*UpdateGistFile `json:"files,omitempty"` +} + // GistFilename represents filename on a gist. type GistFilename string @@ -54,6 +70,23 @@ func (g GistFile) String() string { return Stringify(g) } +// CreateGistFile represents a file within a CreateGistRequest, keyed by filename +// in the request's Files map. +type CreateGistFile struct { + // Content is the contents of the file. + Content string `json:"content"` +} + +// UpdateGistFile represents a file within an UpdateGistRequest, keyed by filename +// in the request's Files map. Mapping a filename to a nil *UpdateGistFile deletes +// that file from the gist. +type UpdateGistFile struct { + // Content is the new contents of the file. + Content *string `json:"content,omitempty"` + // Filename, if set, renames the file. + Filename *string `json:"filename,omitempty"` +} + // GistCommit represents a commit on a gist. type GistCommit struct { URL *string `json:"url,omitempty"` @@ -96,8 +129,9 @@ type GistListOptions struct { // is authenticated, it will returns all gists for the authenticated // 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 +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gists-for-the-authenticated-user // //meta:operation GET /gists //meta:operation GET /users/{username}/gists @@ -113,13 +147,13 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -129,7 +163,7 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti // ListAll lists all public gists. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-public-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-public-gists // //meta:operation GET /gists/public func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { @@ -138,13 +172,13 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -154,7 +188,7 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G // ListStarred lists starred gists of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-starred-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-starred-gists // //meta:operation GET /gists/starred func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { @@ -163,13 +197,13 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gists []*Gist - resp, err := s.client.Do(ctx, req, &gists) + resp, err := s.client.Do(req, &gists) if err != nil { return nil, resp, err } @@ -179,18 +213,18 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( // Get a single gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#get-a-gist // //meta:operation GET /gists/{gist_id} func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) + var gist *Gist + resp, err := s.client.Do(req, &gist) if err != nil { return nil, resp, err } @@ -200,18 +234,18 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er // GetRevision gets a specific revision of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist-revision +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#get-a-gist-revision // //meta:operation GET /gists/{gist_id}/{sha} func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/%v", id, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gist := new(Gist) - resp, err := s.client.Do(ctx, req, gist) + var gist *Gist + resp, err := s.client.Do(req, &gist) if err != nil { return nil, resp, err } @@ -221,18 +255,18 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, // Create a gist for authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#create-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#create-a-gist // //meta:operation POST /gists -func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { +func (s *GistsService) Create(ctx context.Context, body CreateGistRequest) (*Gist, *Response, error) { u := "gists" - req, err := s.client.NewRequest("POST", u, gist) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -240,20 +274,20 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response return g, resp, nil } -// Edit a gist. +// Update a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#update-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#update-a-gist // //meta:operation PATCH /gists/{gist_id} -func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { +func (s *GistsService) Update(ctx context.Context, id string, body UpdateGistRequest) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("PATCH", u, gist) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -263,7 +297,7 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, // ListCommits lists commits of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-commits +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gist-commits // //meta:operation GET /gists/{gist_id}/commits func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) { @@ -273,13 +307,13 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gistCommits []*GistCommit - resp, err := s.client.Do(ctx, req, &gistCommits) + resp, err := s.client.Do(req, &gistCommits) if err != nil { return nil, resp, err } @@ -289,80 +323,80 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt // Delete a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#delete-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#delete-a-gist // //meta:operation DELETE /gists/{gist_id} func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Star a gist on behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#star-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#star-a-gist // //meta:operation PUT /gists/{gist_id}/star func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unstar a gist on a behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#unstar-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#unstar-a-gist // //meta:operation DELETE /gists/{gist_id}/star func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // IsStarred checks if a gist is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#check-if-a-gist-is-starred // //meta:operation GET /gists/{gist_id}/star func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) { u := fmt.Sprintf("gists/%v/star", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) starred, err := parseBoolResponse(err) return starred, resp, err } // Fork a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#fork-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#fork-a-gist // //meta:operation POST /gists/{gist_id}/forks func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - g := new(Gist) - resp, err := s.client.Do(ctx, req, g) + var g *Gist + resp, err := s.client.Do(req, &g) if err != nil { return nil, resp, err } @@ -372,7 +406,7 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e // ListForks lists forks of a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-forks +// GitHub API docs: https://docs.github.com/rest/gists/gists?apiVersion=2022-11-28#list-gist-forks // //meta:operation GET /gists/{gist_id}/forks func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) { @@ -382,13 +416,13 @@ func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptio return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var gistForks []*GistFork - resp, err := s.client.Do(ctx, req, &gistForks) + resp, err := s.client.Do(req, &gistForks) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/gists_comments.go b/vendor/github.com/google/go-github/v93/github/gists_comments.go similarity index 58% rename from vendor/github.com/google/go-github/v69/github/gists_comments.go rename to vendor/github.com/google/go-github/v93/github/gists_comments.go index 5e0614231..d2e769604 100644 --- a/vendor/github.com/google/go-github/v69/github/gists_comments.go +++ b/vendor/github.com/google/go-github/v93/github/gists_comments.go @@ -23,9 +23,21 @@ func (g GistComment) String() string { return Stringify(g) } +// CreateGistCommentRequest represents the input for creating a gist comment. +type CreateGistCommentRequest struct { + // Body is the comment text. + Body string `json:"body"` +} + +// UpdateGistCommentRequest represents the input for updating a gist comment. +type UpdateGistCommentRequest struct { + // Body is the comment text. + Body string `json:"body"` +} + // ListComments lists all comments for a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#list-gist-comments +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#list-gist-comments // //meta:operation GET /gists/{gist_id}/comments func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) { @@ -35,13 +47,13 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*GistComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -51,18 +63,18 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li // GetComment retrieves a single comment from a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#get-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#get-a-gist-comment // //meta:operation GET /gists/{gist_id}/comments/{comment_id} func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -72,18 +84,18 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID // CreateComment creates a comment for a gist. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#create-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#create-a-gist-comment // //meta:operation POST /gists/{gist_id}/comments -func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { +func (s *GistsService) CreateComment(ctx context.Context, gistID string, body CreateGistCommentRequest) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -91,20 +103,20 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment return c, resp, nil } -// EditComment edits an existing gist comment. +// UpdateComment updates an existing gist comment. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#update-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#update-a-gist-comment // //meta:operation PATCH /gists/{gist_id}/comments/{comment_id} -func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { +func (s *GistsService) UpdateComment(ctx context.Context, gistID string, commentID int64, body UpdateGistCommentRequest) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(GistComment) - resp, err := s.client.Do(ctx, req, c) + var c *GistComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -114,15 +126,15 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID // DeleteComment deletes a gist comment. // -// GitHub API docs: https://docs.github.com/rest/gists/comments#delete-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments?apiVersion=2022-11-28#delete-a-gist-comment // //meta:operation DELETE /gists/{gist_id}/comments/{comment_id} func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/git.go b/vendor/github.com/google/go-github/v93/github/git.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/git.go rename to vendor/github.com/google/go-github/v93/github/git.go index 2ca835e1b..ce172cd06 100644 --- a/vendor/github.com/google/go-github/v69/github/git.go +++ b/vendor/github.com/google/go-github/v93/github/git.go @@ -8,5 +8,5 @@ package github // GitService handles communication with the git data related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/git/ +// GitHub API docs: https://docs.github.com/rest/git?apiVersion=2022-11-28 type GitService service diff --git a/vendor/github.com/google/go-github/v69/github/git_blobs.go b/vendor/github.com/google/go-github/v93/github/git_blobs.go similarity index 65% rename from vendor/github.com/google/go-github/v69/github/git_blobs.go rename to vendor/github.com/google/go-github/v93/github/git_blobs.go index d89042888..2f28801c6 100644 --- a/vendor/github.com/google/go-github/v69/github/git_blobs.go +++ b/vendor/github.com/google/go-github/v93/github/git_blobs.go @@ -13,7 +13,7 @@ import ( // Blob represents a blob object. type Blob struct { - Content *string `json:"content,omitempty"` + Content string `json:"content"` Encoding *string `json:"encoding,omitempty"` SHA *string `json:"sha,omitempty"` Size *int `json:"size,omitempty"` @@ -23,18 +23,18 @@ type Blob struct { // GetBlob fetches a blob from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#get-a-blob // //meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} -func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) { +func (s *GitService) GetBlob(ctx context.Context, owner, repo, sha string) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - blob := new(Blob) - resp, err := s.client.Do(ctx, req, blob) + var blob *Blob + resp, err := s.client.Do(req, &blob) if err != nil { return nil, resp, err } @@ -45,12 +45,12 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha // GetBlobRaw fetches a blob's contents from a repo. // Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#get-a-blob // //meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -58,7 +58,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ req.Header.Set("Accept", "application/vnd.github.v3.raw") var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return nil, resp, err } @@ -68,21 +68,21 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // CreateBlob creates a blob object. // -// GitHub API docs: https://docs.github.com/rest/git/blobs#create-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs?apiVersion=2022-11-28#create-a-blob // //meta:operation POST /repos/{owner}/{repo}/git/blobs -func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) { +func (s *GitService) CreateBlob(ctx context.Context, owner, repo string, body Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) - req, err := s.client.NewRequest("POST", u, blob) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(Blob) - resp, err := s.client.Do(ctx, req, t) + var v *Blob + resp, err := s.client.Do(req, &v) if err != nil { return nil, resp, err } - return t, resp, nil + return v, resp, nil } diff --git a/vendor/github.com/google/go-github/v69/github/git_commits.go b/vendor/github.com/google/go-github/v93/github/git_commits.go similarity index 84% rename from vendor/github.com/google/go-github/v69/github/git_commits.go rename to vendor/github.com/google/go-github/v93/github/git_commits.go index d7ed3ecbe..0efad197c 100644 --- a/vendor/github.com/google/go-github/v69/github/git_commits.go +++ b/vendor/github.com/google/go-github/v93/github/git_commits.go @@ -37,6 +37,7 @@ type MessageSigner interface { // MessageSignerFunc is a single function implementation of MessageSigner. type MessageSignerFunc func(w io.Writer, r io.Reader) error +// Sign implements the MessageSigner interface for MessageSignerFunc. func (f MessageSignerFunc) Sign(w io.Writer, r io.Reader) error { return f(w, r) } @@ -81,18 +82,18 @@ func (c CommitAuthor) String() string { // GetCommit fetches the Commit object for a given SHA. // -// GitHub API docs: https://docs.github.com/rest/git/commits#get-a-commit-object +// GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#get-a-commit-object // //meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha} -func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) { +func (s *GitService) GetCommit(ctx context.Context, owner, repo, sha string) (*Commit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) + var c *Commit + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -110,6 +111,8 @@ type createCommit struct { Signature *string `json:"signature,omitempty"` } +// CreateCommitOptions specifies optional parameters to creates +// a new commit in a repository. type CreateCommitOptions struct { // CreateCommit will sign the commit with this signer. See MessageSigner doc for more details. // Ignored on commits where Verification.Signature is defined. @@ -123,13 +126,10 @@ type CreateCommitOptions struct { // data if omitted. If the commit.Author is omitted, it will be filled in with // the authenticated user’s information and the current date. // -// GitHub API docs: https://docs.github.com/rest/git/commits#create-a-commit +// GitHub API docs: https://docs.github.com/rest/git/commits?apiVersion=2022-11-28#create-a-commit // //meta:operation POST /repos/{owner}/{repo}/git/commits -func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { - if commit == nil { - return nil, nil, errors.New("commit must be provided") - } +func (s *GitService) CreateCommit(ctx context.Context, owner, repo string, commit Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { if opts == nil { opts = &CreateCommitOptions{} } @@ -161,13 +161,13 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string body.Signature = &signature } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - c := new(Commit) - resp, err := s.client.Do(ctx, req, c) + var c *Commit + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -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/v69/github/git_refs.go b/vendor/github.com/google/go-github/v93/github/git_refs.go similarity index 50% rename from vendor/github.com/google/go-github/v69/github/git_refs.go rename to vendor/github.com/google/go-github/v93/github/git_refs.go index 91eb6dd43..81561a1f8 100644 --- a/vendor/github.com/google/go-github/v69/github/git_refs.go +++ b/vendor/github.com/google/go-github/v93/github/git_refs.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" "net/url" "strings" @@ -14,6 +15,7 @@ import ( // Reference represents a GitHub reference. type Reference struct { + // The name of the fully qualified reference, i.e.: `refs/heads/master`. Ref *string `json:"ref"` URL *string `json:"url"` Object *GitObject `json:"object"` @@ -35,33 +37,34 @@ func (o GitObject) String() string { return Stringify(o) } -// createRefRequest represents the payload for creating a reference. -type createRefRequest struct { - Ref *string `json:"ref"` - SHA *string `json:"sha"` +// CreateRef represents the payload for creating a reference. +type CreateRef struct { + Ref string `json:"ref"` + SHA string `json:"sha"` } -// updateRefRequest represents the payload for updating a reference. -type updateRefRequest struct { - SHA *string `json:"sha"` - Force *bool `json:"force"` +// UpdateRef represents the payload for updating a reference. +type UpdateRef struct { + SHA string `json:"sha"` + Force *bool `json:"force,omitempty"` } // GetRef fetches a single reference in a repository. +// The ref must be formatted as `heads/` for branches and `tags/` for tags. // -// GitHub API docs: https://docs.github.com/rest/git/refs#get-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#get-a-reference // //meta:operation GET /repos/{owner}/{repo}/git/ref/{ref} -func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) { +func (s *GitService) GetRef(ctx context.Context, owner, repo, ref string) (*Reference, *Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -79,38 +82,25 @@ func refURLEscape(ref string) string { return strings.Join(parts, "/") } -// ReferenceListOptions specifies optional parameters to the -// GitService.ListMatchingRefs method. -type ReferenceListOptions struct { - 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 +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var rs []*Reference - resp, err := s.client.Do(ctx, req, &rs) + resp, err := s.client.Do(req, &rs) if err != nil { return nil, resp, err } @@ -120,22 +110,29 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o // CreateRef creates a new ref in a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#create-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#create-a-reference // //meta:operation POST /repos/{owner}/{repo}/git/refs -func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) { +func (s *GitService) CreateRef(ctx context.Context, owner, repo string, body CreateRef) (*Reference, *Response, error) { + if body.Ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if body.SHA == "" { + return nil, nil, errors.New("sha must be provided") + } + + // ensure the 'refs/' prefix is present + body.Ref = "refs/" + strings.TrimPrefix(body.Ref, "refs/") + u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) - req, err := s.client.NewRequest("POST", u, &createRefRequest{ - // back-compat with previous behavior that didn't require 'refs/' prefix - Ref: Ptr("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), - SHA: ref.Object.SHA, - }) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -145,22 +142,27 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r // UpdateRef updates an existing ref in a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#update-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#update-a-reference // //meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref} -func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { - refPath := strings.TrimPrefix(*ref.Ref, "refs/") +func (s *GitService) UpdateRef(ctx context.Context, owner, repo, ref string, body UpdateRef) (*Reference, *Response, error) { + if ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if body.SHA == "" { + return nil, nil, errors.New("sha must be provided") + } + + refPath := strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(refPath)) - req, err := s.client.NewRequest("PATCH", u, &updateRefRequest{ - SHA: ref.Object.SHA, - Force: &force, - }) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - r := new(Reference) - resp, err := s.client.Do(ctx, req, r) + var r *Reference + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -170,16 +172,16 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r // DeleteRef deletes a ref from a repository. // -// GitHub API docs: https://docs.github.com/rest/git/refs#delete-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs?apiVersion=2022-11-28#delete-a-reference // //meta:operation DELETE /repos/{owner}/{repo}/git/refs/{ref} -func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) { +func (s *GitService) DeleteRef(ctx context.Context, owner, repo, ref string) (*Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/git_tags.go b/vendor/github.com/google/go-github/v93/github/git_tags.go similarity index 51% rename from vendor/github.com/google/go-github/v69/github/git_tags.go rename to vendor/github.com/google/go-github/v93/github/git_tags.go index 67321566f..88ebff4e8 100644 --- a/vendor/github.com/google/go-github/v69/github/git_tags.go +++ b/vendor/github.com/google/go-github/v93/github/git_tags.go @@ -22,31 +22,29 @@ type Tag struct { NodeID *string `json:"node_id,omitempty"` } -// createTagRequest represents the body of a CreateTag request. This is mostly -// identical to Tag with the exception that the object SHA and Type are -// top-level fields, rather than being nested inside a JSON object. -type createTagRequest struct { - Tag *string `json:"tag,omitempty"` - Message *string `json:"message,omitempty"` - Object *string `json:"object,omitempty"` - Type *string `json:"type,omitempty"` +// CreateTag represents the payload for creating a tag. +type CreateTag struct { + Tag string `json:"tag"` + Message string `json:"message"` + Object string `json:"object"` + Type string `json:"type"` Tagger *CommitAuthor `json:"tagger,omitempty"` } // GetTag fetches a tag from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/rest/git/tags#get-a-tag +// GitHub API docs: https://docs.github.com/rest/git/tags?apiVersion=2022-11-28#get-a-tag // //meta:operation GET /repos/{owner}/{repo}/git/tags/{tag_sha} -func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) { +func (s *GitService) GetTag(ctx context.Context, owner, repo, sha string) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - tag := new(Tag) - resp, err := s.client.Do(ctx, req, tag) + var tag *Tag + resp, err := s.client.Do(req, &tag) if err != nil { return nil, resp, err } @@ -56,30 +54,19 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha // CreateTag creates a tag object. // -// GitHub API docs: https://docs.github.com/rest/git/tags#create-a-tag-object +// GitHub API docs: https://docs.github.com/rest/git/tags?apiVersion=2022-11-28#create-a-tag-object // //meta:operation POST /repos/{owner}/{repo}/git/tags -func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) { +func (s *GitService) CreateTag(ctx context.Context, owner, repo string, body CreateTag) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) - // convert Tag into a createTagRequest - tagRequest := &createTagRequest{ - Tag: tag.Tag, - Message: tag.Message, - Tagger: tag.Tagger, - } - if tag.Object != nil { - tagRequest.Object = tag.Object.SHA - tagRequest.Type = tag.Object.Type - } - - req, err := s.client.NewRequest("POST", u, tagRequest) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(Tag) - resp, err := s.client.Do(ctx, req, t) + var t *Tag + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/git_trees.go b/vendor/github.com/google/go-github/v93/github/git_trees.go similarity index 70% rename from vendor/github.com/google/go-github/v69/github/git_trees.go rename to vendor/github.com/google/go-github/v93/github/git_trees.go index b8eed58e1..2e4b9dc21 100644 --- a/vendor/github.com/google/go-github/v69/github/git_trees.go +++ b/vendor/github.com/google/go-github/v93/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"` @@ -58,7 +65,8 @@ type treeEntryWithFileDelete struct { URL *string `json:"url,omitempty"` } -func (t *TreeEntry) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaler interface. +func (t TreeEntry) MarshalJSON() ([]byte, error) { if t.SHA == nil && t.Content == nil { return json.Marshal(struct { SHA *string `json:"sha"` @@ -93,22 +101,22 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) { // GetTree fetches the Tree object for a given sha hash from a repository. // -// GitHub API docs: https://docs.github.com/rest/git/trees#get-a-tree +// GitHub API docs: https://docs.github.com/rest/git/trees?apiVersion=2022-11-28#get-a-tree // //meta:operation GET /repos/{owner}/{repo}/git/trees/{tree_sha} -func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { +func (s *GitService) GetTree(ctx context.Context, owner, repo, sha string, recursive bool) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) if recursive { u += "?recursive=1" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) + var t *Tree + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -118,21 +126,27 @@ func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha // createTree represents the body of a CreateTree request. type createTree struct { - BaseTree string `json:"base_tree,omitempty"` - Entries []interface{} `json:"tree"` + BaseTree string `json:"base_tree,omitempty"` + Entries []any `json:"tree"` } // CreateTree creates a new tree in a repository. If both a tree and a nested // 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. // -// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree +// 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?apiVersion=2022-11-28#create-a-tree // //meta:operation POST /repos/{owner}/{repo}/git/trees -func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { +func (s *GitService) CreateTree(ctx context.Context, owner, repo, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo) - newEntries := make([]interface{}, 0, len(entries)) + newEntries := make([]any, 0, len(entries)) for _, entry := range entries { if entry.Content == nil && entry.SHA == nil { newEntries = append(newEntries, treeEntryWithFileDelete{ @@ -151,13 +165,13 @@ func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, BaseTree: baseTree, Entries: newEntries, } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(Tree) - resp, err := s.client.Do(ctx, req, t) + var t *Tree + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/github-accessors.go b/vendor/github.com/google/go-github/v93/github/github-accessors.go similarity index 56% rename from vendor/github.com/google/go-github/v69/github/github-accessors.go rename to vendor/github.com/google/go-github/v93/github/github-accessors.go index 6270bc1fc..952d3d8fe 100644 --- a/vendor/github.com/google/go-github/v69/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v93/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 ( @@ -14,6 +14,14 @@ import ( "time" ) +// GetMessage returns the Message field. +func (a *AbuseRateLimitError) GetMessage() string { + if a == nil { + return "" + } + return a.Message +} + // GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise. func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { if a == nil || a.RetryAfter == nil { @@ -22,6 +30,102 @@ 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 +} + +// GetStudents returns the Students slice if it's non-nil, nil otherwise. +func (a *AcceptedAssignment) GetStudents() []*ClassroomUser { + if a == nil || a.Students == nil { + return nil + } + return a.Students +} + +// 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 +} + +// GetRaw returns the Raw slice if it's non-nil, nil otherwise. +func (a *AcceptedError) GetRaw() []byte { + if a == nil || a.Raw == nil { + return nil + } + return a.Raw +} + +// GetFullName returns the FullName field. +func (a *AccessibleRepository) GetFullName() string { + if a == nil { + return "" + } + return a.FullName +} + +// GetID returns the ID field. +func (a *AccessibleRepository) GetID() int64 { + if a == nil { + return 0 + } + return a.ID +} + +// GetName returns the Name field. +func (a *AccessibleRepository) GetName() string { + if a == nil { + return "" + } + return a.Name +} + // GetGithubOwnedAllowed returns the GithubOwnedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { if a == nil || a.GithubOwnedAllowed == nil { @@ -30,6 +134,14 @@ func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { return *a.GithubOwnedAllowed } +// GetPatternsAllowed returns the PatternsAllowed slice if it's non-nil, nil otherwise. +func (a *ActionsAllowed) GetPatternsAllowed() []string { + if a == nil || a.PatternsAllowed == nil { + return nil + } + return a.PatternsAllowed +} + // GetVerifiedAllowed returns the VerifiedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetVerifiedAllowed() bool { if a == nil || a.VerifiedAllowed == nil { @@ -94,6 +206,22 @@ func (a *ActionsCache) GetVersion() string { return *a.Version } +// GetActionsCaches returns the ActionsCaches slice if it's non-nil, nil otherwise. +func (a *ActionsCacheList) GetActionsCaches() []*ActionsCache { + if a == nil || a.ActionsCaches == nil { + return nil + } + return a.ActionsCaches +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsCacheList) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + // GetDirection returns the Direction field if it's non-nil, zero value otherwise. func (a *ActionsCacheListOptions) GetDirection() string { if a == nil || a.Direction == nil { @@ -126,6 +254,158 @@ func (a *ActionsCacheListOptions) GetSort() string { return *a.Sort } +// GetMaxCacheRetentionDays returns the MaxCacheRetentionDays field if it's non-nil, zero value otherwise. +func (a *ActionsCacheRetentionLimit) GetMaxCacheRetentionDays() int { + if a == nil || a.MaxCacheRetentionDays == nil { + return 0 + } + return *a.MaxCacheRetentionDays +} + +// GetMaxCacheSizeGB returns the MaxCacheSizeGB field if it's non-nil, zero value otherwise. +func (a *ActionsCacheStorageLimit) GetMaxCacheSizeGB() int { + if a == nil || a.MaxCacheSizeGB == nil { + return 0 + } + return *a.MaxCacheSizeGB +} + +// GetActiveCachesCount returns the ActiveCachesCount field. +func (a *ActionsCacheUsage) GetActiveCachesCount() int { + if a == nil { + return 0 + } + return a.ActiveCachesCount +} + +// GetActiveCachesSizeInBytes returns the ActiveCachesSizeInBytes field. +func (a *ActionsCacheUsage) GetActiveCachesSizeInBytes() int64 { + if a == nil { + return 0 + } + return a.ActiveCachesSizeInBytes +} + +// GetFullName returns the FullName field. +func (a *ActionsCacheUsage) GetFullName() string { + if a == nil { + return "" + } + return a.FullName +} + +// GetRepoCacheUsage returns the RepoCacheUsage slice if it's non-nil, nil otherwise. +func (a *ActionsCacheUsageList) GetRepoCacheUsage() []*ActionsCacheUsage { + if a == nil || a.RepoCacheUsage == nil { + return nil + } + return a.RepoCacheUsage +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsCacheUsageList) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetName returns the Name field. +func (a *ActionsCreateOrgVariableRequest) GetName() string { + if a == nil { + return "" + } + return a.Name +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (a *ActionsCreateOrgVariableRequest) GetSelectedRepositoryIDs() []int64 { + if a == nil || a.SelectedRepositoryIDs == nil { + return nil + } + return a.SelectedRepositoryIDs +} + +// GetValue returns the Value field. +func (a *ActionsCreateOrgVariableRequest) GetValue() string { + if a == nil { + return "" + } + return a.Value +} + +// GetVisibility returns the Visibility field. +func (a *ActionsCreateOrgVariableRequest) GetVisibility() string { + if a == nil { + return "" + } + return a.Visibility +} + +// GetName returns the Name field. +func (a *ActionsCreateVariableRequest) GetName() string { + if a == nil { + return "" + } + return a.Name +} + +// GetValue returns the Value field. +func (a *ActionsCreateVariableRequest) GetValue() string { + if a == nil { + return "" + } + return a.Value +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (a *ActionsEnabledOnEnterpriseRepos) GetOrganizations() []*Organization { + if a == nil || a.Organizations == nil { + return nil + } + return a.Organizations +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsEnabledOnEnterpriseRepos) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (a *ActionsEnabledOnOrgRepos) GetRepositories() []*Repository { + if a == nil || a.Repositories == nil { + return nil + } + return a.Repositories +} + +// GetTotalCount returns the TotalCount field. +func (a *ActionsEnabledOnOrgRepos) GetTotalCount() int { + if a == nil { + return 0 + } + return a.TotalCount +} + +// GetFullDomains returns the FullDomains slice if it's non-nil, nil otherwise. +func (a *ActionsInboundDomains) GetFullDomains() []string { + if a == nil || a.FullDomains == nil { + return nil + } + return a.FullDomains +} + +// GetWildcardDomains returns the WildcardDomains slice if it's non-nil, nil otherwise. +func (a *ActionsInboundDomains) GetWildcardDomains() []string { + if a == nil || a.WildcardDomains == nil { + return nil + } + return a.WildcardDomains +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissions) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { @@ -134,12 +414,12 @@ func (a *ActionsPermissions) GetAllowedActions() string { return *a.AllowedActions } -// GetEnabledRepositories returns the EnabledRepositories field if it's non-nil, zero value otherwise. +// GetEnabledRepositories returns the EnabledRepositories field. func (a *ActionsPermissions) GetEnabledRepositories() string { - if a == nil || a.EnabledRepositories == nil { + if a == nil { return "" } - return *a.EnabledRepositories + return a.EnabledRepositories } // GetSelectedActionsURL returns the SelectedActionsURL field if it's non-nil, zero value otherwise. @@ -150,6 +430,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 { @@ -158,12 +446,12 @@ func (a *ActionsPermissionsEnterprise) GetAllowedActions() string { return *a.AllowedActions } -// GetEnabledOrganizations returns the EnabledOrganizations field if it's non-nil, zero value otherwise. +// GetEnabledOrganizations returns the EnabledOrganizations field. func (a *ActionsPermissionsEnterprise) GetEnabledOrganizations() string { - if a == nil || a.EnabledOrganizations == nil { + if a == nil { return "" } - return *a.EnabledOrganizations + return a.EnabledOrganizations } // GetSelectedActionsURL returns the SelectedActionsURL field if it's non-nil, zero value otherwise. @@ -182,12 +470,12 @@ func (a *ActionsPermissionsRepository) GetAllowedActions() string { return *a.AllowedActions } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +// GetEnabled returns the Enabled field. func (a *ActionsPermissionsRepository) GetEnabled() bool { - if a == nil || a.Enabled == nil { + if a == nil { return false } - return *a.Enabled + return a.Enabled } // GetSelectedActionsURL returns the SelectedActionsURL field if it's non-nil, zero value otherwise. @@ -198,792 +486,944 @@ 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 +} + +// GetConditions returns the Conditions field. +func (a *ActionsPolicy) GetConditions() *ActionsPolicyConditions { + if a == nil { + return nil + } + return a.Conditions +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *ActionsVariable) GetCreatedAt() Timestamp { +func (a *ActionsPolicy) GetCreatedAt() Timestamp { if a == nil || a.CreatedAt == nil { return Timestamp{} } return *a.CreatedAt } -// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. -func (a *ActionsVariable) GetSelectedRepositoriesURL() string { - if a == nil || a.SelectedRepositoriesURL == nil { +// GetEnforcement returns the Enforcement field. +func (a *ActionsPolicy) GetEnforcement() RulesetEnforcement { + if a == nil { return "" } - return *a.SelectedRepositoriesURL + return a.Enforcement } -// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. -func (a *ActionsVariable) GetSelectedRepositoryIDs() *SelectedRepoIDs { +// GetID returns the ID field. +func (a *ActionsPolicy) GetID() int64 { if a == nil { - return nil + return 0 } - return a.SelectedRepositoryIDs + return a.ID } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *ActionsVariable) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} +// GetLinks returns the Links field. +func (a *ActionsPolicy) GetLinks() *RepositoryRulesetLinks { + if a == nil { + return nil } - return *a.UpdatedAt + return a.Links } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (a *ActionsVariable) GetVisibility() string { - if a == nil || a.Visibility == nil { +// GetName returns the Name field. +func (a *ActionsPolicy) GetName() string { + if a == nil { return "" } - return *a.Visibility + return a.Name } -// GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise. -func (a *ActorLocation) GetCountryCode() string { - if a == nil || a.CountryCode == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (a *ActionsPolicy) GetNodeID() string { + if a == nil || a.NodeID == nil { return "" } - return *a.CountryCode + return *a.NodeID } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (a *AdminEnforcedChanges) GetFrom() bool { - if a == nil || a.From == nil { - return false +// GetRules returns the Rules slice if it's non-nil, nil otherwise. +func (a *ActionsPolicy) GetRules() []*ActionsPolicyRule { + if a == nil || a.Rules == nil { + return nil } - return *a.From + return a.Rules } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *AdminEnforcement) GetURL() string { - if a == nil || a.URL == nil { +// GetSource returns the Source field. +func (a *ActionsPolicy) GetSource() string { + if a == nil { return "" } - return *a.URL + return a.Source } -// GetComments returns the Comments field. -func (a *AdminStats) GetComments() *CommentStats { +// GetSourceType returns the SourceType field. +func (a *ActionsPolicy) GetSourceType() RulesetSourceType { if a == nil { - return nil + return "" } - return a.Comments + return a.SourceType } -// GetGists returns the Gists field. -func (a *AdminStats) GetGists() *GistStats { +// GetTarget returns the Target field. +func (a *ActionsPolicy) GetTarget() ActionsPolicyTarget { if a == nil { - return nil + return "" } - return a.Gists + return a.Target } -// GetHooks returns the Hooks field. -func (a *AdminStats) GetHooks() *HookStats { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ActionsPolicy) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetID returns the ID field. +func (a *ActionsPolicyActor) GetID() int64 { if a == nil { - return nil + return 0 } - return a.Hooks + return a.ID } -// GetIssues returns the Issues field. -func (a *AdminStats) GetIssues() *IssueStats { +// GetType returns the Type field. +func (a *ActionsPolicyActor) GetType() ActionsPolicyActorType { + if a == nil { + return "" + } + return a.Type +} + +// GetOrganizationID returns the OrganizationID field. +func (a *ActionsPolicyConditions) GetOrganizationID() *RepositoryRulesetOrganizationIDsConditionParameters { if a == nil { return nil } - return a.Issues + return a.OrganizationID } -// GetMilestones returns the Milestones field. -func (a *AdminStats) GetMilestones() *MilestoneStats { +// GetOrganizationName returns the OrganizationName field. +func (a *ActionsPolicyConditions) GetOrganizationName() *RepositoryRulesetOrganizationNamesConditionParameters { if a == nil { return nil } - return a.Milestones + return a.OrganizationName } -// GetOrgs returns the Orgs field. -func (a *AdminStats) GetOrgs() *OrgStats { +// GetOrganizationProperty returns the OrganizationProperty field. +func (a *ActionsPolicyConditions) GetOrganizationProperty() *RepositoryRulesetOrganizationPropertyConditionParameters { if a == nil { return nil } - return a.Orgs + return a.OrganizationProperty } -// GetPages returns the Pages field. -func (a *AdminStats) GetPages() *PageStats { +// GetRepositoryID returns the RepositoryID field. +func (a *ActionsPolicyConditions) GetRepositoryID() *RepositoryRulesetRepositoryIDsConditionParameters { if a == nil { return nil } - return a.Pages + return a.RepositoryID } -// GetPulls returns the Pulls field. -func (a *AdminStats) GetPulls() *PullStats { +// GetRepositoryName returns the RepositoryName field. +func (a *ActionsPolicyConditions) GetRepositoryName() *RepositoryRulesetRepositoryNamesConditionParameters { if a == nil { return nil } - return a.Pulls + return a.RepositoryName } -// GetRepos returns the Repos field. -func (a *AdminStats) GetRepos() *RepoStats { +// GetRepositoryProperty returns the RepositoryProperty field. +func (a *ActionsPolicyConditions) GetRepositoryProperty() *RepositoryRulesetRepositoryPropertyConditionParameters { if a == nil { return nil } - return a.Repos + return a.RepositoryProperty } -// GetUsers returns the Users field. -func (a *AdminStats) GetUsers() *UserStats { +// GetWorkflowPath returns the WorkflowPath field. +func (a *ActionsPolicyConditions) GetWorkflowPath() *ActionsPolicyWorkflowPathConditionParameters { if a == nil { return nil } - return a.Users + return a.WorkflowPath } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurity) GetStatus() string { - if a == nil || a.Status == nil { - return "" +// GetPolicies returns the Policies slice if it's non-nil, nil otherwise. +func (a *ActionsPolicyList) GetPolicies() []*ActionsPolicy { + if a == nil || a.Policies == nil { + return nil } - return *a.Status + return a.Policies } -// 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 "" +// GetTotalCount returns the TotalCount field. +func (a *ActionsPolicyList) GetTotalCount() int { + if a == nil { + return 0 } - return *a.LastPushedDate + return a.TotalCount } -// 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 "" +// GetHasParents returns the HasParents field if it's non-nil, zero value otherwise. +func (a *ActionsPolicyListOptions) GetHasParents() bool { + if a == nil || a.HasParents == nil { + return false } - return *a.UserLogin + return *a.HasParents } -// GetScore returns the Score field. -func (a *AdvisoryCVSS) GetScore() *float64 { +// GetParameters returns the Parameters field. +func (a *ActionsPolicyRule) GetParameters() *ActionsPolicyRuleParameters { if a == nil { return nil } - return a.Score + return a.Parameters } -// GetVectorString returns the VectorString field if it's non-nil, zero value otherwise. -func (a *AdvisoryCVSS) GetVectorString() string { - if a == nil || a.VectorString == nil { +// GetType returns the Type field. +func (a *ActionsPolicyRule) GetType() ActionsPolicyRuleType { + if a == nil { return "" } - return *a.VectorString + return a.Type } -// GetCWEID returns the CWEID field if it's non-nil, zero value otherwise. -func (a *AdvisoryCWEs) GetCWEID() string { - if a == nil || a.CWEID == nil { - return "" +// GetAllowedActors returns the AllowedActors slice if it's non-nil, nil otherwise. +func (a *ActionsPolicyRuleParameters) GetAllowedActors() []*ActionsPolicyActor { + if a == nil || a.AllowedActors == nil { + return nil } - return *a.CWEID + return a.AllowedActors } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *AdvisoryCWEs) GetName() string { - if a == nil || a.Name == nil { - return "" +// GetAllowedEvents returns the AllowedEvents slice if it's non-nil, nil otherwise. +func (a *ActionsPolicyRuleParameters) GetAllowedEvents() []string { + if a == nil || a.AllowedEvents == nil { + return nil } - return *a.Name + return a.AllowedEvents } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (a *AdvisoryIdentifier) GetType() string { - if a == nil || a.Type == nil { - return "" +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (a *ActionsPolicyWorkflowPathConditionParameters) GetExclude() []string { + if a == nil || a.Exclude == nil { + return nil } - return *a.Type + return a.Exclude } -// GetValue returns the Value field if it's non-nil, zero value otherwise. -func (a *AdvisoryIdentifier) GetValue() string { - if a == nil || a.Value == nil { - return "" +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (a *ActionsPolicyWorkflowPathConditionParameters) GetInclude() []string { + if a == nil || a.Include == nil { + return nil } - return *a.Value + return a.Include } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *AdvisoryReference) GetURL() string { - if a == nil || a.URL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *ActionsUpdateOrgVariableRequest) GetName() string { + if a == nil || a.Name == nil { return "" } - return *a.URL + return *a.Name } -// GetFirstPatchedVersion returns the FirstPatchedVersion field. -func (a *AdvisoryVulnerability) GetFirstPatchedVersion() *FirstPatchedVersion { - if a == nil { +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (a *ActionsUpdateOrgVariableRequest) GetSelectedRepositoryIDs() []int64 { + if a == nil || a.SelectedRepositoryIDs == nil { return nil } - return a.FirstPatchedVersion + return a.SelectedRepositoryIDs } -// GetPackage returns the Package field. -func (a *AdvisoryVulnerability) GetPackage() *VulnerabilityPackage { - if a == nil { - return nil +// GetValue returns the Value field if it's non-nil, zero value otherwise. +func (a *ActionsUpdateOrgVariableRequest) GetValue() string { + if a == nil || a.Value == nil { + return "" } - return a.Package + return *a.Value } -// GetPatchedVersions returns the PatchedVersions field if it's non-nil, zero value otherwise. -func (a *AdvisoryVulnerability) GetPatchedVersions() string { - if a == nil || a.PatchedVersions == nil { +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (a *ActionsUpdateOrgVariableRequest) GetVisibility() string { + if a == nil || a.Visibility == nil { return "" } - return *a.PatchedVersions + return *a.Visibility } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (a *AdvisoryVulnerability) GetSeverity() string { - if a == nil || a.Severity == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *ActionsUpdateVariableRequest) GetName() string { + if a == nil || a.Name == nil { return "" } - return *a.Severity + return *a.Name } -// GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. -func (a *AdvisoryVulnerability) GetVulnerableVersionRange() string { - if a == nil || a.VulnerableVersionRange == nil { +// GetValue returns the Value field if it's non-nil, zero value otherwise. +func (a *ActionsUpdateVariableRequest) GetValue() string { + if a == nil || a.Value == nil { return "" } - return *a.VulnerableVersionRange + return *a.Value } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (a *Alert) GetClosedAt() Timestamp { - if a == nil || a.ClosedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *ActionsVariable) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { return Timestamp{} } - return *a.ClosedAt + return *a.CreatedAt } -// GetClosedBy returns the ClosedBy field. -func (a *Alert) GetClosedBy() *User { +// GetName returns the Name field. +func (a *ActionsVariable) GetName() string { if a == nil { - return nil + return "" } - return a.ClosedBy + return a.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *Alert) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (a *ActionsVariable) GetSelectedRepositoriesURL() string { + if a == nil || a.SelectedRepositoriesURL == nil { + return "" } - return *a.CreatedAt + return *a.SelectedRepositoriesURL } -// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. -func (a *Alert) GetDismissedAt() Timestamp { - if a == nil || a.DismissedAt == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *ActionsVariable) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { return Timestamp{} } - return *a.DismissedAt + return *a.UpdatedAt } -// GetDismissedBy returns the DismissedBy field. -func (a *Alert) GetDismissedBy() *User { +// GetValue returns the Value field. +func (a *ActionsVariable) GetValue() string { if a == nil { - return nil + return "" } - return a.DismissedBy + return a.Value } -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (a *Alert) GetDismissedComment() string { - if a == nil || a.DismissedComment == nil { +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (a *ActionsVariable) GetVisibility() string { + if a == nil || a.Visibility == nil { return "" } - return *a.DismissedComment + return *a.Visibility } -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (a *Alert) GetDismissedReason() string { - if a == nil || a.DismissedReason == nil { - return "" +// GetTotalCount returns the TotalCount field. +func (a *ActionsVariables) GetTotalCount() int { + if a == nil { + return 0 } - return *a.DismissedReason + return a.TotalCount } -// GetFixedAt returns the FixedAt field if it's non-nil, zero value otherwise. -func (a *Alert) GetFixedAt() Timestamp { - if a == nil || a.FixedAt == nil { - return Timestamp{} +// GetVariables returns the Variables slice if it's non-nil, nil otherwise. +func (a *ActionsVariables) GetVariables() []*ActionsVariable { + if a == nil || a.Variables == nil { + return nil } - return *a.FixedAt + return a.Variables } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (a *Alert) GetHTMLURL() string { - if a == nil || a.HTMLURL == nil { - return "" +// 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.HTMLURL + return *a.MaximumAdvancedSecurityCommitters } -// GetInstancesURL returns the InstancesURL field if it's non-nil, zero value otherwise. -func (a *Alert) GetInstancesURL() string { - if a == nil || a.InstancesURL == nil { - return "" +// 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.InstancesURL + return *a.PurchasedAdvancedSecurityCommitters } -// GetMostRecentInstance returns the MostRecentInstance field. -func (a *Alert) GetMostRecentInstance() *MostRecentInstance { - if a == nil { +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (a *ActiveCommitters) GetRepositories() []*RepositoryActiveCommitters { + if a == nil || a.Repositories == nil { return nil } - return a.MostRecentInstance + return a.Repositories } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (a *Alert) GetNumber() int { - if a == nil || a.Number == nil { +// 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.Number + return *a.TotalAdvancedSecurityCommitters } -// GetRepository returns the Repository field. -func (a *Alert) GetRepository() *Repository { - if a == nil { - return nil +// 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.Repository + return *a.TotalCount } -// GetRule returns the Rule field. -func (a *Alert) GetRule() *Rule { - if a == nil { - return nil +// 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.Rule + return *a.AdvancedSecurityProduct } -// GetRuleDescription returns the RuleDescription field if it's non-nil, zero value otherwise. -func (a *Alert) GetRuleDescription() string { - if a == nil || a.RuleDescription == nil { +// GetDirection returns the Direction field. +func (a *ActivityListStarredOptions) GetDirection() string { + if a == nil { return "" } - return *a.RuleDescription + return a.Direction } -// GetRuleID returns the RuleID field if it's non-nil, zero value otherwise. -func (a *Alert) GetRuleID() string { - if a == nil || a.RuleID == nil { +// GetSort returns the Sort field. +func (a *ActivityListStarredOptions) GetSort() string { + if a == nil { return "" } - return *a.RuleID + return a.Sort } -// GetRuleSeverity returns the RuleSeverity field if it's non-nil, zero value otherwise. -func (a *Alert) GetRuleSeverity() string { - if a == nil || a.RuleSeverity == nil { +// GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise. +func (a *ActorLocation) GetCountryCode() string { + if a == nil || a.CountryCode == nil { return "" } - return *a.RuleSeverity + return *a.CountryCode } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (a *Alert) GetState() string { - if a == nil || a.State == nil { +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (a *AddCollaboratorRequest) GetPermission() string { + if a == nil || a.Permission == nil { return "" } - return *a.State + return *a.Permission } -// GetTool returns the Tool field. -func (a *Alert) GetTool() *Tool { - if a == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AddProjectItemRequest) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return a.Tool + return *a.ID } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *Alert) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (a *AddProjectItemRequest) GetNumber() int { + if a == nil || a.Number == nil { + return 0 } - return *a.UpdatedAt + return *a.Number } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *Alert) GetURL() string { - if a == nil || a.URL == nil { +// GetOwner returns the Owner field if it's non-nil, zero value otherwise. +func (a *AddProjectItemRequest) GetOwner() string { + if a == nil || a.Owner == nil { return "" } - return *a.URL + return *a.Owner } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (a *AllowDeletionsEnforcementLevelChanges) GetFrom() string { - if a == nil || a.From == nil { +// GetRepo returns the Repo field if it's non-nil, zero value otherwise. +func (a *AddProjectItemRequest) GetRepo() string { + if a == nil || a.Repo == nil { return "" } - return *a.From + return *a.Repo } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (a *AllowForkSyncing) GetEnabled() bool { - if a == nil || a.Enabled == nil { - return false +// GetType returns the Type field. +func (a *AddProjectItemRequest) GetType() ProjectV2ItemContentType { + if a == nil { + return "" } - return *a.Enabled + return a.Type } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (a *AnalysesListOptions) GetRef() string { - if a == nil || a.Ref == nil { +// GetDataType returns the DataType field if it's non-nil, zero value otherwise. +func (a *AddProjectV2FieldRequest) GetDataType() string { + if a == nil || a.DataType == nil { return "" } - return *a.Ref + return *a.DataType } -// GetSarifID returns the SarifID field if it's non-nil, zero value otherwise. -func (a *AnalysesListOptions) GetSarifID() string { - if a == nil || a.SarifID == nil { - return "" +// GetIssueFieldID returns the IssueFieldID field if it's non-nil, zero value otherwise. +func (a *AddProjectV2FieldRequest) GetIssueFieldID() int64 { + if a == nil || a.IssueFieldID == nil { + return 0 } - return *a.SarifID + return *a.IssueFieldID } -// GetDomains returns the Domains field. -func (a *APIMeta) GetDomains() *APIMetaDomains { +// GetIterationConfiguration returns the IterationConfiguration field. +func (a *AddProjectV2FieldRequest) GetIterationConfiguration() *ProjectV2FieldIterationConfiguration { if a == nil { return nil } - return a.Domains + return a.IterationConfiguration } -// GetSSHKeyFingerprints returns the SSHKeyFingerprints map if it's non-nil, an empty map otherwise. -func (a *APIMeta) GetSSHKeyFingerprints() map[string]string { - if a == nil || a.SSHKeyFingerprints == nil { - return map[string]string{} +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *AddProjectV2FieldRequest) GetName() string { + if a == nil || a.Name == nil { + return "" } - return a.SSHKeyFingerprints + return *a.Name } -// GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise. -func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { - if a == nil || a.VerifiablePasswordAuthentication == nil { - return false +// GetSingleSelectOptions returns the SingleSelectOptions slice if it's non-nil, nil otherwise. +func (a *AddProjectV2FieldRequest) GetSingleSelectOptions() []*ProjectV2FieldSingleSelectOption { + if a == nil || a.SingleSelectOptions == nil { + return nil } - return *a.VerifiablePasswordAuthentication + return a.SingleSelectOptions } -// GetArtifactAttestations returns the ArtifactAttestations field. -func (a *APIMetaDomains) GetArtifactAttestations() *APIMetaArtifactAttestations { - if a == nil { - return nil +// 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.ArtifactAttestations + return *a.Message } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *App) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} +// GetReassignedResources returns the ReassignedResources slice if it's non-nil, nil otherwise. +func (a *AddResourcesToCostCenterResponse) GetReassignedResources() []*ReassignedResource { + if a == nil || a.ReassignedResources == nil { + return nil } - return *a.CreatedAt + return a.ReassignedResources } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (a *App) GetDescription() string { - if a == nil || a.Description == nil { +// GetRole returns the Role field if it's non-nil, zero value otherwise. +func (a *AddTeamMembershipRequest) GetRole() string { + if a == nil || a.Role == nil { return "" } - return *a.Description + return *a.Role } -// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. -func (a *App) GetExternalURL() string { - if a == nil || a.ExternalURL == nil { +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (a *AddTeamProjectRequest) GetPermission() string { + if a == nil || a.Permission == nil { return "" } - return *a.ExternalURL + return *a.Permission } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (a *App) GetHTMLURL() string { - if a == nil || a.HTMLURL == nil { +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (a *AddTeamRepoRequest) GetPermission() string { + if a == nil || a.Permission == nil { return "" } - return *a.HTMLURL + return *a.Permission } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *App) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *AdminEnforcedChanges) GetFrom() bool { + if a == nil || a.From == nil { + return false } - return *a.ID + return *a.From } -// GetInstallationsCount returns the InstallationsCount field if it's non-nil, zero value otherwise. -func (a *App) GetInstallationsCount() int { - if a == nil || a.InstallationsCount == nil { - return 0 +// GetEnabled returns the Enabled field. +func (a *AdminEnforcement) GetEnabled() bool { + if a == nil { + return false } - return *a.InstallationsCount + return a.Enabled } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *App) GetName() string { - if a == nil || a.Name == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (a *AdminEnforcement) GetURL() string { + if a == nil || a.URL == nil { return "" } - return *a.Name + return *a.URL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (a *App) GetNodeID() string { - if a == nil || a.NodeID == nil { - return "" +// GetComments returns the Comments field. +func (a *AdminStats) GetComments() *CommentStats { + if a == nil { + return nil } - return *a.NodeID + return a.Comments } -// GetOwner returns the Owner field. -func (a *App) GetOwner() *User { +// GetGists returns the Gists field. +func (a *AdminStats) GetGists() *GistStats { if a == nil { return nil } - return a.Owner + return a.Gists } -// GetPermissions returns the Permissions field. -func (a *App) GetPermissions() *InstallationPermissions { +// GetHooks returns the Hooks field. +func (a *AdminStats) GetHooks() *HookStats { if a == nil { return nil } - return a.Permissions + return a.Hooks } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (a *App) GetSlug() string { - if a == nil || a.Slug == nil { - return "" +// GetIssues returns the Issues field. +func (a *AdminStats) GetIssues() *IssueStats { + if a == nil { + return nil } - return *a.Slug + return a.Issues } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *App) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} +// GetMilestones returns the Milestones field. +func (a *AdminStats) GetMilestones() *MilestoneStats { + if a == nil { + return nil } - return *a.UpdatedAt + return a.Milestones } -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetClientID() string { - if a == nil || a.ClientID == nil { - return "" +// GetOrgs returns the Orgs field. +func (a *AdminStats) GetOrgs() *OrgStats { + if a == nil { + return nil } - return *a.ClientID + return a.Orgs } -// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetClientSecret() string { - if a == nil || a.ClientSecret == nil { - return "" +// GetPages returns the Pages field. +func (a *AdminStats) GetPages() *PageStats { + if a == nil { + return nil } - return *a.ClientSecret + return a.Pages } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} +// GetPulls returns the Pulls field. +func (a *AdminStats) GetPulls() *PullStats { + if a == nil { + return nil } - return *a.CreatedAt + return a.Pulls } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetDescription() string { - if a == nil || a.Description == nil { +// GetRepos returns the Repos field. +func (a *AdminStats) GetRepos() *RepoStats { + if a == nil { + return nil + } + return a.Repos +} + +// GetUsers returns the Users field. +func (a *AdminStats) GetUsers() *UserStats { + if a == nil { + return nil + } + return a.Users +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (a *AdvancedSecurity) GetStatus() string { + if a == nil || a.Status == nil { return "" } - return *a.Description + return *a.Status } -// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetExternalURL() string { - if a == nil || a.ExternalURL == nil { +// GetLastPushedDate returns the LastPushedDate field. +func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedDate() string { + if a == nil { return "" } - return *a.ExternalURL + return a.LastPushedDate } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetHTMLURL() string { - if a == nil || a.HTMLURL == nil { +// GetLastPushedEmail returns the LastPushedEmail field. +func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedEmail() string { + if a == nil { return "" } - return *a.HTMLURL + return a.LastPushedEmail } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetID() int64 { - if a == nil || a.ID == nil { +// GetUserLogin returns the UserLogin field. +func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { + if a == nil { + return "" + } + return a.UserLogin +} + +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (a *AdvisoryCVSS) GetScore() float64 { + if a == nil || a.Score == nil { return 0 } - return *a.ID + return *a.Score +} + +// GetVectorString returns the VectorString field if it's non-nil, zero value otherwise. +func (a *AdvisoryCVSS) GetVectorString() string { + if a == nil || a.VectorString == nil { + return "" + } + return *a.VectorString +} + +// GetCVSSV3 returns the CVSSV3 field. +func (a *AdvisoryCVSSSeverities) GetCVSSV3() *AdvisoryCVSS { + if a == nil { + return nil + } + return a.CVSSV3 +} + +// GetCVSSV4 returns the CVSSV4 field. +func (a *AdvisoryCVSSSeverities) GetCVSSV4() *AdvisoryCVSS { + if a == nil { + return nil + } + return a.CVSSV4 +} + +// GetCWEID returns the CWEID field if it's non-nil, zero value otherwise. +func (a *AdvisoryCWEs) GetCWEID() string { + if a == nil || a.CWEID == nil { + return "" + } + return *a.CWEID } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetName() string { +func (a *AdvisoryCWEs) GetName() string { if a == nil || a.Name == nil { return "" } return *a.Name } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetNodeID() string { - if a == nil || a.NodeID == nil { - return "" +// GetPercentage returns the Percentage field. +func (a *AdvisoryEPSS) GetPercentage() float64 { + if a == nil { + return 0 } - return *a.NodeID + return a.Percentage } -// GetOwner returns the Owner field. -func (a *AppConfig) GetOwner() *User { +// GetPercentile returns the Percentile field. +func (a *AdvisoryEPSS) GetPercentile() float64 { if a == nil { - return nil + return 0 } - return a.Owner + return a.Percentile } -// GetPEM returns the PEM field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetPEM() string { - if a == nil || a.PEM == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (a *AdvisoryIdentifier) GetType() string { + if a == nil || a.Type == nil { return "" } - return *a.PEM + return *a.Type } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetSlug() string { - if a == nil || a.Slug == nil { +// GetValue returns the Value field if it's non-nil, zero value otherwise. +func (a *AdvisoryIdentifier) GetValue() string { + if a == nil || a.Value == nil { return "" } - return *a.Slug + return *a.Value } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { - return Timestamp{} +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (a *AdvisoryReference) GetURL() string { + if a == nil || a.URL == nil { + return "" } - return *a.UpdatedAt + return *a.URL } -// GetWebhookSecret returns the WebhookSecret field if it's non-nil, zero value otherwise. -func (a *AppConfig) GetWebhookSecret() string { - if a == nil || a.WebhookSecret == nil { +// GetFirstPatchedVersion returns the FirstPatchedVersion field. +func (a *AdvisoryVulnerability) GetFirstPatchedVersion() *FirstPatchedVersion { + if a == nil { + return nil + } + return a.FirstPatchedVersion +} + +// GetPackage returns the Package field. +func (a *AdvisoryVulnerability) GetPackage() *VulnerabilityPackage { + if a == nil { + return nil + } + return a.Package +} + +// GetPatchedVersions returns the PatchedVersions field if it's non-nil, zero value otherwise. +func (a *AdvisoryVulnerability) GetPatchedVersions() string { + if a == nil || a.PatchedVersions == nil { return "" } - return *a.WebhookSecret + return *a.PatchedVersions } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (a *ArchivedAt) GetFrom() Timestamp { - if a == nil || a.From == nil { - return Timestamp{} +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (a *AdvisoryVulnerability) GetSeverity() string { + if a == nil || a.Severity == nil { + return "" } - return *a.From + return *a.Severity } -// GetTo returns the To field if it's non-nil, zero value otherwise. -func (a *ArchivedAt) GetTo() Timestamp { - if a == nil || a.To == nil { - return Timestamp{} +// GetVulnerableFunctions returns the VulnerableFunctions slice if it's non-nil, nil otherwise. +func (a *AdvisoryVulnerability) GetVulnerableFunctions() []string { + if a == nil || a.VulnerableFunctions == nil { + return nil } - return *a.To + return a.VulnerableFunctions } -// GetArchiveDownloadURL returns the ArchiveDownloadURL field if it's non-nil, zero value otherwise. -func (a *Artifact) GetArchiveDownloadURL() string { - if a == nil || a.ArchiveDownloadURL == nil { +// GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. +func (a *AdvisoryVulnerability) GetVulnerableVersionRange() string { + if a == nil || a.VulnerableVersionRange == nil { return "" } - return *a.ArchiveDownloadURL + return *a.VulnerableVersionRange } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *Artifact) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { +// GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. +func (a *AgentTask) GetArchivedAt() Timestamp { + if a == nil || a.ArchivedAt == nil { return Timestamp{} } - return *a.CreatedAt + return *a.ArchivedAt } -// GetExpired returns the Expired field if it's non-nil, zero value otherwise. -func (a *Artifact) GetExpired() bool { - if a == nil || a.Expired == nil { - return false +// GetArtifacts returns the Artifacts slice if it's non-nil, nil otherwise. +func (a *AgentTask) GetArtifacts() []*AgentTaskArtifact { + if a == nil || a.Artifacts == nil { + return nil } - return *a.Expired + return a.Artifacts } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (a *Artifact) GetExpiresAt() Timestamp { - if a == nil || a.ExpiresAt == nil { +// GetCreatedAt returns the CreatedAt field. +func (a *AgentTask) GetCreatedAt() Timestamp { + if a == nil { return Timestamp{} } - return *a.ExpiresAt + return a.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Artifact) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetCreator returns the Creator field. +func (a *AgentTask) GetCreator() *AgentTaskCreator { + if a == nil { + return nil } - return *a.ID + return a.Creator +} + +// GetCreatorType returns the CreatorType field if it's non-nil, zero value otherwise. +func (a *AgentTask) GetCreatorType() string { + if a == nil || a.CreatorType == nil { + return "" + } + return *a.CreatorType +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (a *AgentTask) GetHTMLURL() string { + if a == nil || a.HTMLURL == nil { + return "" + } + return *a.HTMLURL +} + +// GetID returns the ID field. +func (a *AgentTask) GetID() string { + if a == nil { + return "" + } + return a.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *Artifact) GetName() string { +func (a *AgentTask) GetName() string { if a == nil || a.Name == nil { return "" } return *a.Name } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (a *Artifact) GetNodeID() string { - if a == nil || a.NodeID == nil { - return "" +// GetOwner returns the Owner field. +func (a *AgentTask) GetOwner() *AgentTaskOwner { + if a == nil { + return nil } - return *a.NodeID + return a.Owner } -// GetSizeInBytes returns the SizeInBytes field if it's non-nil, zero value otherwise. -func (a *Artifact) GetSizeInBytes() int64 { - if a == nil || a.SizeInBytes == nil { +// GetRepository returns the Repository field. +func (a *AgentTask) GetRepository() *AgentTaskRepository { + if a == nil { + return nil + } + return a.Repository +} + +// GetSessionCount returns the SessionCount field if it's non-nil, zero value otherwise. +func (a *AgentTask) GetSessionCount() int { + if a == nil || a.SessionCount == nil { return 0 } - return *a.SizeInBytes + return *a.SessionCount +} + +// GetSessions returns the Sessions slice if it's non-nil, nil otherwise. +func (a *AgentTask) GetSessions() []*AgentTaskSession { + if a == nil || a.Sessions == nil { + return nil + } + return a.Sessions +} + +// GetState returns the State field. +func (a *AgentTask) GetState() string { + if a == nil { + return "" + } + return a.State } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *Artifact) GetUpdatedAt() Timestamp { +func (a *AgentTask) GetUpdatedAt() Timestamp { if a == nil || a.UpdatedAt == nil { return Timestamp{} } @@ -991,4263 +1431,4591 @@ func (a *Artifact) GetUpdatedAt() Timestamp { } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *Artifact) GetURL() string { +func (a *AgentTask) GetURL() string { if a == nil || a.URL == nil { return "" } return *a.URL } -// GetWorkflowRun returns the WorkflowRun field. -func (a *Artifact) GetWorkflowRun() *ArtifactWorkflowRun { - if a == nil { +// GetUserCollaborators returns the UserCollaborators slice if it's non-nil, nil otherwise. +func (a *AgentTask) GetUserCollaborators() []*User { + if a == nil || a.UserCollaborators == nil { return nil } - return a.WorkflowRun + return a.UserCollaborators } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (a *ArtifactList) GetTotalCount() int64 { - if a == nil || a.TotalCount == nil { - return 0 +// GetData returns the Data field. +func (a *AgentTaskArtifact) GetData() *AgentTaskArtifactData { + if a == nil { + return nil } - return *a.TotalCount + return a.Data } -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (a *ArtifactWorkflowRun) GetHeadBranch() string { - if a == nil || a.HeadBranch == nil { +// GetProvider returns the Provider field. +func (a *AgentTaskArtifact) GetProvider() string { + if a == nil { return "" } - return *a.HeadBranch -} - -// GetHeadRepositoryID returns the HeadRepositoryID field if it's non-nil, zero value otherwise. -func (a *ArtifactWorkflowRun) GetHeadRepositoryID() int64 { - if a == nil || a.HeadRepositoryID == nil { - return 0 - } - return *a.HeadRepositoryID + return a.Provider } -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (a *ArtifactWorkflowRun) GetHeadSHA() string { - if a == nil || a.HeadSHA == nil { +// GetType returns the Type field. +func (a *AgentTaskArtifact) GetType() string { + if a == nil { return "" } - return *a.HeadSHA + return a.Type } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *ArtifactWorkflowRun) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. +func (a *AgentTaskArtifactData) GetBaseRef() string { + if a == nil || a.BaseRef == nil { + return "" } - return *a.ID + return *a.BaseRef } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (a *ArtifactWorkflowRun) GetRepositoryID() int64 { - if a == nil || a.RepositoryID == nil { - return 0 +// GetGlobalID returns the GlobalID field if it's non-nil, zero value otherwise. +func (a *AgentTaskArtifactData) GetGlobalID() string { + if a == nil || a.GlobalID == nil { + return "" } - return *a.RepositoryID + return *a.GlobalID } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (a *Attachment) GetBody() string { - if a == nil || a.Body == nil { +// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. +func (a *AgentTaskArtifactData) GetHeadRef() string { + if a == nil || a.HeadRef == nil { return "" } - return *a.Body + return *a.HeadRef } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Attachment) GetID() int64 { +func (a *AgentTaskArtifactData) 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 "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AgentTaskCreator) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return *a.Title + return *a.ID } -// 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 "" +// GetTasks returns the Tasks slice if it's non-nil, nil otherwise. +func (a *AgentTaskList) GetTasks() []*AgentTask { + if a == nil || a.Tasks == nil { + return nil } - return *a.Action + return a.Tasks } -// 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 "" +// GetTotalActiveCount returns the TotalActiveCount field if it's non-nil, zero value otherwise. +func (a *AgentTaskList) GetTotalActiveCount() int { + if a == nil || a.TotalActiveCount == nil { + return 0 } - return *a.Actor + return *a.TotalActiveCount } -// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActorID() int64 { - if a == nil || a.ActorID == nil { +// GetTotalArchivedCount returns the TotalArchivedCount field if it's non-nil, zero value otherwise. +func (a *AgentTaskList) GetTotalArchivedCount() int { + if a == nil || a.TotalArchivedCount == nil { return 0 } - return *a.ActorID + return *a.TotalArchivedCount } -// GetActorLocation returns the ActorLocation field. -func (a *AuditEntry) GetActorLocation() *ActorLocation { - if a == nil { +// GetCreatorID returns the CreatorID slice if it's non-nil, nil otherwise. +func (a *AgentTaskListByRepoOptions) GetCreatorID() []int64 { + if a == nil || a.CreatorID == nil { return nil } - return a.ActorLocation + return a.CreatorID } -// GetBusiness returns the Business field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetBusiness() string { - if a == nil || a.Business == nil { +// GetDirection returns the Direction field. +func (a *AgentTaskListOptions) GetDirection() string { + if a == nil { return "" } - return *a.Business + return a.Direction } -// GetBusinessID returns the BusinessID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetBusinessID() int64 { - if a == nil || a.BusinessID == nil { - return 0 +// GetIsArchived returns the IsArchived field. +func (a *AgentTaskListOptions) GetIsArchived() bool { + if a == nil { + return false } - return *a.BusinessID + return a.IsArchived } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} +// GetSince returns the Since field if it's non-nil, zero value otherwise. +func (a *AgentTaskListOptions) GetSince() time.Time { + if a == nil || a.Since == nil { + return time.Time{} } - return *a.CreatedAt + return *a.Since } -// GetDocumentID returns the DocumentID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetDocumentID() string { - if a == nil || a.DocumentID == nil { +// GetSort returns the Sort field. +func (a *AgentTaskListOptions) GetSort() string { + if a == nil { return "" } - return *a.DocumentID + return a.Sort } -// GetExternalIdentityNameID returns the ExternalIdentityNameID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetExternalIdentityNameID() string { - if a == nil || a.ExternalIdentityNameID == nil { +// GetState returns the State field. +func (a *AgentTaskListOptions) GetState() string { + if a == nil { return "" } - return *a.ExternalIdentityNameID + return a.State } -// GetExternalIdentityUsername returns the ExternalIdentityUsername field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetExternalIdentityUsername() string { - if a == nil || a.ExternalIdentityUsername == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AgentTaskOwner) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return *a.ExternalIdentityUsername + return *a.ID } -// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetHashedToken() string { - if a == nil || a.HashedToken == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AgentTaskRepository) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return *a.HashedToken + return *a.ID } -// GetOrg returns the Org field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOrg() string { - if a == nil || a.Org == nil { +// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetBaseRef() string { + if a == nil || a.BaseRef == nil { return "" } - return *a.Org + return *a.BaseRef } -// GetOrgID returns the OrgID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOrgID() int64 { - if a == nil || a.OrgID == nil { - return 0 +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetCompletedAt() Timestamp { + if a == nil || a.CompletedAt == nil { + return Timestamp{} } - return *a.OrgID + return *a.CompletedAt } -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTimestamp() Timestamp { - if a == nil || a.Timestamp == nil { +// GetCreatedAt returns the CreatedAt field. +func (a *AgentTaskSession) GetCreatedAt() Timestamp { + if a == nil { return Timestamp{} } - return *a.Timestamp + return a.CreatedAt } -// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTokenID() int64 { - if a == nil || a.TokenID == nil { - return 0 +// GetError returns the Error field. +func (a *AgentTaskSession) GetError() *AgentTaskSessionError { + if a == nil { + return nil } - return *a.TokenID + return a.Error } -// GetTokenScopes returns the TokenScopes field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTokenScopes() string { - if a == nil || a.TokenScopes == nil { +// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetHeadRef() string { + if a == nil || a.HeadRef == nil { return "" } - return *a.TokenScopes + return *a.HeadRef } -// GetUser returns the User field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetUser() string { - if a == nil || a.User == nil { +// GetID returns the ID field. +func (a *AgentTaskSession) GetID() string { + if a == nil { return "" } - return *a.User + return a.ID } -// GetUserID returns the UserID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetUserID() int64 { - if a == nil || a.UserID == nil { - return 0 +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetModel() string { + if a == nil || a.Model == nil { + return "" } - return *a.UserID + return *a.Model } -// GetApp returns the App field. -func (a *Authorization) GetApp() *AuthorizationApp { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetName() string { + if a == nil || a.Name == nil { + return "" + } + return *a.Name +} + +// GetOwner returns the Owner field. +func (a *AgentTaskSession) GetOwner() *AgentTaskOwner { if a == nil { return nil } - return a.App + return a.Owner } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (a *Authorization) GetCreatedAt() Timestamp { - if a == nil || a.CreatedAt == nil { - return Timestamp{} +// GetPrompt returns the Prompt field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetPrompt() string { + if a == nil || a.Prompt == nil { + return "" } - return *a.CreatedAt + return *a.Prompt } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *Authorization) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { +// GetRepository returns the Repository field. +func (a *AgentTaskSession) GetRepository() *AgentTaskRepository { + if a == nil { + return nil + } + return a.Repository +} + +// GetState returns the State field. +func (a *AgentTaskSession) GetState() string { + if a == nil { return "" } - return *a.Fingerprint + return a.State } -// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. -func (a *Authorization) GetHashedToken() string { - if a == nil || a.HashedToken == nil { +// GetTaskID returns the TaskID field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetTaskID() string { + if a == nil || a.TaskID == nil { return "" } - return *a.HashedToken + return *a.TaskID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Authorization) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *AgentTaskSession) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} } - return *a.ID + return *a.UpdatedAt } -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *Authorization) GetNote() string { - if a == nil || a.Note == nil { - return "" +// GetUser returns the User field. +func (a *AgentTaskSession) GetUser() *User { + if a == nil { + return nil } - return *a.Note + return a.User } -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *Authorization) GetNoteURL() string { - if a == nil || a.NoteURL == nil { +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (a *AgentTaskSessionError) GetMessage() string { + if a == nil || a.Message == nil { return "" } - return *a.NoteURL + return *a.Message } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (a *Authorization) GetToken() string { - if a == nil || a.Token == nil { - return "" +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetClosedAt() Timestamp { + if a == nil || a.ClosedAt == nil { + return Timestamp{} } - return *a.Token + return *a.ClosedAt } -// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. -func (a *Authorization) GetTokenLastEight() string { - if a == nil || a.TokenLastEight == nil { - return "" +// GetClosedBy returns the ClosedBy field. +func (a *Alert) GetClosedBy() *User { + if a == nil { + return nil } - return *a.TokenLastEight + return a.ClosedBy } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (a *Authorization) GetUpdatedAt() Timestamp { - if a == nil || a.UpdatedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { return Timestamp{} } - return *a.UpdatedAt + return *a.CreatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *Authorization) GetURL() string { - if a == nil || a.URL == nil { - return "" +// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetDismissedAt() Timestamp { + if a == nil || a.DismissedAt == nil { + return Timestamp{} } - return *a.URL + return *a.DismissedAt } -// GetUser returns the User field. -func (a *Authorization) GetUser() *User { +// GetDismissedBy returns the DismissedBy field. +func (a *Alert) GetDismissedBy() *User { if a == nil { return nil } - return a.User + return a.DismissedBy } -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetClientID() string { - if a == nil || a.ClientID == nil { +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (a *Alert) GetDismissedComment() string { + if a == nil || a.DismissedComment == nil { return "" } - return *a.ClientID + return *a.DismissedComment } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetName() string { - if a == nil || a.Name == nil { +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (a *Alert) GetDismissedReason() string { + if a == nil || a.DismissedReason == nil { return "" } - return *a.Name + return *a.DismissedReason } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (a *AuthorizationApp) GetURL() string { - if a == nil || a.URL == nil { +// GetFixedAt returns the FixedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetFixedAt() Timestamp { + if a == nil || a.FixedAt == nil { + return Timestamp{} + } + return *a.FixedAt +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (a *Alert) GetHTMLURL() string { + if a == nil || a.HTMLURL == nil { return "" } - return *a.URL + return *a.HTMLURL } -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetClientID() string { - if a == nil || a.ClientID == nil { +// GetInstances returns the Instances slice if it's non-nil, nil otherwise. +func (a *Alert) GetInstances() []*MostRecentInstance { + if a == nil || a.Instances == nil { + return nil + } + return a.Instances +} + +// GetInstancesURL returns the InstancesURL field if it's non-nil, zero value otherwise. +func (a *Alert) GetInstancesURL() string { + if a == nil || a.InstancesURL == nil { return "" } - return *a.ClientID + return *a.InstancesURL } -// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetClientSecret() string { - if a == nil || a.ClientSecret == nil { +// GetMostRecentInstance returns the MostRecentInstance field. +func (a *Alert) GetMostRecentInstance() *MostRecentInstance { + if a == nil { + return nil + } + return a.MostRecentInstance +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (a *Alert) GetNumber() int { + if a == nil || a.Number == nil { + return 0 + } + return *a.Number +} + +// GetRepository returns the Repository field. +func (a *Alert) GetRepository() *Repository { + if a == nil { + return nil + } + return a.Repository +} + +// GetRule returns the Rule field. +func (a *Alert) GetRule() *Rule { + if a == nil { + return nil + } + return a.Rule +} + +// GetRuleDescription returns the RuleDescription field if it's non-nil, zero value otherwise. +func (a *Alert) GetRuleDescription() string { + if a == nil || a.RuleDescription == nil { return "" } - return *a.ClientSecret + return *a.RuleDescription } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { +// GetRuleID returns the RuleID field if it's non-nil, zero value otherwise. +func (a *Alert) GetRuleID() string { + if a == nil || a.RuleID == nil { return "" } - return *a.Fingerprint + return *a.RuleID } -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetNote() string { - if a == nil || a.Note == nil { +// GetRuleSeverity returns the RuleSeverity field if it's non-nil, zero value otherwise. +func (a *Alert) GetRuleSeverity() string { + if a == nil || a.RuleSeverity == nil { return "" } - return *a.Note + return *a.RuleSeverity } -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *AuthorizationRequest) GetNoteURL() string { - if a == nil || a.NoteURL == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (a *Alert) GetState() string { + if a == nil || a.State == nil { return "" } - return *a.NoteURL + return *a.State } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { +// GetTool returns the Tool field. +func (a *Alert) GetTool() *Tool { + if a == nil { + return nil + } + return a.Tool +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *Alert) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (a *Alert) GetURL() string { + if a == nil || a.URL == nil { return "" } - return *a.Fingerprint + return *a.URL } -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetNote() string { - if a == nil || a.Note == nil { +// GetRef returns the Ref field. +func (a *AlertInstancesListOptions) GetRef() string { + if a == nil { return "" } - return *a.Note + return a.Ref } -// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. -func (a *AuthorizationUpdateRequest) GetNoteURL() string { - if a == nil || a.NoteURL == nil { +// GetDirection returns the Direction field. +func (a *AlertListOptions) GetDirection() string { + if a == nil { return "" } - return *a.NoteURL + return a.Direction } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (a *AuthorizedActorsOnly) GetFrom() bool { - if a == nil || a.From == nil { - return false +// GetRef returns the Ref field. +func (a *AlertListOptions) GetRef() string { + if a == nil { + return "" } - return *a.From + return a.Ref } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (a *AuthorizedDismissalActorsOnlyChanges) GetFrom() bool { - if a == nil || a.From == nil { - return false +// GetSeverity returns the Severity field. +func (a *AlertListOptions) GetSeverity() string { + if a == nil { + return "" } - return *a.From + return a.Severity } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (a *Autolink) GetID() int64 { - if a == nil || a.ID == nil { - return 0 +// GetSort returns the Sort field. +func (a *AlertListOptions) GetSort() string { + if a == nil { + return "" } - return *a.ID + return a.Sort } -// GetIsAlphanumeric returns the IsAlphanumeric field if it's non-nil, zero value otherwise. -func (a *Autolink) GetIsAlphanumeric() bool { - if a == nil || a.IsAlphanumeric == nil { - return false +// GetState returns the State field. +func (a *AlertListOptions) GetState() string { + if a == nil { + return "" } - return *a.IsAlphanumeric + return a.State } -// GetKeyPrefix returns the KeyPrefix field if it's non-nil, zero value otherwise. -func (a *Autolink) GetKeyPrefix() string { - if a == nil || a.KeyPrefix == nil { +// GetToolGUID returns the ToolGUID field. +func (a *AlertListOptions) GetToolGUID() string { + if a == nil { return "" } - return *a.KeyPrefix + return a.ToolGUID } -// GetURLTemplate returns the URLTemplate field if it's non-nil, zero value otherwise. -func (a *Autolink) GetURLTemplate() string { - if a == nil || a.URLTemplate == nil { +// GetToolName returns the ToolName field. +func (a *AlertListOptions) GetToolName() string { + if a == nil { return "" } - return *a.URLTemplate + return a.ToolName } -// GetIsAlphanumeric returns the IsAlphanumeric field if it's non-nil, zero value otherwise. -func (a *AutolinkOptions) GetIsAlphanumeric() bool { - if a == nil || a.IsAlphanumeric == nil { +// GetEnabled returns the Enabled field. +func (a *AllowDeletions) GetEnabled() bool { + if a == nil { return false } - return *a.IsAlphanumeric + return a.Enabled } -// GetKeyPrefix returns the KeyPrefix field if it's non-nil, zero value otherwise. -func (a *AutolinkOptions) GetKeyPrefix() string { - if a == nil || a.KeyPrefix == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *AllowDeletionsEnforcementLevelChanges) GetFrom() string { + if a == nil || a.From == nil { return "" } - return *a.KeyPrefix + return *a.From } -// GetURLTemplate returns the URLTemplate field if it's non-nil, zero value otherwise. -func (a *AutolinkOptions) GetURLTemplate() string { - if a == nil || a.URLTemplate == nil { - return "" +// GetEnabled returns the Enabled field. +func (a *AllowForcePushes) GetEnabled() bool { + if a == nil { + return false } - return *a.URLTemplate + return a.Enabled } // GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (a *AutomatedSecurityFixes) GetEnabled() bool { +func (a *AllowForkSyncing) GetEnabled() bool { if a == nil || a.Enabled == nil { return false } return *a.Enabled } -// GetPaused returns the Paused field if it's non-nil, zero value otherwise. -func (a *AutomatedSecurityFixes) GetPaused() bool { - if a == nil || a.Paused == nil { - return false +// GetAuthenticationType returns the AuthenticationType field. +func (a *AmazonS3AccessKeysConfig) GetAuthenticationType() string { + if a == nil { + return "" } - return *a.Paused + return a.AuthenticationType } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (a *AutoTriggerCheck) GetAppID() int64 { - if a == nil || a.AppID == nil { - return 0 +// GetBucket returns the Bucket field. +func (a *AmazonS3AccessKeysConfig) GetBucket() string { + if a == nil { + return "" } - return *a.AppID + return a.Bucket } -// GetSetting returns the Setting field if it's non-nil, zero value otherwise. -func (a *AutoTriggerCheck) GetSetting() bool { - if a == nil || a.Setting == nil { - return false +// GetEncryptedAccessKeyID returns the EncryptedAccessKeyID field. +func (a *AmazonS3AccessKeysConfig) GetEncryptedAccessKeyID() string { + if a == nil { + return "" } - return *a.Setting + return a.EncryptedAccessKeyID } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (b *Blob) GetContent() string { - if b == nil || b.Content == nil { +// GetEncryptedSecretKey returns the EncryptedSecretKey field. +func (a *AmazonS3AccessKeysConfig) GetEncryptedSecretKey() string { + if a == nil { return "" } - return *b.Content + return a.EncryptedSecretKey } -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (b *Blob) GetEncoding() string { - if b == nil || b.Encoding == nil { +// GetKeyID returns the KeyID field. +func (a *AmazonS3AccessKeysConfig) GetKeyID() string { + if a == nil { return "" } - return *b.Encoding + return a.KeyID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (b *Blob) GetNodeID() string { - if b == nil || b.NodeID == nil { +// GetRegion returns the Region field. +func (a *AmazonS3AccessKeysConfig) GetRegion() string { + if a == nil { return "" } - return *b.NodeID + return a.Region } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (b *Blob) GetSHA() string { - if b == nil || b.SHA == nil { +// GetArnRole returns the ArnRole field. +func (a *AmazonS3OIDCConfig) GetArnRole() string { + if a == nil { return "" } - return *b.SHA + return a.ArnRole } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (b *Blob) GetSize() int { - if b == nil || b.Size == nil { - return 0 +// GetAuthenticationType returns the AuthenticationType field. +func (a *AmazonS3OIDCConfig) GetAuthenticationType() string { + if a == nil { + return "" } - return *b.Size + return a.AuthenticationType } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (b *Blob) GetURL() string { - if b == nil || b.URL == nil { +// GetBucket returns the Bucket field. +func (a *AmazonS3OIDCConfig) GetBucket() string { + if a == nil { return "" } - return *b.URL + return a.Bucket } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (b *BlockCreations) GetEnabled() bool { - if b == nil || b.Enabled == nil { - return false +// GetKeyID returns the KeyID field. +func (a *AmazonS3OIDCConfig) GetKeyID() string { + if a == nil { + return "" } - return *b.Enabled + return a.KeyID } -// GetCommit returns the Commit field. -func (b *Branch) GetCommit() *RepositoryCommit { - if b == nil { - return nil +// GetRegion returns the Region field. +func (a *AmazonS3OIDCConfig) GetRegion() string { + if a == nil { + return "" } - return b.Commit + return a.Region } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (b *Branch) GetName() string { - if b == nil || b.Name == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (a *AnalysesListOptions) GetRef() string { + if a == nil || a.Ref == nil { return "" } - return *b.Name + return *a.Ref } -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (b *Branch) GetProtected() bool { - if b == nil || b.Protected == nil { - return false +// GetSarifID returns the SarifID field if it's non-nil, zero value otherwise. +func (a *AnalysesListOptions) GetSarifID() string { + if a == nil || a.SarifID == nil { + return "" } - return *b.Protected + return *a.SarifID } -// GetProtection returns the Protection field. -func (b *Branch) GetProtection() *Protection { - if b == nil { +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetActions() []string { + if a == nil || a.Actions == nil { return nil } - return b.Protection + return a.Actions } -// GetCommit returns the Commit field. -func (b *BranchCommit) GetCommit() *Commit { - if b == nil { +// GetActionsMacos returns the ActionsMacos slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetActionsMacos() []string { + if a == nil || a.ActionsMacos == nil { return nil } - return b.Commit + return a.ActionsMacos } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (b *BranchCommit) GetName() string { - if b == nil || b.Name == nil { - return "" +// GetAPI returns the API slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetAPI() []string { + if a == nil || a.API == nil { + return nil } - return *b.Name + return a.API } -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (b *BranchCommit) GetProtected() bool { - if b == nil || b.Protected == nil { - return false +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetCodespaces() []string { + if a == nil || a.Codespaces == nil { + return nil } - return *b.Protected + return a.Codespaces } -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (b *BranchListOptions) GetProtected() bool { - if b == nil || b.Protected == nil { - return false +// GetCopilot returns the Copilot slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetCopilot() []string { + if a == nil || a.Copilot == nil { + return nil } - return *b.Protected + return a.Copilot } -// GetCustomBranchPolicies returns the CustomBranchPolicies field if it's non-nil, zero value otherwise. -func (b *BranchPolicy) GetCustomBranchPolicies() bool { - if b == nil || b.CustomBranchPolicies == nil { - return false +// GetDependabot returns the Dependabot slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetDependabot() []string { + if a == nil || a.Dependabot == nil { + return nil } - return *b.CustomBranchPolicies + return a.Dependabot } -// GetProtectedBranches returns the ProtectedBranches field if it's non-nil, zero value otherwise. -func (b *BranchPolicy) GetProtectedBranches() bool { - if b == nil || b.ProtectedBranches == nil { - return false +// GetDomains returns the Domains field. +func (a *APIMeta) GetDomains() *APIMetaDomains { + if a == nil { + return nil } - return *b.ProtectedBranches + return a.Domains } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (b *BranchProtectionConfigurationEvent) GetAction() string { - if b == nil || b.Action == nil { - return "" +// GetGit returns the Git slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetGit() []string { + if a == nil || a.Git == nil { + return nil } - return *b.Action + return a.Git } -// GetEnterprise returns the Enterprise field. -func (b *BranchProtectionConfigurationEvent) GetEnterprise() *Enterprise { - if b == nil { +// GetGithubEnterpriseImporter returns the GithubEnterpriseImporter slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetGithubEnterpriseImporter() []string { + if a == nil || a.GithubEnterpriseImporter == nil { return nil } - return b.Enterprise + return a.GithubEnterpriseImporter } -// GetInstallation returns the Installation field. -func (b *BranchProtectionConfigurationEvent) GetInstallation() *Installation { - if b == nil { +// GetHooks returns the Hooks slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetHooks() []string { + if a == nil || a.Hooks == nil { return nil } - return b.Installation + return a.Hooks } -// GetOrg returns the Org field. -func (b *BranchProtectionConfigurationEvent) GetOrg() *Organization { - if b == nil { +// GetImporter returns the Importer slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetImporter() []string { + if a == nil || a.Importer == nil { return nil } - return b.Org + return a.Importer } -// GetRepo returns the Repo field. -func (b *BranchProtectionConfigurationEvent) GetRepo() *Repository { - if b == nil { +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetPackages() []string { + if a == nil || a.Packages == nil { return nil } - return b.Repo + return a.Packages } -// GetSender returns the Sender field. -func (b *BranchProtectionConfigurationEvent) GetSender() *User { - if b == nil { +// GetPages returns the Pages slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetPages() []string { + if a == nil || a.Pages == nil { return nil } - return b.Sender + return a.Pages } -// GetAdminEnforced returns the AdminEnforced field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetAdminEnforced() bool { - if b == nil || b.AdminEnforced == nil { +// GetSSHKeyFingerprints returns the SSHKeyFingerprints map if it's non-nil, an empty map otherwise. +func (a *APIMeta) GetSSHKeyFingerprints() map[string]string { + if a == nil || a.SSHKeyFingerprints == nil { + return map[string]string{} + } + return a.SSHKeyFingerprints +} + +// GetSSHKeys returns the SSHKeys slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetSSHKeys() []string { + if a == nil || a.SSHKeys == nil { + return nil + } + return a.SSHKeys +} + +// GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise. +func (a *APIMeta) GetVerifiablePasswordAuthentication() bool { + if a == nil || a.VerifiablePasswordAuthentication == nil { return false } - return *b.AdminEnforced + return *a.VerifiablePasswordAuthentication } -// GetAllowDeletionsEnforcementLevel returns the AllowDeletionsEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetAllowDeletionsEnforcementLevel() string { - if b == nil || b.AllowDeletionsEnforcementLevel == nil { - return "" +// GetWeb returns the Web slice if it's non-nil, nil otherwise. +func (a *APIMeta) GetWeb() []string { + if a == nil || a.Web == nil { + return nil } - return *b.AllowDeletionsEnforcementLevel + return a.Web } -// GetAllowForcePushesEnforcementLevel returns the AllowForcePushesEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetAllowForcePushesEnforcementLevel() string { - if b == nil || b.AllowForcePushesEnforcementLevel == nil { +// GetServices returns the Services slice if it's non-nil, nil otherwise. +func (a *APIMetaArtifactAttestations) GetServices() []string { + if a == nil || a.Services == nil { + return nil + } + return a.Services +} + +// GetTrustDomain returns the TrustDomain field. +func (a *APIMetaArtifactAttestations) GetTrustDomain() string { + if a == nil { return "" } - return *b.AllowForcePushesEnforcementLevel + return a.TrustDomain } -// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetAuthorizedActorsOnly() bool { - if b == nil || b.AuthorizedActorsOnly == nil { - return false +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetActions() []string { + if a == nil || a.Actions == nil { + return nil } - return *b.AuthorizedActorsOnly + return a.Actions } -// GetAuthorizedDismissalActorsOnly returns the AuthorizedDismissalActorsOnly field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetAuthorizedDismissalActorsOnly() bool { - if b == nil || b.AuthorizedDismissalActorsOnly == nil { - return false +// GetActionsInbound returns the ActionsInbound field. +func (a *APIMetaDomains) GetActionsInbound() *ActionsInboundDomains { + if a == nil { + return nil } - return *b.AuthorizedDismissalActorsOnly + return a.ActionsInbound } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetCreatedAt() Timestamp { - if b == nil || b.CreatedAt == nil { - return Timestamp{} +// GetArtifactAttestations returns the ArtifactAttestations field. +func (a *APIMetaDomains) GetArtifactAttestations() *APIMetaArtifactAttestations { + if a == nil { + return nil } - return *b.CreatedAt + return a.ArtifactAttestations } -// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetDismissStaleReviewsOnPush() bool { - if b == nil || b.DismissStaleReviewsOnPush == nil { - return false +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetCodespaces() []string { + if a == nil || a.Codespaces == nil { + return nil } - return *b.DismissStaleReviewsOnPush + return a.Codespaces } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetID() int64 { - if b == nil || b.ID == nil { - return 0 +// GetCopilot returns the Copilot slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetCopilot() []string { + if a == nil || a.Copilot == nil { + return nil } - return *b.ID + return a.Copilot } -// GetIgnoreApprovalsFromContributors returns the IgnoreApprovalsFromContributors field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetIgnoreApprovalsFromContributors() bool { - if b == nil || b.IgnoreApprovalsFromContributors == nil { - return false +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetPackages() []string { + if a == nil || a.Packages == nil { + return nil } - return *b.IgnoreApprovalsFromContributors + return a.Packages } -// GetLinearHistoryRequirementEnforcementLevel returns the LinearHistoryRequirementEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetLinearHistoryRequirementEnforcementLevel() string { - if b == nil || b.LinearHistoryRequirementEnforcementLevel == nil { - return "" +// GetWebsite returns the Website slice if it's non-nil, nil otherwise. +func (a *APIMetaDomains) GetWebsite() []string { + if a == nil || a.Website == nil { + return nil } - return *b.LinearHistoryRequirementEnforcementLevel + return a.Website } -// GetMergeQueueEnforcementLevel returns the MergeQueueEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetMergeQueueEnforcementLevel() string { - if b == nil || b.MergeQueueEnforcementLevel == nil { +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (a *App) GetClientID() string { + if a == nil || a.ClientID == nil { return "" } - return *b.MergeQueueEnforcementLevel + return *a.ClientID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetName() string { - if b == nil || b.Name == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *App) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} + } + return *a.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (a *App) GetDescription() string { + if a == nil || a.Description == nil { return "" } - return *b.Name + return *a.Description } -// GetPullRequestReviewsEnforcementLevel returns the PullRequestReviewsEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetPullRequestReviewsEnforcementLevel() string { - if b == nil || b.PullRequestReviewsEnforcementLevel == nil { +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (a *App) GetEvents() []string { + if a == nil || a.Events == nil { + return nil + } + return a.Events +} + +// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. +func (a *App) GetExternalURL() string { + if a == nil || a.ExternalURL == nil { return "" } - return *b.PullRequestReviewsEnforcementLevel + return *a.ExternalURL } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRepositoryID() int64 { - if b == nil || b.RepositoryID == nil { - return 0 +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (a *App) GetHTMLURL() string { + if a == nil || a.HTMLURL == nil { + return "" } - return *b.RepositoryID + return *a.HTMLURL } -// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRequireCodeOwnerReview() bool { - if b == nil || b.RequireCodeOwnerReview == nil { - return false +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *App) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return *b.RequireCodeOwnerReview + return *a.ID } -// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRequiredApprovingReviewCount() int { - if b == nil || b.RequiredApprovingReviewCount == nil { +// GetInstallationsCount returns the InstallationsCount field if it's non-nil, zero value otherwise. +func (a *App) GetInstallationsCount() int { + if a == nil || a.InstallationsCount == nil { return 0 } - return *b.RequiredApprovingReviewCount + return *a.InstallationsCount } -// GetRequiredConversationResolutionLevel returns the RequiredConversationResolutionLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRequiredConversationResolutionLevel() string { - if b == nil || b.RequiredConversationResolutionLevel == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *App) GetName() string { + if a == nil || a.Name == nil { return "" } - return *b.RequiredConversationResolutionLevel + return *a.Name } -// GetRequiredDeploymentsEnforcementLevel returns the RequiredDeploymentsEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRequiredDeploymentsEnforcementLevel() string { - if b == nil || b.RequiredDeploymentsEnforcementLevel == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (a *App) GetNodeID() string { + if a == nil || a.NodeID == nil { return "" } - return *b.RequiredDeploymentsEnforcementLevel + return *a.NodeID } -// GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string { - if b == nil || b.RequiredStatusChecksEnforcementLevel == nil { +// GetOwner returns the Owner field. +func (a *App) GetOwner() *User { + if a == nil { + return nil + } + return a.Owner +} + +// GetPermissions returns the Permissions field. +func (a *App) GetPermissions() *InstallationPermissions { + if a == nil { + return nil + } + return a.Permissions +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (a *App) GetSlug() string { + if a == nil || a.Slug == nil { return "" } - return *b.RequiredStatusChecksEnforcementLevel + return *a.Slug } -// GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetSignatureRequirementEnforcementLevel() string { - if b == nil || b.SignatureRequirementEnforcementLevel == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *App) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} + } + return *a.UpdatedAt +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetClientID() string { + if a == nil || a.ClientID == nil { return "" } - return *b.SignatureRequirementEnforcementLevel + return *a.ClientID } -// GetStrictRequiredStatusChecksPolicy returns the StrictRequiredStatusChecksPolicy field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetStrictRequiredStatusChecksPolicy() bool { - if b == nil || b.StrictRequiredStatusChecksPolicy == nil { - return false +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetClientSecret() string { + if a == nil || a.ClientSecret == nil { + return "" } - return *b.StrictRequiredStatusChecksPolicy + return *a.ClientSecret } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRule) GetUpdatedAt() Timestamp { - if b == nil || b.UpdatedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { return Timestamp{} } - return *b.UpdatedAt + return *a.CreatedAt } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (b *BranchProtectionRuleEvent) GetAction() string { - if b == nil || b.Action == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetDescription() string { + if a == nil || a.Description == nil { return "" } - return *b.Action + return *a.Description } -// GetChanges returns the Changes field. -func (b *BranchProtectionRuleEvent) GetChanges() *ProtectionChanges { - if b == nil { - return nil +// GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetExternalURL() string { + if a == nil || a.ExternalURL == nil { + return "" } - return b.Changes + return *a.ExternalURL } -// GetInstallation returns the Installation field. -func (b *BranchProtectionRuleEvent) GetInstallation() *Installation { - if b == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetHTMLURL() string { + if a == nil || a.HTMLURL == nil { + return "" } - return b.Installation + return *a.HTMLURL } -// GetOrg returns the Org field. -func (b *BranchProtectionRuleEvent) GetOrg() *Organization { - if b == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return b.Org + return *a.ID } -// GetRepo returns the Repo field. -func (b *BranchProtectionRuleEvent) GetRepo() *Repository { - if b == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetName() string { + if a == nil || a.Name == nil { + return "" } - return b.Repo + return *a.Name } -// GetRule returns the Rule field. -func (b *BranchProtectionRuleEvent) GetRule() *BranchProtectionRule { - if b == nil { - return nil +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetNodeID() string { + if a == nil || a.NodeID == nil { + return "" } - return b.Rule + return *a.NodeID } -// GetSender returns the Sender field. -func (b *BranchProtectionRuleEvent) GetSender() *User { - if b == nil { +// GetOwner returns the Owner field. +func (a *AppConfig) GetOwner() *User { + if a == nil { return nil } - return b.Sender + return a.Owner } -// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. -func (b *BypassActor) GetActorID() int64 { - if b == nil || b.ActorID == nil { - return 0 +// GetPEM returns the PEM field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetPEM() string { + if a == nil || a.PEM == nil { + return "" } - return *b.ActorID + return *a.PEM } -// GetActorType returns the ActorType field. -func (b *BypassActor) GetActorType() *BypassActorType { - if b == nil { - return nil +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetSlug() string { + if a == nil || a.Slug == nil { + return "" } - return b.ActorType + return *a.Slug } -// GetBypassMode returns the BypassMode field. -func (b *BypassActor) GetBypassMode() *BypassMode { - if b == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} } - return b.BypassMode + return *a.UpdatedAt } -// GetApp returns the App field. -func (c *CheckRun) GetApp() *App { - if c == nil { - return nil +// GetWebhookSecret returns the WebhookSecret field if it's non-nil, zero value otherwise. +func (a *AppConfig) GetWebhookSecret() string { + if a == nil || a.WebhookSecret == nil { + return "" } - return c.App + return *a.WebhookSecret } -// GetCheckSuite returns the CheckSuite field. -func (c *CheckRun) GetCheckSuite() *CheckSuite { - if c == nil { +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (a *AppInstallationRepositoriesRequest) GetRepositories() []string { + if a == nil || a.Repositories == nil { return nil } - return c.CheckSuite + return a.Repositories } -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetCompletedAt() Timestamp { - if c == nil || c.CompletedAt == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *ArchivedAt) GetFrom() Timestamp { + if a == nil || a.From == nil { return Timestamp{} } - return *c.CompletedAt + return *a.From } -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetConclusion() string { - if c == nil || c.Conclusion == nil { - return "" +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (a *ArchivedAt) GetTo() Timestamp { + if a == nil || a.To == nil { + return Timestamp{} } - return *c.Conclusion + return *a.To } -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetDetailsURL() string { - if c == nil || c.DetailsURL == nil { +// GetArchiveDownloadURL returns the ArchiveDownloadURL field if it's non-nil, zero value otherwise. +func (a *Artifact) GetArchiveDownloadURL() string { + if a == nil || a.ArchiveDownloadURL == nil { return "" } - return *c.DetailsURL + return *a.ArchiveDownloadURL } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetExternalID() string { - if c == nil || c.ExternalID == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *Artifact) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} } - return *c.ExternalID + return *a.CreatedAt } -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetHeadSHA() string { - if c == nil || c.HeadSHA == nil { +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (a *Artifact) GetDigest() string { + if a == nil || a.Digest == nil { return "" } - return *c.HeadSHA + return *a.Digest } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetExpired returns the Expired field if it's non-nil, zero value otherwise. +func (a *Artifact) GetExpired() bool { + if a == nil || a.Expired == nil { + return false } - return *c.HTMLURL + return *a.Expired +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (a *Artifact) GetExpiresAt() Timestamp { + if a == nil || a.ExpiresAt == nil { + return Timestamp{} + } + return *a.ExpiresAt } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetID() int64 { - if c == nil || c.ID == nil { +func (a *Artifact) GetID() int64 { + if a == nil || a.ID == nil { return 0 } - return *c.ID + return *a.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetName() string { - if c == nil || c.Name == nil { +func (a *Artifact) GetName() string { + if a == nil || a.Name == nil { return "" } - return *c.Name + return *a.Name } // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetNodeID() string { - if c == nil || c.NodeID == nil { +func (a *Artifact) GetNodeID() string { + if a == nil || a.NodeID == nil { return "" } - return *c.NodeID + return *a.NodeID } -// GetOutput returns the Output field. -func (c *CheckRun) GetOutput() *CheckRunOutput { - if c == nil { - return nil +// GetSizeInBytes returns the SizeInBytes field if it's non-nil, zero value otherwise. +func (a *Artifact) GetSizeInBytes() int64 { + if a == nil || a.SizeInBytes == nil { + return 0 } - return c.Output + return *a.SizeInBytes } -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetStartedAt() Timestamp { - if c == nil || c.StartedAt == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *Artifact) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { return Timestamp{} } - return *c.StartedAt -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status + return *a.UpdatedAt } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CheckRun) GetURL() string { - if c == nil || c.URL == nil { - return "" - } - return *c.URL -} - -// GetAnnotationLevel returns the AnnotationLevel field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetAnnotationLevel() string { - if c == nil || c.AnnotationLevel == nil { +func (a *Artifact) GetURL() string { + if a == nil || a.URL == nil { return "" } - return *c.AnnotationLevel + return *a.URL } -// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetEndColumn() int { - if c == nil || c.EndColumn == nil { - return 0 +// GetWorkflowRun returns the WorkflowRun field. +func (a *Artifact) GetWorkflowRun() *ArtifactWorkflowRun { + if a == nil { + return nil } - return *c.EndColumn + return a.WorkflowRun } -// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetEndLine() int { - if c == nil || c.EndLine == nil { +// 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 *c.EndLine + return *a.AttestationID } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetMessage() string { - if c == nil || c.Message == nil { +// 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 *c.Message + return *a.Cluster } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetPath() string { - if c == nil || c.Path == nil { - return "" +// 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 *c.Path + return *a.CreatedAt } -// GetRawDetails returns the RawDetails field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetRawDetails() string { - if c == nil || c.RawDetails == nil { +// 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 *c.RawDetails + return *a.DeploymentName } -// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetStartColumn() int { - if c == nil || c.StartColumn == nil { - return 0 +// 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 *c.StartColumn + return *a.Digest } -// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetStartLine() int { - if c == nil || c.StartLine == nil { +// 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 *c.StartLine + return *a.ID } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (c *CheckRunAnnotation) GetTitle() string { - if c == nil || c.Title == nil { +// 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 *c.Title + return *a.LogicalEnvironment } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CheckRunEvent) GetAction() string { - if c == nil || c.Action == nil { +// 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 *c.Action + return *a.PhysicalEnvironment } -// GetCheckRun returns the CheckRun field. -func (c *CheckRunEvent) GetCheckRun() *CheckRun { - if c == nil { +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (a *ArtifactDeploymentRecord) GetRuntimeRisks() []DeploymentRuntimeRisk { + if a == nil || a.RuntimeRisks == nil { return nil } - return c.CheckRun + return a.RuntimeRisks } -// GetInstallation returns the Installation field. -func (c *CheckRunEvent) GetInstallation() *Installation { - if c == nil { - return nil +// 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 c.Installation + return a.Tags } -// GetOrg returns the Org field. -func (c *CheckRunEvent) GetOrg() *Organization { - if c == nil { - return nil +// 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 c.Org + return *a.UpdatedAt } -// GetRepo returns the Repo field. -func (c *CheckRunEvent) GetRepo() *Repository { - if c == nil { +// GetDeploymentRecords returns the DeploymentRecords slice if it's non-nil, nil otherwise. +func (a *ArtifactDeploymentResponse) GetDeploymentRecords() []*ArtifactDeploymentRecord { + if a == nil || a.DeploymentRecords == nil { return nil } - return c.Repo + return a.DeploymentRecords } -// GetRequestedAction returns the RequestedAction field. -func (c *CheckRunEvent) GetRequestedAction() *RequestedAction { - if c == nil { - return nil +// 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 c.RequestedAction + return *a.TotalCount } -// GetSender returns the Sender field. -func (c *CheckRunEvent) GetSender() *User { - if c == nil { +// GetArtifacts returns the Artifacts slice if it's non-nil, nil otherwise. +func (a *ArtifactList) GetArtifacts() []*Artifact { + if a == nil || a.Artifacts == nil { return nil } - return c.Sender + return a.Artifacts } -// GetAlt returns the Alt field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetAlt() string { - if c == nil || c.Alt == nil { - return "" +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ArtifactList) GetTotalCount() int64 { + if a == nil || a.TotalCount == nil { + return 0 } - return *c.Alt + return *a.TotalCount } -// GetCaption returns the Caption field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetCaption() string { - if c == nil || c.Caption == nil { - return "" +// GetDays returns the Days field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriod) GetDays() int { + if a == nil || a.Days == nil { + return 0 } - return *c.Caption + return *a.Days } -// GetImageURL returns the ImageURL field if it's non-nil, zero value otherwise. -func (c *CheckRunImage) GetImageURL() string { - if c == nil || c.ImageURL == nil { - return "" +// GetMaximumAllowedDays returns the MaximumAllowedDays field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriod) GetMaximumAllowedDays() int { + if a == nil || a.MaximumAllowedDays == nil { + return 0 } - return *c.ImageURL + return *a.MaximumAllowedDays } -// GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetAnnotationsCount() int { - if c == nil || c.AnnotationsCount == nil { +// GetDays returns the Days field. +func (a *ArtifactPeriodOpt) GetDays() int { + if a == nil { return 0 } - return *c.AnnotationsCount + return a.Days } -// GetAnnotationsURL returns the AnnotationsURL field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetAnnotationsURL() string { - if c == nil || c.AnnotationsURL == nil { +// 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 *c.AnnotationsURL + return *a.ArtifactURL } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetSummary() string { - if c == nil || c.Summary == nil { - return "" +// 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 *c.Summary + return *a.CreatedAt } -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetText() string { - if c == nil || c.Text == nil { +// 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 *c.Text + return *a.Digest } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (c *CheckRunOutput) GetTitle() string { - if c == nil || c.Title == nil { - return "" +// 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 *c.Title + return *a.ID } -// GetAfterSHA returns the AfterSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetAfterSHA() string { - if c == nil || c.AfterSHA == nil { +// 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 *c.AfterSHA + return *a.Name } -// GetApp returns the App field. -func (c *CheckSuite) GetApp() *App { - if c == nil { - return nil +// 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 c.App + return *a.RegistryURL } -// GetBeforeSHA returns the BeforeSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetBeforeSHA() string { - if c == nil || c.BeforeSHA == nil { +// 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 *c.BeforeSHA + return *a.Repository } -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetConclusion() string { - if c == nil || c.Conclusion == nil { +// 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 *c.Conclusion + return *a.Status } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { +// 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 *c.CreatedAt + return *a.UpdatedAt +} + +// GetStorageRecords returns the StorageRecords slice if it's non-nil, nil otherwise. +func (a *ArtifactStorageResponse) GetStorageRecords() []*ArtifactStorageRecord { + if a == nil || a.StorageRecords == nil { + return nil + } + return a.StorageRecords +} + +// 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 (c *CheckSuite) GetHeadBranch() string { - if c == nil || c.HeadBranch == nil { +func (a *ArtifactWorkflowRun) GetHeadBranch() string { + if a == nil || a.HeadBranch == nil { return "" } - return *c.HeadBranch + return *a.HeadBranch } -// GetHeadCommit returns the HeadCommit field. -func (c *CheckSuite) GetHeadCommit() *Commit { - if c == nil { - return nil +// GetHeadRepositoryID returns the HeadRepositoryID field if it's non-nil, zero value otherwise. +func (a *ArtifactWorkflowRun) GetHeadRepositoryID() int64 { + if a == nil || a.HeadRepositoryID == nil { + return 0 } - return c.HeadCommit + return *a.HeadRepositoryID } // GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetHeadSHA() string { - if c == nil || c.HeadSHA == nil { +func (a *ArtifactWorkflowRun) GetHeadSHA() string { + if a == nil || a.HeadSHA == nil { return "" } - return *c.HeadSHA + return *a.HeadSHA } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetID() int64 { - if c == nil || c.ID == nil { +func (a *ArtifactWorkflowRun) GetID() int64 { + if a == nil || a.ID == nil { return 0 } - return *c.ID + return *a.ID } -// GetLatestCheckRunsCount returns the LatestCheckRunsCount field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetLatestCheckRunsCount() int64 { - if c == nil || c.LatestCheckRunsCount == nil { +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (a *ArtifactWorkflowRun) GetRepositoryID() int64 { + if a == nil || a.RepositoryID == nil { return 0 } - return *c.LatestCheckRunsCount + return *a.RepositoryID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetNodeID() string { - if c == nil || c.NodeID == 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 *c.NodeID + return *a.AssignmentName } -// GetRepository returns the Repository field. -func (c *CheckSuite) GetRepository() *Repository { - if c == nil { - return nil +// 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 c.Repository + return *a.AssignmentURL } -// GetRerequestable returns the Rerequestable field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetRerequestable() bool { - if c == nil || c.Rerequestable == nil { - return false +// 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 *c.Rerequestable + return *a.GithubUsername } -// GetRunsRerequestable returns the RunsRerequestable field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetRunsRerequestable() bool { - if c == nil || c.RunsRerequestable == nil { - return false +// 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 *c.RunsRerequestable + return *a.GroupName } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetStatus() string { - if c == nil || c.Status == nil { +// 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.PointsAvailable +} + +// 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 *c.Status + return *a.RosterIdentifier } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// 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 *c.UpdatedAt + return *a.StarterCodeURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetURL() string { - if c == nil || c.URL == nil { +// 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 *c.URL + return *a.StudentRepositoryName } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CheckSuiteEvent) GetAction() string { - if c == nil || c.Action == nil { +// 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 *c.Action + return *a.StudentRepositoryURL } -// GetCheckSuite returns the CheckSuite field. -func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite { - if c == nil { - return nil +// 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 c.CheckSuite + return *a.SubmissionTimestamp } -// GetInstallation returns the Installation field. -func (c *CheckSuiteEvent) GetInstallation() *Installation { - if c == nil { - return nil +// 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 c.Installation + return *a.Body } -// GetOrg returns the Org field. -func (c *CheckSuiteEvent) GetOrg() *Organization { - if c == nil { - return nil +// 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 c.Org + return *a.ID } -// GetRepo returns the Repo field. -func (c *CheckSuiteEvent) GetRepo() *Repository { - if c == nil { - return nil +// 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 c.Repo + return *a.Title } -// GetSender returns the Sender field. -func (c *CheckSuiteEvent) GetSender() *User { - if c == nil { - return nil +// GetBundle returns the Bundle field. +func (a *Attestation) GetBundle() json.RawMessage { + if a == nil { + return json.RawMessage{} } - return c.Sender + return a.Bundle } -// GetPreferences returns the Preferences field. -func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList { - if c == nil { - return nil +// GetRepositoryID returns the RepositoryID field. +func (a *Attestation) GetRepositoryID() int64 { + if a == nil { + return 0 } - return c.Preferences + return a.RepositoryID } -// GetRepository returns the Repository field. -func (c *CheckSuitePreferenceResults) GetRepository() *Repository { - if c == nil { +// GetAttestations returns the Attestations slice if it's non-nil, nil otherwise. +func (a *AttestationsResponse) GetAttestations() []*Attestation { + if a == nil || a.Attestations == nil { return nil } - return c.Repository + return a.Attestations } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (c *ClusterSSHKey) GetFingerprint() string { - if c == nil || c.Fingerprint == nil { +// 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 *c.Fingerprint + return *a.Action } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (c *ClusterSSHKey) GetKey() string { - if c == nil || c.Key == nil { +// 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 *c.Key + return *a.Actor } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *ClusterStatus) GetStatus() string { - if c == nil || c.Status == nil { - return "" +// 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 *c.Status + return *a.ActorID } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (c *ClusterStatusNode) GetHostname() string { - if c == nil || c.Hostname == nil { - return "" +// GetActorLocation returns the ActorLocation field. +func (a *AuditEntry) GetActorLocation() *ActorLocation { + if a == nil { + return nil } - return *c.Hostname + return a.ActorLocation } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *ClusterStatusNode) GetStatus() string { - if c == nil || c.Status == nil { - return "" +// GetAdditionalFields returns the AdditionalFields map if it's non-nil, an empty map otherwise. +func (a *AuditEntry) GetAdditionalFields() map[string]any { + if a == nil || a.AdditionalFields == nil { + return map[string]any{} } - return *c.Status + return a.AdditionalFields } -// GetDetails returns the Details field if it's non-nil, zero value otherwise. -func (c *ClusterStatusNodeServiceItem) GetDetails() string { - if c == nil || c.Details == nil { +// GetBusiness returns the Business field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetBusiness() string { + if a == nil || a.Business == nil { return "" } - return *c.Details + return *a.Business } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *ClusterStatusNodeServiceItem) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetBusinessID returns the BusinessID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetBusinessID() int64 { + if a == nil || a.BusinessID == nil { + return 0 } - return *c.Name + return *a.BusinessID } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *ClusterStatusNodeServiceItem) GetStatus() string { - if c == nil || c.Status == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} } - return *c.Status + return *a.CreatedAt } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetBody() string { - if c == nil || c.Body == nil { - return "" +// GetData returns the Data map if it's non-nil, an empty map otherwise. +func (a *AuditEntry) GetData() map[string]any { + if a == nil || a.Data == nil { + return map[string]any{} } - return *c.Body + return a.Data } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetKey() string { - if c == nil || c.Key == nil { +// GetDocumentID returns the DocumentID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetDocumentID() string { + if a == nil || a.DocumentID == nil { return "" } - return *c.Key + return *a.DocumentID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetName() string { - if c == nil || c.Name == nil { +// GetExternalIdentityNameID returns the ExternalIdentityNameID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetExternalIdentityNameID() string { + if a == nil || a.ExternalIdentityNameID == nil { return "" } - return *c.Name + return *a.ExternalIdentityNameID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetURL() string { - if c == nil || c.URL == nil { +// GetExternalIdentityUsername returns the ExternalIdentityUsername field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetExternalIdentityUsername() string { + if a == nil || a.ExternalIdentityUsername == nil { return "" } - return *c.URL + return *a.ExternalIdentityUsername } -// GetSuggestion returns the Suggestion field if it's non-nil, zero value otherwise. -func (c *CodeownersError) GetSuggestion() string { - if c == nil || c.Suggestion == nil { +// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetHashedToken() string { + if a == nil || a.HashedToken == nil { return "" } - return *c.Suggestion + return *a.HashedToken } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetContentType() string { - if c == nil || c.ContentType == nil { +// GetOrg returns the Org field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetOrg() string { + if a == nil || a.Org == nil { return "" } - return *c.ContentType + return *a.Org } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { +// GetOrgID returns the OrgID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetOrgID() int64 { + if a == nil || a.OrgID == nil { + return 0 + } + return *a.OrgID +} + +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetTimestamp() Timestamp { + if a == nil || a.Timestamp == nil { return Timestamp{} } - return *c.CreatedAt + return *a.Timestamp } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetID() int64 { - if c == nil || c.ID == nil { +// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetTokenID() int64 { + if a == nil || a.TokenID == nil { return 0 } - return *c.ID + return *a.TokenID } -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetLanguage() string { - if c == nil || c.Language == nil { +// GetTokenScopes returns the TokenScopes field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetTokenScopes() string { + if a == nil || a.TokenScopes == nil { return "" } - return *c.Language + return *a.TokenScopes } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetName() string { - if c == nil || c.Name == nil { +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetUser() string { + if a == nil || a.User == nil { return "" } - return *c.Name + return *a.User } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetSize() int64 { - if c == nil || c.Size == nil { +// GetUserID returns the UserID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetUserID() int64 { + if a == nil || a.UserID == nil { return 0 } - return *c.Size + return *a.UserID } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { +// GetCreatedAt returns the CreatedAt field. +func (a *AuditLogStream) GetCreatedAt() Timestamp { + if a == nil { return Timestamp{} } - return *c.UpdatedAt + return a.CreatedAt } -// GetUploader returns the Uploader field. -func (c *CodeQLDatabase) GetUploader() *User { - if c == nil { - return nil +// GetEnabled returns the Enabled field. +func (a *AuditLogStream) GetEnabled() bool { + if a == nil { + return false } - return c.Uploader + return a.Enabled } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetURL() string { - if c == nil || c.URL == nil { - return "" +// GetID returns the ID field. +func (a *AuditLogStream) GetID() int64 { + if a == nil { + return 0 } - return *c.URL + return a.ID } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetPausedAt returns the PausedAt field if it's non-nil, zero value otherwise. +func (a *AuditLogStream) GetPausedAt() Timestamp { + if a == nil || a.PausedAt == nil { + return Timestamp{} } - return *c.HTMLURL + return *a.PausedAt } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetName() string { - if c == nil || c.Name == nil { +// GetStreamDetails returns the StreamDetails field. +func (a *AuditLogStream) GetStreamDetails() string { + if a == nil { return "" } - return *c.Name + return a.StreamDetails } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetPath() string { - if c == nil || c.Path == nil { +// GetStreamType returns the StreamType field. +func (a *AuditLogStream) GetStreamType() string { + if a == nil { return "" } - return *c.Path + return a.StreamType } -// GetRepository returns the Repository field. -func (c *CodeResult) GetRepository() *Repository { - if c == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field. +func (a *AuditLogStream) GetUpdatedAt() Timestamp { + if a == nil { + return Timestamp{} } - return c.Repository + return a.UpdatedAt } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CodeResult) GetSHA() string { - if c == nil || c.SHA == nil { - return "" +// GetEnabled returns the Enabled field. +func (a *AuditLogStreamConfig) GetEnabled() bool { + if a == nil { + return false } - return *c.SHA + return a.Enabled } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertEvent) GetAction() string { - if c == nil || c.Action == nil { +// GetStreamType returns the StreamType field. +func (a *AuditLogStreamConfig) GetStreamType() string { + if a == nil { return "" } - return *c.Action + return a.StreamType } -// GetAlert returns the Alert field. -func (c *CodeScanningAlertEvent) GetAlert() *Alert { - if c == nil { +// GetVendorSpecific returns the VendorSpecific field. +func (a *AuditLogStreamConfig) GetVendorSpecific() AuditLogStreamVendorConfig { + if a == nil { return nil } - return c.Alert + return a.VendorSpecific } -// GetCommitOID returns the CommitOID field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertEvent) GetCommitOID() string { - if c == nil || c.CommitOID == nil { +// GetKey returns the Key field. +func (a *AuditLogStreamKey) GetKey() string { + if a == nil { return "" } - return *c.CommitOID + return a.Key } -// GetInstallation returns the Installation field. -func (c *CodeScanningAlertEvent) GetInstallation() *Installation { - if c == nil { - return nil +// GetKeyID returns the KeyID field. +func (a *AuditLogStreamKey) GetKeyID() string { + if a == nil { + return "" } - return c.Installation + return a.KeyID } -// GetOrg returns the Org field. -func (c *CodeScanningAlertEvent) GetOrg() *Organization { - if c == nil { +// GetApp returns the App field. +func (a *Authorization) GetApp() *AuthorizationApp { + if a == nil { return nil } - return c.Org + return a.App } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertEvent) GetRef() string { - if c == nil || c.Ref == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (a *Authorization) GetCreatedAt() Timestamp { + if a == nil || a.CreatedAt == nil { + return Timestamp{} } - return *c.Ref + return *a.CreatedAt } -// GetRepo returns the Repo field. -func (c *CodeScanningAlertEvent) GetRepo() *Repository { - if c == nil { - return nil - } - return c.Repo -} - -// GetSender returns the Sender field. -func (c *CodeScanningAlertEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender -} - -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetDismissedComment() string { - if c == nil || c.DismissedComment == nil { +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (a *Authorization) GetFingerprint() string { + if a == nil || a.Fingerprint == nil { return "" } - return *c.DismissedComment + return *a.Fingerprint } -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (c *CodeScanningAlertState) GetDismissedReason() string { - if c == nil || c.DismissedReason == nil { +// GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. +func (a *Authorization) GetHashedToken() string { + if a == nil || a.HashedToken == nil { return "" } - return *c.DismissedReason -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (c *CodeSearchResult) GetIncompleteResults() bool { - if c == nil || c.IncompleteResults == nil { - return false - } - return *c.IncompleteResults + return *a.HashedToken } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CodeSearchResult) GetTotal() int { - if c == nil || c.Total == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *Authorization) GetID() int64 { + if a == nil || a.ID == nil { return 0 } - return *c.Total + return *a.ID } -// GetAdvancedSecurity returns the AdvancedSecurity field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetAdvancedSecurity() string { - if c == nil || c.AdvancedSecurity == nil { +// GetNote returns the Note field if it's non-nil, zero value otherwise. +func (a *Authorization) GetNote() string { + if a == nil || a.Note == nil { return "" } - return *c.AdvancedSecurity + return *a.Note } -// GetCodeScanningDefaultSetup returns the CodeScanningDefaultSetup field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetup() string { - if c == nil || c.CodeScanningDefaultSetup == nil { +// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. +func (a *Authorization) GetNoteURL() string { + if a == nil || a.NoteURL == nil { return "" } - return *c.CodeScanningDefaultSetup + return *a.NoteURL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *Authorization) GetScopes() []Scope { + if a == nil || a.Scopes == nil { + return nil } - return *c.CreatedAt + return a.Scopes } -// GetDependabotAlerts returns the DependabotAlerts field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDependabotAlerts() string { - if c == nil || c.DependabotAlerts == nil { +// GetToken returns the Token field if it's non-nil, zero value otherwise. +func (a *Authorization) GetToken() string { + if a == nil || a.Token == nil { return "" } - return *c.DependabotAlerts + return *a.Token } -// GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDependabotSecurityUpdates() string { - if c == nil || c.DependabotSecurityUpdates == nil { +// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. +func (a *Authorization) GetTokenLastEight() string { + if a == nil || a.TokenLastEight == nil { return "" } - return *c.DependabotSecurityUpdates + return *a.TokenLastEight } -// GetDependencyGraph returns the DependencyGraph field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDependencyGraph() string { - if c == nil || c.DependencyGraph == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (a *Authorization) GetUpdatedAt() Timestamp { + if a == nil || a.UpdatedAt == nil { + return Timestamp{} } - return *c.DependencyGraph + return *a.UpdatedAt } -// GetDependencyGraphAutosubmitAction returns the DependencyGraphAutosubmitAction field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitAction() string { - if c == nil || c.DependencyGraphAutosubmitAction == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (a *Authorization) GetURL() string { + if a == nil || a.URL == nil { return "" } - return *c.DependencyGraphAutosubmitAction + return *a.URL } -// GetDependencyGraphAutosubmitActionOptions returns the DependencyGraphAutosubmitActionOptions field. -func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitActionOptions() *DependencyGraphAutosubmitActionOptions { - if c == nil { +// GetUser returns the User field. +func (a *Authorization) GetUser() *User { + if a == nil { return nil } - return c.DependencyGraphAutosubmitActionOptions + return a.User } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDescription() string { - if c == nil || c.Description == nil { +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (a *AuthorizationApp) GetClientID() string { + if a == nil || a.ClientID == nil { return "" } - return *c.Description + return *a.ClientID } -// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetEnforcement() string { - if c == nil || c.Enforcement == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (a *AuthorizationApp) GetName() string { + if a == nil || a.Name == nil { return "" } - return *c.Enforcement + return *a.Name } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (a *AuthorizationApp) GetURL() string { + if a == nil || a.URL == nil { return "" } - return *c.HTMLURL + return *a.URL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (a *AuthorizationRequest) GetClientID() string { + if a == nil || a.ClientID == nil { + return "" } - return *c.ID + return *a.ClientID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetName() string { - if c == nil || c.Name == nil { +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (a *AuthorizationRequest) GetClientSecret() string { + if a == nil || a.ClientSecret == nil { return "" } - return *c.Name + return *a.ClientSecret } -// GetPrivateVulnerabilityReporting returns the PrivateVulnerabilityReporting field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { - if c == nil || c.PrivateVulnerabilityReporting == nil { +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (a *AuthorizationRequest) GetFingerprint() string { + if a == nil || a.Fingerprint == nil { return "" } - return *c.PrivateVulnerabilityReporting + return *a.Fingerprint } -// GetSecretScanning returns the SecretScanning field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetSecretScanning() string { - if c == nil || c.SecretScanning == nil { +// GetNote returns the Note field if it's non-nil, zero value otherwise. +func (a *AuthorizationRequest) GetNote() string { + if a == nil || a.Note == nil { return "" } - return *c.SecretScanning + return *a.Note } -// GetSecretScanningNonProviderPatterns returns the SecretScanningNonProviderPatterns field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetSecretScanningNonProviderPatterns() string { - if c == nil || c.SecretScanningNonProviderPatterns == nil { +// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. +func (a *AuthorizationRequest) GetNoteURL() string { + if a == nil || a.NoteURL == nil { return "" } - return *c.SecretScanningNonProviderPatterns + return *a.NoteURL } -// GetSecretScanningPushProtection returns the SecretScanningPushProtection field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetSecretScanningPushProtection() string { - if c == nil || c.SecretScanningPushProtection == nil { - return "" +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationRequest) GetScopes() []Scope { + if a == nil || a.Scopes == nil { + return nil } - return *c.SecretScanningPushProtection + return a.Scopes } -// GetSecretScanningValidityChecks returns the SecretScanningValidityChecks field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetSecretScanningValidityChecks() string { - if c == nil || c.SecretScanningValidityChecks == nil { - return "" +// GetAddScopes returns the AddScopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetAddScopes() []string { + if a == nil || a.AddScopes == nil { + return nil } - return *c.SecretScanningValidityChecks + return a.AddScopes } -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetTargetType() string { - if c == nil || c.TargetType == nil { +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (a *AuthorizationUpdateRequest) GetFingerprint() string { + if a == nil || a.Fingerprint == nil { return "" } - return *c.TargetType + return *a.Fingerprint } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// GetNote returns the Note field if it's non-nil, zero value otherwise. +func (a *AuthorizationUpdateRequest) GetNote() string { + if a == nil || a.Note == nil { + return "" } - return *c.UpdatedAt + return *a.Note } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetURL() string { - if c == nil || c.URL == nil { +// GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise. +func (a *AuthorizationUpdateRequest) GetNoteURL() string { + if a == nil || a.NoteURL == nil { return "" } - return *c.URL + return *a.NoteURL } -// GetConfiguration returns the Configuration field. -func (c *CodeSecurityConfigurationWithDefaultForNewRepos) GetConfiguration() *CodeSecurityConfiguration { - if c == nil { +// GetRemoveScopes returns the RemoveScopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetRemoveScopes() []string { + if a == nil || a.RemoveScopes == nil { return nil } - return c.Configuration + return a.RemoveScopes } -// GetDefaultForNewRepos returns the DefaultForNewRepos field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfigurationWithDefaultForNewRepos) GetDefaultForNewRepos() string { - if c == nil || c.DefaultForNewRepos == nil { - return "" +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (a *AuthorizationUpdateRequest) GetScopes() []string { + if a == nil || a.Scopes == nil { + return nil } - return *c.DefaultForNewRepos + return a.Scopes } -// GetBillableOwner returns the BillableOwner field. -func (c *Codespace) GetBillableOwner() *User { - if c == nil { +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (a *AuthorizedActorNames) GetFrom() []string { + if a == nil || a.From == nil { return nil } - return c.BillableOwner + return a.From } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *Codespace) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *AuthorizedActorsOnly) GetFrom() bool { + if a == nil || a.From == nil { + return false } - return *c.CreatedAt + return *a.From } -// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. -func (c *Codespace) GetDevcontainerPath() string { - if c == nil || c.DevcontainerPath == nil { - return "" +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (a *AuthorizedDismissalActorsOnlyChanges) GetFrom() bool { + if a == nil || a.From == nil { + return false } - return *c.DevcontainerPath + return *a.From } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (c *Codespace) GetDisplayName() string { - if c == nil || c.DisplayName == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *Autolink) GetID() int64 { + if a == nil || a.ID == nil { + return 0 } - return *c.DisplayName + return *a.ID } -// GetEnvironmentID returns the EnvironmentID field if it's non-nil, zero value otherwise. -func (c *Codespace) GetEnvironmentID() string { - if c == nil || c.EnvironmentID == nil { - return "" +// GetIsAlphanumeric returns the IsAlphanumeric field if it's non-nil, zero value otherwise. +func (a *Autolink) GetIsAlphanumeric() bool { + if a == nil || a.IsAlphanumeric == nil { + return false } - return *c.EnvironmentID + return *a.IsAlphanumeric } -// GetGitStatus returns the GitStatus field. -func (c *Codespace) GetGitStatus() *CodespacesGitStatus { - if c == nil { - return nil +// GetKeyPrefix returns the KeyPrefix field if it's non-nil, zero value otherwise. +func (a *Autolink) GetKeyPrefix() string { + if a == nil || a.KeyPrefix == nil { + return "" } - return c.GitStatus + return *a.KeyPrefix } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *Codespace) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetURLTemplate returns the URLTemplate field if it's non-nil, zero value otherwise. +func (a *Autolink) GetURLTemplate() string { + if a == nil || a.URLTemplate == nil { + return "" } - return *c.ID + return *a.URLTemplate } -// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. -func (c *Codespace) GetIdleTimeoutMinutes() int { - if c == nil || c.IdleTimeoutMinutes == nil { - return 0 +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (a *AutomatedSecurityFixes) GetEnabled() bool { + if a == nil || a.Enabled == nil { + return false } - return *c.IdleTimeoutMinutes + return *a.Enabled } -// GetIdleTimeoutNotice returns the IdleTimeoutNotice field if it's non-nil, zero value otherwise. -func (c *Codespace) GetIdleTimeoutNotice() string { - if c == nil || c.IdleTimeoutNotice == nil { - return "" +// GetPaused returns the Paused field if it's non-nil, zero value otherwise. +func (a *AutomatedSecurityFixes) GetPaused() bool { + if a == nil || a.Paused == nil { + return false } - return *c.IdleTimeoutNotice + return *a.Paused } -// GetLastKnownStopNotice returns the LastKnownStopNotice field if it's non-nil, zero value otherwise. -func (c *Codespace) GetLastKnownStopNotice() string { - if c == nil || c.LastKnownStopNotice == nil { - return "" +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (a *AutoTriggerCheck) GetAppID() int64 { + if a == nil || a.AppID == nil { + return 0 } - return *c.LastKnownStopNotice + return *a.AppID } -// GetLastUsedAt returns the LastUsedAt field if it's non-nil, zero value otherwise. -func (c *Codespace) GetLastUsedAt() Timestamp { - if c == nil || c.LastUsedAt == nil { - return Timestamp{} +// GetSetting returns the Setting field if it's non-nil, zero value otherwise. +func (a *AutoTriggerCheck) GetSetting() bool { + if a == nil || a.Setting == nil { + return false } - return *c.LastUsedAt + return *a.Setting } -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (c *Codespace) GetLocation() string { - if c == nil || c.Location == nil { +// GetContainer returns the Container field. +func (a *AzureBlobConfig) GetContainer() string { + if a == nil { return "" } - return *c.Location -} - -// GetMachine returns the Machine field. -func (c *Codespace) GetMachine() *CodespacesMachine { - if c == nil { - return nil - } - return c.Machine + return a.Container } -// GetMachinesURL returns the MachinesURL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetMachinesURL() string { - if c == nil || c.MachinesURL == nil { +// GetEncryptedSASURL returns the EncryptedSASURL field. +func (a *AzureBlobConfig) GetEncryptedSASURL() string { + if a == nil { return "" } - return *c.MachinesURL + return a.EncryptedSASURL } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *Codespace) GetName() string { - if c == nil || c.Name == nil { +// GetKeyID returns the KeyID field. +func (a *AzureBlobConfig) GetKeyID() string { + if a == nil { return "" } - return *c.Name + return a.KeyID } -// GetOwner returns the Owner field. -func (c *Codespace) GetOwner() *User { - if c == nil { - return nil +// GetEncryptedConnstring returns the EncryptedConnstring field. +func (a *AzureHubConfig) GetEncryptedConnstring() string { + if a == nil { + return "" } - return c.Owner + return a.EncryptedConnstring } -// GetPendingOperation returns the PendingOperation field if it's non-nil, zero value otherwise. -func (c *Codespace) GetPendingOperation() bool { - if c == nil || c.PendingOperation == nil { - return false +// GetKeyID returns the KeyID field. +func (a *AzureHubConfig) GetKeyID() string { + if a == nil { + return "" } - return *c.PendingOperation + return a.KeyID } -// GetPendingOperationDisabledReason returns the PendingOperationDisabledReason field if it's non-nil, zero value otherwise. -func (c *Codespace) GetPendingOperationDisabledReason() string { - if c == nil || c.PendingOperationDisabledReason == nil { +// GetName returns the Name field. +func (a *AzureHubConfig) GetName() string { + if a == nil { return "" } - return *c.PendingOperationDisabledReason + return a.Name } -// GetPrebuild returns the Prebuild field if it's non-nil, zero value otherwise. -func (c *Codespace) GetPrebuild() bool { - if c == nil || c.Prebuild == nil { - return false +// GetOTP returns the OTP field. +func (b *BasicAuthTransport) GetOTP() string { + if b == nil { + return "" } - return *c.Prebuild + return b.OTP } -// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetPullsURL() string { - if c == nil || c.PullsURL == nil { +// GetPassword returns the Password field. +func (b *BasicAuthTransport) GetPassword() string { + if b == nil { return "" } - return *c.PullsURL + return b.Password } -// GetRepository returns the Repository field. -func (c *Codespace) GetRepository() *Repository { - if c == nil { - return nil +// GetUsername returns the Username field. +func (b *BasicAuthTransport) GetUsername() string { + if b == nil { + return "" } - return c.Repository + return b.Username } -// GetRetentionExpiresAt returns the RetentionExpiresAt field if it's non-nil, zero value otherwise. -func (c *Codespace) GetRetentionExpiresAt() Timestamp { - if c == nil || c.RetentionExpiresAt == nil { - return Timestamp{} +// GetID returns the ID field. +func (b *BillingCostCenter) GetID() string { + if b == nil { + return "" } - return *c.RetentionExpiresAt + return b.ID } -// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. -func (c *Codespace) GetRetentionPeriodMinutes() int { - if c == nil || c.RetentionPeriodMinutes == nil { - return 0 +// GetName returns the Name field. +func (b *BillingCostCenter) GetName() string { + if b == nil { + return "" } - return *c.RetentionPeriodMinutes + return b.Name } -// GetRuntimeConstraints returns the RuntimeConstraints field. -func (c *Codespace) GetRuntimeConstraints() *CodespacesRuntimeConstraints { - if c == nil { - return nil +// GetContent returns the Content field. +func (b *Blob) GetContent() string { + if b == nil { + return "" } - return c.RuntimeConstraints + return b.Content } -// GetStartURL returns the StartURL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetStartURL() string { - if c == nil || c.StartURL == nil { +// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. +func (b *Blob) GetEncoding() string { + if b == nil || b.Encoding == nil { return "" } - return *c.StartURL + return *b.Encoding } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (c *Codespace) GetState() string { - if c == nil || c.State == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (b *Blob) GetNodeID() string { + if b == nil || b.NodeID == nil { return "" } - return *c.State + return *b.NodeID } -// GetStopURL returns the StopURL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetStopURL() string { - if c == nil || c.StopURL == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (b *Blob) GetSHA() string { + if b == nil || b.SHA == nil { return "" } - return *c.StopURL + return *b.SHA } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *Codespace) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (b *Blob) GetSize() int { + if b == nil || b.Size == nil { + return 0 } - return *c.UpdatedAt + return *b.Size } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetURL() string { - if c == nil || c.URL == nil { +func (b *Blob) GetURL() string { + if b == nil || b.URL == nil { return "" } - return *c.URL + return *b.URL } -// GetWebURL returns the WebURL field if it's non-nil, zero value otherwise. -func (c *Codespace) GetWebURL() string { - if c == nil || c.WebURL == nil { - return "" +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (b *BlockCreations) GetEnabled() bool { + if b == nil || b.Enabled == nil { + return false } - return *c.WebURL + return *b.Enabled } -// 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 +// GetCommit returns the Commit field. +func (b *Branch) GetCommit() *RepositoryCommit { + if b == nil { + return nil } - return *c.Ahead + return b.Commit } -// 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 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (b *Branch) GetName() string { + if b == nil || b.Name == nil { + return "" } - return *c.Behind + return *b.Name } -// GetHasUncommittedChanges returns the HasUncommittedChanges field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetHasUncommittedChanges() bool { - if c == nil || c.HasUncommittedChanges == nil { +// GetProtected returns the Protected field if it's non-nil, zero value otherwise. +func (b *Branch) GetProtected() bool { + if b == nil || b.Protected == nil { return false } - return *c.HasUncommittedChanges + return *b.Protected } -// 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 +// GetProtection returns the Protection field. +func (b *Branch) GetProtection() *Protection { + if b == nil { + return nil } - return *c.HasUnpushedChanges + return b.Protection } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CodespacesGitStatus) GetRef() string { - if c == nil || c.Ref == nil { +// GetProtectionURL returns the ProtectionURL field if it's non-nil, zero value otherwise. +func (b *Branch) GetProtectionURL() string { + if b == nil || b.ProtectionURL == nil { return "" } - return *c.Ref + return *b.ProtectionURL } -// 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 +// GetCommit returns the Commit field. +func (b *BranchCommit) GetCommit() *Commit { + if b == nil { + return nil } - return *c.CPUs + return b.Commit } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetDisplayName() string { - if c == nil || c.DisplayName == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (b *BranchCommit) GetName() string { + if b == nil || b.Name == nil { return "" } - return *c.DisplayName + return *b.Name } -// 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 +// GetProtected returns the Protected field if it's non-nil, zero value otherwise. +func (b *BranchCommit) GetProtected() bool { + if b == nil || b.Protected == nil { + return false } - return *c.MemoryInBytes + return *b.Protected } -// 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 "" +// GetProtected returns the Protected field if it's non-nil, zero value otherwise. +func (b *BranchListOptions) GetProtected() bool { + if b == nil || b.Protected == nil { + return false } - return *c.Name + return *b.Protected } -// 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 "" +// GetCustomBranchPolicies returns the CustomBranchPolicies field if it's non-nil, zero value otherwise. +func (b *BranchPolicy) GetCustomBranchPolicies() bool { + if b == nil || b.CustomBranchPolicies == nil { + return false } - return *c.OperatingSystem + return *b.CustomBranchPolicies } -// GetPrebuildAvailability returns the PrebuildAvailability field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetPrebuildAvailability() string { - if c == nil || c.PrebuildAvailability == nil { - return "" +// GetProtectedBranches returns the ProtectedBranches field if it's non-nil, zero value otherwise. +func (b *BranchPolicy) GetProtectedBranches() bool { + if b == nil || b.ProtectedBranches == nil { + return false } - return *c.PrebuildAvailability + return *b.ProtectedBranches } -// GetStorageInBytes returns the StorageInBytes field if it's non-nil, zero value otherwise. -func (c *CodespacesMachine) GetStorageInBytes() int64 { - if c == nil || c.StorageInBytes == nil { - return 0 +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (b *BranchProtectionConfigurationEvent) GetAction() string { + if b == nil || b.Action == nil { + return "" } - return *c.StorageInBytes + return *b.Action } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CollaboratorInvitation) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetEnterprise returns the Enterprise field. +func (b *BranchProtectionConfigurationEvent) GetEnterprise() *Enterprise { + if b == nil { + return nil } - return *c.CreatedAt + return b.Enterprise } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CollaboratorInvitation) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetInstallation returns the Installation field. +func (b *BranchProtectionConfigurationEvent) GetInstallation() *Installation { + if b == nil { + return nil } - return *c.HTMLURL + return b.Installation } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CollaboratorInvitation) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetOrg returns the Org field. +func (b *BranchProtectionConfigurationEvent) GetOrg() *Organization { + if b == nil { + return nil } - return *c.ID + return b.Org } -// GetInvitee returns the Invitee field. -func (c *CollaboratorInvitation) GetInvitee() *User { - if c == nil { +// GetRepo returns the Repo field. +func (b *BranchProtectionConfigurationEvent) GetRepo() *Repository { + if b == nil { return nil } - return c.Invitee + return b.Repo } -// GetInviter returns the Inviter field. -func (c *CollaboratorInvitation) GetInviter() *User { - if c == nil { +// GetSender returns the Sender field. +func (b *BranchProtectionConfigurationEvent) GetSender() *User { + if b == nil { return nil } - return c.Inviter + return b.Sender } -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (c *CollaboratorInvitation) GetPermissions() string { - if c == nil || c.Permissions == nil { - return "" +// GetAdminEnforced returns the AdminEnforced field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAdminEnforced() bool { + if b == nil || b.AdminEnforced == nil { + return false } - return *c.Permissions + return *b.AdminEnforced } -// GetRepo returns the Repo field. -func (c *CollaboratorInvitation) GetRepo() *Repository { - if c == nil { - return nil +// GetAllowDeletionsEnforcementLevel returns the AllowDeletionsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAllowDeletionsEnforcementLevel() string { + if b == nil || b.AllowDeletionsEnforcementLevel == nil { + return "" } - return c.Repo + return *b.AllowDeletionsEnforcementLevel } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CollaboratorInvitation) GetURL() string { - if c == nil || c.URL == nil { +// GetAllowForcePushesEnforcementLevel returns the AllowForcePushesEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAllowForcePushesEnforcementLevel() string { + if b == nil || b.AllowForcePushesEnforcementLevel == nil { return "" } - return *c.URL + return *b.AllowForcePushesEnforcementLevel } -// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetCommitURL() string { - if c == nil || c.CommitURL == nil { - return "" +// GetAuthorizedActorNames returns the AuthorizedActorNames slice if it's non-nil, nil otherwise. +func (b *BranchProtectionRule) GetAuthorizedActorNames() []string { + if b == nil || b.AuthorizedActorNames == nil { + return nil } - return *c.CommitURL + return b.AuthorizedActorNames } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAuthorizedActorsOnly() bool { + if b == nil || b.AuthorizedActorsOnly == nil { + return false } - return *c.Name + return *b.AuthorizedActorsOnly } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetRepositoryURL() string { - if c == nil || c.RepositoryURL == nil { - return "" +// GetAuthorizedDismissalActorsOnly returns the AuthorizedDismissalActorsOnly field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetAuthorizedDismissalActorsOnly() bool { + if b == nil || b.AuthorizedDismissalActorsOnly == nil { + return false } - return *c.RepositoryURL + return *b.AuthorizedDismissalActorsOnly } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetSHA() string { - if c == nil || c.SHA == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetCreatedAt() Timestamp { + if b == nil || b.CreatedAt == nil { + return Timestamp{} } - return *c.SHA + return *b.CreatedAt } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetState() string { - if c == nil || c.State == nil { - return "" +// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetDismissStaleReviewsOnPush() bool { + if b == nil || b.DismissStaleReviewsOnPush == nil { + return false } - return *c.State + return *b.DismissStaleReviewsOnPush } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (c *CombinedStatus) GetTotalCount() int { - if c == nil || c.TotalCount == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetID() int64 { + if b == nil || b.ID == nil { return 0 } - return *c.TotalCount + return *b.ID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *Comment) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetIgnoreApprovalsFromContributors returns the IgnoreApprovalsFromContributors field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetIgnoreApprovalsFromContributors() bool { + if b == nil || b.IgnoreApprovalsFromContributors == nil { + return false } - return *c.CreatedAt + return *b.IgnoreApprovalsFromContributors } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetAuthorAssociation() string { - if c == nil || c.AuthorAssociation == nil { +// GetLinearHistoryRequirementEnforcementLevel returns the LinearHistoryRequirementEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetLinearHistoryRequirementEnforcementLevel() string { + if b == nil || b.LinearHistoryRequirementEnforcementLevel == nil { return "" } - return *c.AuthorAssociation + return *b.LinearHistoryRequirementEnforcementLevel } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetBody() string { - if c == nil || c.Body == nil { +// GetMergeQueueEnforcementLevel returns the MergeQueueEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetMergeQueueEnforcementLevel() string { + if b == nil || b.MergeQueueEnforcementLevel == nil { return "" } - return *c.Body + return *b.MergeQueueEnforcementLevel } -// GetChildCommentCount returns the ChildCommentCount field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetChildCommentCount() int { - if c == nil || c.ChildCommentCount == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetName() string { + if b == nil || b.Name == nil { + return "" } - return *c.ChildCommentCount + return *b.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetPullRequestReviewsEnforcementLevel returns the PullRequestReviewsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetPullRequestReviewsEnforcementLevel() string { + if b == nil || b.PullRequestReviewsEnforcementLevel == nil { + return "" } - return *c.CreatedAt + return *b.PullRequestReviewsEnforcementLevel } -// GetDiscussionID returns the DiscussionID field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetDiscussionID() int64 { - if c == nil || c.DiscussionID == nil { +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRepositoryID() int64 { + if b == nil || b.RepositoryID == nil { return 0 } - return *c.DiscussionID + return *b.RepositoryID } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequireCodeOwnerReview() bool { + if b == nil || b.RequireCodeOwnerReview == nil { + return false } - return *c.HTMLURL + return *b.RequireCodeOwnerReview } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetID() int64 { - if c == nil || c.ID == nil { +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredApprovingReviewCount() int { + if b == nil || b.RequiredApprovingReviewCount == nil { return 0 } - return *c.ID + return *b.RequiredApprovingReviewCount } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetNodeID() string { - if c == nil || c.NodeID == nil { +// GetRequiredConversationResolutionLevel returns the RequiredConversationResolutionLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredConversationResolutionLevel() string { + if b == nil || b.RequiredConversationResolutionLevel == nil { return "" } - return *c.NodeID + return *b.RequiredConversationResolutionLevel } -// GetParentID returns the ParentID field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetParentID() int64 { - if c == nil || c.ParentID == nil { - return 0 +// GetRequiredDeploymentsEnforcementLevel returns the RequiredDeploymentsEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredDeploymentsEnforcementLevel() string { + if b == nil || b.RequiredDeploymentsEnforcementLevel == nil { + return "" } - return *c.ParentID + return *b.RequiredDeploymentsEnforcementLevel } -// GetReactions returns the Reactions field. -func (c *CommentDiscussion) GetReactions() *Reactions { - if c == nil { +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (b *BranchProtectionRule) GetRequiredStatusChecks() []string { + if b == nil || b.RequiredStatusChecks == nil { return nil } - return c.Reactions + return b.RequiredStatusChecks } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetRepositoryURL() string { - if c == nil || c.RepositoryURL == nil { +// GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string { + if b == nil || b.RequiredStatusChecksEnforcementLevel == nil { return "" } - return *c.RepositoryURL + return *b.RequiredStatusChecksEnforcementLevel } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CommentDiscussion) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetRequireLastPushApproval() bool { + if b == nil || b.RequireLastPushApproval == nil { + return false } - return *c.UpdatedAt + return *b.RequireLastPushApproval } -// GetUser returns the User field. -func (c *CommentDiscussion) GetUser() *User { - if c == nil { - return nil +// GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetSignatureRequirementEnforcementLevel() string { + if b == nil || b.SignatureRequirementEnforcementLevel == nil { + return "" } - return c.User + return *b.SignatureRequirementEnforcementLevel } -// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalCommitComments() int { - if c == nil || c.TotalCommitComments == nil { - return 0 +// GetStrictRequiredStatusChecksPolicy returns the StrictRequiredStatusChecksPolicy field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetStrictRequiredStatusChecksPolicy() bool { + if b == nil || b.StrictRequiredStatusChecksPolicy == nil { + return false } - return *c.TotalCommitComments + return *b.StrictRequiredStatusChecksPolicy } -// GetTotalGistComments returns the TotalGistComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalGistComments() int { - if c == nil || c.TotalGistComments == nil { - return 0 +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRule) GetUpdatedAt() Timestamp { + if b == nil || b.UpdatedAt == nil { + return Timestamp{} } - return *c.TotalGistComments + return *b.UpdatedAt } -// GetTotalIssueComments returns the TotalIssueComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalIssueComments() int { - if c == nil || c.TotalIssueComments == nil { - return 0 +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (b *BranchProtectionRuleEvent) GetAction() string { + if b == nil || b.Action == nil { + return "" } - return *c.TotalIssueComments + return *b.Action } -// GetTotalPullRequestComments returns the TotalPullRequestComments field if it's non-nil, zero value otherwise. -func (c *CommentStats) GetTotalPullRequestComments() int { - if c == nil || c.TotalPullRequestComments == nil { - return 0 +// GetChanges returns the Changes field. +func (b *BranchProtectionRuleEvent) GetChanges() *ProtectionChanges { + if b == nil { + return nil } - return *c.TotalPullRequestComments + return b.Changes } -// GetAuthor returns the Author field. -func (c *Commit) GetAuthor() *CommitAuthor { - if c == nil { +// GetInstallation returns the Installation field. +func (b *BranchProtectionRuleEvent) GetInstallation() *Installation { + if b == nil { return nil } - return c.Author + return b.Installation } -// GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise. -func (c *Commit) GetCommentCount() int { - if c == nil || c.CommentCount == nil { - return 0 +// GetOrg returns the Org field. +func (b *BranchProtectionRuleEvent) GetOrg() *Organization { + if b == nil { + return nil } - return *c.CommentCount + return b.Org } -// GetCommitter returns the Committer field. -func (c *Commit) GetCommitter() *CommitAuthor { - if c == nil { +// GetRepo returns the Repo field. +func (b *BranchProtectionRuleEvent) GetRepo() *Repository { + if b == nil { return nil } - return c.Committer + return b.Repo } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *Commit) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetRule returns the Rule field. +func (b *BranchProtectionRuleEvent) GetRule() *BranchProtectionRule { + if b == nil { + return nil } - return *c.HTMLURL + return b.Rule } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (c *Commit) GetMessage() string { - if c == nil || c.Message == nil { - return "" +// GetSender returns the Sender field. +func (b *BranchProtectionRuleEvent) GetSender() *User { + if b == nil { + return nil } - return *c.Message + return b.Sender } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *Commit) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetApps() []*App { + if b == nil || b.Apps == nil { + return nil } - return *c.NodeID + return b.Apps } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *Commit) GetSHA() string { - if c == nil || c.SHA == nil { - return "" +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetTeams() []*Team { + if b == nil || b.Teams == nil { + return nil } - return *c.SHA + return b.Teams } -// GetTree returns the Tree field. -func (c *Commit) GetTree() *Tree { - if c == nil { +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BranchRestrictions) GetUsers() []*User { + if b == nil || b.Users == nil { return nil } - return c.Tree + return b.Users } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *Commit) GetURL() string { - if c == nil || c.URL == nil { - return "" +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetApps() []string { + if b == nil || b.Apps == nil { + return nil } - return *c.URL + return b.Apps } -// GetVerification returns the Verification field. -func (c *Commit) GetVerification() *SignatureVerification { - if c == nil { +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetTeams() []string { + if b == nil || b.Teams == nil { return nil } - return c.Verification + return b.Teams } -// GetDate returns the Date field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetDate() Timestamp { - if c == nil || c.Date == nil { - return Timestamp{} +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BranchRestrictionsRequest) GetUsers() []string { + if b == nil || b.Users == nil { + return nil } - return *c.Date + return b.Users } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetEmail() string { - if c == nil || c.Email == nil { - return "" +// GetRulesetID returns the RulesetID field. +func (b *BranchRuleMetadata) GetRulesetID() int64 { + if b == nil { + return 0 } - return *c.Email + return b.RulesetID } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetLogin() string { - if c == nil || c.Login == nil { +// GetRulesetSource returns the RulesetSource field. +func (b *BranchRuleMetadata) GetRulesetSource() string { + if b == nil { return "" } - return *c.Login + return b.RulesetSource } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CommitAuthor) GetName() string { - if c == nil || c.Name == nil { +// GetRulesetSourceType returns the RulesetSourceType field. +func (b *BranchRuleMetadata) GetRulesetSourceType() RulesetSourceType { + if b == nil { return "" } - return *c.Name + return b.RulesetSourceType } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CommitCommentEvent) GetAction() string { - if c == nil || c.Action == nil { - return "" +// GetBranchNamePattern returns the BranchNamePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetBranchNamePattern() []*PatternBranchRule { + if b == nil || b.BranchNamePattern == nil { + return nil } - return *c.Action + return b.BranchNamePattern } -// GetComment returns the Comment field. -func (c *CommitCommentEvent) GetComment() *RepositoryComment { - if c == nil { +// GetCodeScanning returns the CodeScanning slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCodeScanning() []*CodeScanningBranchRule { + if b == nil || b.CodeScanning == nil { return nil } - return c.Comment + return b.CodeScanning } -// GetInstallation returns the Installation field. -func (c *CommitCommentEvent) GetInstallation() *Installation { - if c == nil { +// GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitAuthorEmailPattern() []*PatternBranchRule { + if b == nil || b.CommitAuthorEmailPattern == nil { return nil } - return c.Installation + return b.CommitAuthorEmailPattern } -// GetOrg returns the Org field. -func (c *CommitCommentEvent) GetOrg() *Organization { - if c == nil { +// GetCommitMessagePattern returns the CommitMessagePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitMessagePattern() []*PatternBranchRule { + if b == nil || b.CommitMessagePattern == nil { return nil } - return c.Org + return b.CommitMessagePattern } -// GetRepo returns the Repo field. -func (c *CommitCommentEvent) GetRepo() *Repository { - if c == nil { +// GetCommitterEmailPattern returns the CommitterEmailPattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCommitterEmailPattern() []*PatternBranchRule { + if b == nil || b.CommitterEmailPattern == nil { return nil } - return c.Repo + return b.CommitterEmailPattern } -// GetSender returns the Sender field. -func (c *CommitCommentEvent) GetSender() *User { - if c == nil { +// GetCopilotCodeReview returns the CopilotCodeReview slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCopilotCodeReview() []*CopilotCodeReviewBranchRule { + if b == nil || b.CopilotCodeReview == nil { return nil } - return c.Sender + return b.CopilotCodeReview } -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetAdditions() int { - if c == nil || c.Additions == nil { - return 0 +// GetCreation returns the Creation slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetCreation() []*BranchRuleMetadata { + if b == nil || b.Creation == nil { + return nil } - return *c.Additions + return b.Creation } -// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetBlobURL() string { - if c == nil || c.BlobURL == nil { - return "" +// GetDeletion returns the Deletion slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetDeletion() []*BranchRuleMetadata { + if b == nil || b.Deletion == nil { + return nil } - return *c.BlobURL + return b.Deletion } -// GetChanges returns the Changes field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetChanges() int { - if c == nil || c.Changes == nil { - return 0 +// GetFileExtensionRestriction returns the FileExtensionRestriction slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetFileExtensionRestriction() []*FileExtensionRestrictionBranchRule { + if b == nil || b.FileExtensionRestriction == nil { + return nil } - return *c.Changes + return b.FileExtensionRestriction } -// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetContentsURL() string { - if c == nil || c.ContentsURL == nil { - return "" +// GetFilePathRestriction returns the FilePathRestriction slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetFilePathRestriction() []*FilePathRestrictionBranchRule { + if b == nil || b.FilePathRestriction == nil { + return nil } - return *c.ContentsURL + return b.FilePathRestriction } -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetDeletions() int { - if c == nil || c.Deletions == nil { - return 0 +// GetMaxFilePathLength returns the MaxFilePathLength slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMaxFilePathLength() []*MaxFilePathLengthBranchRule { + if b == nil || b.MaxFilePathLength == nil { + return nil } - return *c.Deletions + return b.MaxFilePathLength } -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetFilename() string { - if c == nil || c.Filename == nil { - return "" +// GetMaxFileSize returns the MaxFileSize slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMaxFileSize() []*MaxFileSizeBranchRule { + if b == nil || b.MaxFileSize == nil { + return nil } - return *c.Filename + return b.MaxFileSize } -// GetPatch returns the Patch field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetPatch() string { - if c == nil || c.Patch == nil { - return "" +// GetMergeQueue returns the MergeQueue slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetMergeQueue() []*MergeQueueBranchRule { + if b == nil || b.MergeQueue == nil { + return nil } - return *c.Patch + return b.MergeQueue } -// GetPreviousFilename returns the PreviousFilename field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetPreviousFilename() string { - if c == nil || c.PreviousFilename == nil { - return "" +// GetNonFastForward returns the NonFastForward slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetNonFastForward() []*BranchRuleMetadata { + if b == nil || b.NonFastForward == nil { + return nil } - return *c.PreviousFilename + return b.NonFastForward } -// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetRawURL() string { - if c == nil || c.RawURL == nil { - return "" +// GetPullRequest returns the PullRequest slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetPullRequest() []*PullRequestBranchRule { + if b == nil || b.PullRequest == nil { + return nil } - return *c.RawURL + return b.PullRequest } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetSHA() string { - if c == nil || c.SHA == nil { - return "" +// GetRequiredDeployments returns the RequiredDeployments slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredDeployments() []*RequiredDeploymentsBranchRule { + if b == nil || b.RequiredDeployments == nil { + return nil } - return *c.SHA + return b.RequiredDeployments } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CommitFile) GetStatus() string { - if c == nil || c.Status == nil { - return "" +// GetRequiredLinearHistory returns the RequiredLinearHistory slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredLinearHistory() []*BranchRuleMetadata { + if b == nil || b.RequiredLinearHistory == nil { + return nil } - return *c.Status + return b.RequiredLinearHistory } -// GetAuthor returns the Author field. -func (c *CommitResult) GetAuthor() *User { - if c == nil { +// GetRequiredSignatures returns the RequiredSignatures slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredSignatures() []*BranchRuleMetadata { + if b == nil || b.RequiredSignatures == nil { return nil } - return c.Author + return b.RequiredSignatures } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetCommentsURL() string { - if c == nil || c.CommentsURL == nil { - return "" +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetRequiredStatusChecks() []*RequiredStatusChecksBranchRule { + if b == nil || b.RequiredStatusChecks == nil { + return nil } - return *c.CommentsURL + return b.RequiredStatusChecks } -// GetCommit returns the Commit field. -func (c *CommitResult) GetCommit() *Commit { - if c == nil { +// GetTagNamePattern returns the TagNamePattern slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetTagNamePattern() []*PatternBranchRule { + if b == nil || b.TagNamePattern == nil { return nil } - return c.Commit + return b.TagNamePattern } -// GetCommitter returns the Committer field. -func (c *CommitResult) GetCommitter() *User { - if c == nil { +// GetUpdate returns the Update slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetUpdate() []*UpdateBranchRule { + if b == nil || b.Update == nil { return nil } - return c.Committer + return b.Update } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (b *BranchRules) GetWorkflows() []*WorkflowsBranchRule { + if b == nil || b.Workflows == nil { + return nil } - return *c.HTMLURL + return b.Workflows } -// GetRepository returns the Repository field. -func (c *CommitResult) GetRepository() *Repository { - if c == nil { +// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. +func (b *BypassActor) GetActorID() int64 { + if b == nil || b.ActorID == nil { + return 0 + } + return *b.ActorID +} + +// GetActorType returns the ActorType field. +func (b *BypassActor) GetActorType() *BypassActorType { + if b == nil { return nil } - return c.Repository + return b.ActorType } -// GetScore returns the Score field. -func (c *CommitResult) GetScore() *float64 { - if c == nil { +// GetBypassMode returns the BypassMode field. +func (b *BypassActor) GetBypassMode() *BypassMode { + if b == nil { return nil } - return c.Score + return b.BypassMode } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetSHA() string { - if c == nil || c.SHA == nil { - return "" +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetApps() []*App { + if b == nil || b.Apps == nil { + return nil } - return *c.SHA + return b.Apps } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CommitResult) GetURL() string { - if c == nil || c.URL == nil { - return "" +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetTeams() []*Team { + if b == nil || b.Teams == nil { + return nil } - return *c.URL + return b.Teams } -// GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetAheadBy() int { - if c == nil || c.AheadBy == nil { - return 0 +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowances) GetUsers() []*User { + if b == nil || b.Users == nil { + return nil } - return *c.AheadBy + return b.Users } -// GetBaseCommit returns the BaseCommit field. -func (c *CommitsComparison) GetBaseCommit() *RepositoryCommit { - if c == nil { +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetApps() []string { + if b == nil || b.Apps == nil { return nil } - return c.BaseCommit + return b.Apps } -// GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetBehindBy() int { - if c == nil || c.BehindBy == nil { +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetTeams() []string { + if b == nil || b.Teams == nil { + return nil + } + return b.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (b *BypassPullRequestAllowancesRequest) GetUsers() []string { + if b == nil || b.Users == nil { + return nil + } + return b.Users +} + +// GetReviewerID returns the ReviewerID field. +func (b *BypassReviewer) GetReviewerID() int64 { + if b == nil { return 0 } - return *c.BehindBy + return b.ReviewerID } -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetDiffURL() string { - if c == nil || c.DiffURL == nil { +// GetReviewerType returns the ReviewerType field. +func (b *BypassReviewer) GetReviewerType() string { + if b == nil { return "" } - return *c.DiffURL + return b.ReviewerType } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// 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 *c.HTMLURL + return *b.SecurityConfigurationID } -// GetMergeBaseCommit returns the MergeBaseCommit field. -func (c *CommitsComparison) GetMergeBaseCommit() *RepositoryCommit { +// GetApp returns the App field. +func (c *CheckRun) GetApp() *App { if c == nil { return nil } - return c.MergeBaseCommit + return c.App } -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetPatchURL() string { - if c == nil || c.PatchURL == nil { - return "" +// GetCheckSuite returns the CheckSuite field. +func (c *CheckRun) GetCheckSuite() *CheckSuite { + if c == nil { + return nil } - return *c.PatchURL + return c.CheckSuite } -// GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetPermalinkURL() string { - if c == nil || c.PermalinkURL == nil { - return "" +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} } - return *c.PermalinkURL + return *c.CompletedAt } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetStatus() string { - if c == nil || c.Status == nil { +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetConclusion() string { + if c == nil || c.Conclusion == nil { return "" } - return *c.Status + return *c.Conclusion } -// GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetTotalCommits() int { - if c == nil || c.TotalCommits == nil { - return 0 +// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetDetailsURL() string { + if c == nil || c.DetailsURL == nil { + return "" } - return *c.TotalCommits + return *c.DetailsURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CommitsComparison) GetURL() string { - if c == nil || c.URL == nil { +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetExternalID() string { + if c == nil || c.ExternalID == nil { return "" } - return *c.URL + return *c.ExternalID } -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (c *CommitsSearchResult) GetIncompleteResults() bool { - if c == nil || c.IncompleteResults == nil { - return false +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetHeadSHA() string { + if c == nil || c.HeadSHA == nil { + return "" } - return *c.IncompleteResults + return *c.HeadSHA } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CommitsSearchResult) GetTotal() int { - if c == nil || c.Total == nil { - return 0 +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" } - return *c.Total + return *c.HTMLURL } -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetAdditions() int { - if c == nil || c.Additions == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetID() int64 { + if c == nil || c.ID == nil { return 0 } - return *c.Additions + return *c.ID } -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetDeletions() int { - if c == nil || c.Deletions == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetName() string { + if c == nil || c.Name == nil { + return "" } - return *c.Deletions + return *c.Name } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *CommitStats) GetTotal() int { - if c == nil || c.Total == nil { - return 0 +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" } - return *c.Total + return *c.NodeID } -// GetCodeOfConduct returns the CodeOfConduct field. -func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric { +// GetOutput returns the Output field. +func (c *CheckRun) GetOutput() *CheckRunOutput { if c == nil { return nil } - return c.CodeOfConduct + return c.Output } -// GetCodeOfConductFile returns the CodeOfConductFile field. -func (c *CommunityHealthFiles) GetCodeOfConductFile() *Metric { - if c == nil { +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (c *CheckRun) GetPullRequests() []*PullRequest { + if c == nil || c.PullRequests == nil { return nil } - return c.CodeOfConductFile + return c.PullRequests } -// GetContributing returns the Contributing field. -func (c *CommunityHealthFiles) GetContributing() *Metric { - if c == nil { - return nil +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetStartedAt() Timestamp { + if c == nil || c.StartedAt == nil { + return Timestamp{} } - return c.Contributing + return *c.StartedAt } -// GetIssueTemplate returns the IssueTemplate field. -func (c *CommunityHealthFiles) GetIssueTemplate() *Metric { - if c == nil { - return nil +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetStatus() string { + if c == nil || c.Status == nil { + return "" } - return c.IssueTemplate + return *c.Status } -// GetLicense returns the License field. -func (c *CommunityHealthFiles) GetLicense() *Metric { - if c == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CheckRun) GetURL() string { + if c == nil || c.URL == nil { + return "" } - return c.License + return *c.URL } -// GetPullRequestTemplate returns the PullRequestTemplate field. -func (c *CommunityHealthFiles) GetPullRequestTemplate() *Metric { +// GetDescription returns the Description field. +func (c *CheckRunAction) GetDescription() string { if c == nil { - return nil + return "" } - return c.PullRequestTemplate + return c.Description } -// GetReadme returns the Readme field. -func (c *CommunityHealthFiles) GetReadme() *Metric { +// GetIdentifier returns the Identifier field. +func (c *CheckRunAction) GetIdentifier() string { if c == nil { - return nil - } - return c.Readme -} - -// GetContentReportsEnabled returns the ContentReportsEnabled field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetContentReportsEnabled() bool { - if c == nil || c.ContentReportsEnabled == nil { - return false + return "" } - return *c.ContentReportsEnabled + return c.Identifier } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetDescription() string { - if c == nil || c.Description == nil { +// GetLabel returns the Label field. +func (c *CheckRunAction) GetLabel() string { + if c == nil { return "" } - return *c.Description + return c.Label } -// GetDocumentation returns the Documentation field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetDocumentation() string { - if c == nil || c.Documentation == nil { +// GetAnnotationLevel returns the AnnotationLevel field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetAnnotationLevel() string { + if c == nil || c.AnnotationLevel == nil { return "" } - return *c.Documentation + return *c.AnnotationLevel } -// GetFiles returns the Files field. -func (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles { - if c == nil { - return nil +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetEndColumn() int { + if c == nil || c.EndColumn == nil { + return 0 } - return c.Files + return *c.EndColumn } -// GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetHealthPercentage() int { - if c == nil || c.HealthPercentage == nil { +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetEndLine() int { + if c == nil || c.EndLine == nil { return 0 } - return *c.HealthPercentage + return *c.EndLine } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CommunityHealthMetrics) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetMessage() string { + if c == nil || c.Message == nil { + return "" } - return *c.UpdatedAt + return *c.Message } -// GetLastRequestID returns the LastRequestID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNode) GetLastRequestID() string { - if c == nil || c.LastRequestID == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetPath() string { + if c == nil || c.Path == nil { return "" } - return *c.LastRequestID + return *c.Path } -// GetNode returns the Node field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNode) GetNode() string { - if c == nil || c.Node == nil { +// GetRawDetails returns the RawDetails field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetRawDetails() string { + if c == nil || c.RawDetails == nil { return "" } - return *c.Node + return *c.RawDetails } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetBody() string { - if c == nil || c.Body == nil { - return "" +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetStartColumn() int { + if c == nil || c.StartColumn == nil { + return 0 } - return *c.Body + return *c.StartColumn } -// GetConfigRunID returns the ConfigRunID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetConfigRunID() string { - if c == nil || c.ConfigRunID == nil { - return "" +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetStartLine() int { + if c == nil || c.StartLine == nil { + return 0 } - return *c.ConfigRunID + return *c.StartLine } -// GetEventName returns the EventName field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetEventName() string { - if c == nil || c.EventName == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CheckRunAnnotation) GetTitle() string { + if c == nil || c.Title == nil { return "" } - return *c.EventName + return *c.Title } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetHostname() string { - if c == nil || c.Hostname == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CheckRunEvent) GetAction() string { + if c == nil || c.Action == nil { return "" } - return *c.Hostname + return *c.Action } -// GetSeverityText returns the SeverityText field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetSeverityText() string { - if c == nil || c.SeverityText == nil { - return "" +// GetCheckRun returns the CheckRun field. +func (c *CheckRunEvent) GetCheckRun() *CheckRun { + if c == nil { + return nil } - return *c.SeverityText + return c.CheckRun } -// GetSpanDepth returns the SpanDepth field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetSpanDepth() int { - if c == nil || c.SpanDepth == nil { - return 0 +// GetInstallation returns the Installation field. +func (c *CheckRunEvent) GetInstallation() *Installation { + if c == nil { + return nil } - return *c.SpanDepth + return c.Installation } -// GetSpanID returns the SpanID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetSpanID() string { - if c == nil || c.SpanID == nil { - return "" +// GetOrg returns the Org field. +func (c *CheckRunEvent) GetOrg() *Organization { + if c == nil { + return nil } - return *c.SpanID + return c.Org } -// GetSpanParentID returns the SpanParentID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetSpanParentID() int64 { - if c == nil || c.SpanParentID == nil { - return 0 +// GetRepo returns the Repo field. +func (c *CheckRunEvent) GetRepo() *Repository { + if c == nil { + return nil } - return *c.SpanParentID + return c.Repo } -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetTimestamp() Timestamp { - if c == nil || c.Timestamp == nil { - return Timestamp{} +// GetRequestedAction returns the RequestedAction field. +func (c *CheckRunEvent) GetRequestedAction() *RequestedAction { + if c == nil { + return nil } - return *c.Timestamp + return c.RequestedAction } -// GetTopology returns the Topology field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetTopology() string { - if c == nil || c.Topology == nil { - return "" +// GetSender returns the Sender field. +func (c *CheckRunEvent) GetSender() *User { + if c == nil { + return nil } - return *c.Topology + return c.Sender } -// GetTraceID returns the TraceID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsNodeEvent) GetTraceID() string { - if c == nil || c.TraceID == nil { +// GetAlt returns the Alt field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetAlt() string { + if c == nil || c.Alt == nil { return "" } - return *c.TraceID + return *c.Alt } -// GetLastRequestID returns the LastRequestID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyEventsOptions) GetLastRequestID() string { - if c == nil || c.LastRequestID == nil { +// GetCaption returns the Caption field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetCaption() string { + if c == nil || c.Caption == nil { return "" } - return *c.LastRequestID + return *c.Caption } -// GetRunID returns the RunID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyOptions) GetRunID() string { - if c == nil || c.RunID == nil { +// GetImageURL returns the ImageURL field if it's non-nil, zero value otherwise. +func (c *CheckRunImage) GetImageURL() string { + if c == nil || c.ImageURL == nil { return "" } - return *c.RunID + return *c.ImageURL } -// GetRunning returns the Running field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatus) GetRunning() bool { - if c == nil || c.Running == nil { - return false +// GetAnnotations returns the Annotations slice if it's non-nil, nil otherwise. +func (c *CheckRunOutput) GetAnnotations() []*CheckRunAnnotation { + if c == nil || c.Annotations == nil { + return nil } - return *c.Running + return c.Annotations } -// GetSuccessful returns the Successful field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatus) GetSuccessful() bool { - if c == nil || c.Successful == nil { - return false +// GetAnnotationsCount returns the AnnotationsCount field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetAnnotationsCount() int { + if c == nil || c.AnnotationsCount == nil { + return 0 } - return *c.Successful + return *c.AnnotationsCount } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatusNode) GetHostname() string { - if c == nil || c.Hostname == nil { +// GetAnnotationsURL returns the AnnotationsURL field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetAnnotationsURL() string { + if c == nil || c.AnnotationsURL == nil { return "" } - return *c.Hostname + return *c.AnnotationsURL } -// GetRunID returns the RunID field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatusNode) GetRunID() string { - if c == nil || c.RunID == nil { - return "" +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (c *CheckRunOutput) GetImages() []*CheckRunImage { + if c == nil || c.Images == nil { + return nil } - return *c.RunID + return c.Images } -// GetRunning returns the Running field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatusNode) GetRunning() bool { - if c == nil || c.Running == nil { - return false +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetSummary() string { + if c == nil || c.Summary == nil { + return "" } - return *c.Running + return *c.Summary } -// GetSuccessful returns the Successful field if it's non-nil, zero value otherwise. -func (c *ConfigApplyStatusNode) GetSuccessful() bool { - if c == nil || c.Successful == nil { - return false +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetText() string { + if c == nil || c.Text == nil { + return "" } - return *c.Successful + return *c.Text } -// GetAdminPassword returns the AdminPassword field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetAdminPassword() string { - if c == nil || c.AdminPassword == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CheckRunOutput) GetTitle() string { + if c == nil || c.Title == nil { return "" } - return *c.AdminPassword + return *c.Title } -// GetAssets returns the Assets field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetAssets() string { - if c == nil || c.Assets == nil { +// GetAfterSHA returns the AfterSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetAfterSHA() string { + if c == nil || c.AfterSHA == nil { return "" } - return *c.Assets + return *c.AfterSHA } -// GetAuthMode returns the AuthMode field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetAuthMode() string { - if c == nil || c.AuthMode == nil { +// GetApp returns the App field. +func (c *CheckSuite) GetApp() *App { + if c == nil { + return nil + } + return c.App +} + +// GetBeforeSHA returns the BeforeSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetBeforeSHA() string { + if c == nil || c.BeforeSHA == nil { return "" } - return *c.AuthMode + return *c.BeforeSHA } -// GetAvatar returns the Avatar field. -func (c *ConfigSettings) GetAvatar() *ConfigSettingsAvatar { - if c == nil { - return nil +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetConclusion() string { + if c == nil || c.Conclusion == nil { + return "" } - return c.Avatar + return *c.Conclusion } -// GetCAS returns the CAS field. -func (c *ConfigSettings) GetCAS() *ConfigSettingsCAS { - if c == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return c.CAS + return *c.CreatedAt } -// GetCollectd returns the Collectd field. -func (c *ConfigSettings) GetCollectd() *ConfigSettingsCollectd { +// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetHeadBranch() string { + if c == nil || c.HeadBranch == nil { + return "" + } + return *c.HeadBranch +} + +// GetHeadCommit returns the HeadCommit field. +func (c *CheckSuite) GetHeadCommit() *Commit { if c == nil { return nil } - return c.Collectd + return c.HeadCommit } -// GetConfigurationID returns the ConfigurationID field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetConfigurationID() int64 { - if c == nil || c.ConfigurationID == nil { +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetHeadSHA() string { + if c == nil || c.HeadSHA == nil { + return "" + } + return *c.HeadSHA +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetID() int64 { + if c == nil || c.ID == nil { return 0 } - return *c.ConfigurationID + return *c.ID } -// GetConfigurationRunCount returns the ConfigurationRunCount field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetConfigurationRunCount() int { - if c == nil || c.ConfigurationRunCount == nil { +// GetLatestCheckRunsCount returns the LatestCheckRunsCount field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetLatestCheckRunsCount() int64 { + if c == nil || c.LatestCheckRunsCount == nil { return 0 } - return *c.ConfigurationRunCount + return *c.LatestCheckRunsCount } -// GetCustomer returns the Customer field. -func (c *ConfigSettings) GetCustomer() *ConfigSettingsCustomer { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" + } + return *c.NodeID +} + +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (c *CheckSuite) GetPullRequests() []*PullRequest { + if c == nil || c.PullRequests == nil { + return nil + } + return c.PullRequests +} + +// GetRepository returns the Repository field. +func (c *CheckSuite) GetRepository() *Repository { if c == nil { return nil } - return c.Customer + return c.Repository } -// GetExpireSessions returns the ExpireSessions field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetExpireSessions() bool { - if c == nil || c.ExpireSessions == nil { +// GetRerequestable returns the Rerequestable field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetRerequestable() bool { + if c == nil || c.Rerequestable == nil { return false } - return *c.ExpireSessions + return *c.Rerequestable } -// GetGithubHostname returns the GithubHostname field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetGithubHostname() string { - if c == nil || c.GithubHostname == nil { - return "" +// GetRunsRerequestable returns the RunsRerequestable field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetRunsRerequestable() bool { + if c == nil || c.RunsRerequestable == nil { + return false } - return *c.GithubHostname + return *c.RunsRerequestable } -// GetGithubOAuth returns the GithubOAuth field. -func (c *ConfigSettings) GetGithubOAuth() *ConfigSettingsGithubOAuth { - if c == nil { - return nil +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetStatus() string { + if c == nil || c.Status == nil { + return "" } - return c.GithubOAuth + return *c.Status } -// GetGithubSSL returns the GithubSSL field. -func (c *ConfigSettings) GetGithubSSL() *ConfigSettingsGithubSSL { - if c == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return c.GithubSSL + return *c.UpdatedAt } -// GetHTTPProxy returns the HTTPProxy field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetHTTPProxy() string { - if c == nil || c.HTTPProxy == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CheckSuite) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.HTTPProxy + return *c.URL } -// GetIdenticonsHost returns the IdenticonsHost field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetIdenticonsHost() string { - if c == nil || c.IdenticonsHost == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CheckSuiteEvent) GetAction() string { + if c == nil || c.Action == nil { return "" } - return *c.IdenticonsHost + return *c.Action } -// GetLDAP returns the LDAP field. -func (c *ConfigSettings) GetLDAP() *ConfigSettingsLDAP { +// GetCheckSuite returns the CheckSuite field. +func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite { if c == nil { return nil } - return c.LDAP + return c.CheckSuite } -// GetLicense returns the License field. -func (c *ConfigSettings) GetLicense() *ConfigSettingsLicenseSettings { +// GetInstallation returns the Installation field. +func (c *CheckSuiteEvent) GetInstallation() *Installation { if c == nil { return nil } - return c.License + return c.Installation } -// GetLoadBalancer returns the LoadBalancer field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetLoadBalancer() string { - if c == nil || c.LoadBalancer == nil { - return "" +// GetOrg returns the Org field. +func (c *CheckSuiteEvent) GetOrg() *Organization { + if c == nil { + return nil } - return *c.LoadBalancer + return c.Org } -// GetMapping returns the Mapping field. -func (c *ConfigSettings) GetMapping() *ConfigSettingsMapping { +// GetRepo returns the Repo field. +func (c *CheckSuiteEvent) GetRepo() *Repository { if c == nil { return nil } - return c.Mapping + return c.Repo } -// GetNTP returns the NTP field. -func (c *ConfigSettings) GetNTP() *ConfigSettingsNTP { +// GetSender returns the Sender field. +func (c *CheckSuiteEvent) GetSender() *User { if c == nil { return nil } - return c.NTP + return c.Sender } -// GetPages returns the Pages field. -func (c *ConfigSettings) GetPages() *ConfigSettingsPagesSettings { +// GetAutoTriggerChecks returns the AutoTriggerChecks slice if it's non-nil, nil otherwise. +func (c *CheckSuitePreferenceOptions) GetAutoTriggerChecks() []*AutoTriggerCheck { + if c == nil || c.AutoTriggerChecks == nil { + return nil + } + return c.AutoTriggerChecks +} + +// GetPreferences returns the Preferences field. +func (c *CheckSuitePreferenceResults) GetPreferences() *PreferenceList { if c == nil { return nil } - return c.Pages + return c.Preferences } -// GetPrivateMode returns the PrivateMode field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetPrivateMode() bool { - if c == nil || c.PrivateMode == nil { - return false +// GetRepository returns the Repository field. +func (c *CheckSuitePreferenceResults) GetRepository() *Repository { + if c == nil { + return nil } - return *c.PrivateMode + return c.Repository } -// GetPublicPages returns the PublicPages field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetPublicPages() bool { - if c == nil || c.PublicPages == nil { +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (c *Classroom) GetArchived() bool { + if c == nil || c.Archived == nil { return false } - return *c.PublicPages + return *c.Archived } -// GetSAML returns the SAML field. -func (c *ConfigSettings) GetSAML() *ConfigSettingsSAML { - if c == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *Classroom) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return c.SAML + return *c.ID } -// GetSignupEnabled returns the SignupEnabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetSignupEnabled() bool { - if c == nil || c.SignupEnabled == nil { - return false +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *Classroom) GetName() string { + if c == nil || c.Name == nil { + return "" } - return *c.SignupEnabled + return *c.Name } -// GetSMTP returns the SMTP field. -func (c *ConfigSettings) GetSMTP() *ConfigSettingsSMTP { +// GetOrganization returns the Organization field. +func (c *Classroom) GetOrganization() *Organization { if c == nil { return nil } - return c.SMTP + return c.Organization } -// GetSNMP returns the SNMP field. -func (c *ConfigSettings) GetSNMP() *ConfigSettingsSNMP { - if c == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *Classroom) GetURL() string { + if c == nil || c.URL == nil { + return "" } - return c.SNMP + return *c.URL } -// GetSubdomainIsolation returns the SubdomainIsolation field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetSubdomainIsolation() bool { - if c == nil || c.SubdomainIsolation == nil { - return false +// GetAccepted returns the Accepted field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetAccepted() int { + if c == nil || c.Accepted == nil { + return 0 } - return *c.SubdomainIsolation + return *c.Accepted } -// GetSyslog returns the Syslog field. -func (c *ConfigSettings) GetSyslog() *ConfigSettingsSyslog { +// GetClassroom returns the Classroom field. +func (c *ClassroomAssignment) GetClassroom() *Classroom { if c == nil { return nil } - return c.Syslog + return c.Classroom } -// GetTimezone returns the Timezone field if it's non-nil, zero value otherwise. -func (c *ConfigSettings) GetTimezone() string { - if c == nil || c.Timezone == nil { - return "" +// GetDeadline returns the Deadline field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetDeadline() Timestamp { + if c == nil || c.Deadline == nil { + return Timestamp{} } - return *c.Timezone + return *c.Deadline } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsAvatar) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetEditor returns the Editor field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetEditor() string { + if c == nil || c.Editor == nil { + return "" } - return *c.Enabled + return *c.Editor } -// GetURI returns the URI field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsAvatar) GetURI() string { - if c == nil || c.URI == nil { - return "" +// GetFeedbackPullRequestsEnabled returns the FeedbackPullRequestsEnabled field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetFeedbackPullRequestsEnabled() bool { + if c == nil || c.FeedbackPullRequestsEnabled == nil { + return false } - return *c.URI + return *c.FeedbackPullRequestsEnabled } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCAS) GetURL() string { - if c == nil || c.URL == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return *c.URL + return *c.ID } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetEnabled() bool { - if c == nil || c.Enabled == nil { +// GetInvitationsEnabled returns the InvitationsEnabled field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetInvitationsEnabled() bool { + if c == nil || c.InvitationsEnabled == nil { return false } - return *c.Enabled + return *c.InvitationsEnabled } -// GetEncryption returns the Encryption field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetEncryption() string { - if c == nil || c.Encryption == nil { +// GetInviteLink returns the InviteLink field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetInviteLink() string { + if c == nil || c.InviteLink == nil { return "" } - return *c.Encryption + return *c.InviteLink } -// GetPassword returns the Password field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetPassword() string { - if c == nil || c.Password == nil { +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetLanguage() string { + if c == nil || c.Language == nil { return "" } - return *c.Password + return *c.Language } -// GetPort returns the Port field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetPort() int { - if c == nil || c.Port == nil { +// GetMaxMembers returns the MaxMembers field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetMaxMembers() int { + if c == nil || c.MaxMembers == nil { return 0 } - return *c.Port + return *c.MaxMembers } -// GetServer returns the Server field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetServer() string { - if c == nil || c.Server == nil { - return "" +// GetMaxTeams returns the MaxTeams field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetMaxTeams() int { + if c == nil || c.MaxTeams == nil { + return 0 } - return *c.Server + return *c.MaxTeams } -// GetUsername returns the Username field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCollectd) GetUsername() string { - if c == nil || c.Username == nil { - return "" +// GetPassing returns the Passing field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetPassing() int { + if c == nil || c.Passing == nil { + return 0 } - return *c.Username + return *c.Passing } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCustomer) GetEmail() string { - if c == nil || c.Email == nil { - return "" +// GetPublicRepo returns the PublicRepo field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetPublicRepo() bool { + if c == nil || c.PublicRepo == nil { + return false } - return *c.Email + return *c.PublicRepo } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCustomer) GetName() string { - if c == nil || c.Name == nil { +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetSlug() string { + if c == nil || c.Slug == nil { return "" } - return *c.Name + return *c.Slug } -// GetPublicKeyData returns the PublicKeyData field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCustomer) GetPublicKeyData() string { - if c == nil || c.PublicKeyData == nil { - return "" +// GetStarterCodeRepository returns the StarterCodeRepository field. +func (c *ClassroomAssignment) GetStarterCodeRepository() *Repository { + if c == nil { + return nil } - return *c.PublicKeyData + return c.StarterCodeRepository } -// GetSecret returns the Secret field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCustomer) GetSecret() string { - if c == nil || c.Secret == nil { - return "" +// GetStudentsAreRepoAdmins returns the StudentsAreRepoAdmins field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetStudentsAreRepoAdmins() bool { + if c == nil || c.StudentsAreRepoAdmins == nil { + return false } - return *c.Secret + return *c.StudentsAreRepoAdmins } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsCustomer) GetUUID() string { - if c == nil || c.UUID == nil { - return "" +// GetSubmitted returns the Submitted field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetSubmitted() int { + if c == nil || c.Submitted == nil { + return 0 } - return *c.UUID + return *c.Submitted } -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubOAuth) GetClientID() string { - if c == nil || c.ClientID == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetTitle() string { + if c == nil || c.Title == nil { return "" } - return *c.ClientID + return *c.Title } -// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubOAuth) GetClientSecret() string { - if c == nil || c.ClientSecret == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *ClassroomAssignment) GetType() string { + if c == nil || c.Type == nil { return "" } - return *c.ClientSecret + return *c.Type } -// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubOAuth) GetOrganizationName() string { - if c == nil || c.OrganizationName == nil { +// 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.OrganizationName + return *c.AvatarURL } -// GetOrganizationTeam returns the OrganizationTeam field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubOAuth) GetOrganizationTeam() string { - if c == nil || c.OrganizationTeam == nil { +// 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.OrganizationTeam + return *c.HTMLURL } -// GetCert returns the Cert field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubSSL) GetCert() string { - if c == nil || c.Cert == nil { - return "" +// 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.Cert + return *c.ID } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubSSL) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// 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.Enabled + return *c.Login } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsGithubSSL) GetKey() string { - if c == nil || c.Key == nil { +// GetDeploymentName returns the DeploymentName field. +func (c *ClusterArtifactDeployment) GetDeploymentName() string { + if c == nil { return "" } - return *c.Key + return c.DeploymentName } -// GetAdminGroup returns the AdminGroup field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetAdminGroup() string { - if c == nil || c.AdminGroup == nil { +// GetDigest returns the Digest field. +func (c *ClusterArtifactDeployment) GetDigest() string { + if c == nil { return "" } - return *c.AdminGroup + return c.Digest } -// GetBindDN returns the BindDN field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetBindDN() string { - if c == nil || c.BindDN == nil { +// 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.BindDN + return *c.GithubRepository } -// GetHost returns the Host field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetHost() string { - if c == nil || c.Host == nil { +// GetName returns the Name field. +func (c *ClusterArtifactDeployment) GetName() string { + if c == nil { return "" } - return *c.Host + return c.Name } -// GetMethod returns the Method field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetMethod() string { - if c == nil || c.Method == nil { - return "" +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (c *ClusterArtifactDeployment) GetRuntimeRisks() []DeploymentRuntimeRisk { + if c == nil || c.RuntimeRisks == nil { + return nil } - return *c.Method + return c.RuntimeRisks } -// GetPassword returns the Password field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetPassword() string { - if c == nil || c.Password == nil { +// GetStatus returns the Status field. +func (c *ClusterArtifactDeployment) GetStatus() string { + if c == nil { return "" } - return *c.Password + return c.Status } -// GetPort returns the Port field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetPort() int { - if c == nil || c.Port == nil { - return 0 +// 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.Port + return c.Tags } -// GetPosixSupport returns the PosixSupport field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetPosixSupport() bool { - if c == nil || c.PosixSupport == nil { - return false +// 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.PosixSupport + return *c.Version } -// GetProfile returns the Profile field. -func (c *ConfigSettingsLDAP) GetProfile() *ConfigSettingsLDAPProfile { - if c == nil { +// GetDeployments returns the Deployments slice if it's non-nil, nil otherwise. +func (c *ClusterDeploymentRecordsRequest) GetDeployments() []*ClusterArtifactDeployment { + if c == nil || c.Deployments == nil { return nil } - return c.Profile + return c.Deployments } -// GetReconciliation returns the Reconciliation field. -func (c *ConfigSettingsLDAP) GetReconciliation() *ConfigSettingsLDAPReconciliation { +// GetLogicalEnvironment returns the LogicalEnvironment field. +func (c *ClusterDeploymentRecordsRequest) GetLogicalEnvironment() string { if c == nil { - return nil + return "" } - return c.Reconciliation + return c.LogicalEnvironment } -// GetRecursiveGroupSearch returns the RecursiveGroupSearch field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetRecursiveGroupSearch() bool { - if c == nil || c.RecursiveGroupSearch == nil { - return false +// 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.RecursiveGroupSearch + return *c.PhysicalEnvironment } -// GetSearchStrategy returns the SearchStrategy field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetSearchStrategy() string { - if c == nil || c.SearchStrategy == nil { +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (c *ClusterSSHKey) GetFingerprint() string { + if c == nil || c.Fingerprint == nil { return "" } - return *c.SearchStrategy + return *c.Fingerprint } -// GetSyncEnabled returns the SyncEnabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetSyncEnabled() bool { - if c == nil || c.SyncEnabled == nil { - return false +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (c *ClusterSSHKey) GetKey() string { + if c == nil || c.Key == nil { + return "" } - return *c.SyncEnabled + return *c.Key } -// GetTeamSyncInterval returns the TeamSyncInterval field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetTeamSyncInterval() int { - if c == nil || c.TeamSyncInterval == nil { - return 0 +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ClusterStatus) GetNodes() []*ClusterStatusNode { + if c == nil || c.Nodes == nil { + return nil } - return *c.TeamSyncInterval + return c.Nodes } -// GetUID returns the UID field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetUID() string { - if c == nil || c.UID == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *ClusterStatus) GetStatus() string { + if c == nil || c.Status == nil { return "" } - return *c.UID + return *c.Status } -// GetUserSyncEmails returns the UserSyncEmails field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetUserSyncEmails() bool { - if c == nil || c.UserSyncEmails == nil { - return false +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (c *ClusterStatusNode) GetHostname() string { + if c == nil || c.Hostname == nil { + return "" } - return *c.UserSyncEmails + return *c.Hostname } -// GetUserSyncInterval returns the UserSyncInterval field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetUserSyncInterval() int { - if c == nil || c.UserSyncInterval == nil { - return 0 +// GetServices returns the Services slice if it's non-nil, nil otherwise. +func (c *ClusterStatusNode) GetServices() []*ClusterStatusNodeServiceItem { + if c == nil || c.Services == nil { + return nil } - return *c.UserSyncInterval + return c.Services } -// GetUserSyncKeys returns the UserSyncKeys field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetUserSyncKeys() bool { - if c == nil || c.UserSyncKeys == nil { - return false +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *ClusterStatusNode) GetStatus() string { + if c == nil || c.Status == nil { + return "" } - return *c.UserSyncKeys + return *c.Status } -// GetVirtualAttributeEnabled returns the VirtualAttributeEnabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAP) GetVirtualAttributeEnabled() bool { - if c == nil || c.VirtualAttributeEnabled == nil { - return false +// GetDetails returns the Details field if it's non-nil, zero value otherwise. +func (c *ClusterStatusNodeServiceItem) GetDetails() string { + if c == nil || c.Details == nil { + return "" } - return *c.VirtualAttributeEnabled + return *c.Details } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPProfile) GetKey() string { - if c == nil || c.Key == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ClusterStatusNodeServiceItem) GetName() string { + if c == nil || c.Name == nil { return "" } - return *c.Key + return *c.Name } -// GetMail returns the Mail field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPProfile) GetMail() string { - if c == nil || c.Mail == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *ClusterStatusNodeServiceItem) GetStatus() string { + if c == nil || c.Status == nil { return "" } - return *c.Mail + return *c.Status +} + +// GetMaxCoverageDrop returns the MaxCoverageDrop field if it's non-nil, zero value otherwise. +func (c *CodeCoverageRuleParameters) GetMaxCoverageDrop() float64 { + if c == nil || c.MaxCoverageDrop == nil { + return 0 + } + return *c.MaxCoverageDrop +} + +// GetMinimumCoverage returns the MinimumCoverage field if it's non-nil, zero value otherwise. +func (c *CodeCoverageRuleParameters) GetMinimumCoverage() float64 { + if c == nil || c.MinimumCoverage == nil { + return 0 + } + return *c.MinimumCoverage +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CodeOfConduct) GetBody() string { + if c == nil || c.Body == nil { + return "" + } + return *c.Body +} + +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (c *CodeOfConduct) GetKey() string { + if c == nil || c.Key == nil { + return "" + } + return *c.Key } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPProfile) GetName() string { +func (c *CodeOfConduct) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } -// GetUID returns the UID field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPProfile) GetUID() string { - if c == nil || c.UID == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CodeOfConduct) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.UID + return *c.URL } -// GetOrg returns the Org field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPReconciliation) GetOrg() string { - if c == nil || c.Org == nil { +// GetColumn returns the Column field. +func (c *CodeownersError) GetColumn() int { + if c == nil { + return 0 + } + return c.Column +} + +// GetKind returns the Kind field. +func (c *CodeownersError) GetKind() string { + if c == nil { return "" } - return *c.Org + return c.Kind } -// GetUser returns the User field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLDAPReconciliation) GetUser() string { - if c == nil || c.User == nil { +// GetLine returns the Line field. +func (c *CodeownersError) GetLine() int { + if c == nil { + return 0 + } + return c.Line +} + +// GetMessage returns the Message field. +func (c *CodeownersError) GetMessage() string { + if c == nil { return "" } - return *c.User + return c.Message } -// GetClusterSupport returns the ClusterSupport field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetClusterSupport() bool { - if c == nil || c.ClusterSupport == nil { - return false +// GetPath returns the Path field. +func (c *CodeownersError) GetPath() string { + if c == nil { + return "" } - return *c.ClusterSupport + return c.Path } -// GetEvaluation returns the Evaluation field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetEvaluation() bool { - if c == nil || c.Evaluation == nil { - return false +// GetSource returns the Source field. +func (c *CodeownersError) GetSource() string { + if c == nil { + return "" } - return *c.Evaluation + return c.Source } -// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetExpireAt() Timestamp { - if c == nil || c.ExpireAt == nil { - return Timestamp{} +// GetSuggestion returns the Suggestion field if it's non-nil, zero value otherwise. +func (c *CodeownersError) GetSuggestion() string { + if c == nil || c.Suggestion == nil { + return "" } - return *c.ExpireAt + return *c.Suggestion } -// GetPerpetual returns the Perpetual field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetPerpetual() bool { - if c == nil || c.Perpetual == nil { - return false +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (c *CodeownersErrors) GetErrors() []*CodeownersError { + if c == nil || c.Errors == nil { + return nil } - return *c.Perpetual + return c.Errors } -// GetSeats returns the Seats field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetSeats() int { - if c == nil || c.Seats == nil { +// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetContentType() string { + if c == nil || c.ContentType == nil { + return "" + } + return *c.ContentType +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetID() int64 { + if c == nil || c.ID == nil { return 0 } - return *c.Seats + return *c.ID } -// GetSSHAllowed returns the SSHAllowed field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetSSHAllowed() bool { - if c == nil || c.SSHAllowed == nil { - return false +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetLanguage() string { + if c == nil || c.Language == nil { + return "" } - return *c.SSHAllowed + return *c.Language } -// GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetSupportKey() string { - if c == nil || c.SupportKey == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetName() string { + if c == nil || c.Name == nil { return "" } - return *c.SupportKey + return *c.Name } -// GetUnlimitedSeating returns the UnlimitedSeating field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsLicenseSettings) GetUnlimitedSeating() bool { - if c == nil || c.UnlimitedSeating == nil { - return false +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetSize() int64 { + if c == nil || c.Size == nil { + return 0 } - return *c.UnlimitedSeating + return *c.Size } -// GetBasemap returns the Basemap field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsMapping) GetBasemap() string { - if c == nil || c.Basemap == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return *c.Basemap + return *c.UpdatedAt } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsMapping) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetUploader returns the Uploader field. +func (c *CodeQLDatabase) GetUploader() *User { + if c == nil { + return nil } - return *c.Enabled + return c.Uploader } -// GetTileserver returns the Tileserver field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsMapping) GetTileserver() string { - if c == nil || c.Tileserver == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.Tileserver + return *c.URL } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsMapping) GetToken() string { - if c == nil || c.Token == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQualityFinding) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return *c.Token + return *c.CreatedAt } -// GetPrimaryServer returns the PrimaryServer field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsNTP) GetPrimaryServer() string { - if c == nil || c.PrimaryServer == nil { - return "" +// GetLocation returns the Location field. +func (c *CodeQualityFinding) GetLocation() CodeQualityFindingLocation { + if c == nil { + return CodeQualityFindingLocation{} } - return *c.PrimaryServer + return c.Location } -// GetSecondaryServer returns the SecondaryServer field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsNTP) GetSecondaryServer() string { - if c == nil || c.SecondaryServer == nil { - return "" +// GetMessage returns the Message field. +func (c *CodeQualityFinding) GetMessage() CodeQualityFindingMessage { + if c == nil { + return CodeQualityFindingMessage{} } - return *c.SecondaryServer + return c.Message } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsPagesSettings) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetNumber returns the Number field. +func (c *CodeQualityFinding) GetNumber() int { + if c == nil { + return 0 } - return *c.Enabled + return c.Number } -// GetCertificate returns the Certificate field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetCertificate() string { - if c == nil || c.Certificate == nil { +// GetRule returns the Rule field. +func (c *CodeQualityFinding) GetRule() CodeQualityFindingRule { + if c == nil { + return CodeQualityFindingRule{} + } + return c.Rule +} + +// GetState returns the State field. +func (c *CodeQualityFinding) GetState() string { + if c == nil { return "" } - return *c.Certificate + return c.State } -// GetCertificatePath returns the CertificatePath field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetCertificatePath() string { - if c == nil || c.CertificatePath == nil { +// GetURL returns the URL field. +func (c *CodeQualityFinding) GetURL() string { + if c == nil { return "" } - return *c.CertificatePath + return c.URL } -// GetDisableAdminDemote returns the DisableAdminDemote field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetDisableAdminDemote() bool { - if c == nil || c.DisableAdminDemote == nil { - return false +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (c *CodeQualityFindingLocation) GetEndColumn() int { + if c == nil || c.EndColumn == nil { + return 0 } - return *c.DisableAdminDemote + return *c.EndColumn } -// GetIDPInitiatedSSO returns the IDPInitiatedSSO field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetIDPInitiatedSSO() bool { - if c == nil || c.IDPInitiatedSSO == nil { - return false +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (c *CodeQualityFindingLocation) GetEndLine() int { + if c == nil || c.EndLine == nil { + return 0 } - return *c.IDPInitiatedSSO + return *c.EndLine } -// GetIssuer returns the Issuer field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetIssuer() string { - if c == nil || c.Issuer == nil { +// GetPath returns the Path field. +func (c *CodeQualityFindingLocation) GetPath() string { + if c == nil { return "" } - return *c.Issuer + return c.Path } -// GetSSOURL returns the SSOURL field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSAML) GetSSOURL() string { - if c == nil || c.SSOURL == nil { - return "" +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (c *CodeQualityFindingLocation) GetStartColumn() int { + if c == nil || c.StartColumn == nil { + return 0 } - return *c.SSOURL + return *c.StartColumn } -// GetAddress returns the Address field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetAddress() string { - if c == nil || c.Address == nil { +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (c *CodeQualityFindingLocation) GetStartLine() int { + if c == nil || c.StartLine == nil { + return 0 + } + return *c.StartLine +} + +// GetMarkdown returns the Markdown field. +func (c *CodeQualityFindingMessage) GetMarkdown() string { + if c == nil { return "" } - return *c.Address + return c.Markdown } -// GetAuthentication returns the Authentication field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetAuthentication() string { - if c == nil || c.Authentication == nil { +// GetText returns the Text field. +func (c *CodeQualityFindingMessage) GetText() string { + if c == nil { return "" } - return *c.Authentication + return c.Text } -// GetDiscardToNoreplyAddress returns the DiscardToNoreplyAddress field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetDiscardToNoreplyAddress() bool { - if c == nil || c.DiscardToNoreplyAddress == nil { - return false +// GetCategory returns the Category field. +func (c *CodeQualityFindingRule) GetCategory() string { + if c == nil { + return "" } - return *c.DiscardToNoreplyAddress + return c.Category } -// GetDomain returns the Domain field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetDomain() string { - if c == nil || c.Domain == nil { +// GetDescription returns the Description field. +func (c *CodeQualityFindingRule) GetDescription() string { + if c == nil { return "" } - return *c.Domain + return c.Description } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetHelp returns the Help field if it's non-nil, zero value otherwise. +func (c *CodeQualityFindingRule) GetHelp() string { + if c == nil || c.Help == nil { + return "" } - return *c.Enabled + return *c.Help } -// GetEnableStarttlsAuto returns the EnableStarttlsAuto field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetEnableStarttlsAuto() bool { - if c == nil || c.EnableStarttlsAuto == nil { - return false +// GetID returns the ID field. +func (c *CodeQualityFindingRule) GetID() string { + if c == nil { + return "" } - return *c.EnableStarttlsAuto + return c.ID } -// GetNoreplyAddress returns the NoreplyAddress field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetNoreplyAddress() string { - if c == nil || c.NoreplyAddress == nil { +// GetSeverity returns the Severity field. +func (c *CodeQualityFindingRule) GetSeverity() string { + if c == nil { return "" } - return *c.NoreplyAddress + return c.Severity } -// GetPassword returns the Password field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetPassword() string { - if c == nil || c.Password == nil { +// GetTitle returns the Title field. +func (c *CodeQualityFindingRule) GetTitle() string { + if c == nil { return "" } - return *c.Password + return c.Title } -// GetPort returns the Port field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetPort() string { - if c == nil || c.Port == nil { +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CodeQualitySetupConfiguration) GetLanguages() []string { + if c == nil || c.Languages == nil { + return nil + } + return c.Languages +} + +// GetRunnerLabel returns the RunnerLabel field if it's non-nil, zero value otherwise. +func (c *CodeQualitySetupConfiguration) GetRunnerLabel() string { + if c == nil || c.RunnerLabel == nil { return "" } - return *c.Port + return *c.RunnerLabel } -// GetSupportAddress returns the SupportAddress field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetSupportAddress() string { - if c == nil || c.SupportAddress == nil { +// GetRunnerType returns the RunnerType field if it's non-nil, zero value otherwise. +func (c *CodeQualitySetupConfiguration) GetRunnerType() string { + if c == nil || c.RunnerType == nil { return "" } - return *c.SupportAddress + return *c.RunnerType } -// GetSupportAddressType returns the SupportAddressType field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetSupportAddressType() string { - if c == nil || c.SupportAddressType == nil { +// GetSchedule returns the Schedule field if it's non-nil, zero value otherwise. +func (c *CodeQualitySetupConfiguration) GetSchedule() string { + if c == nil || c.Schedule == nil { return "" } - return *c.SupportAddressType + return *c.Schedule } -// GetUsername returns the Username field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetUsername() string { - if c == nil || c.Username == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CodeQualitySetupConfiguration) GetState() string { + if c == nil || c.State == nil { return "" } - return *c.Username + return *c.State } -// GetUserName returns the UserName field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSMTP) GetUserName() string { - if c == nil || c.UserName == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQualitySetupConfiguration) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CodeQualityUpdateSetupRequest) GetLanguages() []string { + if c == nil || c.Languages == nil { + return nil + } + return c.Languages +} + +// GetRunnerLabel returns the RunnerLabel field if it's non-nil, zero value otherwise. +func (c *CodeQualityUpdateSetupRequest) GetRunnerLabel() string { + if c == nil || c.RunnerLabel == nil { return "" } - return *c.UserName + return *c.RunnerLabel } -// GetCommunity returns the Community field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSNMP) GetCommunity() string { - if c == nil || c.Community == nil { +// GetRunnerType returns the RunnerType field if it's non-nil, zero value otherwise. +func (c *CodeQualityUpdateSetupRequest) GetRunnerType() string { + if c == nil || c.RunnerType == nil { return "" } - return *c.Community + return *c.RunnerType } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSNMP) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CodeQualityUpdateSetupRequest) GetState() string { + if c == nil || c.State == nil { + return "" } - return *c.Enabled + return *c.State } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSyslog) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetRunID returns the RunID field if it's non-nil, zero value otherwise. +func (c *CodeQualityUpdateSetupResponse) GetRunID() int64 { + if c == nil || c.RunID == nil { + return 0 } - return *c.Enabled + return *c.RunID } -// GetProtocolName returns the ProtocolName field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSyslog) GetProtocolName() string { - if c == nil || c.ProtocolName == nil { +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (c *CodeQualityUpdateSetupResponse) GetRunURL() string { + if c == nil || c.RunURL == nil { return "" } - return *c.ProtocolName + return *c.RunURL } -// GetServer returns the Server field if it's non-nil, zero value otherwise. -func (c *ConfigSettingsSyslog) GetServer() string { - if c == nil || c.Server == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CodeResult) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { return "" } - return *c.Server + return *c.HTMLURL } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *ConnectionServiceItem) GetName() string { +func (c *CodeResult) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (c *ConnectionServiceItem) GetNumber() int { - if c == nil || c.Number == nil { - return 0 +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (c *CodeResult) GetPath() string { + if c == nil || c.Path == nil { + return "" } - return *c.Number + return *c.Path } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *ContentReference) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetRepository returns the Repository field. +func (c *CodeResult) GetRepository() *Repository { + if c == nil { + return nil } - return *c.ID + return c.Repository } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *ContentReference) GetNodeID() string { - if c == nil || c.NodeID == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CodeResult) GetSHA() string { + if c == nil || c.SHA == nil { return "" } - return *c.NodeID + return *c.SHA } -// GetReference returns the Reference field if it's non-nil, zero value otherwise. -func (c *ContentReference) GetReference() string { - if c == nil || c.Reference == nil { - return "" +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (c *CodeResult) GetTextMatches() []*TextMatch { + if c == nil || c.TextMatches == nil { + return nil } - return *c.Reference + return c.TextMatches } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *ContentReferenceEvent) GetAction() string { +func (c *CodeScanningAlertEvent) GetAction() string { if c == nil || c.Action == nil { return "" } return *c.Action } -// GetContentReference returns the ContentReference field. -func (c *ContentReferenceEvent) GetContentReference() *ContentReference { +// GetAlert returns the Alert field. +func (c *CodeScanningAlertEvent) GetAlert() *Alert { if c == nil { return nil } - return c.ContentReference + return c.Alert +} + +// GetCommitOID returns the CommitOID field if it's non-nil, zero value otherwise. +func (c *CodeScanningAlertEvent) GetCommitOID() string { + if c == nil || c.CommitOID == nil { + return "" + } + return *c.CommitOID } // GetInstallation returns the Installation field. -func (c *ContentReferenceEvent) GetInstallation() *Installation { +func (c *CodeScanningAlertEvent) GetInstallation() *Installation { if c == nil { return nil } return c.Installation } +// GetOrg returns the Org field. +func (c *CodeScanningAlertEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CodeScanningAlertEvent) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + // GetRepo returns the Repo field. -func (c *ContentReferenceEvent) GetRepo() *Repository { +func (c *CodeScanningAlertEvent) GetRepo() *Repository { if c == nil { return nil } @@ -5255,431 +6023,399 @@ func (c *ContentReferenceEvent) GetRepo() *Repository { } // GetSender returns the Sender field. -func (c *ContentReferenceEvent) GetSender() *User { +func (c *CodeScanningAlertEvent) GetSender() *User { if c == nil { return nil } return c.Sender } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetAvatarURL() string { - if c == nil || c.AvatarURL == nil { +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (c *CodeScanningAlertState) GetDismissedComment() string { + if c == nil || c.DismissedComment == nil { return "" } - return *c.AvatarURL + return *c.DismissedComment } -// GetContributions returns the Contributions field if it's non-nil, zero value otherwise. -func (c *Contributor) GetContributions() int { - if c == nil || c.Contributions == nil { - return 0 +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (c *CodeScanningAlertState) GetDismissedReason() string { + if c == nil || c.DismissedReason == nil { + return "" } - return *c.Contributions + return *c.DismissedReason } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *Contributor) GetEmail() string { - if c == nil || c.Email == nil { +// GetState returns the State field. +func (c *CodeScanningAlertState) GetState() string { + if c == nil { return "" } - return *c.Email + return c.State } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetEventsURL() string { - if c == nil || c.EventsURL == nil { - return "" +// GetParameters returns the Parameters field. +func (c *CodeScanningBranchRule) GetParameters() CodeScanningRuleParameters { + if c == nil { + return CodeScanningRuleParameters{} } - return *c.EventsURL + return c.Parameters } -// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowersURL() string { - if c == nil || c.FollowersURL == nil { +// 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.FollowersURL + return *c.RunnerLabel } -// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowingURL() string { - if c == nil || c.FollowingURL == nil { +// GetRunnerType returns the RunnerType field. +func (c *CodeScanningDefaultSetupOptions) GetRunnerType() string { + if c == nil { return "" } - return *c.FollowingURL + return c.RunnerType } -// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetGistsURL() string { - if c == nil || c.GistsURL == nil { - return "" +// 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.GistsURL + return *c.AllowAdvanced } -// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetGravatarID() string { - if c == nil || c.GravatarID == nil { - return "" +// GetCodeScanningTools returns the CodeScanningTools slice if it's non-nil, nil otherwise. +func (c *CodeScanningRuleParameters) GetCodeScanningTools() []*RuleCodeScanningTool { + if c == nil || c.CodeScanningTools == nil { + return nil } - return *c.GravatarID + return c.CodeScanningTools } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetHTMLURL() string { - if c == nil || c.HTMLURL == nil { - return "" +// GetCodeResults returns the CodeResults slice if it's non-nil, nil otherwise. +func (c *CodeSearchResult) GetCodeResults() []*CodeResult { + if c == nil || c.CodeResults == nil { + return nil } - return *c.HTMLURL + return c.CodeResults } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (c *CodeSearchResult) GetIncompleteResults() bool { + if c == nil || c.IncompleteResults == nil { + return false } - return *c.ID + return *c.IncompleteResults } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *Contributor) GetLogin() string { - if c == nil || c.Login == nil { - return "" +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (c *CodeSearchResult) GetTotal() int { + if c == nil || c.Total == nil { + return 0 } - return *c.Login + return *c.Total } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *Contributor) GetName() string { - if c == nil || c.Name == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CodeSecurity) GetStatus() string { + if c == nil || c.Status == nil { return "" } - return *c.Name + return *c.Status } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *Contributor) GetNodeID() string { - if c == nil || c.NodeID == nil { +// GetAdvancedSecurity returns the AdvancedSecurity field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetAdvancedSecurity() string { + if c == nil || c.AdvancedSecurity == nil { return "" } - return *c.NodeID + return *c.AdvancedSecurity } -// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetOrganizationsURL() string { - if c == nil || c.OrganizationsURL == nil { +// GetCodeScanningDefaultSetup returns the CodeScanningDefaultSetup field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetup() string { + if c == nil || c.CodeScanningDefaultSetup == nil { return "" } - return *c.OrganizationsURL + return *c.CodeScanningDefaultSetup } -// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReceivedEventsURL() string { - if c == nil || c.ReceivedEventsURL == nil { - return "" +// GetCodeScanningDefaultSetupOptions returns the CodeScanningDefaultSetupOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetupOptions() *CodeScanningDefaultSetupOptions { + if c == nil { + return nil } - return *c.ReceivedEventsURL + return c.CodeScanningDefaultSetupOptions } -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReposURL() string { - if c == nil || c.ReposURL == nil { +// 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.ReposURL + return *c.CodeScanningDelegatedAlertDismissal } -// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. -func (c *Contributor) GetSiteAdmin() bool { - if c == nil || c.SiteAdmin == nil { - return false +// GetCodeScanningOptions returns the CodeScanningOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningOptions() *CodeScanningOptions { + if c == nil { + return nil } - return *c.SiteAdmin + return c.CodeScanningOptions } -// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetStarredURL() string { - if c == nil || c.StarredURL == nil { +// 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.StarredURL + return *c.CodeSecurity } -// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetSubscriptionsURL() string { - if c == nil || c.SubscriptionsURL == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return *c.SubscriptionsURL + return *c.CreatedAt } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (c *Contributor) GetType() string { - if c == nil || c.Type == nil { +// GetDependabotAlerts returns the DependabotAlerts field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependabotAlerts() string { + if c == nil || c.DependabotAlerts == nil { return "" } - return *c.Type + return *c.DependabotAlerts } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetURL() string { - if c == nil || c.URL == nil { +// GetDependabotDelegatedAlertDismissal returns the DependabotDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependabotDelegatedAlertDismissal() string { + if c == nil || c.DependabotDelegatedAlertDismissal == nil { return "" } - return *c.URL + return *c.DependabotDelegatedAlertDismissal } -// GetAuthor returns the Author field. -func (c *ContributorStats) GetAuthor() *Contributor { - if c == nil { - return nil +// GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependabotSecurityUpdates() string { + if c == nil || c.DependabotSecurityUpdates == nil { + return "" } - return c.Author + return *c.DependabotSecurityUpdates } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (c *ContributorStats) GetTotal() int { - if c == nil || c.Total == nil { - return 0 +// GetDependencyGraph returns the DependencyGraph field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependencyGraph() string { + if c == nil || c.DependencyGraph == nil { + return "" } - return *c.Total + return *c.DependencyGraph } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotDotcomChatModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == nil { +// GetDependencyGraphAutosubmitAction returns the DependencyGraphAutosubmitAction field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitAction() string { + if c == nil || c.DependencyGraphAutosubmitAction == nil { return "" } - return *c.CustomModelTrainingDate + return *c.DependencyGraphAutosubmitAction } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotDotcomPullRequestsModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == nil { - return "" +// GetDependencyGraphAutosubmitActionOptions returns the DependencyGraphAutosubmitActionOptions field. +func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitActionOptions() *DependencyGraphAutosubmitActionOptions { + if c == nil { + return nil } - return *c.CustomModelTrainingDate + return c.DependencyGraphAutosubmitActionOptions } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotIDEChatModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == nil { +// GetDescription returns the Description field. +func (c *CodeSecurityConfiguration) GetDescription() string { + if c == nil { return "" } - return *c.CustomModelTrainingDate + return c.Description } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotIDECodeCompletionsModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == nil { +// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetEnforcement() string { + if c == nil || c.Enforcement == nil { return "" } - return *c.CustomModelTrainingDate + return *c.Enforcement } -// GetCopilotDotcomChat returns the CopilotDotcomChat field. -func (c *CopilotMetrics) GetCopilotDotcomChat() *CopilotDotcomChat { - if c == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" } - return c.CopilotDotcomChat + return *c.HTMLURL } -// GetCopilotDotcomPullRequests returns the CopilotDotcomPullRequests field. -func (c *CopilotMetrics) GetCopilotDotcomPullRequests() *CopilotDotcomPullRequests { - if c == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return c.CopilotDotcomPullRequests + return *c.ID } -// GetCopilotIDEChat returns the CopilotIDEChat field. -func (c *CopilotMetrics) GetCopilotIDEChat() *CopilotIDEChat { +// GetName returns the Name field. +func (c *CodeSecurityConfiguration) GetName() string { if c == nil { - return nil + return "" } - return c.CopilotIDEChat + return c.Name } -// GetCopilotIDECodeCompletions returns the CopilotIDECodeCompletions field. -func (c *CopilotMetrics) GetCopilotIDECodeCompletions() *CopilotIDECodeCompletions { - if c == nil { - return nil +// GetPrivateVulnerabilityReporting returns the PrivateVulnerabilityReporting field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { + if c == nil || c.PrivateVulnerabilityReporting == nil { + return "" } - return c.CopilotIDECodeCompletions + return *c.PrivateVulnerabilityReporting } -// GetTotalActiveUsers returns the TotalActiveUsers field if it's non-nil, zero value otherwise. -func (c *CopilotMetrics) GetTotalActiveUsers() int { - if c == nil || c.TotalActiveUsers == nil { - return 0 +// 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.TotalActiveUsers + return *c.SecretProtection } -// GetTotalEngagedUsers returns the TotalEngagedUsers field if it's non-nil, zero value otherwise. -func (c *CopilotMetrics) GetTotalEngagedUsers() int { - if c == nil || c.TotalEngagedUsers == nil { - return 0 +// GetSecretScanning returns the SecretScanning field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanning() string { + if c == nil || c.SecretScanning == nil { + return "" } - return *c.TotalEngagedUsers + return *c.SecretScanning } -// GetSince returns the Since field if it's non-nil, zero value otherwise. -func (c *CopilotMetricsListOptions) GetSince() time.Time { - if c == nil || c.Since == nil { - return time.Time{} +// 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.Since + return *c.SecretScanningDelegatedAlertDismissal } -// GetUntil returns the Until field if it's non-nil, zero value otherwise. -func (c *CopilotMetricsListOptions) GetUntil() time.Time { - if c == nil || c.Until == nil { - return time.Time{} +// 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.Until + return *c.SecretScanningDelegatedBypass } -// GetSeatBreakdown returns the SeatBreakdown field. -func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { +// GetSecretScanningDelegatedBypassOptions returns the SecretScanningDelegatedBypassOptions field. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedBypassOptions() *SecretScanningDelegatedBypassOptions { if c == nil { return nil } - return c.SeatBreakdown + return c.SecretScanningDelegatedBypassOptions } -// GetAssigningTeam returns the AssigningTeam field. -func (c *CopilotSeatDetails) GetAssigningTeam() *Team { - if c == nil { - return nil +// GetSecretScanningExtendedMetadata returns the SecretScanningExtendedMetadata field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningExtendedMetadata() string { + if c == nil || c.SecretScanningExtendedMetadata == nil { + return "" } - return c.AssigningTeam + return *c.SecretScanningExtendedMetadata } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// 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.CreatedAt + return *c.SecretScanningGenericSecrets } -// GetLastActivityAt returns the LastActivityAt field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetLastActivityAt() Timestamp { - if c == nil || c.LastActivityAt == nil { - return Timestamp{} +// GetSecretScanningNonProviderPatterns returns the SecretScanningNonProviderPatterns field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningNonProviderPatterns() string { + if c == nil || c.SecretScanningNonProviderPatterns == nil { + return "" } - return *c.LastActivityAt + return *c.SecretScanningNonProviderPatterns } -// GetLastActivityEditor returns the LastActivityEditor field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetLastActivityEditor() string { - if c == nil || c.LastActivityEditor == nil { +// GetSecretScanningPushProtection returns the SecretScanningPushProtection field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningPushProtection() string { + if c == nil || c.SecretScanningPushProtection == nil { return "" } - return *c.LastActivityEditor + return *c.SecretScanningPushProtection } -// GetPendingCancellationDate returns the PendingCancellationDate field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetPendingCancellationDate() string { - if c == nil || c.PendingCancellationDate == nil { +// GetSecretScanningValidityChecks returns the SecretScanningValidityChecks field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningValidityChecks() string { + if c == nil || c.SecretScanningValidityChecks == nil { return "" } - return *c.PendingCancellationDate + return *c.SecretScanningValidityChecks } -// GetPlanType returns the PlanType field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetPlanType() string { - if c == nil || c.PlanType == nil { +// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetTargetType() string { + if c == nil || c.TargetType == nil { return "" } - return *c.PlanType + return *c.TargetType } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetUpdatedAt() Timestamp { +func (c *CodeSecurityConfiguration) GetUpdatedAt() Timestamp { if c == nil || c.UpdatedAt == nil { return Timestamp{} } return *c.UpdatedAt } -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { - if c == nil || c.CompletedAt == nil { - return Timestamp{} - } - return *c.CompletedAt -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetConclusion() string { - if c == nil || c.Conclusion == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.Conclusion + return *c.URL } -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetDetailsURL() string { - if c == nil || c.DetailsURL == nil { - return "" +// GetConfiguration returns the Configuration field. +func (c *CodeSecurityConfigurationWithDefaultForNewRepos) GetConfiguration() *CodeSecurityConfiguration { + if c == nil { + return nil } - return *c.DetailsURL + return c.Configuration } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetExternalID() string { - if c == nil || c.ExternalID == nil { +// GetDefaultForNewRepos returns the DefaultForNewRepos field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfigurationWithDefaultForNewRepos) GetDefaultForNewRepos() string { + if c == nil || c.DefaultForNewRepos == nil { return "" } - return *c.ExternalID + return *c.DefaultForNewRepos } -// GetOutput returns the Output field. -func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { +// GetBillableOwner returns the BillableOwner field. +func (c *Codespace) GetBillableOwner() *User { if c == nil { return nil } - return c.Output + return c.BillableOwner } -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetStartedAt() Timestamp { - if c == nil || c.StartedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *Codespace) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { return Timestamp{} } - return *c.StartedAt -} - -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetStatus() string { - if c == nil || c.Status == nil { - return "" - } - return *c.Status -} - -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (c *CreateCheckSuiteOptions) GetHeadBranch() string { - if c == nil || c.HeadBranch == nil { - return "" - } - return *c.HeadBranch -} - -// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetClientIP() string { - if c == nil || c.ClientIP == nil { - return "" - } - return *c.ClientIP + return *c.CreatedAt } // GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetDevcontainerPath() string { +func (c *Codespace) GetDevcontainerPath() string { if c == nil || c.DevcontainerPath == nil { return "" } @@ -5687,21123 +6423,41163 @@ func (c *CreateCodespaceOptions) GetDevcontainerPath() string { } // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetDisplayName() string { +func (c *Codespace) GetDisplayName() string { if c == nil || c.DisplayName == nil { return "" } return *c.DisplayName } -// GetGeo returns the Geo field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetGeo() string { - if c == nil || c.Geo == nil { +// GetEnvironmentID returns the EnvironmentID field if it's non-nil, zero value otherwise. +func (c *Codespace) GetEnvironmentID() string { + if c == nil || c.EnvironmentID == nil { return "" } - return *c.Geo + return *c.EnvironmentID +} + +// GetGitStatus returns the GitStatus field. +func (c *Codespace) GetGitStatus() *CodespacesGitStatus { + if c == nil { + return nil + } + return c.GitStatus +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *Codespace) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID } // GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetIdleTimeoutMinutes() int { +func (c *Codespace) GetIdleTimeoutMinutes() int { if c == nil || c.IdleTimeoutMinutes == nil { return 0 } return *c.IdleTimeoutMinutes } -// GetMachine returns the Machine field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetMachine() string { - if c == nil || c.Machine == nil { +// GetIdleTimeoutNotice returns the IdleTimeoutNotice field if it's non-nil, zero value otherwise. +func (c *Codespace) GetIdleTimeoutNotice() string { + if c == nil || c.IdleTimeoutNotice == nil { return "" } - return *c.Machine + return *c.IdleTimeoutNotice } -// GetMultiRepoPermissionsOptOut returns the MultiRepoPermissionsOptOut field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetMultiRepoPermissionsOptOut() bool { - if c == nil || c.MultiRepoPermissionsOptOut == nil { - return false +// GetLastKnownStopNotice returns the LastKnownStopNotice field if it's non-nil, zero value otherwise. +func (c *Codespace) GetLastKnownStopNotice() string { + if c == nil || c.LastKnownStopNotice == nil { + return "" } - return *c.MultiRepoPermissionsOptOut + return *c.LastKnownStopNotice } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetRef() string { - if c == nil || c.Ref == nil { - return "" +// GetLastUsedAt returns the LastUsedAt field if it's non-nil, zero value otherwise. +func (c *Codespace) GetLastUsedAt() Timestamp { + if c == nil || c.LastUsedAt == nil { + return Timestamp{} } - return *c.Ref + return *c.LastUsedAt } -// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetRetentionPeriodMinutes() int { - if c == nil || c.RetentionPeriodMinutes == nil { - return 0 +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *Codespace) GetLocation() string { + if c == nil || c.Location == nil { + return "" } - return *c.RetentionPeriodMinutes + return *c.Location } -// GetWorkingDirectory returns the WorkingDirectory field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetWorkingDirectory() string { - if c == nil || c.WorkingDirectory == nil { - return "" +// GetMachine returns the Machine field. +func (c *Codespace) GetMachine() *CodespacesMachine { + if c == nil { + return nil } - return *c.WorkingDirectory + return c.Machine } -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { - if c == nil || c.AllowsPublicRepositories == nil { - return false +// GetMachinesURL returns the MachinesURL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetMachinesURL() string { + if c == nil || c.MachinesURL == nil { + return "" } - return *c.AllowsPublicRepositories + return *c.MachinesURL } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { +func (c *Codespace) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { - if c == nil || c.RestrictedToWorkflows == nil { - return false +// GetOwner returns the Owner field. +func (c *Codespace) GetOwner() *User { + if c == nil { + return nil } - return *c.RestrictedToWorkflows + return c.Owner } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetVisibility() string { - if c == nil || c.Visibility == nil { - return "" +// GetPendingOperation returns the PendingOperation field if it's non-nil, zero value otherwise. +func (c *Codespace) GetPendingOperation() bool { + if c == nil || c.PendingOperation == nil { + return false } - return *c.Visibility + return *c.PendingOperation } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetDescription() string { - if c == nil || c.Description == nil { +// GetPendingOperationDisabledReason returns the PendingOperationDisabledReason field if it's non-nil, zero value otherwise. +func (c *Codespace) GetPendingOperationDisabledReason() string { + if c == nil || c.PendingOperationDisabledReason == nil { return "" } - return *c.Description + return *c.PendingOperationDisabledReason } -// GetInstallation returns the Installation field. -func (c *CreateEvent) GetInstallation() *Installation { - if c == nil { - return nil +// GetPrebuild returns the Prebuild field if it's non-nil, zero value otherwise. +func (c *Codespace) GetPrebuild() bool { + if c == nil || c.Prebuild == nil { + return false } - return c.Installation + return *c.Prebuild } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetMasterBranch() string { - if c == nil || c.MasterBranch == nil { +// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetPullsURL() string { + if c == nil || c.PullsURL == nil { return "" } - return *c.MasterBranch + return *c.PullsURL } -// GetOrg returns the Org field. -func (c *CreateEvent) GetOrg() *Organization { - if c == nil { +// GetRecentFolders returns the RecentFolders slice if it's non-nil, nil otherwise. +func (c *Codespace) GetRecentFolders() []string { + if c == nil || c.RecentFolders == nil { return nil } - return c.Org + return c.RecentFolders } -// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetPusherType() string { - if c == nil || c.PusherType == nil { - return "" +// GetRepository returns the Repository field. +func (c *Codespace) GetRepository() *Repository { + if c == nil { + return nil } - return *c.PusherType + return c.Repository } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetRef() string { - if c == nil || c.Ref == nil { - return "" +// GetRetentionExpiresAt returns the RetentionExpiresAt field if it's non-nil, zero value otherwise. +func (c *Codespace) GetRetentionExpiresAt() Timestamp { + if c == nil || c.RetentionExpiresAt == nil { + return Timestamp{} } - return *c.Ref + return *c.RetentionExpiresAt } -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetRefType() string { - if c == nil || c.RefType == nil { - return "" +// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. +func (c *Codespace) GetRetentionPeriodMinutes() int { + if c == nil || c.RetentionPeriodMinutes == nil { + return 0 } - return *c.RefType + return *c.RetentionPeriodMinutes } -// GetRepo returns the Repo field. -func (c *CreateEvent) GetRepo() *Repository { +// GetRuntimeConstraints returns the RuntimeConstraints field. +func (c *Codespace) GetRuntimeConstraints() *CodespacesRuntimeConstraints { if c == nil { return nil } - return c.Repo + return c.RuntimeConstraints } -// GetSender returns the Sender field. -func (c *CreateEvent) GetSender() *User { - if c == nil { - return nil - } - return c.Sender +// GetStartURL returns the StartURL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetStartURL() string { + if c == nil || c.StartURL == nil { + return "" + } + return *c.StartURL } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetEmail() string { - if c == nil || c.Email == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *Codespace) GetState() string { + if c == nil || c.State == nil { return "" } - return *c.Email + return *c.State } -// 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 +// GetStopURL returns the StopURL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetStopURL() string { + if c == nil || c.StopURL == nil { + return "" } - return *c.InviteeID + return *c.StopURL } -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetRole() string { - if c == nil || c.Role == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *Codespace) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return *c.Role + return *c.UpdatedAt } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateCustomRepoRoleOptions) GetBaseRole() string { - if c == nil || c.BaseRole == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.BaseRole + return *c.URL } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateCustomRepoRoleOptions) GetDescription() string { - if c == nil || c.Description == nil { +// GetWebURL returns the WebURL field if it's non-nil, zero value otherwise. +func (c *Codespace) GetWebURL() string { + if c == nil || c.WebURL == nil { return "" } - return *c.Description + return *c.WebURL } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateCustomRepoRoleOptions) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetBillableOwner returns the BillableOwner field. +func (c *CodespaceDefaultAttributes) GetBillableOwner() *User { + if c == nil { + return nil } - return *c.Name + return c.BillableOwner } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetBaseRole() string { - if c == nil || c.BaseRole == nil { - return "" +// GetDefaults returns the Defaults field. +func (c *CodespaceDefaultAttributes) GetDefaults() *CodespaceDefaults { + if c == nil { + return nil } - return *c.BaseRole + return c.Defaults } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string { - if c == nil || c.Description == nil { +// 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.Description + return *c.DevcontainerPath } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetName() string { - if c == nil || c.Name == nil { +// GetLocation returns the Location field. +func (c *CodespaceDefaults) GetLocation() string { + if c == nil { return "" } - return *c.Name + return c.Location } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (c *CreateProtectedChanges) GetFrom() bool { - if c == nil || c.From == nil { - return false +// 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.From + return *c.Branch } -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetAllowsPublicRepositories() bool { - if c == nil || c.AllowsPublicRepositories == nil { - return false +// 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.AllowsPublicRepositories + return *c.CompletedAt } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetName() string { - if c == nil || c.Name == nil { +// 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.Name + return *c.ExportURL } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { - if c == nil || c.RestrictedToWorkflows == nil { - return false +// 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.RestrictedToWorkflows + return *c.HTMLURL } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetVisibility() string { - if c == nil || c.Visibility == nil { +// 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.Visibility + return *c.ID } -// GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetCanAdminsBypass() bool { - if c == nil || c.CanAdminsBypass == nil { - return false +// 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.CanAdminsBypass + return *c.SHA } -// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. -func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { - if c == nil { - return nil +// 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.DeploymentBranchPolicy + return *c.State } -// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { - if c == nil || c.PreventSelfReview == nil { - return false +// 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.PreventSelfReview + return *c.ClientIP } -// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetWaitTimer() int { - if c == nil || c.WaitTimer == nil { - return 0 +// 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.WaitTimer + return *c.Ref } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (c *CreateUpdateRequiredWorkflowOptions) GetRepositoryID() int64 { - if c == nil || c.RepositoryID == nil { - return 0 +// GetAccepted returns the Accepted field. +func (c *CodespacePermissions) GetAccepted() bool { + if c == nil { + return false } - return *c.RepositoryID + return c.Accepted } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (c *CreateUpdateRequiredWorkflowOptions) GetScope() string { - if c == nil || c.Scope == nil { - return "" +// GetPullRequestNumber returns the PullRequestNumber field. +func (c *CodespacePullRequestOptions) GetPullRequestNumber() int64 { + if c == nil { + return 0 } - return *c.Scope + return c.PullRequestNumber } -// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. -func (c *CreateUpdateRequiredWorkflowOptions) GetSelectedRepositoryIDs() *SelectedRepoIDs { +// GetRepositoryID returns the RepositoryID field. +func (c *CodespacePullRequestOptions) GetRepositoryID() int64 { if c == nil { - return nil + return 0 } - return c.SelectedRepositoryIDs + return c.RepositoryID } -// GetWorkflowFilePath returns the WorkflowFilePath field if it's non-nil, zero value otherwise. -func (c *CreateUpdateRequiredWorkflowOptions) GetWorkflowFilePath() string { - if c == nil || c.WorkflowFilePath == nil { - return "" +// 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.WorkflowFilePath + return *c.Ahead } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateUserRequest) GetEmail() string { - if c == nil || c.Email == nil { - return "" +// 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.Email + return *c.Behind } -// GetSuspended returns the Suspended field if it's non-nil, zero value otherwise. -func (c *CreateUserRequest) GetSuspended() bool { - if c == nil || c.Suspended == nil { +// 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.Suspended + return *c.HasUncommittedChanges } -// GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (c *CreationInfo) GetCreated() Timestamp { - if c == nil || c.Created == nil { - return Timestamp{} +// 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.Created + return *c.HasUnpushedChanges } -// GetAuthorizedCredentialExpiresAt returns the AuthorizedCredentialExpiresAt field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialExpiresAt() Timestamp { - if c == nil || c.AuthorizedCredentialExpiresAt == nil { - return Timestamp{} +// 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.AuthorizedCredentialExpiresAt + return *c.Ref } -// GetAuthorizedCredentialID returns the AuthorizedCredentialID field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialID() int64 { - if c == nil || c.AuthorizedCredentialID == nil { +// 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.AuthorizedCredentialID + return *c.CPUs } -// GetAuthorizedCredentialNote returns the AuthorizedCredentialNote field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialNote() string { - if c == nil || c.AuthorizedCredentialNote == nil { +// 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.AuthorizedCredentialNote + return *c.DisplayName } -// GetAuthorizedCredentialTitle returns the AuthorizedCredentialTitle field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialTitle() string { - if c == nil || c.AuthorizedCredentialTitle == nil { - return "" +// 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.AuthorizedCredentialTitle + return *c.MemoryInBytes } -// GetCredentialAccessedAt returns the CredentialAccessedAt field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetCredentialAccessedAt() Timestamp { - if c == nil || c.CredentialAccessedAt == nil { - return Timestamp{} +// 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.CredentialAccessedAt + return *c.Name } -// GetCredentialAuthorizedAt returns the CredentialAuthorizedAt field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetCredentialAuthorizedAt() Timestamp { - if c == nil || c.CredentialAuthorizedAt == nil { - return Timestamp{} +// 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 "" } - return *c.CredentialAuthorizedAt + return *c.OperatingSystem } -// GetCredentialID returns the CredentialID field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetCredentialID() int64 { - if c == nil || c.CredentialID == nil { - return 0 +// GetPrebuildAvailability returns the PrebuildAvailability field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetPrebuildAvailability() string { + if c == nil || c.PrebuildAvailability == nil { + return "" } - return *c.CredentialID + return *c.PrebuildAvailability } -// GetCredentialType returns the CredentialType field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetCredentialType() string { - if c == nil || c.CredentialType == nil { - return "" +// GetStorageInBytes returns the StorageInBytes field if it's non-nil, zero value otherwise. +func (c *CodespacesMachine) GetStorageInBytes() int64 { + if c == nil || c.StorageInBytes == nil { + return 0 } - return *c.CredentialType + return *c.StorageInBytes } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetFingerprint() string { - if c == nil || c.Fingerprint == nil { - return "" +// GetMachines returns the Machines slice if it's non-nil, nil otherwise. +func (c *CodespacesMachines) GetMachines() []*CodespacesMachine { + if c == nil || c.Machines == nil { + return nil } - return *c.Fingerprint + return c.Machines } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetLogin() string { - if c == nil || c.Login == nil { - return "" +// GetTotalCount returns the TotalCount field. +func (c *CodespacesMachines) GetTotalCount() int64 { + if c == nil { + return 0 } - return *c.Login + return c.TotalCount } -// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetTokenLastEight() string { - if c == nil || c.TokenLastEight == nil { - return "" +// GetSelectedUsernames returns the SelectedUsernames slice if it's non-nil, nil otherwise. +func (c *CodespacesOrgAccessControlRequest) GetSelectedUsernames() []string { + if c == nil || c.SelectedUsernames == nil { + return nil } - return *c.TokenLastEight + return c.SelectedUsernames } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (c *Credit) GetType() string { - if c == nil || c.Type == nil { +// GetVisibility returns the Visibility field. +func (c *CodespacesOrgAccessControlRequest) GetVisibility() string { + if c == nil { return "" } - return *c.Type + return c.Visibility } -// GetUser returns the User field. -func (c *Credit) GetUser() *User { - if c == nil { +// GetAllowedPortPrivacySettings returns the AllowedPortPrivacySettings slice if it's non-nil, nil otherwise. +func (c *CodespacesRuntimeConstraints) GetAllowedPortPrivacySettings() []string { + if c == nil || c.AllowedPortPrivacySettings == nil { return nil } - return c.User + return c.AllowedPortPrivacySettings } -// GetApp returns the App field. -func (c *CustomDeploymentProtectionRule) GetApp() *CustomDeploymentProtectionRuleApp { - if c == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CollaboratorInvitation) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return c.App + return *c.CreatedAt } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRule) GetEnabled() bool { - if c == nil || c.Enabled == nil { - return false +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CollaboratorInvitation) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" } - return *c.Enabled + return *c.HTMLURL } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRule) GetID() int64 { +func (c *CollaboratorInvitation) GetID() int64 { if c == nil || c.ID == nil { return 0 } return *c.ID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRule) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" +// GetInvitee returns the Invitee field. +func (c *CollaboratorInvitation) GetInvitee() *User { + if c == nil { + return nil } - return *c.NodeID + return c.Invitee } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetInviter returns the Inviter field. +func (c *CollaboratorInvitation) GetInviter() *User { + if c == nil { + return nil } - return *c.ID + return c.Inviter } -// GetIntegrationURL returns the IntegrationURL field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetIntegrationURL() string { - if c == nil || c.IntegrationURL == nil { +// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. +func (c *CollaboratorInvitation) GetPermissions() string { + if c == nil || c.Permissions == nil { return "" } - return *c.IntegrationURL + return *c.Permissions } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetNodeID() string { - if c == nil || c.NodeID == nil { - return "" +// GetRepo returns the Repo field. +func (c *CollaboratorInvitation) GetRepo() *Repository { + if c == nil { + return nil } - return *c.NodeID + return c.Repo } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetSlug() string { - if c == nil || c.Slug == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CollaboratorInvitation) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *c.Slug + return *c.URL } -// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleRequest) GetIntegrationID() int64 { - if c == nil || c.IntegrationID == nil { - return 0 +// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetCommitURL() string { + if c == nil || c.CommitURL == nil { + return "" } - return *c.IntegrationID + return *c.CommitURL } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetBaseRole() string { - if c == nil || c.BaseRole == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetName() string { + if c == nil || c.Name == nil { return "" } - return *c.BaseRole + return *c.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetRepositoryURL() string { + if c == nil || c.RepositoryURL == nil { + return "" } - return *c.CreatedAt + return *c.RepositoryURL } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetDescription() string { - if c == nil || c.Description == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetSHA() string { + if c == nil || c.SHA == nil { return "" } - return *c.Description + return *c.SHA } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetState() string { + if c == nil || c.State == nil { + return "" } - return *c.ID + return *c.State } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetStatuses returns the Statuses slice if it's non-nil, nil otherwise. +func (c *CombinedStatus) GetStatuses() []*RepoStatus { + if c == nil || c.Statuses == nil { + return nil } - return *c.Name + return c.Statuses } -// GetOrg returns the Org field. -func (c *CustomOrgRoles) GetOrg() *Organization { - if c == nil { - return nil +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (c *CombinedStatus) GetTotalCount() int { + if c == nil || c.TotalCount == nil { + return 0 } - return c.Org + return *c.TotalCount } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetSource() string { - if c == nil || c.Source == nil { +// GetBody returns the Body field. +func (c *Comment) GetBody() string { + if c == nil { return "" } - return *c.Source + return c.Body } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *Comment) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { return Timestamp{} } - return *c.UpdatedAt + return *c.CreatedAt } -// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDefaultValue() string { - if c == nil || c.DefaultValue == nil { +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetAuthorAssociation() string { + if c == nil || c.AuthorAssociation == nil { return "" } - return *c.DefaultValue + return *c.AuthorAssociation } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDescription() string { - if c == nil || c.Description == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetBody() string { + if c == nil || c.Body == nil { return "" } - return *c.Description + return *c.Body } -// GetPropertyName returns the PropertyName field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetPropertyName() string { - if c == nil || c.PropertyName == nil { - return "" +// GetChildCommentCount returns the ChildCommentCount field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetChildCommentCount() int { + if c == nil || c.ChildCommentCount == nil { + return 0 } - return *c.PropertyName + return *c.ChildCommentCount } -// GetRequired returns the Required field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetRequired() bool { - if c == nil || c.Required == nil { - return false +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return *c.Required + return *c.CreatedAt } -// GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetSourceType() string { - if c == nil || c.SourceType == nil { - return "" +// GetDiscussionID returns the DiscussionID field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetDiscussionID() int64 { + if c == nil || c.DiscussionID == nil { + return 0 } - return *c.SourceType + return *c.DiscussionID } -// GetValuesEditableBy returns the ValuesEditableBy field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetValuesEditableBy() string { - if c == nil || c.ValuesEditableBy == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { return "" } - return *c.ValuesEditableBy + return *c.HTMLURL } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CustomPropertyEvent) GetAction() string { - if c == nil || c.Action == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetNodeID() string { + if c == nil || c.NodeID == nil { return "" } - return *c.Action + return *c.NodeID } -// GetDefinition returns the Definition field. -func (c *CustomPropertyEvent) GetDefinition() *CustomProperty { - if c == nil { - return nil +// GetParentID returns the ParentID field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetParentID() int64 { + if c == nil || c.ParentID == nil { + return 0 } - return c.Definition + return *c.ParentID } -// GetEnterprise returns the Enterprise field. -func (c *CustomPropertyEvent) GetEnterprise() *Enterprise { +// GetReactions returns the Reactions field. +func (c *CommentDiscussion) GetReactions() *Reactions { if c == nil { return nil } - return c.Enterprise + return c.Reactions } -// GetInstallation returns the Installation field. -func (c *CustomPropertyEvent) GetInstallation() *Installation { - if c == nil { - return nil +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetRepositoryURL() string { + if c == nil || c.RepositoryURL == nil { + return "" } - return c.Installation + return *c.RepositoryURL } -// GetOrg returns the Org field. -func (c *CustomPropertyEvent) GetOrg() *Organization { - if c == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CommentDiscussion) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return c.Org + return *c.UpdatedAt } -// GetSender returns the Sender field. -func (c *CustomPropertyEvent) GetSender() *User { +// GetUser returns the User field. +func (c *CommentDiscussion) GetUser() *User { if c == nil { return nil } - return c.Sender + return c.User } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *CustomPropertyValuesEvent) GetAction() string { - if c == nil || c.Action == nil { - return "" +// GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise. +func (c *CommentStats) GetTotalCommitComments() int { + if c == nil || c.TotalCommitComments == nil { + return 0 } - return *c.Action + return *c.TotalCommitComments } -// GetEnterprise returns the Enterprise field. -func (c *CustomPropertyValuesEvent) GetEnterprise() *Enterprise { - if c == nil { - return nil +// GetTotalGistComments returns the TotalGistComments field if it's non-nil, zero value otherwise. +func (c *CommentStats) GetTotalGistComments() int { + if c == nil || c.TotalGistComments == nil { + return 0 } - return c.Enterprise + return *c.TotalGistComments } -// GetInstallation returns the Installation field. -func (c *CustomPropertyValuesEvent) GetInstallation() *Installation { - if c == nil { - return nil +// GetTotalIssueComments returns the TotalIssueComments field if it's non-nil, zero value otherwise. +func (c *CommentStats) GetTotalIssueComments() int { + if c == nil || c.TotalIssueComments == nil { + return 0 } - return c.Installation + return *c.TotalIssueComments } -// GetOrg returns the Org field. -func (c *CustomPropertyValuesEvent) GetOrg() *Organization { - if c == nil { - return nil +// GetTotalPullRequestComments returns the TotalPullRequestComments field if it's non-nil, zero value otherwise. +func (c *CommentStats) GetTotalPullRequestComments() int { + if c == nil || c.TotalPullRequestComments == nil { + return 0 } - return c.Org + return *c.TotalPullRequestComments } -// GetRepo returns the Repo field. -func (c *CustomPropertyValuesEvent) GetRepo() *Repository { +// GetAuthor returns the Author field. +func (c *Commit) GetAuthor() *CommitAuthor { if c == nil { return nil } - return c.Repo + return c.Author } -// GetSender returns the Sender field. -func (c *CustomPropertyValuesEvent) GetSender() *User { +// GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise. +func (c *Commit) GetCommentCount() int { + if c == nil || c.CommentCount == nil { + return 0 + } + return *c.CommentCount +} + +// GetCommitter returns the Committer field. +func (c *Commit) GetCommitter() *CommitAuthor { if c == nil { return nil } - return c.Sender + return c.Committer } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetBaseRole() string { - if c == nil || c.BaseRole == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *Commit) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { return "" } - return *c.BaseRole + return *c.HTMLURL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { - return Timestamp{} +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (c *Commit) GetMessage() string { + if c == nil || c.Message == nil { + return "" } - return *c.CreatedAt + return *c.Message } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetDescription() string { - if c == nil || c.Description == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *Commit) GetNodeID() string { + if c == nil || c.NodeID == nil { return "" } - return *c.Description + return *c.NodeID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetID() int64 { - if c == nil || c.ID == nil { - return 0 +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (c *Commit) GetParents() []*Commit { + if c == nil || c.Parents == nil { + return nil } - return *c.ID + return c.Parents } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetName() string { - if c == nil || c.Name == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *Commit) GetSHA() string { + if c == nil || c.SHA == nil { return "" } - return *c.Name + return *c.SHA } -// GetOrg returns the Org field. -func (c *CustomRepoRoles) GetOrg() *Organization { +// GetTree returns the Tree field. +func (c *Commit) GetTree() *Tree { if c == nil { return nil } - return c.Org -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} - } - return *c.UpdatedAt + return c.Tree } -// GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. -func (d *DefaultSetupConfiguration) GetQuerySuite() string { - if d == nil || d.QuerySuite == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *Commit) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *d.QuerySuite + return *c.URL } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DefaultSetupConfiguration) GetState() string { - if d == nil || d.State == nil { - return "" +// GetVerification returns the Verification field. +func (c *Commit) GetVerification() *SignatureVerification { + if c == nil { + return nil } - return *d.State + return c.Verification } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DefaultSetupConfiguration) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { +// GetDate returns the Date field if it's non-nil, zero value otherwise. +func (c *CommitAuthor) GetDate() Timestamp { + if c == nil || c.Date == nil { return Timestamp{} } - return *d.UpdatedAt + return *c.Date } -// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionEnterprise) GetCanApprovePullRequestReviews() bool { - if d == nil || d.CanApprovePullRequestReviews == nil { - return false +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CommitAuthor) GetEmail() string { + if c == nil || c.Email == nil { + return "" } - return *d.CanApprovePullRequestReviews + return *c.Email } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionEnterprise) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == nil { +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *CommitAuthor) GetLogin() string { + if c == nil || c.Login == nil { return "" } - return *d.DefaultWorkflowPermissions + return *c.Login } -// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionOrganization) GetCanApprovePullRequestReviews() bool { - if d == nil || d.CanApprovePullRequestReviews == nil { - return false +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CommitAuthor) GetName() string { + if c == nil || c.Name == nil { + return "" } - return *d.CanApprovePullRequestReviews + return *c.Name } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionOrganization) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CommitCommentEvent) GetAction() string { + if c == nil || c.Action == nil { return "" } - return *d.DefaultWorkflowPermissions + return *c.Action } -// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionRepository) GetCanApprovePullRequestReviews() bool { - if d == nil || d.CanApprovePullRequestReviews == nil { - return false +// GetComment returns the Comment field. +func (c *CommitCommentEvent) GetComment() *RepositoryComment { + if c == nil { + return nil } - return *d.CanApprovePullRequestReviews + return c.Comment } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionRepository) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == nil { - return "" +// GetInstallation returns the Installation field. +func (c *CommitCommentEvent) GetInstallation() *Installation { + if c == nil { + return nil } - return *d.DefaultWorkflowPermissions + return c.Installation } -// GetConfirmDeleteURL returns the ConfirmDeleteURL field if it's non-nil, zero value otherwise. -func (d *DeleteAnalysis) GetConfirmDeleteURL() string { - if d == nil || d.ConfirmDeleteURL == nil { - return "" +// GetOrg returns the Org field. +func (c *CommitCommentEvent) GetOrg() *Organization { + if c == nil { + return nil } - return *d.ConfirmDeleteURL + return c.Org } -// GetNextAnalysisURL returns the NextAnalysisURL field if it's non-nil, zero value otherwise. -func (d *DeleteAnalysis) GetNextAnalysisURL() string { - if d == nil || d.NextAnalysisURL == nil { - return "" +// GetRepo returns the Repo field. +func (c *CommitCommentEvent) GetRepo() *Repository { + if c == nil { + return nil } - return *d.NextAnalysisURL + return c.Repo } -// GetInstallation returns the Installation field. -func (d *DeleteEvent) GetInstallation() *Installation { - if d == nil { +// GetSender returns the Sender field. +func (c *CommitCommentEvent) GetSender() *User { + if c == nil { return nil } - return d.Installation + return c.Sender } -// GetOrg returns the Org field. -func (d *DeleteEvent) GetOrg() *Organization { - if d == nil { - return nil +// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetAdditions() int { + if c == nil || c.Additions == nil { + return 0 } - return d.Org + return *c.Additions } -// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetPusherType() string { - if d == nil || d.PusherType == nil { +// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetBlobURL() string { + if c == nil || c.BlobURL == nil { return "" } - return *d.PusherType + return *c.BlobURL } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRef() string { - if d == nil || d.Ref == nil { - return "" +// GetChanges returns the Changes field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetChanges() int { + if c == nil || c.Changes == nil { + return 0 } - return *d.Ref + return *c.Changes } -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRefType() string { - if d == nil || d.RefType == nil { +// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetContentsURL() string { + if c == nil || c.ContentsURL == nil { return "" } - return *d.RefType + return *c.ContentsURL } -// GetRepo returns the Repo field. -func (d *DeleteEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetDeletions() int { + if c == nil || c.Deletions == nil { + return 0 } - return d.Repo + return *c.Deletions } -// GetSender returns the Sender field. -func (d *DeleteEvent) GetSender() *User { - if d == nil { - return nil +// GetFilename returns the Filename field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetFilename() string { + if c == nil || c.Filename == nil { + return "" } - return d.Sender + return *c.Filename } -// GetAutoDismissedAt returns the AutoDismissedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetAutoDismissedAt() Timestamp { - if d == nil || d.AutoDismissedAt == nil { - return Timestamp{} +// GetPatch returns the Patch field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetPatch() string { + if c == nil || c.Patch == nil { + return "" } - return *d.AutoDismissedAt + return *c.Patch } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetPreviousFilename returns the PreviousFilename field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetPreviousFilename() string { + if c == nil || c.PreviousFilename == nil { + return "" } - return *d.CreatedAt + return *c.PreviousFilename } -// GetDependency returns the Dependency field. -func (d *DependabotAlert) GetDependency() *Dependency { - if d == nil { - return nil +// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetRawURL() string { + if c == nil || c.RawURL == nil { + return "" } - return d.Dependency + return *c.RawURL } -// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetDismissedAt() Timestamp { - if d == nil || d.DismissedAt == nil { - return Timestamp{} +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetSHA() string { + if c == nil || c.SHA == nil { + return "" } - return *d.DismissedAt + return *c.SHA } -// GetDismissedBy returns the DismissedBy field. -func (d *DependabotAlert) GetDismissedBy() *User { - if d == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CommitFile) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetAuthor returns the Author field. +func (c *CommitResult) GetAuthor() *User { + if c == nil { return nil } - return d.DismissedBy + return c.Author } -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetDismissedComment() string { - if d == nil || d.DismissedComment == nil { +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (c *CommitResult) GetCommentsURL() string { + if c == nil || c.CommentsURL == nil { return "" } - return *d.DismissedComment + return *c.CommentsURL } -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetDismissedReason() string { - if d == nil || d.DismissedReason == nil { - return "" +// GetCommit returns the Commit field. +func (c *CommitResult) GetCommit() *Commit { + if c == nil { + return nil } - return *d.DismissedReason + return c.Commit } -// GetFixedAt returns the FixedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetFixedAt() Timestamp { - if d == nil || d.FixedAt == nil { - return Timestamp{} +// GetCommitter returns the Committer field. +func (c *CommitResult) GetCommitter() *User { + if c == nil { + return nil } - return *d.FixedAt + return c.Committer } // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { +func (c *CommitResult) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { return "" } - return *d.HTMLURL + return *c.HTMLURL } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetNumber() int { - if d == nil || d.Number == nil { - return 0 +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (c *CommitResult) GetParents() []*Commit { + if c == nil || c.Parents == nil { + return nil } - return *d.Number + return c.Parents } // GetRepository returns the Repository field. -func (d *DependabotAlert) GetRepository() *Repository { - if d == nil { +func (c *CommitResult) GetRepository() *Repository { + if c == nil { return nil } - return d.Repository + return c.Repository } -// GetSecurityAdvisory returns the SecurityAdvisory field. -func (d *DependabotAlert) GetSecurityAdvisory() *DependabotSecurityAdvisory { - if d == nil { - return nil +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (c *CommitResult) GetScore() float64 { + if c == nil || c.Score == nil { + return 0 } - return d.SecurityAdvisory + return *c.Score } -// GetSecurityVulnerability returns the SecurityVulnerability field. -func (d *DependabotAlert) GetSecurityVulnerability() *AdvisoryVulnerability { - if d == nil { - return nil +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (c *CommitResult) GetSHA() string { + if c == nil || c.SHA == nil { + return "" } - return d.SecurityVulnerability + return *c.SHA } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetState() string { - if d == nil || d.State == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CommitResult) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *d.State + return *c.URL } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetAheadBy() int { + if c == nil || c.AheadBy == nil { + return 0 } - return *d.UpdatedAt + return *c.AheadBy } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetURL() string { - if d == nil || d.URL == nil { - return "" +// GetBaseCommit returns the BaseCommit field. +func (c *CommitsComparison) GetBaseCommit() *RepositoryCommit { + if c == nil { + return nil } - return *d.URL + return c.BaseCommit } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DependabotAlertEvent) GetAction() string { - if d == nil || d.Action == nil { - return "" +// GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetBehindBy() int { + if c == nil || c.BehindBy == nil { + return 0 } - return *d.Action + return *c.BehindBy } -// GetAlert returns the Alert field. -func (d *DependabotAlertEvent) GetAlert() *DependabotAlert { - if d == nil { +// GetCommits returns the Commits slice if it's non-nil, nil otherwise. +func (c *CommitsComparison) GetCommits() []*RepositoryCommit { + if c == nil || c.Commits == nil { return nil } - return d.Alert + return c.Commits } -// GetEnterprise returns the Enterprise field. -func (d *DependabotAlertEvent) GetEnterprise() *Enterprise { - if d == nil { - return nil +// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetDiffURL() string { + if c == nil || c.DiffURL == nil { + return "" } - return d.Enterprise + return *c.DiffURL } -// GetInstallation returns the Installation field. -func (d *DependabotAlertEvent) GetInstallation() *Installation { - if d == nil { +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (c *CommitsComparison) GetFiles() []*CommitFile { + if c == nil || c.Files == nil { return nil } - return d.Installation + return c.Files } -// GetOrganization returns the Organization field. -func (d *DependabotAlertEvent) GetOrganization() *Organization { - if d == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" } - return d.Organization + return *c.HTMLURL } -// GetRepo returns the Repo field. -func (d *DependabotAlertEvent) GetRepo() *Repository { - if d == nil { +// GetMergeBaseCommit returns the MergeBaseCommit field. +func (c *CommitsComparison) GetMergeBaseCommit() *RepositoryCommit { + if c == nil { return nil } - return d.Repo + return c.MergeBaseCommit } -// GetSender returns the Sender field. -func (d *DependabotAlertEvent) GetSender() *User { - if d == nil { - return nil +// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetPatchURL() string { + if c == nil || c.PatchURL == nil { + return "" } - return d.Sender + return *c.PatchURL } -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedComment() string { - if d == nil || d.DismissedComment == nil { - return "" - } - return *d.DismissedComment -} - -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedReason() string { - if d == nil || d.DismissedReason == nil { +// GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetPermalinkURL() string { + if c == nil || c.PermalinkURL == nil { return "" } - return *d.DismissedReason + return *c.PermalinkURL } -// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetCVEID() string { - if d == nil || d.CVEID == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetStatus() string { + if c == nil || c.Status == nil { return "" } - return *d.CVEID + return *c.Status } -// GetCVSS returns the CVSS field. -func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { - if d == nil { - return nil +// GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetTotalCommits() int { + if c == nil || c.TotalCommits == nil { + return 0 } - return d.CVSS + return *c.TotalCommits } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetDescription() string { - if d == nil || d.Description == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CommitsComparison) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *d.Description + return *c.URL } -// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetGHSAID() string { - if d == nil || d.GHSAID == nil { +// GetAuthor returns the Author field. +func (c *CommitsListOptions) GetAuthor() string { + if c == nil { return "" } - return *d.GHSAID + return c.Author } -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetPublishedAt() Timestamp { - if d == nil || d.PublishedAt == nil { - return Timestamp{} +// GetPath returns the Path field. +func (c *CommitsListOptions) GetPath() string { + if c == nil { + return "" } - return *d.PublishedAt + return c.Path } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetSeverity() string { - if d == nil || d.Severity == nil { +// GetSHA returns the SHA field. +func (c *CommitsListOptions) GetSHA() string { + if c == nil { return "" } - return *d.Severity + return c.SHA } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetSummary() string { - if d == nil || d.Summary == nil { - return "" +// GetSince returns the Since field. +func (c *CommitsListOptions) GetSince() time.Time { + if c == nil { + return time.Time{} } - return *d.Summary + return c.Since } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetUntil returns the Until field. +func (c *CommitsListOptions) GetUntil() time.Time { + if c == nil { + return time.Time{} } - return *d.UpdatedAt + return c.Until } -// GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetWithdrawnAt() Timestamp { - if d == nil || d.WithdrawnAt == nil { - return Timestamp{} +// GetCommits returns the Commits slice if it's non-nil, nil otherwise. +func (c *CommitsSearchResult) GetCommits() []*CommitResult { + if c == nil || c.Commits == nil { + return nil } - return *d.WithdrawnAt + return c.Commits } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityUpdates) GetStatus() string { - if d == nil || d.Status == nil { - return "" +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (c *CommitsSearchResult) GetIncompleteResults() bool { + if c == nil || c.IncompleteResults == nil { + return false } - return *d.Status + return *c.IncompleteResults } -// GetManifestPath returns the ManifestPath field if it's non-nil, zero value otherwise. -func (d *Dependency) GetManifestPath() string { - if d == nil || d.ManifestPath == nil { - return "" +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (c *CommitsSearchResult) GetTotal() int { + if c == nil || c.Total == nil { + return 0 } - return *d.ManifestPath + return *c.Total } -// GetPackage returns the Package field. -func (d *Dependency) GetPackage() *VulnerabilityPackage { - if d == nil { - return nil +// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. +func (c *CommitStats) GetAdditions() int { + if c == nil || c.Additions == nil { + return 0 } - return d.Package + return *c.Additions } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (d *Dependency) GetScope() string { - if d == nil || d.Scope == nil { - return "" +// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. +func (c *CommitStats) GetDeletions() int { + if c == nil || c.Deletions == nil { + return 0 } - return *d.Scope + return *c.Deletions } -// GetLabeledRunners returns the LabeledRunners field if it's non-nil, zero value otherwise. -func (d *DependencyGraphAutosubmitActionOptions) GetLabeledRunners() bool { - if d == nil || d.LabeledRunners == nil { - return false +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (c *CommitStats) GetTotal() int { + if c == nil || c.Total == nil { + return 0 } - return *d.LabeledRunners + return *c.Total } -// GetDetector returns the Detector field. -func (d *DependencyGraphSnapshot) GetDetector() *DependencyGraphSnapshotDetector { - if d == nil { +// GetCodeOfConduct returns the CodeOfConduct field. +func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric { + if c == nil { return nil } - return d.Detector + return c.CodeOfConduct } -// GetJob returns the Job field. -func (d *DependencyGraphSnapshot) GetJob() *DependencyGraphSnapshotJob { - if d == nil { +// GetCodeOfConductFile returns the CodeOfConductFile field. +func (c *CommunityHealthFiles) GetCodeOfConductFile() *Metric { + if c == nil { return nil } - return d.Job + return c.CodeOfConductFile } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshot) GetRef() string { - if d == nil || d.Ref == nil { - return "" +// GetContributing returns the Contributing field. +func (c *CommunityHealthFiles) GetContributing() *Metric { + if c == nil { + return nil } - return *d.Ref + return c.Contributing } -// GetScanned returns the Scanned field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshot) GetScanned() Timestamp { - if d == nil || d.Scanned == nil { - return Timestamp{} +// GetIssueTemplate returns the IssueTemplate field. +func (c *CommunityHealthFiles) GetIssueTemplate() *Metric { + if c == nil { + return nil } - return *d.Scanned + return c.IssueTemplate } -// GetSha returns the Sha field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshot) GetSha() string { - if d == nil || d.Sha == nil { - return "" +// GetLicense returns the License field. +func (c *CommunityHealthFiles) GetLicense() *Metric { + if c == nil { + return nil } - return *d.Sha + return c.License } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotCreationData) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetPullRequestTemplate returns the PullRequestTemplate field. +func (c *CommunityHealthFiles) GetPullRequestTemplate() *Metric { + if c == nil { + return nil } - return *d.CreatedAt + return c.PullRequestTemplate } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotCreationData) GetMessage() string { - if d == nil || d.Message == nil { - return "" +// GetReadme returns the Readme field. +func (c *CommunityHealthFiles) GetReadme() *Metric { + if c == nil { + return nil } - return *d.Message + return c.Readme } -// GetResult returns the Result field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotCreationData) GetResult() string { - if d == nil || d.Result == nil { - return "" +// GetContentReportsEnabled returns the ContentReportsEnabled field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetContentReportsEnabled() bool { + if c == nil || c.ContentReportsEnabled == nil { + return false } - return *d.Result + return *c.ContentReportsEnabled } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotDetector) GetName() string { - if d == nil || d.Name == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetDescription() string { + if c == nil || c.Description == nil { return "" } - return *d.Name + return *c.Description } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotDetector) GetURL() string { - if d == nil || d.URL == nil { +// GetDocumentation returns the Documentation field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetDocumentation() string { + if c == nil || c.Documentation == nil { return "" } - return *d.URL + return *c.Documentation } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotDetector) GetVersion() string { - if d == nil || d.Version == nil { - return "" +// GetFiles returns the Files field. +func (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles { + if c == nil { + return nil } - return *d.Version + return c.Files } -// GetCorrelator returns the Correlator field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetCorrelator() string { - if d == nil || d.Correlator == nil { - return "" +// GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetHealthPercentage() int { + if c == nil || c.HealthPercentage == nil { + return 0 } - return *d.Correlator + return *c.HealthPercentage } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CommunityHealthMetrics) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return *d.HTMLURL + return *c.UpdatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetID() string { - if d == nil || d.ID == nil { - return "" +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ConfigApplyEvents) GetNodes() []*ConfigApplyEventsNode { + if c == nil || c.Nodes == nil { + return nil } - return *d.ID + return c.Nodes } -// GetFile returns the File field. -func (d *DependencyGraphSnapshotManifest) GetFile() *DependencyGraphSnapshotManifestFile { - if d == nil { +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (c *ConfigApplyEventsNode) GetEvents() []*ConfigApplyEventsNodeEvent { + if c == nil || c.Events == nil { return nil } - return d.File + return c.Events } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotManifest) GetName() string { - if d == nil || d.Name == nil { +// GetLastRequestID returns the LastRequestID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNode) GetLastRequestID() string { + if c == nil || c.LastRequestID == nil { return "" } - return *d.Name + return *c.LastRequestID } -// GetSourceLocation returns the SourceLocation field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotManifestFile) GetSourceLocation() string { - if d == nil || d.SourceLocation == nil { +// GetNode returns the Node field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNode) GetNode() string { + if c == nil || c.Node == nil { return "" } - return *d.SourceLocation + return *c.Node } -// GetPackageURL returns the PackageURL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotResolvedDependency) GetPackageURL() string { - if d == nil || d.PackageURL == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetBody() string { + if c == nil || c.Body == nil { return "" } - return *d.PackageURL + return *c.Body } -// GetRelationship returns the Relationship field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotResolvedDependency) GetRelationship() string { - if d == nil || d.Relationship == nil { +// GetConfigRunID returns the ConfigRunID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetConfigRunID() string { + if c == nil || c.ConfigRunID == nil { return "" } - return *d.Relationship + return *c.ConfigRunID } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotResolvedDependency) GetScope() string { - if d == nil || d.Scope == nil { +// GetEventName returns the EventName field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetEventName() string { + if c == nil || c.EventName == nil { return "" } - return *d.Scope + return *c.EventName } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeployKeyEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetHostname() string { + if c == nil || c.Hostname == nil { return "" } - return *d.Action -} - -// GetInstallation returns the Installation field. -func (d *DeployKeyEvent) GetInstallation() *Installation { - if d == nil { - return nil - } - return d.Installation + return *c.Hostname } -// GetKey returns the Key field. -func (d *DeployKeyEvent) GetKey() *Key { - if d == nil { - return nil +// GetSeverityText returns the SeverityText field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetSeverityText() string { + if c == nil || c.SeverityText == nil { + return "" } - return d.Key + return *c.SeverityText } -// GetOrganization returns the Organization field. -func (d *DeployKeyEvent) GetOrganization() *Organization { - if d == nil { - return nil +// GetSpanDepth returns the SpanDepth field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetSpanDepth() int { + if c == nil || c.SpanDepth == nil { + return 0 } - return d.Organization + return *c.SpanDepth } -// GetRepo returns the Repo field. -func (d *DeployKeyEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetSpanID returns the SpanID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetSpanID() string { + if c == nil || c.SpanID == nil { + return "" } - return d.Repo + return *c.SpanID } -// GetSender returns the Sender field. -func (d *DeployKeyEvent) GetSender() *User { - if d == nil { - return nil +// GetSpanParentID returns the SpanParentID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetSpanParentID() int64 { + if c == nil || c.SpanParentID == nil { + return 0 } - return d.Sender + return *c.SpanParentID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *Deployment) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetTimestamp() Timestamp { + if c == nil || c.Timestamp == nil { return Timestamp{} } - return *d.CreatedAt + return *c.Timestamp } -// GetCreator returns the Creator field. -func (d *Deployment) GetCreator() *User { - if d == nil { - return nil +// GetTopology returns the Topology field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetTopology() string { + if c == nil || c.Topology == nil { + return "" } - return d.Creator + return *c.Topology } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *Deployment) GetDescription() string { - if d == nil || d.Description == nil { +// GetTraceID returns the TraceID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsNodeEvent) GetTraceID() string { + if c == nil || c.TraceID == nil { return "" } - return *d.Description + return *c.TraceID } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *Deployment) GetEnvironment() string { - if d == nil || d.Environment == nil { +// GetLastRequestID returns the LastRequestID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyEventsOptions) GetLastRequestID() string { + if c == nil || c.LastRequestID == nil { return "" } - return *d.Environment + return *c.LastRequestID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *Deployment) GetID() int64 { - if d == nil || d.ID == nil { - return 0 +// GetRunID returns the RunID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyOptions) GetRunID() string { + if c == nil || c.RunID == nil { + return "" } - return *d.ID + return *c.RunID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *Deployment) GetNodeID() string { - if d == nil || d.NodeID == nil { - return "" +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (c *ConfigApplyStatus) GetNodes() []*ConfigApplyStatusNode { + if c == nil || c.Nodes == nil { + return nil } - return *d.NodeID + return c.Nodes } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRef() string { - if d == nil || d.Ref == nil { - return "" +// GetRunning returns the Running field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatus) GetRunning() bool { + if c == nil || c.Running == nil { + return false } - return *d.Ref + return *c.Running } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { - return "" +// GetSuccessful returns the Successful field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatus) GetSuccessful() bool { + if c == nil || c.Successful == nil { + return false } - return *d.RepositoryURL + return *c.Successful } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (d *Deployment) GetSHA() string { - if d == nil || d.SHA == nil { +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatusNode) GetHostname() string { + if c == nil || c.Hostname == nil { return "" } - return *d.SHA + return *c.Hostname } -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetStatusesURL() string { - if d == nil || d.StatusesURL == nil { +// GetRunID returns the RunID field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatusNode) GetRunID() string { + if c == nil || c.RunID == nil { return "" } - return *d.StatusesURL + return *c.RunID } -// GetTask returns the Task field if it's non-nil, zero value otherwise. -func (d *Deployment) GetTask() string { - if d == nil || d.Task == nil { - return "" +// GetRunning returns the Running field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatusNode) GetRunning() bool { + if c == nil || c.Running == nil { + return false } - return *d.Task + return *c.Running } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *Deployment) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetSuccessful returns the Successful field if it's non-nil, zero value otherwise. +func (c *ConfigApplyStatusNode) GetSuccessful() bool { + if c == nil || c.Successful == nil { + return false } - return *d.UpdatedAt + return *c.Successful } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetURL() string { - if d == nil || d.URL == nil { +// GetAdminPassword returns the AdminPassword field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetAdminPassword() string { + if c == nil || c.AdminPassword == nil { return "" } - return *d.URL + return *c.AdminPassword } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicy) GetID() int64 { - if d == nil || d.ID == nil { - return 0 +// GetAssets returns the Assets field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetAssets() string { + if c == nil || c.Assets == nil { + return "" } - return *d.ID + return *c.Assets } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicy) GetName() string { - if d == nil || d.Name == nil { +// GetAuthMode returns the AuthMode field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetAuthMode() string { + if c == nil || c.AuthMode == nil { return "" } - return *d.Name + return *c.AuthMode } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicy) GetNodeID() string { - if d == nil || d.NodeID == nil { - return "" +// GetAvatar returns the Avatar field. +func (c *ConfigSettings) GetAvatar() *ConfigSettingsAvatar { + if c == nil { + return nil } - return *d.NodeID + return c.Avatar } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicy) GetType() string { - if d == nil || d.Type == nil { - return "" +// GetCAS returns the CAS field. +func (c *ConfigSettings) GetCAS() *ConfigSettingsCAS { + if c == nil { + return nil } - return *d.Type + return c.CAS } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicyRequest) GetName() string { - if d == nil || d.Name == nil { - return "" +// GetCollectd returns the Collectd field. +func (c *ConfigSettings) GetCollectd() *ConfigSettingsCollectd { + if c == nil { + return nil } - return *d.Name + return c.Collectd } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicyRequest) GetType() string { - if d == nil || d.Type == nil { - return "" +// GetConfigurationID returns the ConfigurationID field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetConfigurationID() int64 { + if c == nil || c.ConfigurationID == nil { + return 0 } - return *d.Type + return *c.ConfigurationID } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicyResponse) GetTotalCount() int { - if d == nil || d.TotalCount == nil { +// GetConfigurationRunCount returns the ConfigurationRunCount field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetConfigurationRunCount() int { + if c == nil || c.ConfigurationRunCount == nil { return 0 } - return *d.TotalCount + return *c.ConfigurationRunCount } -// GetDeployment returns the Deployment field. -func (d *DeploymentEvent) GetDeployment() *Deployment { - if d == nil { +// GetCustomer returns the Customer field. +func (c *ConfigSettings) GetCustomer() *ConfigSettingsCustomer { + if c == nil { return nil } - return d.Deployment + return c.Customer } -// GetInstallation returns the Installation field. -func (d *DeploymentEvent) GetInstallation() *Installation { - if d == nil { - return nil +// GetExpireSessions returns the ExpireSessions field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetExpireSessions() bool { + if c == nil || c.ExpireSessions == nil { + return false } - return d.Installation + return *c.ExpireSessions } -// GetOrg returns the Org field. -func (d *DeploymentEvent) GetOrg() *Organization { - if d == nil { - return nil +// GetGithubHostname returns the GithubHostname field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetGithubHostname() string { + if c == nil || c.GithubHostname == nil { + return "" } - return d.Org + return *c.GithubHostname } -// GetRepo returns the Repo field. -func (d *DeploymentEvent) GetRepo() *Repository { - if d == nil { +// GetGithubOAuth returns the GithubOAuth field. +func (c *ConfigSettings) GetGithubOAuth() *ConfigSettingsGithubOAuth { + if c == nil { return nil } - return d.Repo + return c.GithubOAuth } -// GetSender returns the Sender field. -func (d *DeploymentEvent) GetSender() *User { - if d == nil { +// GetGithubSSL returns the GithubSSL field. +func (c *ConfigSettings) GetGithubSSL() *ConfigSettingsGithubSSL { + if c == nil { return nil } - return d.Sender + return c.GithubSSL } -// GetWorkflow returns the Workflow field. -func (d *DeploymentEvent) GetWorkflow() *Workflow { - if d == nil { - return nil +// GetHTTPProxy returns the HTTPProxy field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetHTTPProxy() string { + if c == nil || c.HTTPProxy == nil { + return "" } - return d.Workflow + return *c.HTTPProxy } -// GetWorkflowRun returns the WorkflowRun field. -func (d *DeploymentEvent) GetWorkflowRun() *WorkflowRun { - if d == nil { - return nil +// GetIdenticonsHost returns the IdenticonsHost field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetIdenticonsHost() string { + if c == nil || c.IdenticonsHost == nil { + return "" } - return d.WorkflowRun + return *c.IdenticonsHost } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetAction() string { - if d == nil || d.Action == nil { - return "" +// GetLDAP returns the LDAP field. +func (c *ConfigSettings) GetLDAP() *ConfigSettingsLDAP { + if c == nil { + return nil } - return *d.Action + return c.LDAP } -// GetDeployment returns the Deployment field. -func (d *DeploymentProtectionRuleEvent) GetDeployment() *Deployment { - if d == nil { +// GetLicense returns the License field. +func (c *ConfigSettings) GetLicense() *ConfigSettingsLicenseSettings { + if c == nil { return nil } - return d.Deployment + return c.License } -// GetDeploymentCallbackURL returns the DeploymentCallbackURL field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetDeploymentCallbackURL() string { - if d == nil || d.DeploymentCallbackURL == nil { +// GetLoadBalancer returns the LoadBalancer field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetLoadBalancer() string { + if c == nil || c.LoadBalancer == nil { return "" } - return *d.DeploymentCallbackURL + return *c.LoadBalancer } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetEnvironment() string { - if d == nil || d.Environment == nil { - return "" +// GetMapping returns the Mapping field. +func (c *ConfigSettings) GetMapping() *ConfigSettingsMapping { + if c == nil { + return nil } - return *d.Environment + return c.Mapping } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetEvent() string { - if d == nil || d.Event == nil { - return "" +// GetNTP returns the NTP field. +func (c *ConfigSettings) GetNTP() *ConfigSettingsNTP { + if c == nil { + return nil } - return *d.Event + return c.NTP } -// GetInstallation returns the Installation field. -func (d *DeploymentProtectionRuleEvent) GetInstallation() *Installation { - if d == nil { +// GetPages returns the Pages field. +func (c *ConfigSettings) GetPages() *ConfigSettingsPagesSettings { + if c == nil { return nil } - return d.Installation + return c.Pages } -// GetOrganization returns the Organization field. -func (d *DeploymentProtectionRuleEvent) GetOrganization() *Organization { - if d == nil { - return nil +// GetPrivateMode returns the PrivateMode field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetPrivateMode() bool { + if c == nil || c.PrivateMode == nil { + return false } - return d.Organization + return *c.PrivateMode } -// GetRepo returns the Repo field. -func (d *DeploymentProtectionRuleEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetPublicPages returns the PublicPages field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetPublicPages() bool { + if c == nil || c.PublicPages == nil { + return false } - return d.Repo + return *c.PublicPages } -// GetSender returns the Sender field. -func (d *DeploymentProtectionRuleEvent) GetSender() *User { - if d == nil { +// GetSAML returns the SAML field. +func (c *ConfigSettings) GetSAML() *ConfigSettingsSAML { + if c == nil { return nil } - return d.Sender + return c.SAML } -// GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetAutoMerge() bool { - if d == nil || d.AutoMerge == nil { +// GetSignupEnabled returns the SignupEnabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetSignupEnabled() bool { + if c == nil || c.SignupEnabled == nil { return false } - return *d.AutoMerge + return *c.SignupEnabled } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetDescription() string { - if d == nil || d.Description == nil { - return "" +// GetSMTP returns the SMTP field. +func (c *ConfigSettings) GetSMTP() *ConfigSettingsSMTP { + if c == nil { + return nil } - return *d.Description + return c.SMTP } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { - return "" +// GetSNMP returns the SNMP field. +func (c *ConfigSettings) GetSNMP() *ConfigSettingsSNMP { + if c == nil { + return nil } - return *d.Environment + return c.SNMP } -// GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetProductionEnvironment() bool { - if d == nil || d.ProductionEnvironment == nil { +// GetSubdomainIsolation returns the SubdomainIsolation field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetSubdomainIsolation() bool { + if c == nil || c.SubdomainIsolation == nil { return false } - return *d.ProductionEnvironment -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRef() string { - if d == nil || d.Ref == nil { - return "" - } - return *d.Ref + return *c.SubdomainIsolation } -// GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRequiredContexts() []string { - if d == nil || d.RequiredContexts == nil { +// GetSyslog returns the Syslog field. +func (c *ConfigSettings) GetSyslog() *ConfigSettingsSyslog { + if c == nil { return nil } - return *d.RequiredContexts + return c.Syslog } -// GetTask returns the Task field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetTask() string { - if d == nil || d.Task == nil { +// GetTimezone returns the Timezone field if it's non-nil, zero value otherwise. +func (c *ConfigSettings) GetTimezone() string { + if c == nil || c.Timezone == nil { return "" } - return *d.Task + return *c.Timezone } -// GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetTransientEnvironment() bool { - if d == nil || d.TransientEnvironment == nil { +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsAvatar) GetEnabled() bool { + if c == nil || c.Enabled == nil { return false } - return *d.TransientEnvironment + return *c.Enabled } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetURI returns the URI field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsAvatar) GetURI() string { + if c == nil || c.URI == nil { return "" } - return *d.Action -} - -// GetApprover returns the Approver field. -func (d *DeploymentReviewEvent) GetApprover() *User { - if d == nil { - return nil - } - return d.Approver + return *c.URI } -// GetComment returns the Comment field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetComment() string { - if d == nil || d.Comment == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCAS) GetURL() string { + if c == nil || c.URL == nil { return "" } - return *d.Comment + return *c.URL } -// GetEnterprise returns the Enterprise field. -func (d *DeploymentReviewEvent) GetEnterprise() *Enterprise { - if d == nil { - return nil +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return d.Enterprise + return *c.Enabled } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetEnvironment() string { - if d == nil || d.Environment == nil { +// GetEncryption returns the Encryption field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetEncryption() string { + if c == nil || c.Encryption == nil { return "" } - return *d.Environment + return *c.Encryption } -// GetInstallation returns the Installation field. -func (d *DeploymentReviewEvent) GetInstallation() *Installation { - if d == nil { - return nil +// GetPassword returns the Password field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetPassword() string { + if c == nil || c.Password == nil { + return "" } - return d.Installation + return *c.Password } -// GetOrganization returns the Organization field. -func (d *DeploymentReviewEvent) GetOrganization() *Organization { - if d == nil { - return nil +// GetPort returns the Port field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetPort() int { + if c == nil || c.Port == nil { + return 0 } - return d.Organization + return *c.Port } -// GetRepo returns the Repo field. -func (d *DeploymentReviewEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetServer returns the Server field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetServer() string { + if c == nil || c.Server == nil { + return "" } - return d.Repo + return *c.Server } -// GetRequester returns the Requester field. -func (d *DeploymentReviewEvent) GetRequester() *User { - if d == nil { - return nil +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCollectd) GetUsername() string { + if c == nil || c.Username == nil { + return "" } - return d.Requester + return *c.Username } -// GetSender returns the Sender field. -func (d *DeploymentReviewEvent) GetSender() *User { - if d == nil { - return nil +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCustomer) GetEmail() string { + if c == nil || c.Email == nil { + return "" } - return d.Sender + return *c.Email } -// GetSince returns the Since field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetSince() string { - if d == nil || d.Since == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCustomer) GetName() string { + if c == nil || c.Name == nil { return "" } - return *d.Since + return *c.Name } -// GetWorkflowJobRun returns the WorkflowJobRun field. -func (d *DeploymentReviewEvent) GetWorkflowJobRun() *WorkflowJobRun { - if d == nil { - return nil +// GetPublicKeyData returns the PublicKeyData field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCustomer) GetPublicKeyData() string { + if c == nil || c.PublicKeyData == nil { + return "" } - return d.WorkflowJobRun + return *c.PublicKeyData } -// GetWorkflowRun returns the WorkflowRun field. -func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { - if d == nil { - return nil +// GetSecret returns the Secret field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCustomer) GetSecret() string { + if c == nil || c.Secret == nil { + return "" } - return d.WorkflowRun + return *c.Secret } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsCustomer) GetUUID() string { + if c == nil || c.UUID == nil { + return "" } - return *d.CreatedAt + return *c.UUID } -// GetCreator returns the Creator field. -func (d *DeploymentStatus) GetCreator() *User { - if d == nil { - return nil +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubOAuth) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" } - return d.Creator + return *c.ClientID } -// GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDeploymentURL() string { - if d == nil || d.DeploymentURL == nil { +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubOAuth) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { return "" } - return *d.DeploymentURL + return *c.ClientSecret } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDescription() string { - if d == nil || d.Description == nil { +// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubOAuth) GetOrganizationName() string { + if c == nil || c.OrganizationName == nil { return "" } - return *d.Description + return *c.OrganizationName } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetEnvironment() string { - if d == nil || d.Environment == nil { +// GetOrganizationTeam returns the OrganizationTeam field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubOAuth) GetOrganizationTeam() string { + if c == nil || c.OrganizationTeam == nil { return "" } - return *d.Environment + return *c.OrganizationTeam } -// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetEnvironmentURL() string { - if d == nil || d.EnvironmentURL == nil { +// GetCert returns the Cert field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubSSL) GetCert() string { + if c == nil || c.Cert == nil { return "" } - return *d.EnvironmentURL + return *c.Cert } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetID() int64 { - if d == nil || d.ID == nil { - return 0 +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubSSL) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return *d.ID + return *c.Enabled } -// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetLogURL() string { - if d == nil || d.LogURL == nil { +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsGithubSSL) GetKey() string { + if c == nil || c.Key == nil { return "" } - return *d.LogURL + return *c.Key } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetNodeID() string { - if d == nil || d.NodeID == nil { +// GetAdminGroup returns the AdminGroup field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetAdminGroup() string { + if c == nil || c.AdminGroup == nil { return "" } - return *d.NodeID + return *c.AdminGroup } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { - return "" +// GetBase returns the Base slice if it's non-nil, nil otherwise. +func (c *ConfigSettingsLDAP) GetBase() []string { + if c == nil || c.Base == nil { + return nil } - return *d.RepositoryURL + return c.Base } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetState() string { - if d == nil || d.State == nil { +// GetBindDN returns the BindDN field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetBindDN() string { + if c == nil || c.BindDN == nil { return "" } - return *d.State + return *c.BindDN } -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetTargetURL() string { - if d == nil || d.TargetURL == nil { +// GetHost returns the Host field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetHost() string { + if c == nil || c.Host == nil { return "" } - return *d.TargetURL -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} - } - return *d.UpdatedAt + return *c.Host } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetURL() string { - if d == nil || d.URL == nil { +// GetMethod returns the Method field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetMethod() string { + if c == nil || c.Method == nil { return "" } - return *d.URL + return *c.Method } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetPassword returns the Password field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetPassword() string { + if c == nil || c.Password == nil { return "" } - return *d.Action + return *c.Password } -// GetDeployment returns the Deployment field. -func (d *DeploymentStatusEvent) GetDeployment() *Deployment { - if d == nil { - return nil +// GetPort returns the Port field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetPort() int { + if c == nil || c.Port == nil { + return 0 } - return d.Deployment + return *c.Port } -// GetDeploymentStatus returns the DeploymentStatus field. -func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus { - if d == nil { - return nil +// GetPosixSupport returns the PosixSupport field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetPosixSupport() bool { + if c == nil || c.PosixSupport == nil { + return false } - return d.DeploymentStatus + return *c.PosixSupport } -// GetInstallation returns the Installation field. -func (d *DeploymentStatusEvent) GetInstallation() *Installation { - if d == nil { +// GetProfile returns the Profile field. +func (c *ConfigSettingsLDAP) GetProfile() *ConfigSettingsLDAPProfile { + if c == nil { return nil } - return d.Installation + return c.Profile } -// GetOrg returns the Org field. -func (d *DeploymentStatusEvent) GetOrg() *Organization { - if d == nil { +// GetReconciliation returns the Reconciliation field. +func (c *ConfigSettingsLDAP) GetReconciliation() *ConfigSettingsLDAPReconciliation { + if c == nil { return nil } - return d.Org + return c.Reconciliation } -// GetRepo returns the Repo field. -func (d *DeploymentStatusEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetRecursiveGroupSearch returns the RecursiveGroupSearch field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetRecursiveGroupSearch() bool { + if c == nil || c.RecursiveGroupSearch == nil { + return false } - return d.Repo + return *c.RecursiveGroupSearch } -// GetSender returns the Sender field. -func (d *DeploymentStatusEvent) GetSender() *User { - if d == nil { - return nil +// GetSearchStrategy returns the SearchStrategy field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetSearchStrategy() string { + if c == nil || c.SearchStrategy == nil { + return "" } - return d.Sender + return *c.SearchStrategy } -// GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetAutoInactive() bool { - if d == nil || d.AutoInactive == nil { +// GetSyncEnabled returns the SyncEnabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetSyncEnabled() bool { + if c == nil || c.SyncEnabled == nil { return false } - return *d.AutoInactive + return *c.SyncEnabled } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetDescription() string { - if d == nil || d.Description == nil { - return "" +// GetTeamSyncInterval returns the TeamSyncInterval field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetTeamSyncInterval() int { + if c == nil || c.TeamSyncInterval == nil { + return 0 } - return *d.Description + return *c.TeamSyncInterval } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { +// GetUID returns the UID field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetUID() string { + if c == nil || c.UID == nil { return "" } - return *d.Environment + return *c.UID } -// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetEnvironmentURL() string { - if d == nil || d.EnvironmentURL == nil { - return "" +// GetUserGroups returns the UserGroups slice if it's non-nil, nil otherwise. +func (c *ConfigSettingsLDAP) GetUserGroups() []string { + if c == nil || c.UserGroups == nil { + return nil } - return *d.EnvironmentURL + return c.UserGroups } -// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetLogURL() string { - if d == nil || d.LogURL == nil { - return "" +// GetUserSyncEmails returns the UserSyncEmails field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetUserSyncEmails() bool { + if c == nil || c.UserSyncEmails == nil { + return false } - return *d.LogURL + return *c.UserSyncEmails } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetState() string { - if d == nil || d.State == nil { - return "" +// GetUserSyncInterval returns the UserSyncInterval field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetUserSyncInterval() int { + if c == nil || c.UserSyncInterval == nil { + return 0 } - return *d.State + return *c.UserSyncInterval } -// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. -func (d *Discussion) GetActiveLockReason() string { - if d == nil || d.ActiveLockReason == nil { +// GetUserSyncKeys returns the UserSyncKeys field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetUserSyncKeys() bool { + if c == nil || c.UserSyncKeys == nil { + return false + } + return *c.UserSyncKeys +} + +// GetVirtualAttributeEnabled returns the VirtualAttributeEnabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAP) GetVirtualAttributeEnabled() bool { + if c == nil || c.VirtualAttributeEnabled == nil { + return false + } + return *c.VirtualAttributeEnabled +} + +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPProfile) GetKey() string { + if c == nil || c.Key == nil { return "" } - return *d.ActiveLockReason + return *c.Key } -// GetAnswerChosenAt returns the AnswerChosenAt field if it's non-nil, zero value otherwise. -func (d *Discussion) GetAnswerChosenAt() Timestamp { - if d == nil || d.AnswerChosenAt == nil { - return Timestamp{} +// GetMail returns the Mail field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPProfile) GetMail() string { + if c == nil || c.Mail == nil { + return "" } - return *d.AnswerChosenAt + return *c.Mail } -// GetAnswerChosenBy returns the AnswerChosenBy field if it's non-nil, zero value otherwise. -func (d *Discussion) GetAnswerChosenBy() string { - if d == nil || d.AnswerChosenBy == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPProfile) GetName() string { + if c == nil || c.Name == nil { return "" } - return *d.AnswerChosenBy + return *c.Name } -// GetAnswerHTMLURL returns the AnswerHTMLURL field if it's non-nil, zero value otherwise. -func (d *Discussion) GetAnswerHTMLURL() string { - if d == nil || d.AnswerHTMLURL == nil { +// GetUID returns the UID field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPProfile) GetUID() string { + if c == nil || c.UID == nil { return "" } - return *d.AnswerHTMLURL + return *c.UID } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (d *Discussion) GetAuthorAssociation() string { - if d == nil || d.AuthorAssociation == nil { +// GetOrg returns the Org field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPReconciliation) GetOrg() string { + if c == nil || c.Org == nil { return "" } - return *d.AuthorAssociation + return *c.Org } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *Discussion) GetBody() string { - if d == nil || d.Body == nil { +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLDAPReconciliation) GetUser() string { + if c == nil || c.User == nil { return "" } - return *d.Body + return *c.User } -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (d *Discussion) GetComments() int { - if d == nil || d.Comments == nil { - return 0 +// GetClusterSupport returns the ClusterSupport field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetClusterSupport() bool { + if c == nil || c.ClusterSupport == nil { + return false } - return *d.Comments + return *c.ClusterSupport } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *Discussion) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetEvaluation returns the Evaluation field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetEvaluation() bool { + if c == nil || c.Evaluation == nil { + return false } - return *d.CreatedAt + return *c.Evaluation } -// GetDiscussionCategory returns the DiscussionCategory field. -func (d *Discussion) GetDiscussionCategory() *DiscussionCategory { - if d == nil { - return nil +// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetExpireAt() Timestamp { + if c == nil || c.ExpireAt == nil { + return Timestamp{} } - return d.DiscussionCategory + return *c.ExpireAt } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *Discussion) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { - return "" +// GetPerpetual returns the Perpetual field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetPerpetual() bool { + if c == nil || c.Perpetual == nil { + return false } - return *d.HTMLURL + return *c.Perpetual } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *Discussion) GetID() int64 { - if d == nil || d.ID == nil { +// GetSeats returns the Seats field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetSeats() int { + if c == nil || c.Seats == nil { return 0 } - return *d.ID + return *c.Seats } -// GetLocked returns the Locked field if it's non-nil, zero value otherwise. -func (d *Discussion) GetLocked() bool { - if d == nil || d.Locked == nil { +// GetSSHAllowed returns the SSHAllowed field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetSSHAllowed() bool { + if c == nil || c.SSHAllowed == nil { return false } - return *d.Locked + return *c.SSHAllowed } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *Discussion) GetNodeID() string { - if d == nil || d.NodeID == nil { +// GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetSupportKey() string { + if c == nil || c.SupportKey == nil { return "" } - return *d.NodeID + return *c.SupportKey } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (d *Discussion) GetNumber() int { - if d == nil || d.Number == nil { - return 0 +// GetUnlimitedSeating returns the UnlimitedSeating field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsLicenseSettings) GetUnlimitedSeating() bool { + if c == nil || c.UnlimitedSeating == nil { + return false } - return *d.Number + return *c.UnlimitedSeating } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *Discussion) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { +// GetBasemap returns the Basemap field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsMapping) GetBasemap() string { + if c == nil || c.Basemap == nil { return "" } - return *d.RepositoryURL + return *c.Basemap } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *Discussion) GetState() string { - if d == nil || d.State == nil { +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsMapping) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false + } + return *c.Enabled +} + +// GetTileserver returns the Tileserver field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsMapping) GetTileserver() string { + if c == nil || c.Tileserver == nil { return "" } - return *d.State + return *c.Tileserver } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (d *Discussion) GetTitle() string { - if d == nil || d.Title == nil { +// GetToken returns the Token field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsMapping) GetToken() string { + if c == nil || c.Token == nil { return "" } - return *d.Title + return *c.Token } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *Discussion) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetPrimaryServer returns the PrimaryServer field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsNTP) GetPrimaryServer() string { + if c == nil || c.PrimaryServer == nil { + return "" } - return *d.UpdatedAt + return *c.PrimaryServer } -// GetUser returns the User field. -func (d *Discussion) GetUser() *User { - if d == nil { - return nil +// GetSecondaryServer returns the SecondaryServer field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsNTP) GetSecondaryServer() string { + if c == nil || c.SecondaryServer == nil { + return "" } - return d.User + return *c.SecondaryServer } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsPagesSettings) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return *d.CreatedAt + return *c.Enabled } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetDescription() string { - if d == nil || d.Description == nil { +// GetCertificate returns the Certificate field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetCertificate() string { + if c == nil || c.Certificate == nil { return "" } - return *d.Description + return *c.Certificate } -// GetEmoji returns the Emoji field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetEmoji() string { - if d == nil || d.Emoji == nil { +// GetCertificatePath returns the CertificatePath field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetCertificatePath() string { + if c == nil || c.CertificatePath == nil { return "" } - return *d.Emoji + return *c.CertificatePath } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetID() int64 { - if d == nil || d.ID == nil { - return 0 +// GetDisableAdminDemote returns the DisableAdminDemote field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetDisableAdminDemote() bool { + if c == nil || c.DisableAdminDemote == nil { + return false } - return *d.ID + return *c.DisableAdminDemote } -// GetIsAnswerable returns the IsAnswerable field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetIsAnswerable() bool { - if d == nil || d.IsAnswerable == nil { +// GetIDPInitiatedSSO returns the IDPInitiatedSSO field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetIDPInitiatedSSO() bool { + if c == nil || c.IDPInitiatedSSO == nil { return false } - return *d.IsAnswerable + return *c.IDPInitiatedSSO } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetName() string { - if d == nil || d.Name == nil { +// GetIssuer returns the Issuer field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetIssuer() string { + if c == nil || c.Issuer == nil { return "" } - return *d.Name + return *c.Issuer } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetNodeID() string { - if d == nil || d.NodeID == nil { +// GetSSOURL returns the SSOURL field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSAML) GetSSOURL() string { + if c == nil || c.SSOURL == nil { return "" } - return *d.NodeID + return *c.SSOURL } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetRepositoryID() int64 { - if d == nil || d.RepositoryID == nil { - return 0 +// GetAddress returns the Address field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetAddress() string { + if c == nil || c.Address == nil { + return "" } - return *d.RepositoryID + return *c.Address } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetSlug() string { - if d == nil || d.Slug == nil { +// GetAuthentication returns the Authentication field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetAuthentication() string { + if c == nil || c.Authentication == nil { return "" } - return *d.Slug + return *c.Authentication } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionCategory) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetDiscardToNoreplyAddress returns the DiscardToNoreplyAddress field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetDiscardToNoreplyAddress() bool { + if c == nil || c.DiscardToNoreplyAddress == nil { + return false } - return *d.UpdatedAt + return *c.DiscardToNoreplyAddress } -// GetAuthor returns the Author field. -func (d *DiscussionComment) GetAuthor() *User { - if d == nil { - return nil +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetDomain() string { + if c == nil || c.Domain == nil { + return "" } - return d.Author + return *c.Domain } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBody() string { - if d == nil || d.Body == nil { - return "" +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return *d.Body + return *c.Enabled } -// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBodyHTML() string { - if d == nil || d.BodyHTML == nil { - return "" +// GetEnableStarttlsAuto returns the EnableStarttlsAuto field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetEnableStarttlsAuto() bool { + if c == nil || c.EnableStarttlsAuto == nil { + return false } - return *d.BodyHTML + return *c.EnableStarttlsAuto } -// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetBodyVersion() string { - if d == nil || d.BodyVersion == nil { +// GetNoreplyAddress returns the NoreplyAddress field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetNoreplyAddress() string { + if c == nil || c.NoreplyAddress == nil { return "" } - return *d.BodyVersion + return *c.NoreplyAddress } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { - return Timestamp{} +// GetPassword returns the Password field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetPassword() string { + if c == nil || c.Password == nil { + return "" } - return *d.CreatedAt + return *c.Password } -// GetDiscussionURL returns the DiscussionURL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetDiscussionURL() string { - if d == nil || d.DiscussionURL == nil { +// GetPort returns the Port field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetPort() string { + if c == nil || c.Port == nil { return "" } - return *d.DiscussionURL + return *c.Port } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { +// GetSupportAddress returns the SupportAddress field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetSupportAddress() string { + if c == nil || c.SupportAddress == nil { return "" } - return *d.HTMLURL + return *c.SupportAddress } -// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetLastEditedAt() Timestamp { - if d == nil || d.LastEditedAt == nil { - return Timestamp{} +// GetSupportAddressType returns the SupportAddressType field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetSupportAddressType() string { + if c == nil || c.SupportAddressType == nil { + return "" } - return *d.LastEditedAt + return *c.SupportAddressType } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetNodeID() string { - if d == nil || d.NodeID == nil { +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetUsername() string { + if c == nil || c.Username == nil { return "" } - return *d.NodeID + return *c.Username } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetNumber() int { - if d == nil || d.Number == nil { - return 0 +// GetUserName returns the UserName field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSMTP) GetUserName() string { + if c == nil || c.UserName == nil { + return "" } - return *d.Number + return *c.UserName } -// GetReactions returns the Reactions field. -func (d *DiscussionComment) GetReactions() *Reactions { - if d == nil { - return nil +// GetCommunity returns the Community field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSNMP) GetCommunity() string { + if c == nil || c.Community == nil { + return "" } - return d.Reactions + return *c.Community } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == nil { - return Timestamp{} +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSNMP) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return *d.UpdatedAt + return *c.Enabled } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetURL() string { - if d == nil || d.URL == nil { - return "" +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSyslog) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false } - return *d.URL + return *c.Enabled } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DiscussionCommentEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetProtocolName returns the ProtocolName field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSyslog) GetProtocolName() string { + if c == nil || c.ProtocolName == nil { return "" } - return *d.Action + return *c.ProtocolName } -// GetComment returns the Comment field. -func (d *DiscussionCommentEvent) GetComment() *CommentDiscussion { - if d == nil { - return nil +// GetServer returns the Server field if it's non-nil, zero value otherwise. +func (c *ConfigSettingsSyslog) GetServer() string { + if c == nil || c.Server == nil { + return "" } - return d.Comment + return *c.Server } -// GetDiscussion returns the Discussion field. -func (d *DiscussionCommentEvent) GetDiscussion() *Discussion { - if d == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConnectionServiceItem) GetName() string { + if c == nil || c.Name == nil { + return "" } - return d.Discussion + return *c.Name } -// GetInstallation returns the Installation field. -func (d *DiscussionCommentEvent) GetInstallation() *Installation { - if d == nil { - return nil +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (c *ConnectionServiceItem) GetNumber() int { + if c == nil || c.Number == nil { + return 0 } - return d.Installation + return *c.Number } -// GetOrg returns the Org field. -func (d *DiscussionCommentEvent) GetOrg() *Organization { - if d == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ContentReference) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return d.Org + return *c.ID } -// GetRepo returns the Repo field. -func (d *DiscussionCommentEvent) GetRepo() *Repository { - if d == nil { - return nil +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *ContentReference) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" } - return d.Repo + return *c.NodeID } -// GetSender returns the Sender field. -func (d *DiscussionCommentEvent) GetSender() *User { - if d == nil { - return nil +// GetReference returns the Reference field if it's non-nil, zero value otherwise. +func (c *ContentReference) GetReference() string { + if c == nil || c.Reference == nil { + return "" } - return d.Sender + return *c.Reference } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DiscussionEvent) GetAction() string { - if d == nil || d.Action == nil { +func (c *ContentReferenceEvent) GetAction() string { + if c == nil || c.Action == nil { return "" } - return *d.Action + return *c.Action } -// GetDiscussion returns the Discussion field. -func (d *DiscussionEvent) GetDiscussion() *Discussion { - if d == nil { +// GetContentReference returns the ContentReference field. +func (c *ContentReferenceEvent) GetContentReference() *ContentReference { + if c == nil { return nil } - return d.Discussion + return c.ContentReference } // GetInstallation returns the Installation field. -func (d *DiscussionEvent) GetInstallation() *Installation { - if d == nil { +func (c *ContentReferenceEvent) GetInstallation() *Installation { + if c == nil { return nil } - return d.Installation + return c.Installation } -// GetOrg returns the Org field. -func (d *DiscussionEvent) GetOrg() *Organization { - if d == nil { +// GetRepo returns the Repo field. +func (c *ContentReferenceEvent) GetRepo() *Repository { + if c == nil { return nil } - return d.Org + return c.Repo } -// GetRepo returns the Repo field. -func (d *DiscussionEvent) GetRepo() *Repository { - if d == nil { +// GetSender returns the Sender field. +func (c *ContentReferenceEvent) GetSender() *User { + if c == nil { return nil } - return d.Repo + return c.Sender } -// GetSender returns the Sender field. -func (d *DiscussionEvent) GetSender() *User { - if d == nil { - return nil +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetAvatarURL() string { + if c == nil || c.AvatarURL == nil { + return "" } - return d.Sender + return *c.AvatarURL } -// GetApps returns the Apps field if it's non-nil, zero value otherwise. -func (d *DismissalRestrictionsRequest) GetApps() []string { - if d == nil || d.Apps == nil { - return nil +// GetContributions returns the Contributions field if it's non-nil, zero value otherwise. +func (c *Contributor) GetContributions() int { + if c == nil || c.Contributions == nil { + return 0 } - return *d.Apps + return *c.Contributions } -// GetTeams returns the Teams field if it's non-nil, zero value otherwise. -func (d *DismissalRestrictionsRequest) GetTeams() []string { - if d == nil || d.Teams == nil { - return nil +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *Contributor) GetEmail() string { + if c == nil || c.Email == nil { + return "" } - return *d.Teams + return *c.Email } -// GetUsers returns the Users field if it's non-nil, zero value otherwise. -func (d *DismissalRestrictionsRequest) GetUsers() []string { - if d == nil || d.Users == nil { - return nil +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetEventsURL() string { + if c == nil || c.EventsURL == nil { + return "" } - return *d.Users + return *c.EventsURL } -// GetDismissalCommitID returns the DismissalCommitID field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetDismissalCommitID() string { - if d == nil || d.DismissalCommitID == nil { +// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetFollowersURL() string { + if c == nil || c.FollowersURL == nil { return "" } - return *d.DismissalCommitID + return *c.FollowersURL } -// GetDismissalMessage returns the DismissalMessage field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetDismissalMessage() string { - if d == nil || d.DismissalMessage == nil { +// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetFollowingURL() string { + if c == nil || c.FollowingURL == nil { return "" } - return *d.DismissalMessage + return *c.FollowingURL } -// GetReviewID returns the ReviewID field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetReviewID() int64 { - if d == nil || d.ReviewID == nil { - return 0 +// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetGistsURL() string { + if c == nil || c.GistsURL == nil { + return "" } - return *d.ReviewID + return *c.GistsURL } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetState() string { - if d == nil || d.State == nil { +// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. +func (c *Contributor) GetGravatarID() string { + if c == nil || c.GravatarID == nil { return "" } - return *d.State + return *c.GravatarID } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (d *DismissStaleReviewsOnPushChanges) GetFrom() bool { - if d == nil || d.From == nil { - return false +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" } - return *d.From + return *c.HTMLURL } -// GetClientPayload returns the ClientPayload field if it's non-nil, zero value otherwise. -func (d *DispatchRequestOptions) GetClientPayload() json.RawMessage { - if d == nil || d.ClientPayload == nil { - return json.RawMessage{} +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *Contributor) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return *d.ClientPayload + return *c.ID } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetBody() string { - if d == nil || d.Body == nil { +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *Contributor) GetLogin() string { + if c == nil || c.Login == nil { return "" } - return *d.Body + return *c.Login } -// GetLine returns the Line field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetLine() int { - if d == nil || d.Line == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *Contributor) GetName() string { + if c == nil || c.Name == nil { + return "" } - return *d.Line + return *c.Name } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetPath() string { - if d == nil || d.Path == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *Contributor) GetNodeID() string { + if c == nil || c.NodeID == nil { return "" } - return *d.Path + return *c.NodeID } -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetPosition() int { - if d == nil || d.Position == nil { - return 0 +// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetOrganizationsURL() string { + if c == nil || c.OrganizationsURL == nil { + return "" } - return *d.Position + return *c.OrganizationsURL } -// GetSide returns the Side field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetSide() string { - if d == nil || d.Side == nil { +// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetReceivedEventsURL() string { + if c == nil || c.ReceivedEventsURL == nil { return "" } - return *d.Side + return *c.ReceivedEventsURL } -// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetStartLine() int { - if d == nil || d.StartLine == nil { - return 0 +// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetReposURL() string { + if c == nil || c.ReposURL == nil { + return "" } - return *d.StartLine + return *c.ReposURL } -// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetStartSide() string { - if d == nil || d.StartSide == nil { - return "" +// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. +func (c *Contributor) GetSiteAdmin() bool { + if c == nil || c.SiteAdmin == nil { + return false } - return *d.StartSide + return *c.SiteAdmin } -// GetRef returns the Ref field. -func (e *EditBase) GetRef() *EditRef { - if e == nil { - return nil +// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetStarredURL() string { + if c == nil || c.StarredURL == nil { + return "" } - return e.Ref + return *c.StarredURL } -// GetSHA returns the SHA field. -func (e *EditBase) GetSHA() *EditSHA { - if e == nil { - return nil +// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetSubscriptionsURL() string { + if c == nil || c.SubscriptionsURL == nil { + return "" } - return e.SHA + return *c.SubscriptionsURL } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditBody) GetFrom() string { - if e == nil || e.From == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *Contributor) GetType() string { + if c == nil || c.Type == nil { return "" } - return *e.From + return *c.Type } -// GetBase returns the Base field. -func (e *EditChange) GetBase() *EditBase { - if e == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *Contributor) GetURL() string { + if c == nil || c.URL == nil { + return "" } - return e.Base + return *c.URL } -// GetBody returns the Body field. -func (e *EditChange) GetBody() *EditBody { - if e == nil { - return nil +// GetApprovalPolicy returns the ApprovalPolicy field. +func (c *ContributorApprovalPermissions) GetApprovalPolicy() string { + if c == nil { + return "" } - return e.Body + return c.ApprovalPolicy } -// GetDefaultBranch returns the DefaultBranch field. -func (e *EditChange) GetDefaultBranch() *EditDefaultBranch { - if e == nil { +// GetAuthor returns the Author field. +func (c *ContributorStats) GetAuthor() *Contributor { + if c == nil { return nil } - return e.DefaultBranch + return c.Author } -// GetOwner returns the Owner field. -func (e *EditChange) GetOwner() *EditOwner { - if e == nil { - return nil +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (c *ContributorStats) GetTotal() int { + if c == nil || c.Total == nil { + return 0 } - return e.Owner + return *c.Total } -// GetRepo returns the Repo field. -func (e *EditChange) GetRepo() *EditRepo { - if e == nil { +// GetWeeks returns the Weeks slice if it's non-nil, nil otherwise. +func (c *ContributorStats) GetWeeks() []*WeeklyStats { + if c == nil || c.Weeks == nil { return nil } - return e.Repo + return c.Weeks } -// GetTitle returns the Title field. -func (e *EditChange) GetTitle() *EditTitle { - if e == nil { +// GetCustomAllowlist returns the CustomAllowlist slice if it's non-nil, nil otherwise. +func (c *CopilotCloudAgentConfiguration) GetCustomAllowlist() []string { + if c == nil || c.CustomAllowlist == nil { return nil } - return e.Title + return c.CustomAllowlist } -// GetTopics returns the Topics field. -func (e *EditChange) GetTopics() *EditTopics { - if e == nil { +// GetEnabledTools returns the EnabledTools field. +func (c *CopilotCloudAgentConfiguration) GetEnabledTools() *CopilotCloudAgentEnabledTools { + if c == nil { return nil } - return e.Topics + return c.EnabledTools } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditDefaultBranch) GetFrom() string { - if e == nil || e.From == nil { - return "" +// GetIsFirewallEnabled returns the IsFirewallEnabled field. +func (c *CopilotCloudAgentConfiguration) GetIsFirewallEnabled() bool { + if c == nil { + return false } - return *e.From + return c.IsFirewallEnabled } -// GetOwnerInfo returns the OwnerInfo field. -func (e *EditOwner) GetOwnerInfo() *OwnerInfo { - if e == nil { - return nil +// GetIsFirewallRecommendedAllowlistEnabled returns the IsFirewallRecommendedAllowlistEnabled field. +func (c *CopilotCloudAgentConfiguration) GetIsFirewallRecommendedAllowlistEnabled() bool { + if c == nil { + return false } - return e.OwnerInfo + return c.IsFirewallRecommendedAllowlistEnabled } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditRef) GetFrom() string { - if e == nil || e.From == nil { - return "" +// GetMCPConfiguration returns the MCPConfiguration field. +func (c *CopilotCloudAgentConfiguration) GetMCPConfiguration() any { + if c == nil { + return nil } - return *e.From + return c.MCPConfiguration } -// GetName returns the Name field. -func (e *EditRepo) GetName() *RepoName { - if e == nil { - return nil +// GetRequireActionsWorkflowApproval returns the RequireActionsWorkflowApproval field. +func (c *CopilotCloudAgentConfiguration) GetRequireActionsWorkflowApproval() bool { + if c == nil { + return false } - return e.Name + return c.RequireActionsWorkflowApproval } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditSHA) GetFrom() string { - if e == nil || e.From == nil { - return "" +// GetCodeql returns the Codeql field. +func (c *CopilotCloudAgentEnabledTools) GetCodeql() bool { + if c == nil { + return false } - return *e.From + return c.Codeql } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditTitle) GetFrom() string { - if e == nil || e.From == nil { - return "" +// GetCopilotCodeReview returns the CopilotCodeReview field. +func (c *CopilotCloudAgentEnabledTools) GetCopilotCodeReview() bool { + if c == nil { + return false } - return *e.From + return c.CopilotCodeReview } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetAvatarURL() string { - if e == nil || e.AvatarURL == nil { - return "" +// GetDependencyVulnerabilityChecks returns the DependencyVulnerabilityChecks field. +func (c *CopilotCloudAgentEnabledTools) GetDependencyVulnerabilityChecks() bool { + if c == nil { + return false } - return *e.AvatarURL + return c.DependencyVulnerabilityChecks } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetCreatedAt() Timestamp { - if e == nil || e.CreatedAt == nil { - return Timestamp{} +// GetSecretScanning returns the SecretScanning field. +func (c *CopilotCloudAgentEnabledTools) GetSecretScanning() bool { + if c == nil { + return false } - return *e.CreatedAt + return c.SecretScanning } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetDescription() string { - if e == nil || e.Description == nil { - return "" +// GetParameters returns the Parameters field. +func (c *CopilotCodeReviewBranchRule) GetParameters() CopilotCodeReviewRuleParameters { + if c == nil { + return CopilotCodeReviewRuleParameters{} } - return *e.Description + return c.Parameters } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetHTMLURL() string { - if e == nil || e.HTMLURL == nil { - return "" +// GetReviewDraftPullRequests returns the ReviewDraftPullRequests field. +func (c *CopilotCodeReviewRuleParameters) GetReviewDraftPullRequests() bool { + if c == nil { + return false } - return *e.HTMLURL + return c.ReviewDraftPullRequests } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetID() int { - if e == nil || e.ID == nil { - return 0 +// GetReviewOnPush returns the ReviewOnPush field. +func (c *CopilotCodeReviewRuleParameters) GetReviewOnPush() bool { + if c == nil { + return false } - return *e.ID + return c.ReviewOnPush } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetName() string { - if e == nil || e.Name == nil { - return "" +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 } - return *e.Name + return *c.CodeAcceptanceActivityCount } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetNodeID() string { - if e == nil || e.NodeID == nil { - return "" +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 } - return *e.NodeID + return *c.CodeGenerationActivityCount } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetSlug() string { - if e == nil || e.Slug == nil { - return "" +// GetDailyActiveCLIUsers returns the DailyActiveCLIUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCLIUsers() int { + if c == nil || c.DailyActiveCLIUsers == nil { + return 0 } - return *e.Slug + return *c.DailyActiveCLIUsers } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetUpdatedAt() Timestamp { - if e == nil || e.UpdatedAt == nil { - return Timestamp{} +// GetDailyActiveCopilotAppUsers returns the DailyActiveCopilotAppUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCopilotAppUsers() int { + if c == nil || c.DailyActiveCopilotAppUsers == nil { + return 0 } - return *e.UpdatedAt + return *c.DailyActiveCopilotAppUsers } -// GetWebsiteURL returns the WebsiteURL field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetWebsiteURL() string { - if e == nil || e.WebsiteURL == nil { - return "" +// GetDailyActiveCopilotCloudAgentUsers returns the DailyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCopilotCloudAgentUsers() int { + if c == nil || c.DailyActiveCopilotCloudAgentUsers == nil { + return 0 } - return *e.WebsiteURL + return *c.DailyActiveCopilotCloudAgentUsers } -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool { - if e == nil || e.AllowsPublicRepositories == nil { - return false +// GetDailyActiveCopilotCodeReviewUsers returns the DailyActiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveCopilotCodeReviewUsers() int { + if c == nil || c.DailyActiveCopilotCodeReviewUsers == nil { + return 0 } - return *e.AllowsPublicRepositories + return *c.DailyActiveCopilotCodeReviewUsers } -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetDefault() bool { - if e == nil || e.Default == nil { - return false +// GetDailyActiveUsers returns the DailyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyActiveUsers() int { + if c == nil || c.DailyActiveUsers == nil { + return 0 } - return *e.Default + return *c.DailyActiveUsers } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetID() int64 { - if e == nil || e.ID == nil { +// GetDailyPassiveCopilotCodeReviewUsers returns the DailyPassiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetDailyPassiveCopilotCodeReviewUsers() int { + if c == nil || c.DailyPassiveCopilotCodeReviewUsers == nil { return 0 } - return *e.ID + return *c.DailyPassiveCopilotCodeReviewUsers } -// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetInherited() bool { - if e == nil || e.Inherited == nil { - return false +// GetDay returns the Day field. +func (c *CopilotDailyMetrics) GetDay() string { + if c == nil { + return "" } - return *e.Inherited + return c.Day } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetName() string { - if e == nil || e.Name == nil { +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { return "" } - return *e.Name + return *c.EnterpriseID } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetRestrictedToWorkflows() bool { - if e == nil || e.RestrictedToWorkflows == nil { - return false +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 } - return *e.RestrictedToWorkflows + return *c.LOCAddedSum } -// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetRunnersURL() string { - if e == nil || e.RunnersURL == nil { - return "" +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 } - return *e.RunnersURL + return *c.LOCDeletedSum } -// GetSelectedOrganizationsURL returns the SelectedOrganizationsURL field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetSelectedOrganizationsURL() string { - if e == nil || e.SelectedOrganizationsURL == nil { - return "" +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 } - return *e.SelectedOrganizationsURL + return *c.LOCSuggestedToAddSum } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetVisibility() string { - if e == nil || e.Visibility == nil { - return "" +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 } - return *e.Visibility + return *c.LOCSuggestedToDeleteSum } -// GetWorkflowRestrictionsReadOnly returns the WorkflowRestrictionsReadOnly field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetWorkflowRestrictionsReadOnly() bool { - if e == nil || e.WorkflowRestrictionsReadOnly == nil { - return false +// GetMonthlyActiveAgentUsers returns the MonthlyActiveAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveAgentUsers() int { + if c == nil || c.MonthlyActiveAgentUsers == nil { + return 0 } - return *e.WorkflowRestrictionsReadOnly + return *c.MonthlyActiveAgentUsers } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroups) GetTotalCount() int { - if e == nil || e.TotalCount == nil { +// GetMonthlyActiveChatUsers returns the MonthlyActiveChatUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveChatUsers() int { + if c == nil || c.MonthlyActiveChatUsers == nil { return 0 } - return *e.TotalCount + return *c.MonthlyActiveChatUsers } -// GetAdvancedSecurityEnabledForNewRepositories returns the AdvancedSecurityEnabledForNewRepositories field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetAdvancedSecurityEnabledForNewRepositories() bool { - if e == nil || e.AdvancedSecurityEnabledForNewRepositories == nil { - return false +// GetMonthlyActiveCopilotCloudAgentUsers returns the MonthlyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveCopilotCloudAgentUsers() int { + if c == nil || c.MonthlyActiveCopilotCloudAgentUsers == nil { + return 0 } - return *e.AdvancedSecurityEnabledForNewRepositories + return *c.MonthlyActiveCopilotCloudAgentUsers } -// GetSecretScanningEnabledForNewRepositories returns the SecretScanningEnabledForNewRepositories field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningEnabledForNewRepositories() bool { - if e == nil || e.SecretScanningEnabledForNewRepositories == nil { - return false +// GetMonthlyActiveCopilotCodeReviewUsers returns the MonthlyActiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveCopilotCodeReviewUsers() int { + if c == nil || c.MonthlyActiveCopilotCodeReviewUsers == nil { + return 0 } - return *e.SecretScanningEnabledForNewRepositories + return *c.MonthlyActiveCopilotCodeReviewUsers } -// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionCustomLink() string { - if e == nil || e.SecretScanningPushProtectionCustomLink == nil { - return "" +// GetMonthlyActiveUsers returns the MonthlyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyActiveUsers() int { + if c == nil || c.MonthlyActiveUsers == nil { + return 0 } - return *e.SecretScanningPushProtectionCustomLink + return *c.MonthlyActiveUsers } -// GetSecretScanningPushProtectionEnabledForNewRepositories returns the SecretScanningPushProtectionEnabledForNewRepositories field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionEnabledForNewRepositories() bool { - if e == nil || e.SecretScanningPushProtectionEnabledForNewRepositories == nil { - return false +// GetMonthlyPassiveCopilotCodeReviewUsers returns the MonthlyPassiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetMonthlyPassiveCopilotCodeReviewUsers() int { + if c == nil || c.MonthlyPassiveCopilotCodeReviewUsers == nil { + return 0 } - return *e.SecretScanningPushProtectionEnabledForNewRepositories + return *c.MonthlyPassiveCopilotCodeReviewUsers } -// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningValidityChecksEnabled() bool { - if e == nil || e.SecretScanningValidityChecksEnabled == nil { - return false +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" } - return *e.SecretScanningValidityChecksEnabled + return *c.OrganizationID } -// GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. -func (e *Environment) GetCanAdminsBypass() bool { - if e == nil || e.CanAdminsBypass == nil { - return false +// GetPullRequests returns the PullRequests field. +func (c *CopilotDailyMetrics) GetPullRequests() *CopilotMetricsPullRequests { + if c == nil { + return nil } - return *e.CanAdminsBypass + return c.PullRequests } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (e *Environment) GetCreatedAt() Timestamp { - if e == nil || e.CreatedAt == nil { - return Timestamp{} +// GetTotalsBy3rdPartyAgent returns the TotalsBy3rdPartyAgent slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsBy3rdPartyAgent() []*CopilotMetricsThirdPartyAgent { + if c == nil || c.TotalsBy3rdPartyAgent == nil { + return nil } - return *e.CreatedAt + return c.TotalsBy3rdPartyAgent } -// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. -func (e *Environment) GetDeploymentBranchPolicy() *BranchPolicy { - if e == nil { +// GetTotalsByAIAdoptionPhase returns the TotalsByAIAdoptionPhase slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByAIAdoptionPhase() []*CopilotMetricsAIAdoptionPhaseTotals { + if c == nil || c.TotalsByAIAdoptionPhase == nil { return nil } - return e.DeploymentBranchPolicy + return c.TotalsByAIAdoptionPhase } -// GetEnvironmentName returns the EnvironmentName field if it's non-nil, zero value otherwise. -func (e *Environment) GetEnvironmentName() string { - if e == nil || e.EnvironmentName == nil { - return "" +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotDailyMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil } - return *e.EnvironmentName + return c.TotalsByCLI } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (e *Environment) GetHTMLURL() string { - if e == nil || e.HTMLURL == nil { - return "" +// GetTotalsByCopilotApp returns the TotalsByCopilotApp field. +func (c *CopilotDailyMetrics) GetTotalsByCopilotApp() *CopilotMetricsCopilotApp { + if c == nil { + return nil } - return *e.HTMLURL + return c.TotalsByCopilotApp } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *Environment) GetID() int64 { - if e == nil || e.ID == nil { - return 0 +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil } - return *e.ID + return c.TotalsByFeature } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (e *Environment) GetName() string { - if e == nil || e.Name == nil { - return "" +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByIDE() []*CopilotMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil } - return *e.Name + return c.TotalsByIDE } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (e *Environment) GetNodeID() string { - if e == nil || e.NodeID == nil { - return "" +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil } - return *e.NodeID + return c.TotalsByLanguageFeature } -// GetOwner returns the Owner field if it's non-nil, zero value otherwise. -func (e *Environment) GetOwner() string { - if e == nil || e.Owner == nil { - return "" +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil } - return *e.Owner + return c.TotalsByLanguageModel } -// GetRepo returns the Repo field if it's non-nil, zero value otherwise. -func (e *Environment) GetRepo() string { - if e == nil || e.Repo == nil { - return "" +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil } - return *e.Repo + return c.TotalsByModelFeature } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (e *Environment) GetUpdatedAt() Timestamp { - if e == nil || e.UpdatedAt == nil { - return Timestamp{} +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 } - return *e.UpdatedAt + return *c.UserInitiatedInteractionCount } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (e *Environment) GetURL() string { - if e == nil || e.URL == nil { - return "" +// GetWeeklyActiveCopilotCloudAgentUsers returns the WeeklyActiveCopilotCloudAgentUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyActiveCopilotCloudAgentUsers() int { + if c == nil || c.WeeklyActiveCopilotCloudAgentUsers == nil { + return 0 } - return *e.URL + return *c.WeeklyActiveCopilotCloudAgentUsers } -// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. -func (e *Environment) GetWaitTimer() int { - if e == nil || e.WaitTimer == nil { +// GetWeeklyActiveCopilotCodeReviewUsers returns the WeeklyActiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyActiveCopilotCodeReviewUsers() int { + if c == nil || c.WeeklyActiveCopilotCodeReviewUsers == nil { return 0 } - return *e.WaitTimer + return *c.WeeklyActiveCopilotCodeReviewUsers } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (e *EnvResponse) GetTotalCount() int { - if e == nil || e.TotalCount == nil { +// GetWeeklyActiveUsers returns the WeeklyActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyActiveUsers() int { + if c == nil || c.WeeklyActiveUsers == nil { return 0 } - return *e.TotalCount + return *c.WeeklyActiveUsers } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *EnvReviewers) GetID() int64 { - if e == nil || e.ID == nil { +// GetWeeklyPassiveCopilotCodeReviewUsers returns the WeeklyPassiveCopilotCodeReviewUsers field if it's non-nil, zero value otherwise. +func (c *CopilotDailyMetrics) GetWeeklyPassiveCopilotCodeReviewUsers() int { + if c == nil || c.WeeklyPassiveCopilotCodeReviewUsers == nil { return 0 } - return *e.ID + return *c.WeeklyPassiveCopilotCodeReviewUsers } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (e *EnvReviewers) GetType() string { - if e == nil || e.Type == nil { - return "" +// GetDownloadLinks returns the DownloadLinks slice if it's non-nil, nil otherwise. +func (c *CopilotDailyMetricsReport) GetDownloadLinks() []string { + if c == nil || c.DownloadLinks == nil { + return nil } - return *e.Type + return c.DownloadLinks } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (e *ErrorBlock) GetCreatedAt() Timestamp { - if e == nil || e.CreatedAt == nil { - return Timestamp{} +// GetReportDay returns the ReportDay field. +func (c *CopilotDailyMetricsReport) GetReportDay() string { + if c == nil { + return "" } - return *e.CreatedAt + return c.ReportDay } -// GetBlock returns the Block field. -func (e *ErrorResponse) GetBlock() *ErrorBlock { - if e == nil { +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomChat) GetModels() []*CopilotDotcomChatModel { + if c == nil || c.Models == nil { return nil } - return e.Block + return c.Models } -// GetActor returns the Actor field. -func (e *Event) GetActor() *User { - if e == nil { - return nil +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomChat) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return e.Actor + return c.TotalEngagedUsers } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (e *Event) GetCreatedAt() Timestamp { - if e == nil || e.CreatedAt == nil { - return Timestamp{} +// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. +func (c *CopilotDotcomChatModel) GetCustomModelTrainingDate() string { + if c == nil || c.CustomModelTrainingDate == nil { + return "" } - return *e.CreatedAt + return *c.CustomModelTrainingDate } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *Event) GetID() string { - if e == nil || e.ID == nil { +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotDotcomChatModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetName returns the Name field. +func (c *CopilotDotcomChatModel) GetName() string { + if c == nil { return "" } - return *e.ID + return c.Name } -// GetOrg returns the Org field. -func (e *Event) GetOrg() *Organization { - if e == nil { +// GetTotalChats returns the TotalChats field. +func (c *CopilotDotcomChatModel) GetTotalChats() int { + if c == nil { + return 0 + } + return c.TotalChats +} + +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomChatModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomPullRequests) GetRepositories() []*CopilotDotcomPullRequestsRepository { + if c == nil || c.Repositories == nil { return nil } - return e.Org + return c.Repositories } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (e *Event) GetPublic() bool { - if e == nil || e.Public == nil { - return false +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequests) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return *e.Public + return c.TotalEngagedUsers } -// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. -func (e *Event) GetRawPayload() json.RawMessage { - if e == nil || e.RawPayload == nil { - return json.RawMessage{} +// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. +func (c *CopilotDotcomPullRequestsModel) GetCustomModelTrainingDate() string { + if c == nil || c.CustomModelTrainingDate == nil { + return "" } - return *e.RawPayload + return *c.CustomModelTrainingDate } -// GetRepo returns the Repo field. -func (e *Event) GetRepo() *Repository { - if e == nil { - return nil +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotDotcomPullRequestsModel) GetIsCustomModel() bool { + if c == nil { + return false } - return e.Repo + return c.IsCustomModel } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (e *Event) GetType() string { - if e == nil || e.Type == nil { +// GetName returns the Name field. +func (c *CopilotDotcomPullRequestsModel) GetName() string { + if c == nil { return "" } - return *e.Type + return c.Name } -// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. -func (e *ExternalGroup) GetGroupID() int64 { - if e == nil || e.GroupID == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequestsModel) GetTotalEngagedUsers() int { + if c == nil { return 0 } - return *e.GroupID + return c.TotalEngagedUsers } -// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. -func (e *ExternalGroup) GetGroupName() string { - if e == nil || e.GroupName == nil { - return "" +// GetTotalPRSummariesCreated returns the TotalPRSummariesCreated field. +func (c *CopilotDotcomPullRequestsModel) GetTotalPRSummariesCreated() int { + if c == nil { + return 0 } - return *e.GroupName + return c.TotalPRSummariesCreated } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (e *ExternalGroup) GetUpdatedAt() Timestamp { - if e == nil || e.UpdatedAt == nil { - return Timestamp{} +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotDotcomPullRequestsRepository) GetModels() []*CopilotDotcomPullRequestsModel { + if c == nil || c.Models == nil { + return nil } - return *e.UpdatedAt + return c.Models } -// GetMemberEmail returns the MemberEmail field if it's non-nil, zero value otherwise. -func (e *ExternalGroupMember) GetMemberEmail() string { - if e == nil || e.MemberEmail == nil { +// GetName returns the Name field. +func (c *CopilotDotcomPullRequestsRepository) GetName() string { + if c == nil { return "" } - return *e.MemberEmail + return c.Name } -// GetMemberID returns the MemberID field if it's non-nil, zero value otherwise. -func (e *ExternalGroupMember) GetMemberID() int64 { - if e == nil || e.MemberID == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotDotcomPullRequestsRepository) GetTotalEngagedUsers() int { + if c == nil { return 0 } - return *e.MemberID + return c.TotalEngagedUsers } -// GetMemberLogin returns the MemberLogin field if it's non-nil, zero value otherwise. -func (e *ExternalGroupMember) GetMemberLogin() string { - if e == nil || e.MemberLogin == nil { - return "" +// GetEditors returns the Editors slice if it's non-nil, nil otherwise. +func (c *CopilotIDEChat) GetEditors() []*CopilotIDEChatEditor { + if c == nil || c.Editors == nil { + return nil } - return *e.MemberLogin + return c.Editors } -// GetMemberName returns the MemberName field if it's non-nil, zero value otherwise. -func (e *ExternalGroupMember) GetMemberName() string { - if e == nil || e.MemberName == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChat) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotIDEChatEditor) GetModels() []*CopilotIDEChatModel { + if c == nil || c.Models == nil { + return nil + } + return c.Models +} + +// GetName returns the Name field. +func (c *CopilotIDEChatEditor) GetName() string { + if c == nil { return "" } - return *e.MemberName + return c.Name } -// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. -func (e *ExternalGroupTeam) GetTeamID() int64 { - if e == nil || e.TeamID == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChatEditor) GetTotalEngagedUsers() int { + if c == nil { return 0 } - return *e.TeamID + return c.TotalEngagedUsers } -// GetTeamName returns the TeamName field if it's non-nil, zero value otherwise. -func (e *ExternalGroupTeam) GetTeamName() string { - if e == nil || e.TeamName == nil { +// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. +func (c *CopilotIDEChatModel) GetCustomModelTrainingDate() string { + if c == nil || c.CustomModelTrainingDate == nil { return "" } - return *e.TeamName + return *c.CustomModelTrainingDate } -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (f *FeedLink) GetHRef() string { - if f == nil || f.HRef == nil { - return "" +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotIDEChatModel) GetIsCustomModel() bool { + if c == nil { + return false } - return *f.HRef + return c.IsCustomModel } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (f *FeedLink) GetType() string { - if f == nil || f.Type == nil { +// GetName returns the Name field. +func (c *CopilotIDEChatModel) GetName() string { + if c == nil { return "" } - return *f.Type + return c.Name } -// GetCurrentUser returns the CurrentUser field. -func (f *FeedLinks) GetCurrentUser() *FeedLink { - if f == nil { - return nil +// GetTotalChatCopyEvents returns the TotalChatCopyEvents field. +func (c *CopilotIDEChatModel) GetTotalChatCopyEvents() int { + if c == nil { + return 0 } - return f.CurrentUser + return c.TotalChatCopyEvents } -// GetCurrentUserActor returns the CurrentUserActor field. -func (f *FeedLinks) GetCurrentUserActor() *FeedLink { - if f == nil { - return nil +// GetTotalChatInsertionEvents returns the TotalChatInsertionEvents field. +func (c *CopilotIDEChatModel) GetTotalChatInsertionEvents() int { + if c == nil { + return 0 } - return f.CurrentUserActor + return c.TotalChatInsertionEvents } -// GetCurrentUserOrganization returns the CurrentUserOrganization field. -func (f *FeedLinks) GetCurrentUserOrganization() *FeedLink { - if f == nil { - return nil +// GetTotalChats returns the TotalChats field. +func (c *CopilotIDEChatModel) GetTotalChats() int { + if c == nil { + return 0 } - return f.CurrentUserOrganization + return c.TotalChats } -// GetCurrentUserPublic returns the CurrentUserPublic field. -func (f *FeedLinks) GetCurrentUserPublic() *FeedLink { - if f == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDEChatModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetEditors returns the Editors slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletions) GetEditors() []*CopilotIDECodeCompletionsEditor { + if c == nil || c.Editors == nil { return nil } - return f.CurrentUserPublic + return c.Editors } -// GetTimeline returns the Timeline field. -func (f *FeedLinks) GetTimeline() *FeedLink { - if f == nil { +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletions) GetLanguages() []*CopilotIDECodeCompletionsLanguage { + if c == nil || c.Languages == nil { return nil } - return f.Timeline + return c.Languages } -// GetUser returns the User field. -func (f *FeedLinks) GetUser() *FeedLink { - if f == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletions) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetModels returns the Models slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletionsEditor) GetModels() []*CopilotIDECodeCompletionsModel { + if c == nil || c.Models == nil { return nil } - return f.User + return c.Models } -// GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserActorURL() string { - if f == nil || f.CurrentUserActorURL == nil { +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsEditor) GetName() string { + if c == nil { return "" } - return *f.CurrentUserActorURL + return c.Name } -// GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserOrganizationURL() string { - if f == nil || f.CurrentUserOrganizationURL == nil { - return "" +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsEditor) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return *f.CurrentUserOrganizationURL + return c.TotalEngagedUsers } -// GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserPublicURL() string { - if f == nil || f.CurrentUserPublicURL == nil { +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsLanguage) GetName() string { + if c == nil { return "" } - return *f.CurrentUserPublicURL + return c.Name } -// GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserURL() string { - if f == nil || f.CurrentUserURL == nil { +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsLanguage) GetTotalEngagedUsers() int { + if c == nil { + return 0 + } + return c.TotalEngagedUsers +} + +// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. +func (c *CopilotIDECodeCompletionsModel) GetCustomModelTrainingDate() string { + if c == nil || c.CustomModelTrainingDate == nil { return "" } - return *f.CurrentUserURL + return *c.CustomModelTrainingDate } -// GetLinks returns the Links field. -func (f *Feeds) GetLinks() *FeedLinks { - if f == nil { +// GetIsCustomModel returns the IsCustomModel field. +func (c *CopilotIDECodeCompletionsModel) GetIsCustomModel() bool { + if c == nil { + return false + } + return c.IsCustomModel +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (c *CopilotIDECodeCompletionsModel) GetLanguages() []*CopilotIDECodeCompletionsModelLanguage { + if c == nil || c.Languages == nil { return nil } - return f.Links + return c.Languages } -// GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetTimelineURL() string { - if f == nil || f.TimelineURL == nil { +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsModel) GetName() string { + if c == nil { return "" } - return *f.TimelineURL + return c.Name } -// GetUserURL returns the UserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetUserURL() string { - if f == nil || f.UserURL == nil { - return "" +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsModel) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return *f.UserURL + return c.TotalEngagedUsers } -// GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise. -func (f *FirstPatchedVersion) GetIdentifier() string { - if f == nil || f.Identifier == nil { +// GetName returns the Name field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetName() string { + if c == nil { return "" } - return *f.Identifier + return c.Name } -// GetForkee returns the Forkee field. -func (f *ForkEvent) GetForkee() *Repository { - if f == nil { - return nil +// GetTotalCodeAcceptances returns the TotalCodeAcceptances field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeAcceptances() int { + if c == nil { + return 0 } - return f.Forkee + return c.TotalCodeAcceptances } -// GetInstallation returns the Installation field. -func (f *ForkEvent) GetInstallation() *Installation { - if f == nil { - return nil +// GetTotalCodeLinesAccepted returns the TotalCodeLinesAccepted field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeLinesAccepted() int { + if c == nil { + return 0 } - return f.Installation + return c.TotalCodeLinesAccepted } -// GetRepo returns the Repo field. -func (f *ForkEvent) GetRepo() *Repository { - if f == nil { - return nil +// GetTotalCodeLinesSuggested returns the TotalCodeLinesSuggested field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeLinesSuggested() int { + if c == nil { + return 0 } - return f.Repo + return c.TotalCodeLinesSuggested } -// GetSender returns the Sender field. -func (f *ForkEvent) GetSender() *User { - if f == nil { - return nil +// GetTotalCodeSuggestions returns the TotalCodeSuggestions field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalCodeSuggestions() int { + if c == nil { + return 0 } - return f.Sender + return c.TotalCodeSuggestions } -// GetWorkFolder returns the WorkFolder field if it's non-nil, zero value otherwise. -func (g *GenerateJITConfigRequest) GetWorkFolder() string { - if g == nil || g.WorkFolder == nil { - return "" +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotIDECodeCompletionsModelLanguage) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return *g.WorkFolder + return c.TotalEngagedUsers } -// GetPreviousTagName returns the PreviousTagName field if it's non-nil, zero value otherwise. -func (g *GenerateNotesOptions) GetPreviousTagName() string { - if g == nil || g.PreviousTagName == nil { - return "" +// GetCopilotDotcomChat returns the CopilotDotcomChat field. +func (c *CopilotMetrics) GetCopilotDotcomChat() *CopilotDotcomChat { + if c == nil { + return nil } - return *g.PreviousTagName + return c.CopilotDotcomChat } -// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. -func (g *GenerateNotesOptions) GetTargetCommitish() string { - if g == nil || g.TargetCommitish == nil { - return "" +// GetCopilotDotcomPullRequests returns the CopilotDotcomPullRequests field. +func (c *CopilotMetrics) GetCopilotDotcomPullRequests() *CopilotDotcomPullRequests { + if c == nil { + return nil } - return *g.TargetCommitish + return c.CopilotDotcomPullRequests } -// GetInclude returns the Include field if it's non-nil, zero value otherwise. -func (g *GetAuditLogOptions) GetInclude() string { - if g == nil || g.Include == nil { - return "" +// GetCopilotIDEChat returns the CopilotIDEChat field. +func (c *CopilotMetrics) GetCopilotIDEChat() *CopilotIDEChat { + if c == nil { + return nil } - return *g.Include + return c.CopilotIDEChat } -// GetOrder returns the Order field if it's non-nil, zero value otherwise. -func (g *GetAuditLogOptions) GetOrder() string { - if g == nil || g.Order == nil { - return "" +// GetCopilotIDECodeCompletions returns the CopilotIDECodeCompletions field. +func (c *CopilotMetrics) GetCopilotIDECodeCompletions() *CopilotIDECodeCompletions { + if c == nil { + return nil } - return *g.Order + return c.CopilotIDECodeCompletions } -// GetPhrase returns the Phrase field if it's non-nil, zero value otherwise. -func (g *GetAuditLogOptions) GetPhrase() string { - if g == nil || g.Phrase == nil { +// GetDate returns the Date field. +func (c *CopilotMetrics) GetDate() string { + if c == nil { return "" } - return *g.Phrase + return c.Date } -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (g *Gist) GetComments() int { - if g == nil || g.Comments == nil { +// GetTotalActiveUsers returns the TotalActiveUsers field if it's non-nil, zero value otherwise. +func (c *CopilotMetrics) GetTotalActiveUsers() int { + if c == nil || c.TotalActiveUsers == nil { return 0 } - return *g.Comments + return *c.TotalActiveUsers } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *Gist) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} +// GetTotalEngagedUsers returns the TotalEngagedUsers field if it's non-nil, zero value otherwise. +func (c *CopilotMetrics) GetTotalEngagedUsers() int { + if c == nil || c.TotalEngagedUsers == nil { + return 0 } - return *g.CreatedAt + return *c.TotalEngagedUsers } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (g *Gist) GetDescription() string { - if g == nil || g.Description == nil { +// GetPhase returns the Phase field. +func (c *CopilotMetricsAIAdoptionPhase) GetPhase() string { + if c == nil { return "" } - return *g.Description + return c.Phase } -// GetFiles returns the Files map if it's non-nil, an empty map otherwise. -func (g *Gist) GetFiles() map[GistFilename]GistFile { - if g == nil || g.Files == nil { - return map[GistFilename]GistFile{} +// GetPhaseNumber returns the PhaseNumber field. +func (c *CopilotMetricsAIAdoptionPhase) GetPhaseNumber() int { + if c == nil { + return 0 } - return g.Files + return c.PhaseNumber } -// GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPullURL() string { - if g == nil || g.GitPullURL == nil { +// GetVersion returns the Version field. +func (c *CopilotMetricsAIAdoptionPhase) GetVersion() string { + if c == nil { return "" } - return *g.GitPullURL + return c.Version } -// GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPushURL() string { - if g == nil || g.GitPushURL == nil { - return "" +// GetAvgCodeAcceptanceActivities returns the AvgCodeAcceptanceActivities field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgCodeAcceptanceActivities() float64 { + if c == nil { + return 0 } - return *g.GitPushURL + return c.AvgCodeAcceptanceActivities } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetHTMLURL() string { - if g == nil || g.HTMLURL == nil { - return "" +// GetAvgCodeGenerationActivities returns the AvgCodeGenerationActivities field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgCodeGenerationActivities() float64 { + if c == nil { + return 0 } - return *g.HTMLURL + return c.AvgCodeGenerationActivities } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Gist) GetID() string { - if g == nil || g.ID == nil { - return "" +// GetAvgLOCAdded returns the AvgLOCAdded field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgLOCAdded() float64 { + if c == nil { + return 0 } - return *g.ID + return c.AvgLOCAdded } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *Gist) GetNodeID() string { - if g == nil || g.NodeID == nil { - return "" +// GetAvgLOCDeleted returns the AvgLOCDeleted field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgLOCDeleted() float64 { + if c == nil { + return 0 } - return *g.NodeID + return c.AvgLOCDeleted } -// GetOwner returns the Owner field. -func (g *Gist) GetOwner() *User { - if g == nil { - return nil +// GetAvgPullRequestsCreated returns the AvgPullRequestsCreated field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsCreated() float64 { + if c == nil { + return 0 } - return g.Owner + return c.AvgPullRequestsCreated } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (g *Gist) GetPublic() bool { - if g == nil || g.Public == nil { - return false +// GetAvgPullRequestsMedianMinutesToMerge returns the AvgPullRequestsMedianMinutesToMerge field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsMedianMinutesToMerge() float64 { + if c == nil { + return 0 } - return *g.Public + return c.AvgPullRequestsMedianMinutesToMerge } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *Gist) GetUpdatedAt() Timestamp { - if g == nil || g.UpdatedAt == nil { - return Timestamp{} +// GetAvgPullRequestsMerged returns the AvgPullRequestsMerged field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsMerged() float64 { + if c == nil { + return 0 } - return *g.UpdatedAt + return c.AvgPullRequestsMerged } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (g *GistComment) GetBody() string { - if g == nil || g.Body == nil { - return "" +// GetAvgPullRequestsMinutesToReview returns the AvgPullRequestsMinutesToReview field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsMinutesToReview() float64 { + if c == nil { + return 0 } - return *g.Body + return c.AvgPullRequestsMinutesToReview } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GistComment) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} +// GetAvgPullRequestsReviewCycles returns the AvgPullRequestsReviewCycles field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsReviewCycles() float64 { + if c == nil { + return 0 } - return *g.CreatedAt + return c.AvgPullRequestsReviewCycles } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistComment) GetID() int64 { - if g == nil || g.ID == nil { +// GetAvgPullRequestsReviewed returns the AvgPullRequestsReviewed field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgPullRequestsReviewed() float64 { + if c == nil { return 0 } - return *g.ID + return c.AvgPullRequestsReviewed } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistComment) GetURL() string { - if g == nil || g.URL == nil { - return "" +// GetAvgUserInitiatedInteractions returns the AvgUserInitiatedInteractions field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetAvgUserInitiatedInteractions() float64 { + if c == nil { + return 0 } - return *g.URL + return c.AvgUserInitiatedInteractions } -// GetUser returns the User field. -func (g *GistComment) GetUser() *User { - if g == nil { - return nil +// GetPhase returns the Phase field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetPhase() string { + if c == nil { + return "" } - return g.User + return c.Phase } -// GetChangeStatus returns the ChangeStatus field. -func (g *GistCommit) GetChangeStatus() *CommitStats { - if g == nil { - return nil +// GetPhaseNumber returns the PhaseNumber field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetPhaseNumber() int { + if c == nil { + return 0 } - return g.ChangeStatus + return c.PhaseNumber } -// GetCommittedAt returns the CommittedAt field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetCommittedAt() Timestamp { - if g == nil || g.CommittedAt == nil { - return Timestamp{} +// GetTotalEngagedUsers returns the TotalEngagedUsers field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetTotalEngagedUsers() int { + if c == nil { + return 0 } - return *g.CommittedAt + return c.TotalEngagedUsers } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetNodeID() string { - if g == nil || g.NodeID == nil { - return "" +// GetTotalPullRequestsMerged returns the TotalPullRequestsMerged field. +func (c *CopilotMetricsAIAdoptionPhaseTotals) GetTotalPullRequestsMerged() int { + if c == nil { + return 0 } - return *g.NodeID + return c.TotalPullRequestsMerged } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetURL() string { - if g == nil || g.URL == nil { - return "" +// GetChatPanelAgentMode returns the ChatPanelAgentMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelAgentMode() int { + if c == nil || c.ChatPanelAgentMode == nil { + return 0 } - return *g.URL + return *c.ChatPanelAgentMode } -// GetUser returns the User field. -func (g *GistCommit) GetUser() *User { - if g == nil { - return nil +// GetChatPanelAskMode returns the ChatPanelAskMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelAskMode() int { + if c == nil || c.ChatPanelAskMode == nil { + return 0 } - return g.User + return *c.ChatPanelAskMode } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetVersion() string { - if g == nil || g.Version == nil { - return "" +// GetChatPanelCustomMode returns the ChatPanelCustomMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelCustomMode() int { + if c == nil || c.ChatPanelCustomMode == nil { + return 0 } - return *g.Version + return *c.ChatPanelCustomMode } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (g *GistFile) GetContent() string { - if g == nil || g.Content == nil { - return "" +// GetChatPanelEditMode returns the ChatPanelEditMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelEditMode() int { + if c == nil || c.ChatPanelEditMode == nil { + return 0 } - return *g.Content + return *c.ChatPanelEditMode } -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (g *GistFile) GetFilename() string { - if g == nil || g.Filename == nil { - return "" +// GetChatPanelUnknownMode returns the ChatPanelUnknownMode field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsChatPanel) GetChatPanelUnknownMode() int { + if c == nil || c.ChatPanelUnknownMode == nil { + return 0 } - return *g.Filename + return *c.ChatPanelUnknownMode } -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (g *GistFile) GetLanguage() string { - if g == nil || g.Language == nil { - return "" +// GetLastKnownCLIVersion returns the LastKnownCLIVersion field. +func (c *CopilotMetricsCLI) GetLastKnownCLIVersion() *CopilotMetricsCLIVersion { + if c == nil { + return nil } - return *g.Language + return c.LastKnownCLIVersion } -// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. -func (g *GistFile) GetRawURL() string { - if g == nil || g.RawURL == nil { - return "" +// GetPromptCount returns the PromptCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetPromptCount() int { + if c == nil || c.PromptCount == nil { + return 0 } - return *g.RawURL + return *c.PromptCount } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (g *GistFile) GetSize() int { - if g == nil || g.Size == nil { +// GetRequestCount returns the RequestCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetRequestCount() int { + if c == nil || c.RequestCount == nil { return 0 } - return *g.Size + return *c.RequestCount } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GistFile) GetType() string { - if g == nil || g.Type == nil { - return "" +// GetSessionCount returns the SessionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLI) GetSessionCount() int { + if c == nil || c.SessionCount == nil { + return 0 } - return *g.Type + return *c.SessionCount } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GistFork) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} +// GetTokenUsage returns the TokenUsage field. +func (c *CopilotMetricsCLI) GetTokenUsage() *CopilotMetricsCLITokenUsage { + if c == nil { + return nil } - return *g.CreatedAt + return c.TokenUsage } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistFork) GetID() string { - if g == nil || g.ID == nil { - return "" +// GetAvgTokensPerRequest returns the AvgTokensPerRequest field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetAvgTokensPerRequest() float64 { + if c == nil || c.AvgTokensPerRequest == nil { + return 0 } - return *g.ID + return *c.AvgTokensPerRequest } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *GistFork) GetNodeID() string { - if g == nil || g.NodeID == nil { +// GetOutputTokensSum returns the OutputTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetOutputTokensSum() int { + if c == nil || c.OutputTokensSum == nil { + return 0 + } + return *c.OutputTokensSum +} + +// GetPromptTokensSum returns the PromptTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLITokenUsage) GetPromptTokensSum() int { + if c == nil || c.PromptTokensSum == nil { + return 0 + } + return *c.PromptTokensSum +} + +// GetCLIVersion returns the CLIVersion field. +func (c *CopilotMetricsCLIVersion) GetCLIVersion() string { + if c == nil { return "" } - return *g.NodeID + return c.CLIVersion } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *GistFork) GetUpdatedAt() Timestamp { - if g == nil || g.UpdatedAt == nil { +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCLIVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { return Timestamp{} } - return *g.UpdatedAt + return *c.SampledAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistFork) GetURL() string { - if g == nil || g.URL == nil { - return "" +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 } - return *g.URL + return *c.CodeAcceptanceActivityCount } -// GetUser returns the User field. -func (g *GistFork) GetUser() *User { - if g == nil { - return nil +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 } - return g.User + return *c.CodeGenerationActivityCount } -// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetPrivateGists() int { - if g == nil || g.PrivateGists == nil { +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { return 0 } - return *g.PrivateGists + return *c.LOCAddedSum } -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetPublicGists() int { - if g == nil || g.PublicGists == nil { +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { return 0 } - return *g.PublicGists + return *c.LOCDeletedSum } -// GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetTotalGists() int { - if g == nil || g.TotalGists == nil { +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { return 0 } - return *g.TotalGists + return *c.LOCSuggestedToAddSum } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (g *GitHubAppAuthorizationEvent) GetAction() string { - if g == nil || g.Action == nil { - return "" +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCodeActivity) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 } - return *g.Action + return *c.LOCSuggestedToDeleteSum } -// GetInstallation returns the Installation field. -func (g *GitHubAppAuthorizationEvent) GetInstallation() *Installation { - if g == nil { - return nil +// GetPromptCount returns the PromptCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotApp) GetPromptCount() int { + if c == nil || c.PromptCount == nil { + return 0 } - return g.Installation + return *c.PromptCount } -// GetSender returns the Sender field. -func (g *GitHubAppAuthorizationEvent) GetSender() *User { - if g == nil { - return nil +// GetRequestCount returns the RequestCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotApp) GetRequestCount() int { + if c == nil || c.RequestCount == nil { + return 0 } - return g.Sender + return *c.RequestCount } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetName() string { - if g == nil || g.Name == nil { - return "" +// GetSessionCount returns the SessionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotApp) GetSessionCount() int { + if c == nil || c.SessionCount == nil { + return 0 } - return *g.Name + return *c.SessionCount } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetSource() string { - if g == nil || g.Source == nil { - return "" +// GetTokenUsage returns the TokenUsage field. +func (c *CopilotMetricsCopilotApp) GetTokenUsage() *CopilotMetricsCopilotAppTokenUsage { + if c == nil { + return nil } - return *g.Source + return c.TokenUsage } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (g *GitObject) GetSHA() string { - if g == nil || g.SHA == nil { - return "" +// GetAvgTokensPerRequest returns the AvgTokensPerRequest field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotAppTokenUsage) GetAvgTokensPerRequest() float64 { + if c == nil || c.AvgTokensPerRequest == nil { + return 0 } - return *g.SHA + return *c.AvgTokensPerRequest } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GitObject) GetType() string { - if g == nil || g.Type == nil { - return "" +// GetOutputTokensSum returns the OutputTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotAppTokenUsage) GetOutputTokensSum() int { + if c == nil || c.OutputTokensSum == nil { + return 0 } - return *g.Type + return *c.OutputTokensSum } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GitObject) GetURL() string { - if g == nil || g.URL == nil { - return "" +// GetPromptTokensSum returns the PromptTokensSum field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotAppTokenUsage) GetPromptTokensSum() int { + if c == nil || c.PromptTokensSum == nil { + return 0 } - return *g.URL + return *c.PromptTokensSum } -// GetGithubReviewedAt returns the GithubReviewedAt field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetGithubReviewedAt() Timestamp { - if g == nil || g.GithubReviewedAt == nil { - return Timestamp{} +// GetCommentType returns the CommentType field. +func (c *CopilotMetricsCopilotSuggestionByCommentType) GetCommentType() string { + if c == nil { + return "" } - return *g.GithubReviewedAt + return c.CommentType } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetID() int64 { - if g == nil || g.ID == nil { +// GetTotalCopilotAppliedSuggestions returns the TotalCopilotAppliedSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotSuggestionByCommentType) GetTotalCopilotAppliedSuggestions() int { + if c == nil || c.TotalCopilotAppliedSuggestions == nil { return 0 } - return *g.ID + return *c.TotalCopilotAppliedSuggestions } -// GetNVDPublishedAt returns the NVDPublishedAt field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetNVDPublishedAt() Timestamp { - if g == nil || g.NVDPublishedAt == nil { - return Timestamp{} +// GetTotalCopilotSuggestions returns the TotalCopilotSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsCopilotSuggestionByCommentType) GetTotalCopilotSuggestions() int { + if c == nil || c.TotalCopilotSuggestions == nil { + return 0 } - return *g.NVDPublishedAt + return *c.TotalCopilotSuggestions } -// GetRepositoryAdvisoryURL returns the RepositoryAdvisoryURL field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetRepositoryAdvisoryURL() string { - if g == nil || g.RepositoryAdvisoryURL == nil { +// GetFeature returns the Feature field. +func (c *CopilotMetricsFeature) GetFeature() string { + if c == nil { return "" } - return *g.RepositoryAdvisoryURL + return c.Feature } -// GetSourceCodeLocation returns the SourceCodeLocation field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetSourceCodeLocation() string { - if g == nil || g.SourceCodeLocation == nil { - return "" +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsFeature) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 } - return *g.SourceCodeLocation + return *c.UserInitiatedInteractionCount } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetType() string { - if g == nil || g.Type == nil { +// GetIDE returns the IDE field. +func (c *CopilotMetricsIDE) GetIDE() string { + if c == nil { return "" } - return *g.Type + return c.IDE } -// GetFirstPatchedVersion returns the FirstPatchedVersion field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityVulnerability) GetFirstPatchedVersion() string { - if g == nil || g.FirstPatchedVersion == nil { - return "" +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsIDE) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 } - return *g.FirstPatchedVersion + return *c.UserInitiatedInteractionCount } -// GetPackage returns the Package field. -func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { - if g == nil { - return nil +// GetFeature returns the Feature field. +func (c *CopilotMetricsLanguageFeature) GetFeature() string { + if c == nil { + return "" } - return g.Package + return c.Feature } -// GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityVulnerability) GetVulnerableVersionRange() string { - if g == nil || g.VulnerableVersionRange == nil { +// GetLanguage returns the Language field. +func (c *CopilotMetricsLanguageFeature) GetLanguage() string { + if c == nil { return "" } - return *g.VulnerableVersionRange + return c.Language } -// GetInstallation returns the Installation field. -func (g *GollumEvent) GetInstallation() *Installation { - if g == nil { - return nil +// GetLanguage returns the Language field. +func (c *CopilotMetricsLanguageModel) GetLanguage() string { + if c == nil { + return "" } - return g.Installation + return c.Language } -// GetOrg returns the Org field. -func (g *GollumEvent) GetOrg() *Organization { - if g == nil { - return nil +// GetModel returns the Model field. +func (c *CopilotMetricsLanguageModel) GetModel() string { + if c == nil { + return "" } - return g.Org + return c.Model } -// GetRepo returns the Repo field. -func (g *GollumEvent) GetRepo() *Repository { - if g == nil { - return nil +// GetSince returns the Since field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsListOptions) GetSince() time.Time { + if c == nil || c.Since == nil { + return time.Time{} } - return g.Repo + return *c.Since } -// GetSender returns the Sender field. -func (g *GollumEvent) GetSender() *User { - if g == nil { - return nil +// GetUntil returns the Until field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsListOptions) GetUntil() time.Time { + if c == nil || c.Until == nil { + return time.Time{} } - return g.Sender + return *c.Until } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (g *GPGEmail) GetEmail() string { - if g == nil || g.Email == nil { +// GetFeature returns the Feature field. +func (c *CopilotMetricsModelFeature) GetFeature() string { + if c == nil { return "" } - return *g.Email + return c.Feature } -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (g *GPGEmail) GetVerified() bool { - if g == nil || g.Verified == nil { - return false +// GetModel returns the Model field. +func (c *CopilotMetricsModelFeature) GetModel() string { + if c == nil { + return "" } - return *g.Verified + return c.Model } -// GetCanCertify returns the CanCertify field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanCertify() bool { - if g == nil || g.CanCertify == nil { - return false +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsModelFeature) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 } - return *g.CanCertify + return *c.UserInitiatedInteractionCount } -// GetCanEncryptComms returns the CanEncryptComms field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanEncryptComms() bool { - if g == nil || g.CanEncryptComms == nil { - return false +// GetCopilotSuggestionsByCommentType returns the CopilotSuggestionsByCommentType slice if it's non-nil, nil otherwise. +func (c *CopilotMetricsPullRequests) GetCopilotSuggestionsByCommentType() []*CopilotMetricsCopilotSuggestionByCommentType { + if c == nil || c.CopilotSuggestionsByCommentType == nil { + return nil } - return *g.CanEncryptComms + return c.CopilotSuggestionsByCommentType } -// GetCanEncryptStorage returns the CanEncryptStorage field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanEncryptStorage() bool { - if g == nil || g.CanEncryptStorage == nil { - return false +// GetMedianMinutesToMerge returns the MedianMinutesToMerge field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMerge() float64 { + if c == nil || c.MedianMinutesToMerge == nil { + return 0 } - return *g.CanEncryptStorage + return *c.MedianMinutesToMerge } -// GetCanSign returns the CanSign field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCanSign() bool { - if g == nil || g.CanSign == nil { - return false +// GetMedianMinutesToMergeCopilotAuthored returns the MedianMinutesToMergeCopilotAuthored field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMergeCopilotAuthored() float64 { + if c == nil || c.MedianMinutesToMergeCopilotAuthored == nil { + return 0 } - return *g.CanSign + return *c.MedianMinutesToMergeCopilotAuthored } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} +// GetMedianMinutesToMergeCopilotReviewed returns the MedianMinutesToMergeCopilotReviewed field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetMedianMinutesToMergeCopilotReviewed() float64 { + if c == nil || c.MedianMinutesToMergeCopilotReviewed == nil { + return 0 } - return *g.CreatedAt + return *c.MedianMinutesToMergeCopilotReviewed } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetExpiresAt() Timestamp { - if g == nil || g.ExpiresAt == nil { - return Timestamp{} +// GetTotalAppliedSuggestions returns the TotalAppliedSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalAppliedSuggestions() int { + if c == nil || c.TotalAppliedSuggestions == nil { + return 0 } - return *g.ExpiresAt + return *c.TotalAppliedSuggestions } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetID() int64 { - if g == nil || g.ID == nil { +// GetTotalCopilotAppliedSuggestions returns the TotalCopilotAppliedSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCopilotAppliedSuggestions() int { + if c == nil || c.TotalCopilotAppliedSuggestions == nil { return 0 } - return *g.ID + return *c.TotalCopilotAppliedSuggestions } -// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetKeyID() string { - if g == nil || g.KeyID == nil { - return "" +// GetTotalCopilotSuggestions returns the TotalCopilotSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCopilotSuggestions() int { + if c == nil || c.TotalCopilotSuggestions == nil { + return 0 } - return *g.KeyID + return *c.TotalCopilotSuggestions } -// GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetPrimaryKeyID() int64 { - if g == nil || g.PrimaryKeyID == nil { +// GetTotalCreated returns the TotalCreated field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCreated() int { + if c == nil || c.TotalCreated == nil { return 0 } - return *g.PrimaryKeyID + return *c.TotalCreated } -// GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetPublicKey() string { - if g == nil || g.PublicKey == nil { - return "" +// GetTotalCreatedByCopilot returns the TotalCreatedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalCreatedByCopilot() int { + if c == nil || c.TotalCreatedByCopilot == nil { + return 0 } - return *g.PublicKey + return *c.TotalCreatedByCopilot } -// GetRawKey returns the RawKey field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetRawKey() string { - if g == nil || g.RawKey == nil { - return "" +// GetTotalMerged returns the TotalMerged field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMerged() int { + if c == nil || c.TotalMerged == nil { + return 0 } - return *g.RawKey + return *c.TotalMerged } -// GetApp returns the App field. -func (g *Grant) GetApp() *AuthorizationApp { - if g == nil { - return nil +// GetTotalMergedCreatedByCopilot returns the TotalMergedCreatedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMergedCreatedByCopilot() int { + if c == nil || c.TotalMergedCreatedByCopilot == nil { + return 0 } - return g.App + return *c.TotalMergedCreatedByCopilot } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *Grant) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { - return Timestamp{} +// GetTotalMergedReviewedByCopilot returns the TotalMergedReviewedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalMergedReviewedByCopilot() int { + if c == nil || c.TotalMergedReviewedByCopilot == nil { + return 0 } - return *g.CreatedAt + return *c.TotalMergedReviewedByCopilot } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Grant) GetID() int64 { - if g == nil || g.ID == nil { +// GetTotalReviewed returns the TotalReviewed field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalReviewed() int { + if c == nil || c.TotalReviewed == nil { return 0 } - return *g.ID + return *c.TotalReviewed } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (g *Grant) GetUpdatedAt() Timestamp { - if g == nil || g.UpdatedAt == nil { - return Timestamp{} +// GetTotalReviewedByCopilot returns the TotalReviewedByCopilot field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalReviewedByCopilot() int { + if c == nil || c.TotalReviewedByCopilot == nil { + return 0 } - return *g.UpdatedAt + return *c.TotalReviewedByCopilot } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *Grant) GetURL() string { - if g == nil || g.URL == nil { - return "" +// GetTotalSuggestions returns the TotalSuggestions field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsPullRequests) GetTotalSuggestions() int { + if c == nil || c.TotalSuggestions == nil { + return 0 } - return *g.URL + return *c.TotalSuggestions } -// GetAuthor returns the Author field. -func (h *HeadCommit) GetAuthor() *CommitAuthor { - if h == nil { +// GetDownloadLinks returns the DownloadLinks slice if it's non-nil, nil otherwise. +func (c *CopilotMetricsReport) GetDownloadLinks() []string { + if c == nil || c.DownloadLinks == nil { return nil } - return h.Author + return c.DownloadLinks } -// GetCommitter returns the Committer field. -func (h *HeadCommit) GetCommitter() *CommitAuthor { - if h == nil { - return nil +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotMetricsReport) GetReportEndDay() string { + if c == nil { + return "" } - return h.Committer + return c.ReportEndDay } -// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetDistinct() bool { - if h == nil || h.Distinct == nil { - return false +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotMetricsReport) GetReportStartDay() string { + if c == nil { + return "" } - return *h.Distinct + return c.ReportStartDay } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetID() string { - if h == nil || h.ID == nil { +// GetDay returns the Day field. +func (c *CopilotMetricsReportOptions) GetDay() string { + if c == nil { return "" } - return *h.ID + return c.Day } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetMessage() string { - if h == nil || h.Message == nil { +// GetAgentID returns the AgentID field. +func (c *CopilotMetricsThirdPartyAgent) GetAgentID() string { + if c == nil { return "" } - return *h.Message + return c.AgentID } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetSHA() string { - if h == nil || h.SHA == nil { +// GetAgentName returns the AgentName field. +func (c *CopilotMetricsThirdPartyAgent) GetAgentName() string { + if c == nil { return "" } - return *h.SHA + return c.AgentName } -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetTimestamp() Timestamp { - if h == nil || h.Timestamp == nil { - return Timestamp{} +// GetSessionCount returns the SessionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsThirdPartyAgent) GetSessionCount() int { + if c == nil || c.SessionCount == nil { + return 0 } - return *h.Timestamp + return *c.SessionCount } -// GetTreeID returns the TreeID field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetTreeID() string { - if h == nil || h.TreeID == nil { - return "" +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotMetricsThirdPartyAgent) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 } - return *h.TreeID + return *c.UserInitiatedInteractionCount } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetURL() string { - if h == nil || h.URL == nil { +// GetCopilotChat returns the CopilotChat field. +func (c *CopilotOrganizationDetails) GetCopilotChat() string { + if c == nil { return "" } - return *h.URL + return c.CopilotChat } -// GetActive returns the Active field if it's non-nil, zero value otherwise. -func (h *Hook) GetActive() bool { - if h == nil || h.Active == nil { - return false +// GetPublicCodeSuggestions returns the PublicCodeSuggestions field. +func (c *CopilotOrganizationDetails) GetPublicCodeSuggestions() string { + if c == nil { + return "" } - return *h.Active + return c.PublicCodeSuggestions } -// GetConfig returns the Config field. -func (h *Hook) GetConfig() *HookConfig { - if h == nil { +// GetSeatBreakdown returns the SeatBreakdown field. +func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { + if c == nil { return nil } - return h.Config + return c.SeatBreakdown +} + +// GetSeatManagementSetting returns the SeatManagementSetting field. +func (c *CopilotOrganizationDetails) GetSeatManagementSetting() string { + if c == nil { + return "" + } + return c.SeatManagementSetting } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (h *Hook) GetCreatedAt() Timestamp { - if h == nil || h.CreatedAt == nil { +func (c *CopilotPeriodicMetrics) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { return Timestamp{} } - return *h.CreatedAt + return *c.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *Hook) GetID() int64 { - if h == nil || h.ID == nil { - return 0 +// GetDayTotals returns the DayTotals slice if it's non-nil, nil otherwise. +func (c *CopilotPeriodicMetrics) GetDayTotals() []*CopilotDailyMetrics { + if c == nil || c.DayTotals == nil { + return nil } - return *h.ID + return c.DayTotals } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (h *Hook) GetName() string { - if h == nil || h.Name == nil { +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotPeriodicMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { return "" } - return *h.Name + return *c.EnterpriseID } -// GetPingURL returns the PingURL field if it's non-nil, zero value otherwise. -func (h *Hook) GetPingURL() string { - if h == nil || h.PingURL == nil { +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotPeriodicMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { return "" } - return *h.PingURL + return *c.OrganizationID } -// GetTestURL returns the TestURL field if it's non-nil, zero value otherwise. -func (h *Hook) GetTestURL() string { - if h == nil || h.TestURL == nil { +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotPeriodicMetrics) GetReportEndDay() string { + if c == nil { return "" } - return *h.TestURL + return c.ReportEndDay } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (h *Hook) GetType() string { - if h == nil || h.Type == nil { +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotPeriodicMetrics) GetReportStartDay() string { + if c == nil { return "" } - return *h.Type + return c.ReportStartDay } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (h *Hook) GetUpdatedAt() Timestamp { - if h == nil || h.UpdatedAt == nil { - return Timestamp{} +// GetDay returns the Day field. +func (c *CopilotRepositoryDailyMetrics) GetDay() string { + if c == nil { + return "" } - return *h.UpdatedAt + return c.Day } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *Hook) GetURL() string { - if h == nil || h.URL == nil { +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotRepositoryDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { return "" } - return *h.URL + return *c.EnterpriseID } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetContentType() string { - if h == nil || h.ContentType == nil { +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotRepositoryDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { return "" } - return *h.ContentType + return *c.OrganizationID } -// GetInsecureSSL returns the InsecureSSL field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetInsecureSSL() string { - if h == nil || h.InsecureSSL == nil { - return "" +// GetPullRequests returns the PullRequests field. +func (c *CopilotRepositoryDailyMetrics) GetPullRequests() *CopilotMetricsPullRequests { + if c == nil { + return nil } - return *h.InsecureSSL + return c.PullRequests } -// GetSecret returns the Secret field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetSecret() string { - if h == nil || h.Secret == nil { - return "" +// GetRepoID returns the RepoID field. +func (c *CopilotRepositoryDailyMetrics) GetRepoID() int64 { + if c == nil { + return 0 } - return *h.Secret + return c.RepoID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetURL() string { - if h == nil || h.URL == nil { +// GetRepoName returns the RepoName field. +func (c *CopilotRepositoryDailyMetrics) GetRepoName() string { + if c == nil { return "" } - return *h.URL + return c.RepoName } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetAction() string { - if h == nil || h.Action == nil { +// GetRepoOwnerName returns the RepoOwnerName field. +func (c *CopilotRepositoryDailyMetrics) GetRepoOwnerName() string { + if c == nil { return "" } - return *h.Action + return c.RepoOwnerName } -// GetDeliveredAt returns the DeliveredAt field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetDeliveredAt() Timestamp { - if h == nil || h.DeliveredAt == nil { - return Timestamp{} +// GetRepoVisibility returns the RepoVisibility field. +func (c *CopilotRepositoryDailyMetrics) GetRepoVisibility() string { + if c == nil { + return "" } - return *h.DeliveredAt + return c.RepoVisibility } -// GetDuration returns the Duration field. -func (h *HookDelivery) GetDuration() *float64 { - if h == nil { - return nil +// GetActiveThisCycle returns the ActiveThisCycle field. +func (c *CopilotSeatBreakdown) GetActiveThisCycle() int { + if c == nil { + return 0 } - return h.Duration + return c.ActiveThisCycle } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetEvent() string { - if h == nil || h.Event == nil { - return "" +// GetAddedThisCycle returns the AddedThisCycle field. +func (c *CopilotSeatBreakdown) GetAddedThisCycle() int { + if c == nil { + return 0 } - return *h.Event + return c.AddedThisCycle } -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetGUID() string { - if h == nil || h.GUID == nil { - return "" +// GetInactiveThisCycle returns the InactiveThisCycle field. +func (c *CopilotSeatBreakdown) GetInactiveThisCycle() int { + if c == nil { + return 0 } - return *h.GUID + return c.InactiveThisCycle } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetID() int64 { - if h == nil || h.ID == nil { +// GetPendingCancellation returns the PendingCancellation field. +func (c *CopilotSeatBreakdown) GetPendingCancellation() int { + if c == nil { return 0 } - return *h.ID + return c.PendingCancellation } -// GetInstallationID returns the InstallationID field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetInstallationID() int64 { - if h == nil || h.InstallationID == nil { +// GetPendingInvitation returns the PendingInvitation field. +func (c *CopilotSeatBreakdown) GetPendingInvitation() int { + if c == nil { return 0 } - return *h.InstallationID + return c.PendingInvitation } -// GetRedelivery returns the Redelivery field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetRedelivery() bool { - if h == nil || h.Redelivery == nil { - return false +// GetTotal returns the Total field. +func (c *CopilotSeatBreakdown) GetTotal() int { + if c == nil { + return 0 } - return *h.Redelivery + return c.Total } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetRepositoryID() int64 { - if h == nil || h.RepositoryID == nil { - return 0 +// GetAssignee returns the Assignee field. +func (c *CopilotSeatDetails) GetAssignee() any { + if c == nil { + return nil } - return *h.RepositoryID + return c.Assignee } -// GetRequest returns the Request field. -func (h *HookDelivery) GetRequest() *HookRequest { - if h == nil { +// GetAssigningTeam returns the AssigningTeam field. +func (c *CopilotSeatDetails) GetAssigningTeam() *Team { + if c == nil { return nil } - return h.Request + return c.AssigningTeam } -// GetResponse returns the Response field. -func (h *HookDelivery) GetResponse() *HookResponse { - if h == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return h.Response + return *c.CreatedAt } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetStatus() string { - if h == nil || h.Status == nil { - return "" +// GetLastActivityAt returns the LastActivityAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetLastActivityAt() Timestamp { + if c == nil || c.LastActivityAt == nil { + return Timestamp{} } - return *h.Status + return *c.LastActivityAt } -// GetStatusCode returns the StatusCode field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetStatusCode() int { - if h == nil || h.StatusCode == nil { - return 0 +// GetLastActivityEditor returns the LastActivityEditor field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetLastActivityEditor() string { + if c == nil || c.LastActivityEditor == nil { + return "" } - return *h.StatusCode + return *c.LastActivityEditor } -// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. -func (h *HookRequest) GetHeaders() map[string]string { - if h == nil || h.Headers == nil { - return map[string]string{} +// GetPendingCancellationDate returns the PendingCancellationDate field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetPendingCancellationDate() string { + if c == nil || c.PendingCancellationDate == nil { + return "" } - return h.Headers + return *c.PendingCancellationDate } -// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. -func (h *HookRequest) GetRawPayload() json.RawMessage { - if h == nil || h.RawPayload == nil { - return json.RawMessage{} +// GetPlanType returns the PlanType field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetPlanType() string { + if c == nil || c.PlanType == nil { + return "" } - return *h.RawPayload + return *c.PlanType } -// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. -func (h *HookResponse) GetHeaders() map[string]string { - if h == nil || h.Headers == nil { - return map[string]string{} +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return h.Headers + return *c.UpdatedAt } -// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. -func (h *HookResponse) GetRawPayload() json.RawMessage { - if h == nil || h.RawPayload == nil { - return json.RawMessage{} +// GetAPIURL returns the APIURL field. +func (c *CopilotSpace) GetAPIURL() string { + if c == nil { + return "" } - return *h.RawPayload + return c.APIURL } -// GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetActiveHooks() int { - if h == nil || h.ActiveHooks == nil { - return 0 +// GetBaseRole returns the BaseRole field. +func (c *CopilotSpace) GetBaseRole() string { + if c == nil { + return "" } - return *h.ActiveHooks + return c.BaseRole } -// GetInactiveHooks returns the InactiveHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetInactiveHooks() int { - if h == nil || h.InactiveHooks == nil { - return 0 +// GetCreatedAt returns the CreatedAt field. +func (c *CopilotSpace) GetCreatedAt() Timestamp { + if c == nil { + return Timestamp{} } - return *h.InactiveHooks + return c.CreatedAt } -// GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetTotalHooks() int { - if h == nil || h.TotalHooks == nil { - return 0 +// GetCreator returns the Creator field. +func (c *CopilotSpace) GetCreator() User { + if c == nil { + return User{} } - return *h.TotalHooks + return c.Creator } -// GetGroupDescription returns the GroupDescription field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupDescription() string { - if i == nil || i.GroupDescription == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CopilotSpace) GetDescription() string { + if c == nil || c.Description == nil { return "" } - return *i.GroupDescription + return *c.Description } -// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupID() string { - if i == nil || i.GroupID == nil { +// GetGeneralInstructions returns the GeneralInstructions field if it's non-nil, zero value otherwise. +func (c *CopilotSpace) GetGeneralInstructions() string { + if c == nil || c.GeneralInstructions == nil { return "" } - return *i.GroupID + return *c.GeneralInstructions } -// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupName() string { - if i == nil || i.GroupName == nil { +// GetHTMLURL returns the HTMLURL field. +func (c *CopilotSpace) GetHTMLURL() string { + if c == nil { return "" } - return *i.GroupName + return c.HTMLURL } -// GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise. -func (i *Import) GetAuthorsCount() int { - if i == nil || i.AuthorsCount == nil { +// GetID returns the ID field. +func (c *CopilotSpace) GetID() int64 { + if c == nil { return 0 } - return *i.AuthorsCount + return c.ID } -// GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise. -func (i *Import) GetAuthorsURL() string { - if i == nil || i.AuthorsURL == nil { +// GetName returns the Name field. +func (c *CopilotSpace) GetName() string { + if c == nil { return "" } - return *i.AuthorsURL + return c.Name } -// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. -func (i *Import) GetCommitCount() int { - if i == nil || i.CommitCount == nil { +// GetNumber returns the Number field. +func (c *CopilotSpace) GetNumber() int { + if c == nil { return 0 } - return *i.CommitCount + return c.Number } -// GetFailedStep returns the FailedStep field if it's non-nil, zero value otherwise. -func (i *Import) GetFailedStep() string { - if i == nil || i.FailedStep == nil { +// GetOwner returns the Owner field. +func (c *CopilotSpace) GetOwner() any { + if c == nil { + return nil + } + return c.Owner +} + +// GetResourcesAttributes returns the ResourcesAttributes slice if it's non-nil, nil otherwise. +func (c *CopilotSpace) GetResourcesAttributes() []*CopilotSpaceResource { + if c == nil || c.ResourcesAttributes == nil { + return nil + } + return c.ResourcesAttributes +} + +// GetUpdatedAt returns the UpdatedAt field. +func (c *CopilotSpace) GetUpdatedAt() Timestamp { + if c == nil { + return Timestamp{} + } + return c.UpdatedAt +} + +// GetCopilotChatAttachmentID returns the CopilotChatAttachmentID field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetCopilotChatAttachmentID() int64 { + if c == nil || c.CopilotChatAttachmentID == nil { + return 0 + } + return *c.CopilotChatAttachmentID +} + +// GetFilePath returns the FilePath field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetFilePath() string { + if c == nil || c.FilePath == nil { return "" } - return *i.FailedStep + return *c.FilePath } -// GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise. -func (i *Import) GetHasLargeFiles() bool { - if i == nil || i.HasLargeFiles == nil { - return false +// GetHeight returns the Height field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetHeight() int { + if c == nil || c.Height == nil { + return 0 } - return *i.HasLargeFiles + return *c.Height } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Import) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { +// GetMediaType returns the MediaType field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetMediaType() string { + if c == nil || c.MediaType == nil { return "" } - return *i.HTMLURL + return *c.MediaType } -// GetHumanName returns the HumanName field if it's non-nil, zero value otherwise. -func (i *Import) GetHumanName() string { - if i == nil || i.HumanName == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetName() string { + if c == nil || c.Name == nil { return "" } - return *i.HumanName + return *c.Name } -// GetLargeFilesCount returns the LargeFilesCount field if it's non-nil, zero value otherwise. -func (i *Import) GetLargeFilesCount() int { - if i == nil || i.LargeFilesCount == nil { +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetNumber() int { + if c == nil || c.Number == nil { return 0 } - return *i.LargeFilesCount + return *c.Number } -// GetLargeFilesSize returns the LargeFilesSize field if it's non-nil, zero value otherwise. -func (i *Import) GetLargeFilesSize() int { - if i == nil || i.LargeFilesSize == nil { +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetRepositoryID() int64 { + if c == nil || c.RepositoryID == nil { return 0 } - return *i.LargeFilesSize + return *c.RepositoryID } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (i *Import) GetMessage() string { - if i == nil || i.Message == nil { +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetText() string { + if c == nil || c.Text == nil { return "" } - return *i.Message + return *c.Text } -// GetPercent returns the Percent field if it's non-nil, zero value otherwise. -func (i *Import) GetPercent() int { - if i == nil || i.Percent == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + +// GetWidth returns the Width field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceMetadata) GetWidth() int { + if c == nil || c.Width == nil { return 0 } - return *i.Percent + return *c.Width } -// GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise. -func (i *Import) GetPushPercent() int { - if i == nil || i.PushPercent == nil { +// GetCopilotChatAttachmentID returns the CopilotChatAttachmentID field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceResource) GetCopilotChatAttachmentID() int64 { + if c == nil || c.CopilotChatAttachmentID == nil { return 0 } - return *i.PushPercent + return *c.CopilotChatAttachmentID } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Import) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceResource) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} } - return *i.RepositoryURL + return *c.CreatedAt } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (i *Import) GetStatus() string { - if i == nil || i.Status == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceResource) GetID() int64 { + if c == nil || c.ID == nil { + return 0 } - return *i.Status + return *c.ID } -// GetStatusText returns the StatusText field if it's non-nil, zero value otherwise. -func (i *Import) GetStatusText() string { - if i == nil || i.StatusText == nil { - return "" +// GetMetadata returns the Metadata field. +func (c *CopilotSpaceResource) GetMetadata() *CopilotSpaceMetadata { + if c == nil { + return nil } - return *i.StatusText + return c.Metadata } -// GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise. -func (i *Import) GetTFVCProject() string { - if i == nil || i.TFVCProject == nil { +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceResource) GetResourceType() string { + if c == nil || c.ResourceType == nil { return "" } - return *i.TFVCProject + return *c.ResourceType } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Import) GetURL() string { - if i == nil || i.URL == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSpaceResource) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return *i.URL + return *c.UpdatedAt } -// GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise. -func (i *Import) GetUseLFS() string { - if i == nil || i.UseLFS == nil { - return "" +// GetSpaces returns the Spaces slice if it's non-nil, nil otherwise. +func (c *CopilotSpacesList) GetSpaces() []*CopilotSpace { + if c == nil || c.Spaces == nil { + return nil } - return *i.UseLFS + return c.Spaces } -// GetVCS returns the VCS field if it's non-nil, zero value otherwise. -func (i *Import) GetVCS() string { - if i == nil || i.VCS == nil { - return "" +// GetAIAdoptionPhase returns the AIAdoptionPhase field. +func (c *CopilotUserDailyMetrics) GetAIAdoptionPhase() *CopilotMetricsAIAdoptionPhase { + if c == nil { + return nil } - return *i.VCS + return c.AIAdoptionPhase } -// GetVCSPassword returns the VCSPassword field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSPassword() string { - if i == nil || i.VCSPassword == nil { - return "" +// GetAICreditsUsed returns the AICreditsUsed field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetAICreditsUsed() float64 { + if c == nil || c.AICreditsUsed == nil { + return 0 } - return *i.VCSPassword + return *c.AICreditsUsed } -// GetVCSURL returns the VCSURL field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSURL() string { - if i == nil || i.VCSURL == nil { - return "" +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 } - return *i.VCSURL + return *c.CodeAcceptanceActivityCount } -// GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSUsername() string { - if i == nil || i.VCSUsername == nil { +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetDay returns the Day field. +func (c *CopilotUserDailyMetrics) GetDay() string { + if c == nil { return "" } - return *i.VCSUsername + return c.Day } -// GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetAccessTokensURL() string { - if i == nil || i.AccessTokensURL == nil { +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { return "" } - return *i.AccessTokensURL + return *c.EnterpriseID } -// GetAccount returns the Account field. -func (i *Installation) GetAccount() *User { - if i == nil { - return nil +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 } - return i.Account + return *c.LOCAddedSum } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (i *Installation) GetAppID() int64 { - if i == nil || i.AppID == nil { +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { return 0 } - return *i.AppID + return *c.LOCDeletedSum } -// GetAppSlug returns the AppSlug field if it's non-nil, zero value otherwise. -func (i *Installation) GetAppSlug() string { - if i == nil || i.AppSlug == nil { +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { return "" } - return *i.AppSlug + return *c.OrganizationID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} +// GetTotalsBy3rdPartyAgent returns the TotalsBy3rdPartyAgent slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsBy3rdPartyAgent() []*CopilotMetricsThirdPartyAgent { + if c == nil || c.TotalsBy3rdPartyAgent == nil { + return nil } - return *i.CreatedAt + return c.TotalsBy3rdPartyAgent } -// GetHasMultipleSingleFiles returns the HasMultipleSingleFiles field if it's non-nil, zero value otherwise. -func (i *Installation) GetHasMultipleSingleFiles() bool { - if i == nil || i.HasMultipleSingleFiles == nil { +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotUserDailyMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil + } + return c.TotalsByCLI +} + +// GetTotalsByCopilotApp returns the TotalsByCopilotApp field. +func (c *CopilotUserDailyMetrics) GetTotalsByCopilotApp() *CopilotMetricsCopilotApp { + if c == nil { + return nil + } + return c.TotalsByCopilotApp +} + +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil + } + return c.TotalsByFeature +} + +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByIDE() []*CopilotUserMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil + } + return c.TotalsByIDE +} + +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil + } + return c.TotalsByLanguageFeature +} + +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil + } + return c.TotalsByLanguageModel +} + +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserDailyMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil + } + return c.TotalsByModelFeature +} + +// GetUsedAgent returns the UsedAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedAgent() bool { + if c == nil || c.UsedAgent == nil { return false } - return *i.HasMultipleSingleFiles + return *c.UsedAgent } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" +// GetUsedChat returns the UsedChat field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedChat() bool { + if c == nil || c.UsedChat == nil { + return false } - return *i.HTMLURL + return *c.UsedChat } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Installation) GetID() int64 { - if i == nil || i.ID == nil { +// GetUsedCLI returns the UsedCLI field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCLI() bool { + if c == nil || c.UsedCLI == nil { + return false + } + return *c.UsedCLI +} + +// GetUsedCopilotApp returns the UsedCopilotApp field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotApp() bool { + if c == nil || c.UsedCopilotApp == nil { + return false + } + return *c.UsedCopilotApp +} + +// GetUsedCopilotCloudAgent returns the UsedCopilotCloudAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCloudAgent() bool { + if c == nil || c.UsedCopilotCloudAgent == nil { + return false + } + return *c.UsedCopilotCloudAgent +} + +// GetUsedCopilotCodeReviewActive returns the UsedCopilotCodeReviewActive field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodeReviewActive() bool { + if c == nil || c.UsedCopilotCodeReviewActive == nil { + return false + } + return *c.UsedCopilotCodeReviewActive +} + +// GetUsedCopilotCodeReviewPassive returns the UsedCopilotCodeReviewPassive field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodeReviewPassive() bool { + if c == nil || c.UsedCopilotCodeReviewPassive == nil { + return false + } + return *c.UsedCopilotCodeReviewPassive +} + +// GetUsedCopilotCodingAgent returns the UsedCopilotCodingAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUsedCopilotCodingAgent() bool { + if c == nil || c.UsedCopilotCodingAgent == nil { + return false + } + return *c.UsedCopilotCodingAgent +} + +// GetUserID returns the UserID field. +func (c *CopilotUserDailyMetrics) GetUserID() int { + if c == nil { return 0 } - return *i.ID + return c.UserID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Installation) GetNodeID() string { - if i == nil || i.NodeID == nil { +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserDailyMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetUserLogin returns the UserLogin field. +func (c *CopilotUserDailyMetrics) GetUserLogin() string { + if c == nil { return "" } - return *i.NodeID + return c.UserLogin } -// GetPermissions returns the Permissions field. -func (i *Installation) GetPermissions() *InstallationPermissions { - if i == nil { +// GetIDE returns the IDE field. +func (c *CopilotUserMetricsIDE) GetIDE() string { + if c == nil { + return "" + } + return c.IDE +} + +// GetLastKnownIDEVersion returns the LastKnownIDEVersion field. +func (c *CopilotUserMetricsIDE) GetLastKnownIDEVersion() *CopilotUserMetricsIDEVersion { + if c == nil { return nil } - return i.Permissions + return c.LastKnownIDEVersion } -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (i *Installation) GetRepositoriesURL() string { - if i == nil || i.RepositoriesURL == nil { +// GetLastKnownPluginVersion returns the LastKnownPluginVersion field. +func (c *CopilotUserMetricsIDE) GetLastKnownPluginVersion() *CopilotUserMetricsPluginVersion { + if c == nil { + return nil + } + return c.LastKnownPluginVersion +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsIDE) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetIDEVersion returns the IDEVersion field. +func (c *CopilotUserMetricsIDEVersion) GetIDEVersion() string { + if c == nil { return "" } - return *i.RepositoriesURL + return c.IDEVersion } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (i *Installation) GetRepositorySelection() string { - if i == nil || i.RepositorySelection == nil { +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsIDEVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { + return Timestamp{} + } + return *c.SampledAt +} + +// GetPlugin returns the Plugin field. +func (c *CopilotUserMetricsPluginVersion) GetPlugin() string { + if c == nil { return "" } - return *i.RepositorySelection + return c.Plugin } -// GetSingleFileName returns the SingleFileName field if it's non-nil, zero value otherwise. -func (i *Installation) GetSingleFileName() string { - if i == nil || i.SingleFileName == nil { +// GetPluginVersion returns the PluginVersion field. +func (c *CopilotUserMetricsPluginVersion) GetPluginVersion() string { + if c == nil { return "" } - return *i.SingleFileName + return c.PluginVersion } -// GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetSuspendedAt() Timestamp { - if i == nil || i.SuspendedAt == nil { +// GetSampledAt returns the SampledAt field if it's non-nil, zero value otherwise. +func (c *CopilotUserMetricsPluginVersion) GetSampledAt() Timestamp { + if c == nil || c.SampledAt == nil { return Timestamp{} } - return *i.SuspendedAt + return *c.SampledAt } -// GetSuspendedBy returns the SuspendedBy field. -func (i *Installation) GetSuspendedBy() *User { - if i == nil { +// GetAIAdoptionPhase returns the AIAdoptionPhase field. +func (c *CopilotUserPeriodicMetrics) GetAIAdoptionPhase() *CopilotMetricsAIAdoptionPhase { + if c == nil { return nil } - return i.SuspendedBy + return c.AIAdoptionPhase +} + +// GetAICreditsUsed returns the AICreditsUsed field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetAICreditsUsed() float64 { + if c == nil || c.AICreditsUsed == nil { + return 0 + } + return *c.AICreditsUsed +} + +// GetCodeAcceptanceActivityCount returns the CodeAcceptanceActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetCodeAcceptanceActivityCount() int { + if c == nil || c.CodeAcceptanceActivityCount == nil { + return 0 + } + return *c.CodeAcceptanceActivityCount +} + +// GetCodeGenerationActivityCount returns the CodeGenerationActivityCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetCodeGenerationActivityCount() int { + if c == nil || c.CodeGenerationActivityCount == nil { + return 0 + } + return *c.CodeGenerationActivityCount +} + +// GetDay returns the Day field. +func (c *CopilotUserPeriodicMetrics) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetLOCAddedSum returns the LOCAddedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCAddedSum() int { + if c == nil || c.LOCAddedSum == nil { + return 0 + } + return *c.LOCAddedSum +} + +// GetLOCDeletedSum returns the LOCDeletedSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCDeletedSum() int { + if c == nil || c.LOCDeletedSum == nil { + return 0 + } + return *c.LOCDeletedSum +} + +// GetLOCSuggestedToAddSum returns the LOCSuggestedToAddSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCSuggestedToAddSum() int { + if c == nil || c.LOCSuggestedToAddSum == nil { + return 0 + } + return *c.LOCSuggestedToAddSum +} + +// GetLOCSuggestedToDeleteSum returns the LOCSuggestedToDeleteSum field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetLOCSuggestedToDeleteSum() int { + if c == nil || c.LOCSuggestedToDeleteSum == nil { + return 0 + } + return *c.LOCSuggestedToDeleteSum +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetReportEndDay returns the ReportEndDay field. +func (c *CopilotUserPeriodicMetrics) GetReportEndDay() string { + if c == nil { + return "" + } + return c.ReportEndDay +} + +// GetReportStartDay returns the ReportStartDay field. +func (c *CopilotUserPeriodicMetrics) GetReportStartDay() string { + if c == nil { + return "" + } + return c.ReportStartDay +} + +// GetTotalsBy3rdPartyAgent returns the TotalsBy3rdPartyAgent slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsBy3rdPartyAgent() []*CopilotMetricsThirdPartyAgent { + if c == nil || c.TotalsBy3rdPartyAgent == nil { + return nil + } + return c.TotalsBy3rdPartyAgent +} + +// GetTotalsByCLI returns the TotalsByCLI field. +func (c *CopilotUserPeriodicMetrics) GetTotalsByCLI() *CopilotMetricsCLI { + if c == nil { + return nil + } + return c.TotalsByCLI +} + +// GetTotalsByCopilotApp returns the TotalsByCopilotApp field. +func (c *CopilotUserPeriodicMetrics) GetTotalsByCopilotApp() *CopilotMetricsCopilotApp { + if c == nil { + return nil + } + return c.TotalsByCopilotApp +} + +// GetTotalsByFeature returns the TotalsByFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByFeature() []*CopilotMetricsFeature { + if c == nil || c.TotalsByFeature == nil { + return nil + } + return c.TotalsByFeature +} + +// GetTotalsByIDE returns the TotalsByIDE slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByIDE() []*CopilotUserMetricsIDE { + if c == nil || c.TotalsByIDE == nil { + return nil + } + return c.TotalsByIDE +} + +// GetTotalsByLanguageFeature returns the TotalsByLanguageFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByLanguageFeature() []*CopilotMetricsLanguageFeature { + if c == nil || c.TotalsByLanguageFeature == nil { + return nil + } + return c.TotalsByLanguageFeature +} + +// GetTotalsByLanguageModel returns the TotalsByLanguageModel slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByLanguageModel() []*CopilotMetricsLanguageModel { + if c == nil || c.TotalsByLanguageModel == nil { + return nil + } + return c.TotalsByLanguageModel +} + +// GetTotalsByModelFeature returns the TotalsByModelFeature slice if it's non-nil, nil otherwise. +func (c *CopilotUserPeriodicMetrics) GetTotalsByModelFeature() []*CopilotMetricsModelFeature { + if c == nil || c.TotalsByModelFeature == nil { + return nil + } + return c.TotalsByModelFeature +} + +// GetUsedAgent returns the UsedAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedAgent() bool { + if c == nil || c.UsedAgent == nil { + return false + } + return *c.UsedAgent +} + +// GetUsedChat returns the UsedChat field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedChat() bool { + if c == nil || c.UsedChat == nil { + return false + } + return *c.UsedChat +} + +// GetUsedCLI returns the UsedCLI field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCLI() bool { + if c == nil || c.UsedCLI == nil { + return false + } + return *c.UsedCLI +} + +// GetUsedCopilotApp returns the UsedCopilotApp field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotApp() bool { + if c == nil || c.UsedCopilotApp == nil { + return false + } + return *c.UsedCopilotApp +} + +// GetUsedCopilotCloudAgent returns the UsedCopilotCloudAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCloudAgent() bool { + if c == nil || c.UsedCopilotCloudAgent == nil { + return false + } + return *c.UsedCopilotCloudAgent +} + +// GetUsedCopilotCodeReviewActive returns the UsedCopilotCodeReviewActive field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodeReviewActive() bool { + if c == nil || c.UsedCopilotCodeReviewActive == nil { + return false + } + return *c.UsedCopilotCodeReviewActive +} + +// GetUsedCopilotCodeReviewPassive returns the UsedCopilotCodeReviewPassive field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodeReviewPassive() bool { + if c == nil || c.UsedCopilotCodeReviewPassive == nil { + return false + } + return *c.UsedCopilotCodeReviewPassive +} + +// GetUsedCopilotCodingAgent returns the UsedCopilotCodingAgent field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUsedCopilotCodingAgent() bool { + if c == nil || c.UsedCopilotCodingAgent == nil { + return false + } + return *c.UsedCopilotCodingAgent +} + +// GetUserID returns the UserID field. +func (c *CopilotUserPeriodicMetrics) GetUserID() int { + if c == nil { + return 0 + } + return c.UserID +} + +// GetUserInitiatedInteractionCount returns the UserInitiatedInteractionCount field if it's non-nil, zero value otherwise. +func (c *CopilotUserPeriodicMetrics) GetUserInitiatedInteractionCount() int { + if c == nil || c.UserInitiatedInteractionCount == nil { + return 0 + } + return *c.UserInitiatedInteractionCount +} + +// GetUserLogin returns the UserLogin field. +func (c *CopilotUserPeriodicMetrics) GetUserLogin() string { + if c == nil { + return "" + } + return c.UserLogin +} + +// GetDay returns the Day field. +func (c *CopilotUserTeamsDailyMetrics) GetDay() string { + if c == nil { + return "" + } + return c.Day +} + +// GetEnterpriseID returns the EnterpriseID field if it's non-nil, zero value otherwise. +func (c *CopilotUserTeamsDailyMetrics) GetEnterpriseID() string { + if c == nil || c.EnterpriseID == nil { + return "" + } + return *c.EnterpriseID +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (c *CopilotUserTeamsDailyMetrics) GetOrganizationID() string { + if c == nil || c.OrganizationID == nil { + return "" + } + return *c.OrganizationID +} + +// GetSlug returns the Slug field. +func (c *CopilotUserTeamsDailyMetrics) GetSlug() string { + if c == nil { + return "" + } + return c.Slug +} + +// GetTeamID returns the TeamID field. +func (c *CopilotUserTeamsDailyMetrics) GetTeamID() int64 { + if c == nil { + return 0 + } + return c.TeamID +} + +// GetUserID returns the UserID field. +func (c *CopilotUserTeamsDailyMetrics) GetUserID() int64 { + if c == nil { + return 0 + } + return c.UserID +} + +// GetUserLogin returns the UserLogin field. +func (c *CopilotUserTeamsDailyMetrics) GetUserLogin() string { + if c == nil { + return "" + } + return c.UserLogin +} + +// 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 +} + +// GetID returns the ID field. +func (c *CostCenter) GetID() string { + if c == nil { + return "" + } + return c.ID +} + +// GetName returns the Name field. +func (c *CostCenter) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (c *CostCenter) GetResources() []*CostCenterResource { + if c == nil || c.Resources == nil { + return nil + } + return c.Resources +} + +// 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 +} + +// GetName returns the Name field. +func (c *CostCenterRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetName returns the Name field. +func (c *CostCenterResource) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetType returns the Type field. +func (c *CostCenterResource) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetOrganizations() []string { + if c == nil || c.Organizations == nil { + return nil + } + return c.Organizations +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetRepositories() []string { + if c == nil || c.Repositories == nil { + return nil + } + return c.Repositories +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (c *CostCenterResourceRequest) GetUsers() []string { + if c == nil || c.Users == nil { + return nil + } + return c.Users +} + +// GetCostCenters returns the CostCenters slice if it's non-nil, nil otherwise. +func (c *CostCenters) GetCostCenters() []*CostCenter { + if c == nil || c.CostCenters == nil { + return nil + } + return c.CostCenters +} + +// GetConditions returns the Conditions field. +func (c *CreateActionsPolicyRequest) GetConditions() *ActionsPolicyConditions { + if c == nil { + return nil + } + return c.Conditions +} + +// GetEnforcement returns the Enforcement field. +func (c *CreateActionsPolicyRequest) GetEnforcement() RulesetEnforcement { + if c == nil { + return "" + } + return c.Enforcement +} + +// GetName returns the Name field. +func (c *CreateActionsPolicyRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetRules returns the Rules slice if it's non-nil, nil otherwise. +func (c *CreateActionsPolicyRequest) GetRules() []*ActionsPolicyRule { + if c == nil || c.Rules == nil { + return nil + } + return c.Rules +} + +// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. +func (c *CreateAgentTaskRequest) GetBaseRef() string { + if c == nil || c.BaseRef == nil { + return "" + } + return *c.BaseRef +} + +// GetCreatePullRequest returns the CreatePullRequest field if it's non-nil, zero value otherwise. +func (c *CreateAgentTaskRequest) GetCreatePullRequest() bool { + if c == nil || c.CreatePullRequest == nil { + return false + } + return *c.CreatePullRequest +} + +// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. +func (c *CreateAgentTaskRequest) GetHeadRef() string { + if c == nil || c.HeadRef == nil { + return "" + } + return *c.HeadRef +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (c *CreateAgentTaskRequest) GetModel() string { + if c == nil || c.Model == nil { + return "" + } + return *c.Model +} + +// GetPrompt returns the Prompt field. +func (c *CreateAgentTaskRequest) GetPrompt() string { + if c == nil { + return "" + } + return c.Prompt +} + +// 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 +} + +// GetDeploymentName returns the DeploymentName field. +func (c *CreateArtifactDeploymentRequest) GetDeploymentName() string { + if c == nil { + return "" + } + return c.DeploymentName +} + +// GetDigest returns the Digest field. +func (c *CreateArtifactDeploymentRequest) GetDigest() string { + if c == nil { + return "" + } + return c.Digest +} + +// 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 +} + +// GetLogicalEnvironment returns the LogicalEnvironment field. +func (c *CreateArtifactDeploymentRequest) GetLogicalEnvironment() string { + if c == nil { + return "" + } + return c.LogicalEnvironment +} + +// GetName returns the Name field. +func (c *CreateArtifactDeploymentRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// 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 +} + +// GetRuntimeRisks returns the RuntimeRisks slice if it's non-nil, nil otherwise. +func (c *CreateArtifactDeploymentRequest) GetRuntimeRisks() []DeploymentRuntimeRisk { + if c == nil || c.RuntimeRisks == nil { + return nil + } + return c.RuntimeRisks +} + +// GetStatus returns the Status field. +func (c *CreateArtifactDeploymentRequest) GetStatus() string { + if c == nil { + return "" + } + return c.Status +} + +// 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 +} + +// GetDigest returns the Digest field. +func (c *CreateArtifactStorageRequest) GetDigest() string { + if c == nil { + return "" + } + return c.Digest +} + +// 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 +} + +// GetName returns the Name field. +func (c *CreateArtifactStorageRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// 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 +} + +// GetRegistryURL returns the RegistryURL field. +func (c *CreateArtifactStorageRequest) GetRegistryURL() string { + if c == nil { + return "" + } + return c.RegistryURL +} + +// 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 +} + +// GetIsAlphanumeric returns the IsAlphanumeric field if it's non-nil, zero value otherwise. +func (c *CreateAutolinkRequest) GetIsAlphanumeric() bool { + if c == nil || c.IsAlphanumeric == nil { + return false + } + return *c.IsAlphanumeric +} + +// GetKeyPrefix returns the KeyPrefix field. +func (c *CreateAutolinkRequest) GetKeyPrefix() string { + if c == nil { + return "" + } + return c.KeyPrefix +} + +// GetURLTemplate returns the URLTemplate field. +func (c *CreateAutolinkRequest) GetURLTemplate() string { + if c == nil { + return "" + } + return c.URLTemplate +} + +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (c *CreateCheckRunOptions) GetActions() []*CheckRunAction { + if c == nil || c.Actions == nil { + return nil + } + return c.Actions +} + +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { + if c == nil || c.CompletedAt == nil { + return Timestamp{} + } + return *c.CompletedAt +} + +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetConclusion() string { + if c == nil || c.Conclusion == nil { + return "" + } + return *c.Conclusion +} + +// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetDetailsURL() string { + if c == nil || c.DetailsURL == nil { + return "" + } + return *c.DetailsURL +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetExternalID() string { + if c == nil || c.ExternalID == nil { + return "" + } + return *c.ExternalID +} + +// GetHeadSHA returns the HeadSHA field. +func (c *CreateCheckRunOptions) GetHeadSHA() string { + if c == nil { + return "" + } + return c.HeadSHA +} + +// GetName returns the Name field. +func (c *CreateCheckRunOptions) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetOutput returns the Output field. +func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { + if c == nil { + return nil + } + return c.Output +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetStartedAt() Timestamp { + if c == nil || c.StartedAt == nil { + return Timestamp{} + } + return *c.StartedAt +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (c *CreateCheckRunOptions) GetStatus() string { + if c == nil || c.Status == nil { + return "" + } + return *c.Status +} + +// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. +func (c *CreateCheckSuiteOptions) GetHeadBranch() string { + if c == nil || c.HeadBranch == nil { + return "" + } + return *c.HeadBranch +} + +// GetHeadSHA returns the HeadSHA field. +func (c *CreateCheckSuiteOptions) GetHeadSHA() string { + if c == nil { + return "" + } + return c.HeadSHA +} + +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" + } + return *c.ClientIP +} + +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" + } + return *c.DevcontainerPath +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetDisplayName() string { + if c == nil || c.DisplayName == nil { + return "" + } + return *c.DisplayName +} + +// GetGeo returns the Geo field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetGeo() string { + if c == nil || c.Geo == nil { + return "" + } + return *c.Geo +} + +// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetIdleTimeoutMinutes() int { + if c == nil || c.IdleTimeoutMinutes == nil { + return 0 + } + return *c.IdleTimeoutMinutes +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) 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 *CreateCodespaceForUserRequest) GetMachine() string { + if c == nil || c.Machine == nil { + return "" + } + return *c.Machine +} + +// GetMultiRepoPermissionsOptOut returns the MultiRepoPermissionsOptOut field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetMultiRepoPermissionsOptOut() bool { + if c == nil || c.MultiRepoPermissionsOptOut == nil { + return false + } + return *c.MultiRepoPermissionsOptOut +} + +// GetPullRequest returns the PullRequest field. +func (c *CreateCodespaceForUserRequest) GetPullRequest() *CodespacePullRequestOptions { + if c == nil { + return nil + } + return c.PullRequest +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) GetRepositoryID() int64 { + if c == nil || c.RepositoryID == nil { + return 0 + } + return *c.RepositoryID +} + +// GetRetentionPeriodMinutes returns the RetentionPeriodMinutes field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceForUserRequest) 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 *CreateCodespaceForUserRequest) GetWorkingDirectory() string { + if c == nil || c.WorkingDirectory == nil { + return "" + } + return *c.WorkingDirectory +} + +// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetClientIP() string { + if c == nil || c.ClientIP == nil { + return "" + } + return *c.ClientIP +} + +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" + } + return *c.DevcontainerPath +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetDisplayName() string { + if c == nil || c.DisplayName == nil { + return "" + } + return *c.DisplayName +} + +// GetGeo returns the Geo field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetGeo() string { + if c == nil || c.Geo == nil { + return "" + } + return *c.Geo +} + +// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetIdleTimeoutMinutes() int { + if c == nil || c.IdleTimeoutMinutes == nil { + return 0 + } + return *c.IdleTimeoutMinutes +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) 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 *CreateCodespaceRequest) GetMachine() string { + if c == nil || c.Machine == nil { + return "" + } + return *c.Machine +} + +// GetMultiRepoPermissionsOptOut returns the MultiRepoPermissionsOptOut field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) GetMultiRepoPermissionsOptOut() bool { + if c == nil || c.MultiRepoPermissionsOptOut == nil { + return false + } + return *c.MultiRepoPermissionsOptOut +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceRequest) 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 *CreateCodespaceRequest) 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 *CreateCodespaceRequest) GetWorkingDirectory() string { + if c == nil || c.WorkingDirectory == nil { + return "" + } + return *c.WorkingDirectory +} + +// GetBody returns the Body field. +func (c *CreateCommitCommentRequest) GetBody() string { + if c == nil { + return "" + } + return c.Body +} + +// GetLine returns the Line field if it's non-nil, zero value otherwise. +func (c *CreateCommitCommentRequest) GetLine() int { + if c == nil || c.Line == nil { + return 0 + } + return *c.Line +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (c *CreateCommitCommentRequest) GetPath() string { + if c == nil || c.Path == nil { + return "" + } + return *c.Path +} + +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (c *CreateCommitCommentRequest) GetPosition() int { + if c == nil || c.Position == nil { + return 0 + } + return *c.Position +} + +// GetSigner returns the Signer field. +func (c *CreateCommitOptions) GetSigner() MessageSigner { + if c == nil { + return nil + } + return c.Signer +} + +// GetMetadata returns the Metadata field. +func (c *CreateCopilotSpaceResourceAttributes) GetMetadata() *CopilotSpaceMetadata { + if c == nil { + return nil + } + return c.Metadata +} + +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (c *CreateCopilotSpaceResourceAttributes) GetResourceType() string { + if c == nil || c.ResourceType == nil { + return "" + } + return *c.ResourceType +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CreateCustomOrgRoleRequest) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateCustomOrgRoleRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetName returns the Name field. +func (c *CreateCustomOrgRoleRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CreateCustomOrgRoleRequest) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + +// GetBaseRole returns the BaseRole field. +func (c *CreateCustomRepoRoleRequest) GetBaseRole() string { + if c == nil { + return "" + } + return c.BaseRole +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateCustomRepoRoleRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetName returns the Name field. +func (c *CreateCustomRepoRoleRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CreateCustomRepoRoleRequest) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + +// GetDetector returns the Detector field. +func (c *CreateDependencyGraphSnapshotRequest) GetDetector() DependencyGraphSnapshotDetector { + if c == nil { + return DependencyGraphSnapshotDetector{} + } + return c.Detector +} + +// GetJob returns the Job field. +func (c *CreateDependencyGraphSnapshotRequest) GetJob() DependencyGraphSnapshotJob { + if c == nil { + return DependencyGraphSnapshotJob{} + } + return c.Job +} + +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (c *CreateDependencyGraphSnapshotRequest) GetMetadata() map[string]any { + if c == nil || c.Metadata == nil { + return map[string]any{} + } + return c.Metadata +} + +// GetRef returns the Ref field. +func (c *CreateDependencyGraphSnapshotRequest) GetRef() string { + if c == nil { + return "" + } + return c.Ref +} + +// GetScanned returns the Scanned field. +func (c *CreateDependencyGraphSnapshotRequest) GetScanned() Timestamp { + if c == nil { + return Timestamp{} + } + return c.Scanned +} + +// GetSHA returns the SHA field. +func (c *CreateDependencyGraphSnapshotRequest) GetSHA() string { + if c == nil { + return "" + } + return c.SHA +} + +// GetVersion returns the Version field. +func (c *CreateDependencyGraphSnapshotRequest) GetVersion() int { + if c == nil { + return 0 + } + return c.Version +} + +// GetKey returns the Key field. +func (c *CreateDeployKeyRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise. +func (c *CreateDeployKeyRequest) GetReadOnly() bool { + if c == nil || c.ReadOnly == nil { + return false + } + return *c.ReadOnly +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CreateDeployKeyRequest) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetName returns the Name field. +func (c *CreateDeploymentBranchPolicyRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *CreateDeploymentBranchPolicyRequest) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if c == nil || c.AllowsPublicRepositories == nil { + return false + } + return *c.AllowsPublicRepositories +} + +// GetName returns the Name field. +func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) 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 *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { + if c == nil || c.RestrictedToWorkflows == nil { + return false + } + return *c.RestrictedToWorkflows +} + +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetRunners() []int64 { + if c == nil || c.Runners == nil { + return nil + } + return c.Runners +} + +// GetSelectedOrganizationIDs returns the SelectedOrganizationIDs slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetSelectedOrganizationIDs() []int64 { + if c == nil || c.SelectedOrganizationIDs == nil { + return nil + } + return c.SelectedOrganizationIDs +} + +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetSelectedWorkflows() []string { + if c == nil || c.SelectedWorkflows == nil { + return nil + } + return c.SelectedWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetVisibility() string { + if c == nil || c.Visibility == nil { + return "" + } + return *c.Visibility +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetInstallation returns the Installation field. +func (c *CreateEvent) GetInstallation() *Installation { + if c == nil { + return nil + } + return c.Installation +} + +// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetMasterBranch() string { + if c == nil || c.MasterBranch == nil { + return "" + } + return *c.MasterBranch +} + +// GetOrg returns the Org field. +func (c *CreateEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetPusherType() string { + if c == nil || c.PusherType == nil { + return "" + } + return *c.PusherType +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetRef() string { + if c == nil || c.Ref == nil { + return "" + } + return *c.Ref +} + +// GetRefType returns the RefType field if it's non-nil, zero value otherwise. +func (c *CreateEvent) GetRefType() string { + if c == nil || c.RefType == nil { + return "" + } + return *c.RefType +} + +// GetRepo returns the Repo field. +func (c *CreateEvent) GetRepo() *Repository { + if c == nil { + return nil + } + return c.Repo +} + +// GetSender returns the Sender field. +func (c *CreateEvent) GetSender() *User { + if c == nil { + return nil + } + return c.Sender +} + +// GetDefaultBranchOnly returns the DefaultBranchOnly field if it's non-nil, zero value otherwise. +func (c *CreateForkRequest) GetDefaultBranchOnly() bool { + if c == nil || c.DefaultBranchOnly == nil { + return false + } + return *c.DefaultBranchOnly +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateForkRequest) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (c *CreateForkRequest) GetOrganization() string { + if c == nil || c.Organization == nil { + return "" + } + return *c.Organization +} + +// GetBody returns the Body field. +func (c *CreateGistCommentRequest) GetBody() string { + if c == nil { + return "" + } + return c.Body +} + +// GetContent returns the Content field. +func (c *CreateGistFile) GetContent() string { + if c == nil { + return "" + } + return c.Content +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateGistRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (c *CreateGistRequest) GetPublic() bool { + if c == nil || c.Public == nil { + return false + } + return *c.Public +} + +// 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.EnableStaticIP +} + +// GetImage returns the Image field. +func (c *CreateHostedRunnerRequest) GetImage() HostedRunnerImage { + if c == nil { + return HostedRunnerImage{} + } + return c.Image +} + +// 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.MaximumRunners +} + +// GetName returns the Name field. +func (c *CreateHostedRunnerRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetRunnerGroupID returns the RunnerGroupID field. +func (c *CreateHostedRunnerRequest) GetRunnerGroupID() int64 { + if c == nil { + return 0 + } + return c.RunnerGroupID +} + +// GetSize returns the Size field. +func (c *CreateHostedRunnerRequest) GetSize() string { + if c == nil { + return "" + } + return c.Size +} + +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (c *CreateIssueLabelRequest) GetColor() string { + if c == nil || c.Color == nil { + return "" + } + return *c.Color +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateIssueLabelRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetName returns the Name field. +func (c *CreateIssueLabelRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. +func (c *CreateIssueRequest) GetAssignee() string { + if c == nil || c.Assignee == nil { + return "" + } + return *c.Assignee +} + +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (c *CreateIssueRequest) GetAssignees() []string { + if c == nil || c.Assignees == nil { + return nil + } + return c.Assignees +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CreateIssueRequest) GetBody() string { + if c == nil || c.Body == nil { + return "" + } + return *c.Body +} + +// GetIssueFieldValues returns the IssueFieldValues slice if it's non-nil, nil otherwise. +func (c *CreateIssueRequest) GetIssueFieldValues() []*IssueRequestFieldValue { + if c == nil || c.IssueFieldValues == nil { + return nil + } + return c.IssueFieldValues +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (c *CreateIssueRequest) GetLabels() []string { + if c == nil || c.Labels == nil { + return nil + } + return c.Labels +} + +// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. +func (c *CreateIssueRequest) GetMilestone() int { + if c == nil || c.Milestone == nil { + return 0 + } + return *c.Milestone +} + +// GetTitle returns the Title field. +func (c *CreateIssueRequest) GetTitle() string { + if c == nil { + return "" + } + return c.Title +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *CreateIssueRequest) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (c *CreateJITConfigRequest) GetLabels() []string { + if c == nil || c.Labels == nil { + return nil + } + return c.Labels +} + +// GetName returns the Name field. +func (c *CreateJITConfigRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetRunnerGroupID returns the RunnerGroupID field. +func (c *CreateJITConfigRequest) GetRunnerGroupID() int64 { + if c == nil { + return 0 + } + return c.RunnerGroupID +} + +// GetWorkFolder returns the WorkFolder field if it's non-nil, zero value otherwise. +func (c *CreateJITConfigRequest) GetWorkFolder() string { + if c == nil || c.WorkFolder == nil { + return "" + } + return *c.WorkFolder +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateMilestoneRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise. +func (c *CreateMilestoneRequest) GetDueOn() Timestamp { + if c == nil || c.DueOn == nil { + return Timestamp{} + } + return *c.DueOn +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (c *CreateMilestoneRequest) GetState() string { + if c == nil || c.State == nil { + return "" + } + return *c.State +} + +// GetTitle returns the Title field. +func (c *CreateMilestoneRequest) GetTitle() string { + if c == nil { + return "" + } + return c.Title +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationCopilotSpaceRequest) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationCopilotSpaceRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetGeneralInstructions returns the GeneralInstructions field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationCopilotSpaceRequest) GetGeneralInstructions() string { + if c == nil || c.GeneralInstructions == nil { + return "" + } + return *c.GeneralInstructions +} + +// GetName returns the Name field. +func (c *CreateOrganizationCopilotSpaceRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetResourcesAttributes returns the ResourcesAttributes slice if it's non-nil, nil otherwise. +func (c *CreateOrganizationCopilotSpaceRequest) GetResourcesAttributes() []*CreateCopilotSpaceResourceAttributes { + if c == nil || c.ResourcesAttributes == nil { + return nil + } + return c.ResourcesAttributes +} + +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAccountID() string { + if c == nil || c.AccountID == nil { + return "" + } + return *c.AccountID +} + +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAudience() string { + if c == nil || c.Audience == nil { + return "" + } + return *c.Audience +} + +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAuthType() string { + if c == nil || c.AuthType == nil { + return "" + } + return *c.AuthType +} + +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetAWSRegion() string { + if c == nil || c.AWSRegion == nil { + return "" + } + return *c.AWSRegion +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomain() string { + if c == nil || c.Domain == nil { + return "" + } + return *c.Domain +} + +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetDomainOwner() string { + if c == nil || c.DomainOwner == nil { + return "" + } + return *c.DomainOwner +} + +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetEncryptedValue() string { + if c == nil || c.EncryptedValue == nil { + return "" + } + return *c.EncryptedValue +} + +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if c == nil || c.IdentityMappingName == nil { + return "" + } + return *c.IdentityMappingName +} + +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetJFrogOIDCProviderName() string { + if c == nil || c.JFrogOIDCProviderName == nil { + return "" + } + return *c.JFrogOIDCProviderName +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetKeyID() string { + if c == nil || c.KeyID == nil { + return "" + } + return *c.KeyID +} + +// GetRegistryType returns the RegistryType field. +func (c *CreateOrganizationPrivateRegistry) GetRegistryType() PrivateRegistryType { + if c == nil { + return "" + } + return c.RegistryType +} + +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetReplacesBase() bool { + if c == nil || c.ReplacesBase == nil { + return false + } + return *c.ReplacesBase +} + +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetRoleName() string { + if c == nil || c.RoleName == nil { + return "" + } + return *c.RoleName +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (c *CreateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if c == nil || c.SelectedRepositoryIDs == nil { + return nil + } + return c.SelectedRepositoryIDs +} + +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (c *CreateOrganizationPrivateRegistry) GetTenantID() string { + if c == nil || c.TenantID == nil { + return "" + } + return *c.TenantID +} + +// GetURL returns the URL field. +func (c *CreateOrganizationPrivateRegistry) GetURL() string { + if c == nil { + return "" + } + return c.URL +} + +// 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 +} + +// GetVisibility returns the Visibility field. +func (c *CreateOrganizationPrivateRegistry) GetVisibility() PrivateRegistryVisibility { + if c == nil { + return "" + } + return c.Visibility +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CreateOrgInvitationRequest) 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 *CreateOrgInvitationRequest) 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. +func (c *CreateOrgInvitationRequest) GetRole() string { + if c == nil || c.Role == nil { + return "" + } + return *c.Role +} + +// GetTeamIDs returns the TeamIDs slice if it's non-nil, nil otherwise. +func (c *CreateOrgInvitationRequest) GetTeamIDs() []int64 { + if c == nil || c.TeamIDs == nil { + return nil + } + return c.TeamIDs +} + +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateIssueTypesOptions) GetColor() string { + if c == nil || c.Color == nil { + return "" + } + return *c.Color +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateIssueTypesOptions) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetIsEnabled returns the IsEnabled field. +func (c *CreateOrUpdateIssueTypesOptions) GetIsEnabled() bool { + if c == nil { + return false + } + return c.IsEnabled +} + +// GetIsPrivate returns the IsPrivate field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateIssueTypesOptions) GetIsPrivate() bool { + if c == nil || c.IsPrivate == nil { + return false + } + return *c.IsPrivate +} + +// GetName returns the Name field. +func (c *CreateOrUpdateIssueTypesOptions) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CreateProjectV2DraftItemRequest) GetBody() string { + if c == nil || c.Body == nil { + return "" + } + return *c.Body +} + +// GetTitle returns the Title field. +func (c *CreateProjectV2DraftItemRequest) GetTitle() string { + if c == nil { + return "" + } + return c.Title +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (c *CreateProjectV2ViewRequest) GetFilter() string { + if c == nil || c.Filter == nil { + return "" + } + return *c.Filter +} + +// GetLayout returns the Layout field. +func (c *CreateProjectV2ViewRequest) GetLayout() string { + if c == nil { + return "" + } + return c.Layout +} + +// GetName returns the Name field. +func (c *CreateProjectV2ViewRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetVisibleFields returns the VisibleFields slice if it's non-nil, nil otherwise. +func (c *CreateProjectV2ViewRequest) GetVisibleFields() []int64 { + if c == nil || c.VisibleFields == nil { + return nil + } + return c.VisibleFields +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (c *CreateProtectedChanges) GetFrom() bool { + if c == nil || c.From == nil { + return false + } + return *c.From +} + +// GetBase returns the Base field. +func (c *CreatePullRequest) GetBase() string { + if c == nil { + return "" + } + return c.Base +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetBody() string { + if c == nil || c.Body == nil { + return "" + } + return *c.Body +} + +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetDraft() bool { + if c == nil || c.Draft == nil { + return false + } + return *c.Draft +} + +// GetHead returns the Head field. +func (c *CreatePullRequest) GetHead() string { + if c == nil { + return "" + } + return c.Head +} + +// GetHeadRepo returns the HeadRepo field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetHeadRepo() string { + if c == nil || c.HeadRepo == nil { + return "" + } + return *c.HeadRepo +} + +// GetIssue returns the Issue field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetIssue() int { + if c == nil || c.Issue == nil { + return 0 + } + return *c.Issue +} + +// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetMaintainerCanModify() bool { + if c == nil || c.MaintainerCanModify == nil { + return false + } + return *c.MaintainerCanModify +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CreatePullRequest) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetBody returns the Body field. +func (c *CreatePullRequestCommentRequest) GetBody() string { + if c == nil { + return "" + } + return c.Body +} + +// GetCommitID returns the CommitID field. +func (c *CreatePullRequestCommentRequest) GetCommitID() string { + if c == nil { + return "" + } + return c.CommitID +} + +// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetInReplyTo() int64 { + if c == nil || c.InReplyTo == nil { + return 0 + } + return *c.InReplyTo +} + +// GetLine returns the Line field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetLine() int { + if c == nil || c.Line == nil { + return 0 + } + return *c.Line +} + +// GetPath returns the Path field. +func (c *CreatePullRequestCommentRequest) GetPath() string { + if c == nil { + return "" + } + return c.Path +} + +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetPosition() int { + if c == nil || c.Position == nil { + return 0 + } + return *c.Position +} + +// GetSide returns the Side field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetSide() string { + if c == nil || c.Side == nil { + return "" + } + return *c.Side +} + +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetStartLine() int { + if c == nil || c.StartLine == nil { + return 0 + } + return *c.StartLine +} + +// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetStartSide() string { + if c == nil || c.StartSide == nil { + return "" + } + return *c.StartSide +} + +// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise. +func (c *CreatePullRequestCommentRequest) GetSubjectType() string { + if c == nil || c.SubjectType == nil { + return "" + } + return *c.SubjectType +} + +// GetRef returns the Ref field. +func (c *CreateRef) GetRef() string { + if c == nil { + return "" + } + return c.Ref +} + +// GetSHA returns the SHA field. +func (c *CreateRef) GetSHA() string { + if c == nil { + return "" + } + return c.SHA +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetBody() string { + if c == nil || c.Body == nil { + return "" + } + return *c.Body +} + +// GetDiscussionCategoryName returns the DiscussionCategoryName field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetDiscussionCategoryName() string { + if c == nil || c.DiscussionCategoryName == nil { + return "" + } + return *c.DiscussionCategoryName +} + +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetDraft() bool { + if c == nil || c.Draft == nil { + return false + } + return *c.Draft +} + +// GetGenerateReleaseNotes returns the GenerateReleaseNotes field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetGenerateReleaseNotes() bool { + if c == nil || c.GenerateReleaseNotes == nil { + return false + } + return *c.GenerateReleaseNotes +} + +// GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetMakeLatest() string { + if c == nil || c.MakeLatest == nil { + return "" + } + return *c.MakeLatest +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetPrerelease() bool { + if c == nil || c.Prerelease == nil { + return false + } + return *c.Prerelease +} + +// GetTagName returns the TagName field. +func (c *CreateReleaseRequest) GetTagName() string { + if c == nil { + return "" + } + return c.TagName +} + +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (c *CreateReleaseRequest) GetTargetCommitish() string { + if c == nil || c.TargetCommitish == nil { + return "" + } + return *c.TargetCommitish +} + +// GetAllowAutoMerge returns the AllowAutoMerge field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowAutoMerge() bool { + if c == nil || c.AllowAutoMerge == nil { + return false + } + return *c.AllowAutoMerge +} + +// GetAllowForking returns the AllowForking field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowForking() bool { + if c == nil || c.AllowForking == nil { + return false + } + return *c.AllowForking +} + +// GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowMergeCommit() bool { + if c == nil || c.AllowMergeCommit == nil { + return false + } + return *c.AllowMergeCommit +} + +// GetAllowRebaseMerge returns the AllowRebaseMerge field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowRebaseMerge() bool { + if c == nil || c.AllowRebaseMerge == nil { + return false + } + return *c.AllowRebaseMerge +} + +// GetAllowSquashMerge returns the AllowSquashMerge field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowSquashMerge() bool { + if c == nil || c.AllowSquashMerge == nil { + return false + } + return *c.AllowSquashMerge +} + +// GetAllowUpdateBranch returns the AllowUpdateBranch field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAllowUpdateBranch() bool { + if c == nil || c.AllowUpdateBranch == nil { + return false + } + return *c.AllowUpdateBranch +} + +// GetAutoInit returns the AutoInit field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetAutoInit() bool { + if c == nil || c.AutoInit == nil { + return false + } + return *c.AutoInit +} + +// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise. +func (c *CreateRepositoryRequest) GetCustomProperties() map[string]any { + if c == nil || c.CustomProperties == nil { + return map[string]any{} + } + return c.CustomProperties +} + +// GetDeleteBranchOnMerge returns the DeleteBranchOnMerge field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetDeleteBranchOnMerge() bool { + if c == nil || c.DeleteBranchOnMerge == nil { + return false + } + return *c.DeleteBranchOnMerge +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetGitignoreTemplate returns the GitignoreTemplate field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetGitignoreTemplate() string { + if c == nil || c.GitignoreTemplate == nil { + return "" + } + return *c.GitignoreTemplate +} + +// GetHasDiscussions returns the HasDiscussions field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetHasDiscussions() bool { + if c == nil || c.HasDiscussions == nil { + return false + } + return *c.HasDiscussions +} + +// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetHasIssues() bool { + if c == nil || c.HasIssues == nil { + return false + } + return *c.HasIssues +} + +// GetHasProjects returns the HasProjects field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetHasProjects() bool { + if c == nil || c.HasProjects == nil { + return false + } + return *c.HasProjects +} + +// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetHasWiki() bool { + if c == nil || c.HasWiki == nil { + return false + } + return *c.HasWiki +} + +// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetHomepage() string { + if c == nil || c.Homepage == nil { + return "" + } + return *c.Homepage +} + +// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetIsTemplate() bool { + if c == nil || c.IsTemplate == nil { + return false + } + return *c.IsTemplate +} + +// GetLicenseTemplate returns the LicenseTemplate field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetLicenseTemplate() string { + if c == nil || c.LicenseTemplate == nil { + return "" + } + return *c.LicenseTemplate +} + +// GetMergeCommitMessage returns the MergeCommitMessage field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetMergeCommitMessage() string { + if c == nil || c.MergeCommitMessage == nil { + return "" + } + return *c.MergeCommitMessage +} + +// GetMergeCommitTitle returns the MergeCommitTitle field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetMergeCommitTitle() string { + if c == nil || c.MergeCommitTitle == nil { + return "" + } + return *c.MergeCommitTitle +} + +// GetName returns the Name field. +func (c *CreateRepositoryRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetPrivate() bool { + if c == nil || c.Private == nil { + return false + } + return *c.Private +} + +// GetSquashMergeCommitMessage returns the SquashMergeCommitMessage field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetSquashMergeCommitMessage() string { + if c == nil || c.SquashMergeCommitMessage == nil { + return "" + } + return *c.SquashMergeCommitMessage +} + +// GetSquashMergeCommitTitle returns the SquashMergeCommitTitle field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetSquashMergeCommitTitle() string { + if c == nil || c.SquashMergeCommitTitle == nil { + return "" + } + return *c.SquashMergeCommitTitle +} + +// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetTeamID() int64 { + if c == nil || c.TeamID == nil { + return 0 + } + return *c.TeamID +} + +// GetUseSquashPRTitleAsDefault returns the UseSquashPRTitleAsDefault field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetUseSquashPRTitleAsDefault() bool { + if c == nil || c.UseSquashPRTitleAsDefault == nil { + return false + } + return *c.UseSquashPRTitleAsDefault +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (c *CreateRepositoryRequest) GetVisibility() string { + if c == nil || c.Visibility == nil { + return "" + } + return *c.Visibility +} + +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if c == nil || c.AllowsPublicRepositories == nil { + return false + } + return *c.AllowsPublicRepositories +} + +// GetName returns the Name field. +func (c *CreateRunnerGroupRequest) GetName() string { + if c == nil { + return "" + } + 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 { + return false + } + return *c.RestrictedToWorkflows +} + +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetRunners() []int64 { + if c == nil || c.Runners == nil { + return nil + } + return c.Runners +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetSelectedRepositoryIDs() []int64 { + if c == nil || c.SelectedRepositoryIDs == nil { + return nil + } + return c.SelectedRepositoryIDs +} + +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (c *CreateRunnerGroupRequest) GetSelectedWorkflows() []string { + if c == nil || c.SelectedWorkflows == nil { + return nil + } + return c.SelectedWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetVisibility() string { + if c == nil || c.Visibility == nil { + return "" + } + return *c.Visibility +} + +// GetKey returns the Key field. +func (c *CreateSSHSigningKeyRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CreateSSHSigningKeyRequest) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetMessage returns the Message field. +func (c *CreateTag) GetMessage() string { + if c == nil { + return "" + } + return c.Message +} + +// GetObject returns the Object field. +func (c *CreateTag) GetObject() string { + if c == nil { + return "" + } + return c.Object +} + +// GetTag returns the Tag field. +func (c *CreateTag) GetTag() string { + if c == nil { + return "" + } + return c.Tag +} + +// GetTagger returns the Tagger field. +func (c *CreateTag) GetTagger() *CommitAuthor { + if c == nil { + return nil + } + return c.Tagger +} + +// GetType returns the Type field. +func (c *CreateTag) GetType() string { + if c == nil { + return "" + } + return c.Type +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetLDAPDN() string { + if c == nil || c.LDAPDN == nil { + return "" + } + return *c.LDAPDN +} + +// GetMaintainers returns the Maintainers slice if it's non-nil, nil otherwise. +func (c *CreateTeamRequest) GetMaintainers() []string { + if c == nil || c.Maintainers == nil { + return nil + } + return c.Maintainers +} + +// GetName returns the Name field. +func (c *CreateTeamRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetNotificationSetting() string { + if c == nil || c.NotificationSetting == nil { + return "" + } + return *c.NotificationSetting +} + +// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetParentTeamID() int64 { + if c == nil || c.ParentTeamID == nil { + return 0 + } + return *c.ParentTeamID +} + +// GetParentTeamSlug returns the ParentTeamSlug field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetParentTeamSlug() string { + if c == nil || c.ParentTeamSlug == nil { + return "" + } + return *c.ParentTeamSlug +} + +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetPermission() string { + if c == nil || c.Permission == nil { + return "" + } + return *c.Permission +} + +// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. +func (c *CreateTeamRequest) GetPrivacy() string { + if c == nil || c.Privacy == nil { + return "" + } + return *c.Privacy +} + +// GetRepoNames returns the RepoNames slice if it's non-nil, nil otherwise. +func (c *CreateTeamRequest) GetRepoNames() []string { + if c == nil || c.RepoNames == nil { + return nil + } + return c.RepoNames +} + +// GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. +func (c *CreateUpdateEnvironment) GetCanAdminsBypass() bool { + if c == nil || c.CanAdminsBypass == nil { + return false + } + return *c.CanAdminsBypass +} + +// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. +func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { + if c == nil { + return nil + } + return c.DeploymentBranchPolicy +} + +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { + if c == nil || c.PreventSelfReview == nil { + return false + } + return *c.PreventSelfReview +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (c *CreateUpdateEnvironment) GetReviewers() []*EnvReviewers { + if c == nil || c.Reviewers == nil { + return nil + } + return c.Reviewers +} + +// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. +func (c *CreateUpdateEnvironment) GetWaitTimer() int { + if c == nil || c.WaitTimer == nil { + return 0 + } + return *c.WaitTimer +} + +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (c *CreateUserImpersonationRequest) GetScopes() []string { + if c == nil || c.Scopes == nil { + return nil + } + return c.Scopes +} + +// GetKey returns the Key field. +func (c *CreateUserKeyRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (c *CreateUserKeyRequest) GetTitle() string { + if c == nil || c.Title == nil { + return "" + } + return *c.Title +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CreateUserRequest) GetEmail() string { + if c == nil || c.Email == nil { + return "" + } + return *c.Email +} + +// GetLogin returns the Login field. +func (c *CreateUserRequest) GetLogin() string { + if c == nil { + return "" + } + return c.Login +} + +// GetSuspended returns the Suspended field if it's non-nil, zero value otherwise. +func (c *CreateUserRequest) GetSuspended() bool { + if c == nil || c.Suspended == nil { + return false + } + return *c.Suspended +} + +// GetInputs returns the Inputs map if it's non-nil, an empty map otherwise. +func (c *CreateWorkflowDispatchEventRequest) GetInputs() map[string]any { + if c == nil || c.Inputs == nil { + return map[string]any{} + } + return c.Inputs +} + +// GetRef returns the Ref field. +func (c *CreateWorkflowDispatchEventRequest) GetRef() string { + if c == nil { + return "" + } + return c.Ref +} + +// 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 { + return Timestamp{} + } + return *c.Created +} + +// GetCreators returns the Creators slice if it's non-nil, nil otherwise. +func (c *CreationInfo) GetCreators() []string { + if c == nil || c.Creators == nil { + return nil + } + return c.Creators +} + +// GetAuthorizedCredentialExpiresAt returns the AuthorizedCredentialExpiresAt field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetAuthorizedCredentialExpiresAt() Timestamp { + if c == nil || c.AuthorizedCredentialExpiresAt == nil { + return Timestamp{} + } + return *c.AuthorizedCredentialExpiresAt +} + +// GetAuthorizedCredentialID returns the AuthorizedCredentialID field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetAuthorizedCredentialID() int64 { + if c == nil || c.AuthorizedCredentialID == nil { + return 0 + } + return *c.AuthorizedCredentialID +} + +// GetAuthorizedCredentialNote returns the AuthorizedCredentialNote field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetAuthorizedCredentialNote() string { + if c == nil || c.AuthorizedCredentialNote == nil { + return "" + } + return *c.AuthorizedCredentialNote +} + +// GetAuthorizedCredentialTitle returns the AuthorizedCredentialTitle field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetAuthorizedCredentialTitle() string { + if c == nil || c.AuthorizedCredentialTitle == nil { + return "" + } + return *c.AuthorizedCredentialTitle +} + +// GetCredentialAccessedAt returns the CredentialAccessedAt field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetCredentialAccessedAt() Timestamp { + if c == nil || c.CredentialAccessedAt == nil { + return Timestamp{} + } + return *c.CredentialAccessedAt +} + +// GetCredentialAuthorizedAt returns the CredentialAuthorizedAt field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetCredentialAuthorizedAt() Timestamp { + if c == nil || c.CredentialAuthorizedAt == nil { + return Timestamp{} + } + return *c.CredentialAuthorizedAt +} + +// GetCredentialID returns the CredentialID field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetCredentialID() int64 { + if c == nil || c.CredentialID == nil { + return 0 + } + return *c.CredentialID +} + +// GetCredentialType returns the CredentialType field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetCredentialType() string { + if c == nil || c.CredentialType == nil { + return "" + } + return *c.CredentialType +} + +// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetFingerprint() string { + if c == nil || c.Fingerprint == nil { + return "" + } + return *c.Fingerprint +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetLogin() string { + if c == nil || c.Login == nil { + return "" + } + return *c.Login +} + +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (c *CredentialAuthorization) GetScopes() []string { + if c == nil || c.Scopes == nil { + return nil + } + return c.Scopes +} + +// GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise. +func (c *CredentialAuthorization) GetTokenLastEight() string { + if c == nil || c.TokenLastEight == nil { + return "" + } + return *c.TokenLastEight +} + +// GetLogin returns the Login field. +func (c *CredentialAuthorizationsListOptions) GetLogin() string { + if c == nil { + return "" + } + return c.Login +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *Credit) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetUser returns the User field. +func (c *Credit) GetUser() *User { + if c == nil { + return nil + } + return c.User +} + +// GetApp returns the App field. +func (c *CustomDeploymentProtectionRule) GetApp() *CustomDeploymentProtectionRuleApp { + if c == nil { + return nil + } + return c.App +} + +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false + } + return *c.Enabled +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" + } + return *c.NodeID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetIntegrationURL returns the IntegrationURL field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetIntegrationURL() string { + if c == nil || c.IntegrationURL == nil { + return "" + } + return *c.IntegrationURL +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" + } + return *c.NodeID +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetSlug() string { + if c == nil || c.Slug == nil { + return "" + } + return *c.Slug +} + +// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleRequest) GetIntegrationID() int64 { + if c == nil || c.IntegrationID == nil { + return 0 + } + return *c.IntegrationID +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOrg returns the Org field. +func (c *CustomOrgRole) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CustomOrgRole) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetSource() string { + if c == nil || c.Source == nil { + return "" + } + return *c.Source +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CustomOrgRole) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + +// 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.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 +} + +// GetAllowedValues returns the AllowedValues slice if it's non-nil, nil otherwise. +func (c *CustomProperty) GetAllowedValues() []string { + if c == nil || c.AllowedValues == nil { + return nil + } + return c.AllowedValues +} + +// GetDefaultValue returns the DefaultValue field. +func (c *CustomProperty) GetDefaultValue() any { + if c == nil { + return nil + } + return c.DefaultValue +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetPropertyName returns the PropertyName field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetPropertyName() string { + if c == nil || c.PropertyName == nil { + return "" + } + return *c.PropertyName +} + +// GetRequired returns the Required field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetRequired() bool { + if c == nil || c.Required == nil { + return false + } + return *c.Required +} + +// GetRequireExplicitValues returns the RequireExplicitValues field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetRequireExplicitValues() bool { + if c == nil || c.RequireExplicitValues == nil { + return false + } + return *c.RequireExplicitValues +} + +// GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetSourceType() string { + if c == nil || c.SourceType == nil { + return "" + } + 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 { + return "" + } + return *c.ValuesEditableBy +} + +// GetValueType returns the ValueType field. +func (c *CustomProperty) GetValueType() PropertyValueType { + if c == nil { + return "" + } + return c.ValueType +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CustomPropertyEvent) GetAction() string { + if c == nil || c.Action == nil { + return "" + } + return *c.Action +} + +// GetDefinition returns the Definition field. +func (c *CustomPropertyEvent) GetDefinition() *CustomProperty { + if c == nil { + return nil + } + return c.Definition +} + +// GetEnterprise returns the Enterprise field. +func (c *CustomPropertyEvent) GetEnterprise() *Enterprise { + if c == nil { + return nil + } + return c.Enterprise +} + +// GetInstallation returns the Installation field. +func (c *CustomPropertyEvent) GetInstallation() *Installation { + if c == nil { + return nil + } + return c.Installation +} + +// GetOrg returns the Org field. +func (c *CustomPropertyEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetSender returns the Sender field. +func (c *CustomPropertyEvent) GetSender() *User { + if c == nil { + return nil + } + return c.Sender +} + +// GetPropertyName returns the PropertyName field. +func (c *CustomPropertyValue) GetPropertyName() string { + if c == nil { + return "" + } + return c.PropertyName +} + +// GetValue returns the Value field. +func (c *CustomPropertyValue) GetValue() any { + if c == nil { + return nil + } + return c.Value +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *CustomPropertyValuesEvent) GetAction() string { + if c == nil || c.Action == nil { + return "" + } + return *c.Action +} + +// GetEnterprise returns the Enterprise field. +func (c *CustomPropertyValuesEvent) GetEnterprise() *Enterprise { + if c == nil { + return nil + } + return c.Enterprise +} + +// GetInstallation returns the Installation field. +func (c *CustomPropertyValuesEvent) GetInstallation() *Installation { + if c == nil { + return nil + } + return c.Installation +} + +// GetNewPropertyValues returns the NewPropertyValues slice if it's non-nil, nil otherwise. +func (c *CustomPropertyValuesEvent) GetNewPropertyValues() []*CustomPropertyValue { + if c == nil || c.NewPropertyValues == nil { + return nil + } + return c.NewPropertyValues +} + +// GetOldPropertyValues returns the OldPropertyValues slice if it's non-nil, nil otherwise. +func (c *CustomPropertyValuesEvent) GetOldPropertyValues() []*CustomPropertyValue { + if c == nil || c.OldPropertyValues == nil { + return nil + } + return c.OldPropertyValues +} + +// GetOrg returns the Org field. +func (c *CustomPropertyValuesEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetRepo returns the Repo field. +func (c *CustomPropertyValuesEvent) GetRepo() *Repository { + if c == nil { + return nil + } + return c.Repo +} + +// GetSender returns the Sender field. +func (c *CustomPropertyValuesEvent) GetSender() *User { + if c == nil { + return nil + } + return c.Sender +} + +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOrg returns the Org field. +func (c *CustomRepoRoles) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (c *CustomRepoRoles) GetPermissions() []string { + if c == nil || c.Permissions == nil { + return nil + } + return c.Permissions +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CustomRepoRoles) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + +// GetEncryptedToken returns the EncryptedToken field. +func (d *DatadogConfig) GetEncryptedToken() string { + if d == nil { + return "" + } + return d.EncryptedToken +} + +// GetKeyID returns the KeyID field. +func (d *DatadogConfig) GetKeyID() string { + if d == nil { + return "" + } + return d.KeyID +} + +// GetSite returns the Site field. +func (d *DatadogConfig) GetSite() string { + if d == nil { + return "" + } + return d.Site +} + +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (d *DefaultSetupConfiguration) GetLanguages() []string { + if d == nil || d.Languages == nil { + return nil + } + return d.Languages +} + +// GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. +func (d *DefaultSetupConfiguration) GetQuerySuite() string { + if d == nil || d.QuerySuite == nil { + return "" + } + return *d.QuerySuite +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (d *DefaultSetupConfiguration) GetState() string { + if d == nil || d.State == nil { + return "" + } + return *d.State +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DefaultSetupConfiguration) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionEnterprise) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionEnterprise) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionOrganization) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionOrganization) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionRepository) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionRepository) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + +// GetConfirmDeleteURL returns the ConfirmDeleteURL field if it's non-nil, zero value otherwise. +func (d *DeleteAnalysis) GetConfirmDeleteURL() string { + if d == nil || d.ConfirmDeleteURL == nil { + return "" + } + return *d.ConfirmDeleteURL +} + +// GetNextAnalysisURL returns the NextAnalysisURL field if it's non-nil, zero value otherwise. +func (d *DeleteAnalysis) GetNextAnalysisURL() string { + if d == nil || d.NextAnalysisURL == nil { + return "" + } + return *d.NextAnalysisURL +} + +// GetCostCenterState returns the CostCenterState field. +func (d *DeleteCostCenterResponse) GetCostCenterState() string { + if d == nil { + return "" + } + return d.CostCenterState +} + +// GetID returns the ID field. +func (d *DeleteCostCenterResponse) GetID() string { + if d == nil { + return "" + } + return d.ID +} + +// GetMessage returns the Message field. +func (d *DeleteCostCenterResponse) GetMessage() string { + if d == nil { + return "" + } + return d.Message +} + +// GetName returns the Name field. +func (d *DeleteCostCenterResponse) GetName() string { + if d == nil { + return "" + } + return d.Name +} + +// GetInstallation returns the Installation field. +func (d *DeleteEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrg returns the Org field. +func (d *DeleteEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + +// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. +func (d *DeleteEvent) GetPusherType() string { + if d == nil || d.PusherType == nil { + return "" + } + return *d.PusherType +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (d *DeleteEvent) GetRef() string { + if d == nil || d.Ref == nil { + return "" + } + return *d.Ref +} + +// GetRefType returns the RefType field if it's non-nil, zero value otherwise. +func (d *DeleteEvent) GetRefType() string { + if d == nil || d.RefType == nil { + return "" + } + return *d.RefType +} + +// GetRepo returns the Repo field. +func (d *DeleteEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DeleteEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetAutoDismissedAt returns the AutoDismissedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetAutoDismissedAt() Timestamp { + if d == nil || d.AutoDismissedAt == nil { + return Timestamp{} + } + return *d.AutoDismissedAt +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetDependency returns the Dependency field. +func (d *DependabotAlert) GetDependency() *Dependency { + if d == nil { + return nil + } + return d.Dependency +} + +// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetDismissedAt() Timestamp { + if d == nil || d.DismissedAt == nil { + return Timestamp{} + } + return *d.DismissedAt +} + +// GetDismissedBy returns the DismissedBy field. +func (d *DependabotAlert) GetDismissedBy() *User { + if d == nil { + return nil + } + return d.DismissedBy +} + +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetDismissedComment() string { + if d == nil || d.DismissedComment == nil { + return "" + } + return *d.DismissedComment +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetDismissedReason() string { + if d == nil || d.DismissedReason == nil { + return "" + } + return *d.DismissedReason +} + +// GetFixedAt returns the FixedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetFixedAt() Timestamp { + if d == nil || d.FixedAt == nil { + return Timestamp{} + } + return *d.FixedAt +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetHTMLURL() string { + if d == nil || d.HTMLURL == nil { + return "" + } + return *d.HTMLURL +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetNumber() int { + if d == nil || d.Number == nil { + return 0 + } + return *d.Number +} + +// GetRepository returns the Repository field. +func (d *DependabotAlert) GetRepository() *Repository { + if d == nil { + return nil + } + return d.Repository +} + +// GetSecurityAdvisory returns the SecurityAdvisory field. +func (d *DependabotAlert) GetSecurityAdvisory() *DependabotSecurityAdvisory { + if d == nil { + return nil + } + return d.SecurityAdvisory +} + +// GetSecurityVulnerability returns the SecurityVulnerability field. +func (d *DependabotAlert) GetSecurityVulnerability() *AdvisoryVulnerability { + if d == nil { + return nil + } + return d.SecurityVulnerability +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetState() string { + if d == nil || d.State == nil { + return "" + } + return *d.State +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetURL() string { + if d == nil || d.URL == nil { + return "" + } + return *d.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DependabotAlertEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetAlert returns the Alert field. +func (d *DependabotAlertEvent) GetAlert() *DependabotAlert { + if d == nil { + return nil + } + return d.Alert +} + +// GetEnterprise returns the Enterprise field. +func (d *DependabotAlertEvent) GetEnterprise() *Enterprise { + if d == nil { + return nil + } + return d.Enterprise +} + +// GetInstallation returns the Installation field. +func (d *DependabotAlertEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrganization returns the Organization field. +func (d *DependabotAlertEvent) GetOrganization() *Organization { + if d == nil { + return nil + } + return d.Organization +} + +// GetRepo returns the Repo field. +func (d *DependabotAlertEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DependabotAlertEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (d *DependabotAlertState) GetDismissedComment() string { + if d == nil || d.DismissedComment == nil { + return "" + } + return *d.DismissedComment +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (d *DependabotAlertState) GetDismissedReason() string { + if d == nil || d.DismissedReason == nil { + return "" + } + return *d.DismissedReason +} + +// GetState returns the State field. +func (d *DependabotAlertState) GetState() string { + if d == nil { + return "" + } + return d.State +} + +// GetClassification returns the Classification field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetClassification() string { + if d == nil || d.Classification == nil { + return "" + } + return *d.Classification +} + +// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetCVEID() string { + if d == nil || d.CVEID == nil { + return "" + } + return *d.CVEID +} + +// GetCVSS returns the CVSS field. +func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { + if d == nil { + return nil + } + return d.CVSS +} + +// GetCVSSSeverities returns the CVSSSeverities field. +func (d *DependabotSecurityAdvisory) GetCVSSSeverities() *AdvisoryCVSSSeverities { + if d == nil { + return nil + } + return d.CVSSSeverities +} + +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetCWEs() []*AdvisoryCWEs { + if d == nil || d.CWEs == nil { + return nil + } + return d.CWEs +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEPSS returns the EPSS field. +func (d *DependabotSecurityAdvisory) GetEPSS() *AdvisoryEPSS { + if d == nil { + return nil + } + return d.EPSS +} + +// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetGHSAID() string { + if d == nil || d.GHSAID == nil { + return "" + } + return *d.GHSAID +} + +// GetIdentifiers returns the Identifiers slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetIdentifiers() []*AdvisoryIdentifier { + if d == nil || d.Identifiers == nil { + return nil + } + return d.Identifiers +} + +// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetPublishedAt() Timestamp { + if d == nil || d.PublishedAt == nil { + return Timestamp{} + } + return *d.PublishedAt +} + +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetReferences() []*AdvisoryReference { + if d == nil || d.References == nil { + return nil + } + return d.References +} + +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetSeverity() string { + if d == nil || d.Severity == nil { + return "" + } + return *d.Severity +} + +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetSummary() string { + if d == nil || d.Summary == nil { + return "" + } + return *d.Summary +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (d *DependabotSecurityAdvisory) GetVulnerabilities() []*AdvisoryVulnerability { + if d == nil || d.Vulnerabilities == nil { + return nil + } + return d.Vulnerabilities +} + +// GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityAdvisory) GetWithdrawnAt() Timestamp { + if d == nil || d.WithdrawnAt == nil { + return Timestamp{} + } + return *d.WithdrawnAt +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (d *DependabotSecurityUpdates) GetStatus() string { + if d == nil || d.Status == nil { + return "" + } + return *d.Status +} + +// GetManifestPath returns the ManifestPath field if it's non-nil, zero value otherwise. +func (d *Dependency) GetManifestPath() string { + if d == nil || d.ManifestPath == nil { + return "" + } + return *d.ManifestPath +} + +// GetPackage returns the Package field. +func (d *Dependency) GetPackage() *VulnerabilityPackage { + if d == nil { + return nil + } + return d.Package +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (d *Dependency) GetScope() string { + if d == nil || d.Scope == nil { + return "" + } + return *d.Scope +} + +// GetLabeledRunners returns the LabeledRunners field if it's non-nil, zero value otherwise. +func (d *DependencyGraphAutosubmitActionOptions) GetLabeledRunners() bool { + if d == nil || d.LabeledRunners == nil { + return false + } + return *d.LabeledRunners +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotCreationData) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetID returns the ID field. +func (d *DependencyGraphSnapshotCreationData) GetID() int64 { + if d == nil { + return 0 + } + return d.ID +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotCreationData) GetMessage() string { + if d == nil || d.Message == nil { + return "" + } + return *d.Message +} + +// GetResult returns the Result field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotCreationData) GetResult() string { + if d == nil || d.Result == nil { + return "" + } + return *d.Result +} + +// GetName returns the Name field. +func (d *DependencyGraphSnapshotDetector) GetName() string { + if d == nil { + return "" + } + return d.Name +} + +// GetURL returns the URL field. +func (d *DependencyGraphSnapshotDetector) GetURL() string { + if d == nil { + return "" + } + return d.URL +} + +// GetVersion returns the Version field. +func (d *DependencyGraphSnapshotDetector) GetVersion() string { + if d == nil { + return "" + } + return d.Version +} + +// GetCorrelator returns the Correlator field. +func (d *DependencyGraphSnapshotJob) GetCorrelator() string { + if d == nil { + return "" + } + return d.Correlator +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotJob) GetHTMLURL() string { + if d == nil || d.HTMLURL == nil { + return "" + } + return *d.HTMLURL +} + +// GetID returns the ID field. +func (d *DependencyGraphSnapshotJob) GetID() string { + if d == nil { + return "" + } + return d.ID +} + +// GetFile returns the File field. +func (d *DependencyGraphSnapshotManifest) GetFile() *DependencyGraphSnapshotManifestFile { + if d == nil { + return nil + } + return d.File +} + +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshotManifest) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + +// GetName returns the Name field. +func (d *DependencyGraphSnapshotManifest) GetName() string { + if d == nil { + return "" + } + return d.Name +} + +// GetSourceLocation returns the SourceLocation field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotManifestFile) GetSourceLocation() string { + if d == nil || d.SourceLocation == nil { + return "" + } + return *d.SourceLocation +} + +// GetDependencies returns the Dependencies slice if it's non-nil, nil otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetDependencies() []string { + if d == nil || d.Dependencies == nil { + return nil + } + return d.Dependencies +} + +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + +// GetPackageURL returns the PackageURL field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetPackageURL() string { + if d == nil || d.PackageURL == nil { + return "" + } + return *d.PackageURL +} + +// GetRelationship returns the Relationship field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetRelationship() string { + if d == nil || d.Relationship == nil { + return "" + } + return *d.Relationship +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotResolvedDependency) GetScope() string { + if d == nil || d.Scope == nil { + return "" + } + return *d.Scope +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DeployKeyEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetInstallation returns the Installation field. +func (d *DeployKeyEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetKey returns the Key field. +func (d *DeployKeyEvent) GetKey() *Key { + if d == nil { + return nil + } + return d.Key +} + +// GetOrganization returns the Organization field. +func (d *DeployKeyEvent) GetOrganization() *Organization { + if d == nil { + return nil + } + return d.Organization +} + +// GetRepo returns the Repo field. +func (d *DeployKeyEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DeployKeyEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *Deployment) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetCreator returns the Creator field. +func (d *Deployment) GetCreator() *User { + if d == nil { + return nil + } + return d.Creator +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *Deployment) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *Deployment) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *Deployment) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *Deployment) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetPayload returns the Payload field. +func (d *Deployment) GetPayload() json.RawMessage { + if d == nil { + return json.RawMessage{} + } + return d.Payload +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (d *Deployment) GetRef() string { + if d == nil || d.Ref == nil { + return "" + } + return *d.Ref +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (d *Deployment) GetRepositoryURL() string { + if d == nil || d.RepositoryURL == nil { + return "" + } + return *d.RepositoryURL +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (d *Deployment) GetSHA() string { + if d == nil || d.SHA == nil { + return "" + } + return *d.SHA +} + +// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. +func (d *Deployment) GetStatusesURL() string { + if d == nil || d.StatusesURL == nil { + return "" + } + return *d.StatusesURL +} + +// GetTask returns the Task field if it's non-nil, zero value otherwise. +func (d *Deployment) GetTask() string { + if d == nil || d.Task == nil { + return "" + } + return *d.Task +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *Deployment) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *Deployment) GetURL() string { + if d == nil || d.URL == nil { + return "" + } + return *d.URL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicy) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicy) GetName() string { + if d == nil || d.Name == nil { + return "" + } + return *d.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicy) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicy) GetType() string { + if d == nil || d.Type == nil { + return "" + } + return *d.Type +} + +// GetBranchPolicies returns the BranchPolicies slice if it's non-nil, nil otherwise. +func (d *DeploymentBranchPolicyResponse) GetBranchPolicies() []*DeploymentBranchPolicy { + if d == nil || d.BranchPolicies == nil { + return nil + } + return d.BranchPolicies +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicyResponse) GetTotalCount() int { + if d == nil || d.TotalCount == nil { + return 0 + } + return *d.TotalCount +} + +// GetDeployment returns the Deployment field. +func (d *DeploymentEvent) GetDeployment() *Deployment { + if d == nil { + return nil + } + return d.Deployment +} + +// GetInstallation returns the Installation field. +func (d *DeploymentEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrg returns the Org field. +func (d *DeploymentEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + +// GetRepo returns the Repo field. +func (d *DeploymentEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DeploymentEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetWorkflow returns the Workflow field. +func (d *DeploymentEvent) GetWorkflow() *Workflow { + if d == nil { + return nil + } + return d.Workflow +} + +// GetWorkflowRun returns the WorkflowRun field. +func (d *DeploymentEvent) GetWorkflowRun() *WorkflowRun { + if d == nil { + return nil + } + return d.WorkflowRun +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DeploymentProtectionRuleEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetDeployment returns the Deployment field. +func (d *DeploymentProtectionRuleEvent) GetDeployment() *Deployment { + if d == nil { + return nil + } + return d.Deployment +} + +// GetDeploymentCallbackURL returns the DeploymentCallbackURL field if it's non-nil, zero value otherwise. +func (d *DeploymentProtectionRuleEvent) GetDeploymentCallbackURL() string { + if d == nil || d.DeploymentCallbackURL == nil { + return "" + } + return *d.DeploymentCallbackURL +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *DeploymentProtectionRuleEvent) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (d *DeploymentProtectionRuleEvent) GetEvent() string { + if d == nil || d.Event == nil { + return "" + } + return *d.Event +} + +// GetInstallation returns the Installation field. +func (d *DeploymentProtectionRuleEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrganization returns the Organization field. +func (d *DeploymentProtectionRuleEvent) GetOrganization() *Organization { + if d == nil { + return nil + } + return d.Organization +} + +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (d *DeploymentProtectionRuleEvent) GetPullRequests() []*PullRequest { + if d == nil || d.PullRequests == nil { + return nil + } + return d.PullRequests +} + +// GetRepo returns the Repo field. +func (d *DeploymentProtectionRuleEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DeploymentProtectionRuleEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetAutoMerge() bool { + if d == nil || d.AutoMerge == nil { + return false + } + return *d.AutoMerge +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetPayload returns the Payload field. +func (d *DeploymentRequest) GetPayload() any { + if d == nil { + return nil + } + return d.Payload +} + +// GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetProductionEnvironment() bool { + if d == nil || d.ProductionEnvironment == nil { + return false + } + return *d.ProductionEnvironment +} + +// GetRef returns the Ref field. +func (d *DeploymentRequest) GetRef() string { + if d == nil { + return "" + } + return d.Ref +} + +// GetRequiredContexts returns the RequiredContexts slice if it's non-nil, nil otherwise. +func (d *DeploymentRequest) GetRequiredContexts() []string { + if d == nil || d.RequiredContexts == nil { + return nil + } + return d.RequiredContexts +} + +// GetTask returns the Task field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetTask() string { + if d == nil || d.Task == nil { + return "" + } + return *d.Task +} + +// GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetTransientEnvironment() bool { + if d == nil || d.TransientEnvironment == nil { + return false + } + return *d.TransientEnvironment +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DeploymentReviewEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetApprover returns the Approver field. +func (d *DeploymentReviewEvent) GetApprover() *User { + if d == nil { + return nil + } + return d.Approver +} + +// GetComment returns the Comment field if it's non-nil, zero value otherwise. +func (d *DeploymentReviewEvent) GetComment() string { + if d == nil || d.Comment == nil { + return "" + } + return *d.Comment +} + +// GetEnterprise returns the Enterprise field. +func (d *DeploymentReviewEvent) GetEnterprise() *Enterprise { + if d == nil { + return nil + } + return d.Enterprise +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *DeploymentReviewEvent) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetInstallation returns the Installation field. +func (d *DeploymentReviewEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrganization returns the Organization field. +func (d *DeploymentReviewEvent) GetOrganization() *Organization { + if d == nil { + return nil + } + return d.Organization +} + +// GetRepo returns the Repo field. +func (d *DeploymentReviewEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetRequester returns the Requester field. +func (d *DeploymentReviewEvent) GetRequester() *User { + if d == nil { + return nil + } + return d.Requester +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (d *DeploymentReviewEvent) GetReviewers() []*RequiredReviewer { + if d == nil || d.Reviewers == nil { + return nil + } + return d.Reviewers +} + +// GetSender returns the Sender field. +func (d *DeploymentReviewEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetSince returns the Since field if it's non-nil, zero value otherwise. +func (d *DeploymentReviewEvent) GetSince() string { + if d == nil || d.Since == nil { + return "" + } + return *d.Since +} + +// GetWorkflowJobRun returns the WorkflowJobRun field. +func (d *DeploymentReviewEvent) GetWorkflowJobRun() *WorkflowJobRun { + if d == nil { + return nil + } + return d.WorkflowJobRun +} + +// GetWorkflowJobRuns returns the WorkflowJobRuns slice if it's non-nil, nil otherwise. +func (d *DeploymentReviewEvent) GetWorkflowJobRuns() []*WorkflowJobRun { + if d == nil || d.WorkflowJobRuns == nil { + return nil + } + return d.WorkflowJobRuns +} + +// GetWorkflowRun returns the WorkflowRun field. +func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { + if d == nil { + return nil + } + return d.WorkflowRun +} + +// GetEnvironment returns the Environment field. +func (d *DeploymentsListOptions) GetEnvironment() string { + if d == nil { + return "" + } + return d.Environment +} + +// GetRef returns the Ref field. +func (d *DeploymentsListOptions) GetRef() string { + if d == nil { + return "" + } + return d.Ref +} + +// GetSHA returns the SHA field. +func (d *DeploymentsListOptions) GetSHA() string { + if d == nil { + return "" + } + return d.SHA +} + +// GetTask returns the Task field. +func (d *DeploymentsListOptions) GetTask() string { + if d == nil { + return "" + } + return d.Task +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetCreator returns the Creator field. +func (d *DeploymentStatus) GetCreator() *User { + if d == nil { + return nil + } + return d.Creator +} + +// GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetDeploymentURL() string { + if d == nil || d.DeploymentURL == nil { + return "" + } + return *d.DeploymentURL +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetEnvironmentURL() string { + if d == nil || d.EnvironmentURL == nil { + return "" + } + return *d.EnvironmentURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetLogURL() string { + if d == nil || d.LogURL == nil { + return "" + } + return *d.LogURL +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetRepositoryURL() string { + if d == nil || d.RepositoryURL == nil { + return "" + } + return *d.RepositoryURL +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetState() string { + if d == nil || d.State == nil { + return "" + } + return *d.State +} + +// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetTargetURL() string { + if d == nil || d.TargetURL == nil { + return "" + } + return *d.TargetURL +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatus) GetURL() string { + if d == nil || d.URL == nil { + return "" + } + return *d.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetDeployment returns the Deployment field. +func (d *DeploymentStatusEvent) GetDeployment() *Deployment { + if d == nil { + return nil + } + return d.Deployment +} + +// GetDeploymentStatus returns the DeploymentStatus field. +func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus { + if d == nil { + return nil + } + return d.DeploymentStatus +} + +// GetInstallation returns the Installation field. +func (d *DeploymentStatusEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrg returns the Org field. +func (d *DeploymentStatusEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + +// GetRepo returns the Repo field. +func (d *DeploymentStatusEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DeploymentStatusEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetAutoInactive() bool { + if d == nil || d.AutoInactive == nil { + return false + } + return *d.AutoInactive +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetEnvironment() string { + if d == nil || d.Environment == nil { + return "" + } + return *d.Environment +} + +// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetEnvironmentURL() string { + if d == nil || d.EnvironmentURL == nil { + return "" + } + return *d.EnvironmentURL +} + +// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetLogURL() string { + if d == nil || d.LogURL == nil { + return "" + } + return *d.LogURL +} + +// GetState returns the State field. +func (d *DeploymentStatusRequest) GetState() string { + if d == nil { + return "" + } + return d.State +} + +// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. +func (d *DeploymentStatusRequest) GetTargetURL() string { + if d == nil || d.TargetURL == nil { + return "" + } + return *d.TargetURL +} + +// 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 +} + +// GetPath returns the Path field. +func (d *DevContainer) GetPath() string { + if d == nil { + return "" + } + return d.Path +} + +// GetDevcontainers returns the Devcontainers slice if it's non-nil, nil otherwise. +func (d *DevContainerConfigurations) GetDevcontainers() []*DevContainer { + if d == nil || d.Devcontainers == nil { + return nil + } + return d.Devcontainers +} + +// GetTotalCount returns the TotalCount field. +func (d *DevContainerConfigurations) GetTotalCount() int64 { + if d == nil { + return 0 + } + return d.TotalCount +} + +// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. +func (d *Discussion) GetActiveLockReason() string { + if d == nil || d.ActiveLockReason == nil { + return "" + } + return *d.ActiveLockReason +} + +// GetAnswerChosenAt returns the AnswerChosenAt field if it's non-nil, zero value otherwise. +func (d *Discussion) GetAnswerChosenAt() Timestamp { + if d == nil || d.AnswerChosenAt == nil { + return Timestamp{} + } + return *d.AnswerChosenAt +} + +// GetAnswerChosenBy returns the AnswerChosenBy field if it's non-nil, zero value otherwise. +func (d *Discussion) GetAnswerChosenBy() string { + if d == nil || d.AnswerChosenBy == nil { + return "" + } + return *d.AnswerChosenBy +} + +// GetAnswerHTMLURL returns the AnswerHTMLURL field if it's non-nil, zero value otherwise. +func (d *Discussion) GetAnswerHTMLURL() string { + if d == nil || d.AnswerHTMLURL == nil { + return "" + } + return *d.AnswerHTMLURL +} + +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (d *Discussion) GetAuthorAssociation() string { + if d == nil || d.AuthorAssociation == nil { + return "" + } + return *d.AuthorAssociation +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (d *Discussion) GetBody() string { + if d == nil || d.Body == nil { + return "" + } + return *d.Body +} + +// GetComments returns the Comments field if it's non-nil, zero value otherwise. +func (d *Discussion) GetComments() int { + if d == nil || d.Comments == nil { + return 0 + } + return *d.Comments +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *Discussion) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetDiscussionCategory returns the DiscussionCategory field. +func (d *Discussion) GetDiscussionCategory() *DiscussionCategory { + if d == nil { + return nil + } + return d.DiscussionCategory +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (d *Discussion) GetHTMLURL() string { + if d == nil || d.HTMLURL == nil { + return "" + } + return *d.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *Discussion) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetLocked returns the Locked field if it's non-nil, zero value otherwise. +func (d *Discussion) GetLocked() bool { + if d == nil || d.Locked == nil { + return false + } + return *d.Locked +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *Discussion) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (d *Discussion) GetNumber() int { + if d == nil || d.Number == nil { + return 0 + } + return *d.Number +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (d *Discussion) GetRepositoryURL() string { + if d == nil || d.RepositoryURL == nil { + return "" + } + return *d.RepositoryURL +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (d *Discussion) GetState() string { + if d == nil || d.State == nil { + return "" + } + return *d.State +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (d *Discussion) GetTitle() string { + if d == nil || d.Title == nil { + return "" + } + return *d.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *Discussion) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetUser returns the User field. +func (d *Discussion) GetUser() *User { + if d == nil { + return nil + } + return d.User +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetDescription() string { + if d == nil || d.Description == nil { + return "" + } + return *d.Description +} + +// GetEmoji returns the Emoji field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetEmoji() string { + if d == nil || d.Emoji == nil { + return "" + } + return *d.Emoji +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetID() int64 { + if d == nil || d.ID == nil { + return 0 + } + return *d.ID +} + +// GetIsAnswerable returns the IsAnswerable field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetIsAnswerable() bool { + if d == nil || d.IsAnswerable == nil { + return false + } + return *d.IsAnswerable +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetName() string { + if d == nil || d.Name == nil { + return "" + } + return *d.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetRepositoryID() int64 { + if d == nil || d.RepositoryID == nil { + return 0 + } + return *d.RepositoryID +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetSlug() string { + if d == nil || d.Slug == nil { + return "" + } + return *d.Slug +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DiscussionCategory) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetAuthor returns the Author field. +func (d *DiscussionComment) GetAuthor() *User { + if d == nil { + return nil + } + return d.Author +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetBody() string { + if d == nil || d.Body == nil { + return "" + } + return *d.Body +} + +// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetBodyHTML() string { + if d == nil || d.BodyHTML == nil { + return "" + } + return *d.BodyHTML +} + +// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetBodyVersion() string { + if d == nil || d.BodyVersion == nil { + return "" + } + return *d.BodyVersion +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { + return Timestamp{} + } + return *d.CreatedAt +} + +// GetDiscussionURL returns the DiscussionURL field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetDiscussionURL() string { + if d == nil || d.DiscussionURL == nil { + return "" + } + return *d.DiscussionURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetHTMLURL() string { + if d == nil || d.HTMLURL == nil { + return "" + } + return *d.HTMLURL +} + +// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetLastEditedAt() Timestamp { + if d == nil || d.LastEditedAt == nil { + return Timestamp{} + } + return *d.LastEditedAt +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetNodeID() string { + if d == nil || d.NodeID == nil { + return "" + } + return *d.NodeID +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetNumber() int { + if d == nil || d.Number == nil { + return 0 + } + return *d.Number +} + +// GetReactions returns the Reactions field. +func (d *DiscussionComment) GetReactions() *Reactions { + if d == nil { + return nil + } + return d.Reactions +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetUpdatedAt() Timestamp { + if d == nil || d.UpdatedAt == nil { + return Timestamp{} + } + return *d.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *DiscussionComment) GetURL() string { + if d == nil || d.URL == nil { + return "" + } + return *d.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DiscussionCommentEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetComment returns the Comment field. +func (d *DiscussionCommentEvent) GetComment() *CommentDiscussion { + if d == nil { + return nil + } + return d.Comment +} + +// GetDiscussion returns the Discussion field. +func (d *DiscussionCommentEvent) GetDiscussion() *Discussion { + if d == nil { + return nil + } + return d.Discussion +} + +// GetInstallation returns the Installation field. +func (d *DiscussionCommentEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrg returns the Org field. +func (d *DiscussionCommentEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + +// GetRepo returns the Repo field. +func (d *DiscussionCommentEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DiscussionCommentEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetDirection returns the Direction field. +func (d *DiscussionCommentListOptions) GetDirection() string { + if d == nil { + return "" + } + return d.Direction +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DiscussionEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetDiscussion returns the Discussion field. +func (d *DiscussionEvent) GetDiscussion() *Discussion { + if d == nil { + return nil + } + return d.Discussion +} + +// GetInstallation returns the Installation field. +func (d *DiscussionEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrg returns the Org field. +func (d *DiscussionEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + +// GetRepo returns the Repo field. +func (d *DiscussionEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DiscussionEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + +// GetDirection returns the Direction field. +func (d *DiscussionListOptions) GetDirection() string { + if d == nil { + return "" + } + return d.Direction +} + +// GetAllowedActors returns the AllowedActors slice if it's non-nil, nil otherwise. +func (d *DismissalRestriction) GetAllowedActors() []*DismissalRestrictionActor { + if d == nil || d.AllowedActors == nil { + return nil + } + return d.AllowedActors +} + +// GetEnabled returns the Enabled field. +func (d *DismissalRestriction) GetEnabled() bool { + if d == nil { + return false + } + return d.Enabled +} + +// GetID returns the ID field. +func (d *DismissalRestrictionActor) GetID() int64 { + if d == nil { + return 0 + } + return d.ID +} + +// GetType returns the Type field. +func (d *DismissalRestrictionActor) GetType() DismissalRestrictionActorType { + if d == nil { + return "" + } + return d.Type +} + +// GetApps returns the Apps slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetApps() []*App { + if d == nil || d.Apps == nil { + return nil + } + return d.Apps +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetTeams() []*Team { + if d == nil || d.Teams == nil { + return nil + } + return d.Teams +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (d *DismissalRestrictions) GetUsers() []*User { + if d == nil || d.Users == nil { + return nil + } + return d.Users +} + +// GetApps returns the Apps field if it's non-nil, zero value otherwise. +func (d *DismissalRestrictionsRequest) GetApps() []string { + if d == nil || d.Apps == nil { + return nil + } + return *d.Apps +} + +// GetTeams returns the Teams field if it's non-nil, zero value otherwise. +func (d *DismissalRestrictionsRequest) GetTeams() []string { + if d == nil || d.Teams == nil { + return nil + } + return *d.Teams +} + +// GetUsers returns the Users field if it's non-nil, zero value otherwise. +func (d *DismissalRestrictionsRequest) GetUsers() []string { + if d == nil || d.Users == nil { + return nil + } + return *d.Users +} + +// GetDismissalCommitID returns the DismissalCommitID field if it's non-nil, zero value otherwise. +func (d *DismissedReview) GetDismissalCommitID() string { + if d == nil || d.DismissalCommitID == nil { + return "" + } + return *d.DismissalCommitID +} + +// GetDismissalMessage returns the DismissalMessage field if it's non-nil, zero value otherwise. +func (d *DismissedReview) GetDismissalMessage() string { + if d == nil || d.DismissalMessage == nil { + return "" + } + return *d.DismissalMessage +} + +// GetReviewID returns the ReviewID field if it's non-nil, zero value otherwise. +func (d *DismissedReview) GetReviewID() int64 { + if d == nil || d.ReviewID == nil { + return 0 + } + return *d.ReviewID +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (d *DismissedReview) GetState() string { + if d == nil || d.State == nil { + return "" + } + return *d.State +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (d *DismissStaleReviewsOnPushChanges) GetFrom() bool { + if d == nil || d.From == nil { + return false + } + return *d.From +} + +// GetClientPayload returns the ClientPayload field if it's non-nil, zero value otherwise. +func (d *DispatchRequestOptions) GetClientPayload() json.RawMessage { + if d == nil || d.ClientPayload == nil { + return json.RawMessage{} + } + return *d.ClientPayload +} + +// GetEventType returns the EventType field. +func (d *DispatchRequestOptions) GetEventType() string { + if d == nil { + return "" + } + return d.EventType +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetBody() string { + if d == nil || d.Body == nil { + return "" + } + return *d.Body +} + +// GetLine returns the Line field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetLine() int { + if d == nil || d.Line == nil { + return 0 + } + return *d.Line +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetPath() string { + if d == nil || d.Path == nil { + return "" + } + return *d.Path +} + +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetPosition() int { + if d == nil || d.Position == nil { + return 0 + } + return *d.Position +} + +// GetSide returns the Side field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetSide() string { + if d == nil || d.Side == nil { + return "" + } + return *d.Side +} + +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetStartLine() int { + if d == nil || d.StartLine == nil { + return 0 + } + return *d.StartLine +} + +// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. +func (d *DraftReviewComment) GetStartSide() string { + if d == nil || d.StartSide == nil { + return "" + } + return *d.StartSide +} + +// GetRef returns the Ref field. +func (e *EditBase) GetRef() *EditRef { + if e == nil { + return nil + } + return e.Ref +} + +// GetSHA returns the SHA field. +func (e *EditBase) GetSHA() *EditSHA { + if e == nil { + return nil + } + return e.SHA +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditBody) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + +// GetBase returns the Base field. +func (e *EditChange) GetBase() *EditBase { + if e == nil { + return nil + } + return e.Base +} + +// GetBody returns the Body field. +func (e *EditChange) GetBody() *EditBody { + if e == nil { + return nil + } + return e.Body +} + +// GetDefaultBranch returns the DefaultBranch field. +func (e *EditChange) GetDefaultBranch() *EditDefaultBranch { + if e == nil { + return nil + } + return e.DefaultBranch +} + +// GetOwner returns the Owner field. +func (e *EditChange) GetOwner() *EditOwner { + if e == nil { + return nil + } + return e.Owner +} + +// GetRepo returns the Repo field. +func (e *EditChange) GetRepo() *EditRepo { + if e == nil { + return nil + } + return e.Repo +} + +// GetTitle returns the Title field. +func (e *EditChange) GetTitle() *EditTitle { + if e == nil { + return nil + } + return e.Title +} + +// GetTopics returns the Topics field. +func (e *EditChange) GetTopics() *EditTopics { + if e == nil { + return nil + } + return e.Topics +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditDefaultBranch) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + +// GetOwnerInfo returns the OwnerInfo field. +func (e *EditOwner) GetOwnerInfo() *OwnerInfo { + if e == nil { + return nil + } + return e.OwnerInfo +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditRef) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + +// GetName returns the Name field. +func (e *EditRepo) GetName() *RepoName { + if e == nil { + return nil + } + return e.Name +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditSHA) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditTitle) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (e *EditTopics) GetFrom() []string { + if e == nil || e.From == nil { + return nil + } + return e.From +} + +// GetEncryptedValue returns the EncryptedValue field. +func (e *EncryptedSecret) GetEncryptedValue() string { + if e == nil { + return "" + } + return e.EncryptedValue +} + +// GetKeyID returns the KeyID field. +func (e *EncryptedSecret) GetKeyID() string { + if e == nil { + return "" + } + return e.KeyID +} + +// GetName returns the Name field. +func (e *EncryptedSecret) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. +func (e *EncryptedSecret) GetSelectedRepositoryIDs() SelectedRepoIDs { + if e == nil { + return nil + } + return e.SelectedRepositoryIDs +} + +// GetVisibility returns the Visibility field. +func (e *EncryptedSecret) GetVisibility() string { + if e == nil { + return "" + } + return e.Visibility +} + +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetAvatarURL() string { + if e == nil || e.AvatarURL == nil { + return "" + } + return *e.AvatarURL +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetCreatedAt() Timestamp { + if e == nil || e.CreatedAt == nil { + return Timestamp{} + } + return *e.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetDescription() string { + if e == nil || e.Description == nil { + return "" + } + return *e.Description +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetHTMLURL() string { + if e == nil || e.HTMLURL == nil { + return "" + } + return *e.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetID() int { + if e == nil || e.ID == nil { + return 0 + } + return *e.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetName() string { + if e == nil || e.Name == nil { + return "" + } + return *e.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetNodeID() string { + if e == nil || e.NodeID == nil { + return "" + } + return *e.NodeID +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetSlug() string { + if e == nil || e.Slug == nil { + return "" + } + return *e.Slug +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetUpdatedAt() Timestamp { + if e == nil || e.UpdatedAt == nil { + return Timestamp{} + } + return *e.UpdatedAt +} + +// GetWebsiteURL returns the WebsiteURL field if it's non-nil, zero value otherwise. +func (e *Enterprise) GetWebsiteURL() string { + if e == nil || e.WebsiteURL == nil { + return "" + } + return *e.WebsiteURL +} + +// GetDiscountAmount returns the DiscountAmount field. +func (e *EnterpriseAggregatedUsageItem) GetDiscountAmount() float64 { + if e == nil { + return 0 + } + return e.DiscountAmount +} + +// GetDiscountQuantity returns the DiscountQuantity field. +func (e *EnterpriseAggregatedUsageItem) GetDiscountQuantity() float64 { + if e == nil { + return 0 + } + return e.DiscountQuantity +} + +// GetGrossAmount returns the GrossAmount field. +func (e *EnterpriseAggregatedUsageItem) GetGrossAmount() float64 { + if e == nil { + return 0 + } + return e.GrossAmount +} + +// GetGrossQuantity returns the GrossQuantity field. +func (e *EnterpriseAggregatedUsageItem) GetGrossQuantity() float64 { + if e == nil { + return 0 + } + return e.GrossQuantity +} + +// GetModel returns the Model field. +func (e *EnterpriseAggregatedUsageItem) GetModel() string { + if e == nil { + return "" + } + return e.Model +} + +// GetNetAmount returns the NetAmount field. +func (e *EnterpriseAggregatedUsageItem) GetNetAmount() float64 { + if e == nil { + return 0 + } + return e.NetAmount +} + +// GetNetQuantity returns the NetQuantity field. +func (e *EnterpriseAggregatedUsageItem) GetNetQuantity() float64 { + if e == nil { + return 0 + } + return e.NetQuantity +} + +// GetPricePerUnit returns the PricePerUnit field. +func (e *EnterpriseAggregatedUsageItem) GetPricePerUnit() float64 { + if e == nil { + return 0 + } + return e.PricePerUnit +} + +// GetProduct returns the Product field. +func (e *EnterpriseAggregatedUsageItem) GetProduct() string { + if e == nil { + return "" + } + return e.Product +} + +// GetSKU returns the SKU field. +func (e *EnterpriseAggregatedUsageItem) GetSKU() string { + if e == nil { + return "" + } + return e.SKU +} + +// GetUnitType returns the UnitType field. +func (e *EnterpriseAggregatedUsageItem) GetUnitType() string { + if e == nil { + return "" + } + return e.UnitType +} + +// GetCostCenter returns the CostCenter field. +func (e *EnterpriseAggregatedUsageReport) GetCostCenter() *BillingCostCenter { + if e == nil { + return nil + } + return e.CostCenter +} + +// GetEnterprise returns the Enterprise field. +func (e *EnterpriseAggregatedUsageReport) GetEnterprise() string { + if e == nil { + return "" + } + return e.Enterprise +} + +// GetModel returns the Model field if it's non-nil, zero value otherwise. +func (e *EnterpriseAggregatedUsageReport) GetModel() string { + if e == nil || e.Model == nil { + return "" + } + return *e.Model +} + +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (e *EnterpriseAggregatedUsageReport) GetOrganization() string { + if e == nil || e.Organization == nil { + return "" + } + return *e.Organization +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (e *EnterpriseAggregatedUsageReport) GetProduct() string { + if e == nil || e.Product == nil { + return "" + } + return *e.Product +} + +// GetTimePeriod returns the TimePeriod field. +func (e *EnterpriseAggregatedUsageReport) GetTimePeriod() EnterpriseUsageTimePeriod { + if e == nil { + return EnterpriseUsageTimePeriod{} + } + return e.TimePeriod +} + +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (e *EnterpriseAggregatedUsageReport) GetUsageItems() []*EnterpriseAggregatedUsageItem { + if e == nil || e.UsageItems == nil { + return nil + } + return e.UsageItems +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (e *EnterpriseAggregatedUsageReport) GetUser() string { + if e == nil || e.User == nil { + return "" + } + return *e.User +} + +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseBudget) GetBudgetAlerting() *EnterpriseBudgetAlerting { + if e == nil { + return nil + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetAmount() int { + if e == nil || e.BudgetAmount == nil { + return 0 + } + return *e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetScope() string { + if e == nil || e.BudgetScope == nil { + return "" + } + return *e.BudgetScope +} + +// GetBudgetType returns the BudgetType field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetBudgetType() string { + if e == nil || e.BudgetType == nil { + return "" + } + return *e.BudgetType +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetID() string { + if e == nil || e.ID == nil { + return "" + } + return *e.ID +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudget) GetPreventFurtherUsage() bool { + if e == nil || e.PreventFurtherUsage == nil { + return false + } + return *e.PreventFurtherUsage +} + +// GetAlertRecipients returns the AlertRecipients slice if it's non-nil, nil otherwise. +func (e *EnterpriseBudgetAlerting) GetAlertRecipients() []string { + if e == nil || e.AlertRecipients == nil { + return nil + } + return e.AlertRecipients +} + +// GetWillAlert returns the WillAlert field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudgetAlerting) GetWillAlert() bool { + if e == nil || e.WillAlert == nil { + return false + } + return *e.WillAlert +} + +// GetConsumedAmount returns the ConsumedAmount field. +func (e *EnterpriseBudgetUserState) GetConsumedAmount() float64 { + if e == nil { + return 0 + } + return e.ConsumedAmount +} + +// GetOverrideBudgetID returns the OverrideBudgetID field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudgetUserState) GetOverrideBudgetID() string { + if e == nil || e.OverrideBudgetID == nil { + return "" + } + return *e.OverrideBudgetID +} + +// GetTargetAmount returns the TargetAmount field. +func (e *EnterpriseBudgetUserState) GetTargetAmount() float64 { + if e == nil { + return 0 + } + return e.TargetAmount +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (e *EnterpriseBudgetUserState) GetUser() string { + if e == nil || e.User == nil { + return "" + } + return *e.User +} + +// GetHasNextPage returns the HasNextPage field. +func (e *EnterpriseBudgetUserStates) GetHasNextPage() bool { + if e == nil { + return false + } + return e.HasNextPage +} + +// GetTotalCount returns the TotalCount field. +func (e *EnterpriseBudgetUserStates) GetTotalCount() int { + if e == nil { + return 0 + } + return e.TotalCount +} + +// GetUserStates returns the UserStates slice if it's non-nil, nil otherwise. +func (e *EnterpriseBudgetUserStates) GetUserStates() []*EnterpriseBudgetUserState { + if e == nil || e.UserStates == nil { + return nil + } + return e.UserStates +} + +// GetTotalSeatsConsumed returns the TotalSeatsConsumed field. +func (e *EnterpriseConsumedLicenses) GetTotalSeatsConsumed() int { + if e == nil { + return 0 + } + return e.TotalSeatsConsumed +} + +// GetTotalSeatsPurchased returns the TotalSeatsPurchased field. +func (e *EnterpriseConsumedLicenses) GetTotalSeatsPurchased() int { + if e == nil { + return 0 + } + return e.TotalSeatsPurchased +} + +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (e *EnterpriseConsumedLicenses) GetUsers() []*EnterpriseLicensedUsers { + if e == nil || e.Users == nil { + return nil + } + return e.Users +} + +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseCreateBudget) GetBudgetAlerting() EnterpriseBudgetAlerting { + if e == nil { + return EnterpriseBudgetAlerting{} + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field. +func (e *EnterpriseCreateBudget) GetBudgetAmount() int { + if e == nil { + return 0 + } + return e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseCreateBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseCreateBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field. +func (e *EnterpriseCreateBudget) GetBudgetScope() string { + if e == nil { + return "" + } + return e.BudgetScope +} + +// GetBudgetType returns the BudgetType field. +func (e *EnterpriseCreateBudget) GetBudgetType() string { + if e == nil { + return "" + } + return e.BudgetType +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field. +func (e *EnterpriseCreateBudget) GetPreventFurtherUsage() bool { + if e == nil { + return false + } + return e.PreventFurtherUsage +} + +// GetBudget returns the Budget field. +func (e *EnterpriseCreateOrUpdateBudgetResponse) GetBudget() *EnterpriseBudget { + if e == nil { + return nil + } + return e.Budget +} + +// GetMessage returns the Message field. +func (e *EnterpriseCreateOrUpdateBudgetResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// 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 +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertiesValues) GetProperties() []*CustomPropertyValue { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertySchema) GetProperties() []*CustomProperty { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetOrganizationLogins returns the OrganizationLogins slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertyValuesRequest) GetOrganizationLogins() []string { + if e == nil || e.OrganizationLogins == nil { + return nil + } + return e.OrganizationLogins +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (e *EnterpriseCustomPropertyValuesRequest) GetProperties() []*CustomPropertyValue { + if e == nil || e.Properties == nil { + return nil + } + return e.Properties +} + +// GetID returns the ID field. +func (e *EnterpriseDeleteBudgetResponse) GetID() string { + if e == nil { + return "" + } + return e.ID +} + +// GetMessage returns the Message field. +func (e *EnterpriseDeleteBudgetResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetSortOrder returns the SortOrder field. +func (e *EnterpriseGetUserStatesOptions) GetSortOrder() int { + if e == nil { + return 0 + } + return e.SortOrder +} + +// GetThresholdLowerBound returns the ThresholdLowerBound field. +func (e *EnterpriseGetUserStatesOptions) GetThresholdLowerBound() float64 { + if e == nil { + return 0 + } + return e.ThresholdLowerBound +} + +// GetThresholdUpperBound returns the ThresholdUpperBound field. +func (e *EnterpriseGetUserStatesOptions) GetThresholdUpperBound() float64 { + if e == nil { + return 0 + } + return e.ThresholdUpperBound +} + +// GetUser returns the User field. +func (e *EnterpriseGetUserStatesOptions) GetUser() string { + if e == nil { + return "" + } + return e.User +} + +// GetEnterpriseServerEmails returns the EnterpriseServerEmails slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerEmails() []string { + if e == nil || e.EnterpriseServerEmails == nil { + return nil + } + return e.EnterpriseServerEmails +} + +// 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 +} + +// GetEnterpriseServerUserIDs returns the EnterpriseServerUserIDs slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetEnterpriseServerUserIDs() []string { + if e == nil || e.EnterpriseServerUserIDs == nil { + return nil + } + return e.EnterpriseServerUserIDs +} + +// GetGithubComEnterpriseRoles returns the GithubComEnterpriseRoles slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComEnterpriseRoles() []string { + if e == nil || e.GithubComEnterpriseRoles == nil { + return nil + } + return e.GithubComEnterpriseRoles +} + +// GetGithubComLogin returns the GithubComLogin field. +func (e *EnterpriseLicensedUsers) GetGithubComLogin() string { + if e == nil { + return "" + } + return e.GithubComLogin +} + +// GetGithubComMemberRoles returns the GithubComMemberRoles slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComMemberRoles() []string { + if e == nil || e.GithubComMemberRoles == nil { + return nil + } + return e.GithubComMemberRoles +} + +// 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 +} + +// GetGithubComOrgsWithPendingInvites returns the GithubComOrgsWithPendingInvites slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComOrgsWithPendingInvites() []string { + if e == nil || e.GithubComOrgsWithPendingInvites == nil { + return nil + } + return e.GithubComOrgsWithPendingInvites +} + +// 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 +} + +// GetGithubComUser returns the GithubComUser field. +func (e *EnterpriseLicensedUsers) GetGithubComUser() bool { + if e == nil { + return false + } + return e.GithubComUser +} + +// GetGithubComVerifiedDomainEmails returns the GithubComVerifiedDomainEmails slice if it's non-nil, nil otherwise. +func (e *EnterpriseLicensedUsers) GetGithubComVerifiedDomainEmails() []string { + if e == nil || e.GithubComVerifiedDomainEmails == nil { + return nil + } + return e.GithubComVerifiedDomainEmails +} + +// GetLicenseType returns the LicenseType field. +func (e *EnterpriseLicensedUsers) GetLicenseType() string { + if e == nil { + return "" + } + return e.LicenseType +} + +// GetTotalUserAccounts returns the TotalUserAccounts field. +func (e *EnterpriseLicensedUsers) GetTotalUserAccounts() int { + if e == nil { + return 0 + } + return e.TotalUserAccounts +} + +// 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 +} + +// GetVisualStudioSubscriptionUser returns the VisualStudioSubscriptionUser field. +func (e *EnterpriseLicensedUsers) GetVisualStudioSubscriptionUser() bool { + if e == nil { + return false + } + return e.VisualStudioSubscriptionUser +} + +// GetDescription returns the Description field. +func (e *EnterpriseLicenseSyncStatus) GetDescription() string { + if e == nil { + return "" + } + return e.Description +} + +// GetProperties returns the Properties field. +func (e *EnterpriseLicenseSyncStatus) GetProperties() *ServerInstanceProperties { + if e == nil { + return nil + } + return e.Properties +} + +// GetTitle returns the Title field. +func (e *EnterpriseLicenseSyncStatus) GetTitle() string { + if e == nil { + return "" + } + return e.Title +} + +// GetBudgets returns the Budgets slice if it's non-nil, nil otherwise. +func (e *EnterpriseListBudgets) GetBudgets() []*EnterpriseBudget { + if e == nil || e.Budgets == nil { + return nil + } + return e.Budgets +} + +// GetHasNextPage returns the HasNextPage field if it's non-nil, zero value otherwise. +func (e *EnterpriseListBudgets) GetHasNextPage() bool { + if e == nil || e.HasNextPage == nil { + return false + } + return *e.HasNextPage +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (e *EnterpriseListBudgets) GetTotalCount() int { + if e == nil || e.TotalCount == nil { + return 0 + } + return *e.TotalCount +} + +// GetScope returns the Scope field. +func (e *EnterpriseListBudgetsOptions) GetScope() string { + if e == nil { + return "" + } + return e.Scope +} + +// GetUser returns the User field. +func (e *EnterpriseListBudgetsOptions) GetUser() string { + if e == nil { + return "" + } + return e.User +} + +// GetModel returns the Model field. +func (e *EnterprisePremiumRequestUsageReportOptions) GetModel() string { + if e == nil { + return "" + } + return e.Model +} + +// GetOrganization returns the Organization field. +func (e *EnterprisePremiumRequestUsageReportOptions) GetOrganization() string { + if e == nil { + return "" + } + return e.Organization +} + +// GetProduct returns the Product field. +func (e *EnterprisePremiumRequestUsageReportOptions) GetProduct() string { + if e == nil { + return "" + } + return e.Product +} + +// GetUser returns the User field. +func (e *EnterprisePremiumRequestUsageReportOptions) GetUser() string { + if e == nil { + return "" + } + return e.User +} + +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool { + if e == nil || e.AllowsPublicRepositories == nil { + return false + } + return *e.AllowsPublicRepositories +} + +// GetDefault returns the Default field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetDefault() bool { + if e == nil || e.Default == nil { + return false + } + return *e.Default +} + +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetHostedRunnersURL() string { + if e == nil || e.HostedRunnersURL == nil { + return "" + } + return *e.HostedRunnersURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetID() int64 { + if e == nil || e.ID == nil { + return 0 + } + return *e.ID +} + +// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetInherited() bool { + if e == nil || e.Inherited == nil { + return false + } + return *e.Inherited +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetName() string { + if e == nil || e.Name == nil { + return "" + } + return *e.Name +} + +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetNetworkConfigurationID() string { + if e == nil || e.NetworkConfigurationID == nil { + return "" + } + return *e.NetworkConfigurationID +} + +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetRestrictedToWorkflows() bool { + if e == nil || e.RestrictedToWorkflows == nil { + return false + } + return *e.RestrictedToWorkflows +} + +// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetRunnersURL() string { + if e == nil || e.RunnersURL == nil { + return "" + } + return *e.RunnersURL +} + +// GetSelectedOrganizationsURL returns the SelectedOrganizationsURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetSelectedOrganizationsURL() string { + if e == nil || e.SelectedOrganizationsURL == nil { + return "" + } + return *e.SelectedOrganizationsURL +} + +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (e *EnterpriseRunnerGroup) GetSelectedWorkflows() []string { + if e == nil || e.SelectedWorkflows == nil { + return nil + } + return e.SelectedWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetVisibility() string { + if e == nil || e.Visibility == nil { + return "" + } + return *e.Visibility +} + +// GetWorkflowRestrictionsReadOnly returns the WorkflowRestrictionsReadOnly field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetWorkflowRestrictionsReadOnly() bool { + if e == nil || e.WorkflowRestrictionsReadOnly == nil { + return false + } + return *e.WorkflowRestrictionsReadOnly +} + +// GetRunnerGroups returns the RunnerGroups slice if it's non-nil, nil otherwise. +func (e *EnterpriseRunnerGroups) GetRunnerGroups() []*EnterpriseRunnerGroup { + if e == nil || e.RunnerGroups == nil { + return nil + } + return e.RunnerGroups +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroups) GetTotalCount() int { + if e == nil || e.TotalCount == nil { + return 0 + } + return *e.TotalCount +} + +// GetAdvancedSecurityEnabledForNewRepositories returns the AdvancedSecurityEnabledForNewRepositories field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetAdvancedSecurityEnabledForNewRepositories() bool { + if e == nil || e.AdvancedSecurityEnabledForNewRepositories == nil { + return false + } + return *e.AdvancedSecurityEnabledForNewRepositories +} + +// GetSecretScanningEnabledForNewRepositories returns the SecretScanningEnabledForNewRepositories field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningEnabledForNewRepositories() bool { + if e == nil || e.SecretScanningEnabledForNewRepositories == nil { + return false + } + return *e.SecretScanningEnabledForNewRepositories +} + +// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionCustomLink() string { + if e == nil || e.SecretScanningPushProtectionCustomLink == nil { + return "" + } + return *e.SecretScanningPushProtectionCustomLink +} + +// GetSecretScanningPushProtectionEnabledForNewRepositories returns the SecretScanningPushProtectionEnabledForNewRepositories field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionEnabledForNewRepositories() bool { + if e == nil || e.SecretScanningPushProtectionEnabledForNewRepositories == nil { + return false + } + return *e.SecretScanningPushProtectionEnabledForNewRepositories +} + +// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningValidityChecksEnabled() bool { + if e == nil || e.SecretScanningValidityChecksEnabled == nil { + return false + } + return *e.SecretScanningValidityChecksEnabled +} + +// GetCreatedAt returns the CreatedAt field. +func (e *EnterpriseTeam) GetCreatedAt() Timestamp { + if e == nil { + return Timestamp{} + } + return e.CreatedAt +} + +// 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 +} + +// GetGroupID returns the GroupID field. +func (e *EnterpriseTeam) GetGroupID() string { + if e == nil { + return "" + } + return e.GroupID +} + +// GetHTMLURL returns the HTMLURL field. +func (e *EnterpriseTeam) GetHTMLURL() string { + if e == nil { + return "" + } + return e.HTMLURL +} + +// GetID returns the ID field. +func (e *EnterpriseTeam) GetID() int64 { + if e == nil { + return 0 + } + return e.ID +} + +// GetMemberURL returns the MemberURL field. +func (e *EnterpriseTeam) GetMemberURL() string { + if e == nil { + return "" + } + return e.MemberURL +} + +// GetName returns the Name field. +func (e *EnterpriseTeam) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// 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 +} + +// GetSlug returns the Slug field. +func (e *EnterpriseTeam) GetSlug() string { + if e == nil { + return "" + } + return e.Slug +} + +// GetUpdatedAt returns the UpdatedAt field. +func (e *EnterpriseTeam) GetUpdatedAt() Timestamp { + if e == nil { + return Timestamp{} + } + return e.UpdatedAt +} + +// GetURL returns the URL field. +func (e *EnterpriseTeam) GetURL() string { + if e == nil { + return "" + } + return e.URL +} + +// 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 +} + +// GetName returns the Name field. +func (e *EnterpriseTeamCreateOrUpdateRequest) GetName() string { + if e == nil { + return "" + } + return e.Name +} + +// 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 +} + +// GetBudgetAlerting returns the BudgetAlerting field. +func (e *EnterpriseUpdateBudget) GetBudgetAlerting() *EnterpriseBudgetAlerting { + if e == nil { + return nil + } + return e.BudgetAlerting +} + +// GetBudgetAmount returns the BudgetAmount field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetAmount() int { + if e == nil || e.BudgetAmount == nil { + return 0 + } + return *e.BudgetAmount +} + +// GetBudgetEntityName returns the BudgetEntityName field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetEntityName() string { + if e == nil || e.BudgetEntityName == nil { + return "" + } + return *e.BudgetEntityName +} + +// GetBudgetProductSKU returns the BudgetProductSKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetProductSKU() string { + if e == nil || e.BudgetProductSKU == nil { + return "" + } + return *e.BudgetProductSKU +} + +// GetBudgetScope returns the BudgetScope field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetScope() string { + if e == nil || e.BudgetScope == nil { + return "" + } + return *e.BudgetScope +} + +// GetBudgetType returns the BudgetType field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetBudgetType() string { + if e == nil || e.BudgetType == nil { + return "" + } + return *e.BudgetType +} + +// GetPreventFurtherUsage returns the PreventFurtherUsage field if it's non-nil, zero value otherwise. +func (e *EnterpriseUpdateBudget) GetPreventFurtherUsage() bool { + if e == nil || e.PreventFurtherUsage == nil { + return false + } + return *e.PreventFurtherUsage +} + +// GetDate returns the Date field. +func (e *EnterpriseUsageItem) GetDate() string { + if e == nil { + return "" + } + return e.Date +} + +// GetDiscountAmount returns the DiscountAmount field. +func (e *EnterpriseUsageItem) GetDiscountAmount() float64 { + if e == nil { + return 0 + } + return e.DiscountAmount +} + +// GetGrossAmount returns the GrossAmount field. +func (e *EnterpriseUsageItem) GetGrossAmount() float64 { + if e == nil { + return 0 + } + return e.GrossAmount +} + +// GetNetAmount returns the NetAmount field. +func (e *EnterpriseUsageItem) GetNetAmount() float64 { + if e == nil { + return 0 + } + return e.NetAmount +} + +// GetOrganizationName returns the OrganizationName field. +func (e *EnterpriseUsageItem) GetOrganizationName() string { + if e == nil { + return "" + } + return e.OrganizationName +} + +// GetPricePerUnit returns the PricePerUnit field. +func (e *EnterpriseUsageItem) GetPricePerUnit() float64 { + if e == nil { + return 0 + } + return e.PricePerUnit +} + +// GetProduct returns the Product field. +func (e *EnterpriseUsageItem) GetProduct() string { + if e == nil { + return "" + } + return e.Product +} + +// GetQuantity returns the Quantity field. +func (e *EnterpriseUsageItem) GetQuantity() float64 { + if e == nil { + return 0 + } + return e.Quantity +} + +// GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageItem) GetRepositoryName() string { + if e == nil || e.RepositoryName == nil { + return "" + } + return *e.RepositoryName +} + +// GetSKU returns the SKU field. +func (e *EnterpriseUsageItem) GetSKU() string { + if e == nil { + return "" + } + return e.SKU +} + +// GetUnitType returns the UnitType field. +func (e *EnterpriseUsageItem) GetUnitType() string { + if e == nil { + return "" + } + return e.UnitType +} + +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (e *EnterpriseUsageReport) GetUsageItems() []*EnterpriseUsageItem { + if e == nil || e.UsageItems == nil { + return nil + } + return e.UsageItems +} + +// GetCostCenterID returns the CostCenterID field. +func (e *EnterpriseUsageReportOptions) GetCostCenterID() string { + if e == nil { + return "" + } + return e.CostCenterID +} + +// GetDay returns the Day field. +func (e *EnterpriseUsageReportOptions) GetDay() int { + if e == nil { + return 0 + } + return e.Day +} + +// GetMonth returns the Month field. +func (e *EnterpriseUsageReportOptions) GetMonth() int { + if e == nil { + return 0 + } + return e.Month +} + +// GetYear returns the Year field. +func (e *EnterpriseUsageReportOptions) GetYear() int { + if e == nil { + return 0 + } + return e.Year +} + +// GetDiscountAmount returns the DiscountAmount field. +func (e *EnterpriseUsageSummaryItem) GetDiscountAmount() float64 { + if e == nil { + return 0 + } + return e.DiscountAmount +} + +// GetDiscountQuantity returns the DiscountQuantity field. +func (e *EnterpriseUsageSummaryItem) GetDiscountQuantity() float64 { + if e == nil { + return 0 + } + return e.DiscountQuantity +} + +// GetGrossAmount returns the GrossAmount field. +func (e *EnterpriseUsageSummaryItem) GetGrossAmount() float64 { + if e == nil { + return 0 + } + return e.GrossAmount +} + +// GetGrossQuantity returns the GrossQuantity field. +func (e *EnterpriseUsageSummaryItem) GetGrossQuantity() float64 { + if e == nil { + return 0 + } + return e.GrossQuantity +} + +// GetNetAmount returns the NetAmount field. +func (e *EnterpriseUsageSummaryItem) GetNetAmount() float64 { + if e == nil { + return 0 + } + return e.NetAmount +} + +// GetNetQuantity returns the NetQuantity field. +func (e *EnterpriseUsageSummaryItem) GetNetQuantity() float64 { + if e == nil { + return 0 + } + return e.NetQuantity +} + +// GetPricePerUnit returns the PricePerUnit field. +func (e *EnterpriseUsageSummaryItem) GetPricePerUnit() float64 { + if e == nil { + return 0 + } + return e.PricePerUnit +} + +// GetProduct returns the Product field. +func (e *EnterpriseUsageSummaryItem) GetProduct() string { + if e == nil { + return "" + } + return e.Product +} + +// GetSKU returns the SKU field. +func (e *EnterpriseUsageSummaryItem) GetSKU() string { + if e == nil { + return "" + } + return e.SKU +} + +// GetUnitType returns the UnitType field. +func (e *EnterpriseUsageSummaryItem) GetUnitType() string { + if e == nil { + return "" + } + return e.UnitType +} + +// GetOrganization returns the Organization field. +func (e *EnterpriseUsageSummaryOptions) GetOrganization() string { + if e == nil { + return "" + } + return e.Organization +} + +// GetProduct returns the Product field. +func (e *EnterpriseUsageSummaryOptions) GetProduct() string { + if e == nil { + return "" + } + return e.Product +} + +// GetRepository returns the Repository field. +func (e *EnterpriseUsageSummaryOptions) GetRepository() string { + if e == nil { + return "" + } + return e.Repository +} + +// GetSKU returns the SKU field. +func (e *EnterpriseUsageSummaryOptions) GetSKU() string { + if e == nil { + return "" + } + return e.SKU +} + +// GetCostCenter returns the CostCenter field. +func (e *EnterpriseUsageSummaryReport) GetCostCenter() *BillingCostCenter { + if e == nil { + return nil + } + return e.CostCenter +} + +// GetEnterprise returns the Enterprise field. +func (e *EnterpriseUsageSummaryReport) GetEnterprise() string { + if e == nil { + return "" + } + return e.Enterprise +} + +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageSummaryReport) GetOrganization() string { + if e == nil || e.Organization == nil { + return "" + } + return *e.Organization +} + +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageSummaryReport) GetProduct() string { + if e == nil || e.Product == nil { + return "" + } + return *e.Product +} + +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageSummaryReport) GetRepository() string { + if e == nil || e.Repository == nil { + return "" + } + return *e.Repository +} + +// GetSKU returns the SKU field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageSummaryReport) GetSKU() string { + if e == nil || e.SKU == nil { + return "" + } + return *e.SKU +} + +// GetTimePeriod returns the TimePeriod field. +func (e *EnterpriseUsageSummaryReport) GetTimePeriod() EnterpriseUsageTimePeriod { + if e == nil { + return EnterpriseUsageTimePeriod{} + } + return e.TimePeriod +} + +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (e *EnterpriseUsageSummaryReport) GetUsageItems() []*EnterpriseUsageSummaryItem { + if e == nil || e.UsageItems == nil { + return nil + } + return e.UsageItems +} + +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageTimePeriod) GetDay() int { + if e == nil || e.Day == nil { + return 0 + } + return *e.Day +} + +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (e *EnterpriseUsageTimePeriod) GetMonth() int { + if e == nil || e.Month == nil { + return 0 + } + return *e.Month +} + +// GetYear returns the Year field. +func (e *EnterpriseUsageTimePeriod) GetYear() int { + if e == nil { + return 0 + } + return e.Year +} + +// GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. +func (e *Environment) GetCanAdminsBypass() bool { + if e == nil || e.CanAdminsBypass == nil { + return false + } + return *e.CanAdminsBypass +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (e *Environment) GetCreatedAt() Timestamp { + if e == nil || e.CreatedAt == nil { + return Timestamp{} + } + return *e.CreatedAt +} + +// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. +func (e *Environment) GetDeploymentBranchPolicy() *BranchPolicy { + if e == nil { + return nil + } + return e.DeploymentBranchPolicy +} + +// GetEnvironmentName returns the EnvironmentName field if it's non-nil, zero value otherwise. +func (e *Environment) GetEnvironmentName() string { + if e == nil || e.EnvironmentName == nil { + return "" + } + return *e.EnvironmentName +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (e *Environment) GetHTMLURL() string { + if e == nil || e.HTMLURL == nil { + return "" + } + return *e.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *Environment) GetID() int64 { + if e == nil || e.ID == nil { + return 0 + } + return *e.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (e *Environment) GetName() string { + if e == nil || e.Name == nil { + return "" + } + return *e.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (e *Environment) GetNodeID() string { + if e == nil || e.NodeID == nil { + return "" + } + return *e.NodeID +} + +// GetOwner returns the Owner field if it's non-nil, zero value otherwise. +func (e *Environment) GetOwner() string { + if e == nil || e.Owner == nil { + return "" + } + return *e.Owner +} + +// GetProtectionRules returns the ProtectionRules slice if it's non-nil, nil otherwise. +func (e *Environment) GetProtectionRules() []*ProtectionRule { + if e == nil || e.ProtectionRules == nil { + return nil + } + return e.ProtectionRules +} + +// GetRepo returns the Repo field if it's non-nil, zero value otherwise. +func (e *Environment) GetRepo() string { + if e == nil || e.Repo == nil { + return "" + } + return *e.Repo +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (e *Environment) GetReviewers() []*EnvReviewers { + if e == nil || e.Reviewers == nil { + return nil + } + return e.Reviewers +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (e *Environment) GetUpdatedAt() Timestamp { + if e == nil || e.UpdatedAt == nil { + return Timestamp{} + } + return *e.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (e *Environment) GetURL() string { + if e == nil || e.URL == nil { + return "" + } + return *e.URL +} + +// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. +func (e *Environment) GetWaitTimer() int { + if e == nil || e.WaitTimer == nil { + return 0 + } + return *e.WaitTimer +} + +// GetEnvironments returns the Environments slice if it's non-nil, nil otherwise. +func (e *EnvResponse) GetEnvironments() []*Environment { + if e == nil || e.Environments == nil { + return nil + } + return e.Environments +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (e *EnvResponse) GetTotalCount() int { + if e == nil || e.TotalCount == nil { + return 0 + } + return *e.TotalCount +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *EnvReviewers) GetID() int64 { + if e == nil || e.ID == nil { + return 0 + } + return *e.ID +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (e *EnvReviewers) GetType() string { + if e == nil || e.Type == nil { + return "" + } + return *e.Type +} + +// GetCode returns the Code field. +func (e *Error) GetCode() string { + if e == nil { + return "" + } + return e.Code +} + +// GetField returns the Field field. +func (e *Error) GetField() string { + if e == nil { + return "" + } + return e.Field +} + +// GetMessage returns the Message field. +func (e *Error) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetResource returns the Resource field. +func (e *Error) GetResource() string { + if e == nil { + return "" + } + return e.Resource +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (e *ErrorBlock) GetCreatedAt() Timestamp { + if e == nil || e.CreatedAt == nil { + return Timestamp{} + } + return *e.CreatedAt +} + +// GetReason returns the Reason field. +func (e *ErrorBlock) GetReason() string { + if e == nil { + return "" + } + return e.Reason +} + +// GetBlock returns the Block field. +func (e *ErrorResponse) GetBlock() *ErrorBlock { + if e == nil { + return nil + } + return e.Block +} + +// GetDocumentationURL returns the DocumentationURL field. +func (e *ErrorResponse) GetDocumentationURL() string { + if e == nil { + return "" + } + return e.DocumentationURL +} + +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (e *ErrorResponse) GetErrors() []Error { + if e == nil || e.Errors == nil { + return nil + } + return e.Errors +} + +// GetMessage returns the Message field. +func (e *ErrorResponse) GetMessage() string { + if e == nil { + return "" + } + return e.Message +} + +// GetActor returns the Actor field. +func (e *Event) GetActor() *User { + if e == nil { + return nil + } + return e.Actor +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (e *Event) GetCreatedAt() Timestamp { + if e == nil || e.CreatedAt == nil { + return Timestamp{} + } + return *e.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *Event) GetID() string { + if e == nil || e.ID == nil { + return "" + } + return *e.ID +} + +// GetOrg returns the Org field. +func (e *Event) GetOrg() *Organization { + if e == nil { + return nil + } + return e.Org +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (e *Event) GetPublic() bool { + if e == nil || e.Public == nil { + return false + } + return *e.Public +} + +// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. +func (e *Event) GetRawPayload() json.RawMessage { + if e == nil || e.RawPayload == nil { + return json.RawMessage{} + } + return *e.RawPayload +} + +// GetRepo returns the Repo field. +func (e *Event) GetRepo() *Repository { + if e == nil { + return nil + } + return e.Repo +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (e *Event) GetType() string { + if e == nil || e.Type == nil { + return "" + } + return *e.Type +} + +// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. +func (e *ExternalGroup) GetGroupID() int64 { + if e == nil || e.GroupID == nil { + return 0 + } + return *e.GroupID +} + +// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. +func (e *ExternalGroup) GetGroupName() string { + if e == nil || e.GroupName == nil { + return "" + } + return *e.GroupName +} + +// GetMembers returns the Members slice if it's non-nil, nil otherwise. +func (e *ExternalGroup) GetMembers() []*ExternalGroupMember { + if e == nil || e.Members == nil { + return nil + } + return e.Members +} + +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (e *ExternalGroup) GetTeams() []*ExternalGroupTeam { + if e == nil || e.Teams == nil { + return nil + } + return e.Teams +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (e *ExternalGroup) GetUpdatedAt() Timestamp { + if e == nil || e.UpdatedAt == nil { + return Timestamp{} + } + return *e.UpdatedAt +} + +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (e *ExternalGroupList) GetGroups() []*ExternalGroup { + if e == nil || e.Groups == nil { + return nil + } + return e.Groups +} + +// GetMemberEmail returns the MemberEmail field if it's non-nil, zero value otherwise. +func (e *ExternalGroupMember) GetMemberEmail() string { + if e == nil || e.MemberEmail == nil { + return "" + } + return *e.MemberEmail +} + +// GetMemberID returns the MemberID field if it's non-nil, zero value otherwise. +func (e *ExternalGroupMember) GetMemberID() int64 { + if e == nil || e.MemberID == nil { + return 0 + } + return *e.MemberID +} + +// GetMemberLogin returns the MemberLogin field if it's non-nil, zero value otherwise. +func (e *ExternalGroupMember) GetMemberLogin() string { + if e == nil || e.MemberLogin == nil { + return "" + } + return *e.MemberLogin +} + +// GetMemberName returns the MemberName field if it's non-nil, zero value otherwise. +func (e *ExternalGroupMember) GetMemberName() string { + if e == nil || e.MemberName == nil { + return "" + } + return *e.MemberName +} + +// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. +func (e *ExternalGroupTeam) GetTeamID() int64 { + if e == nil || e.TeamID == nil { + return 0 + } + return *e.TeamID +} + +// GetTeamName returns the TeamName field if it's non-nil, zero value otherwise. +func (e *ExternalGroupTeam) GetTeamName() string { + if e == nil || e.TeamName == nil { + return "" + } + return *e.TeamName +} + +// GetHRef returns the HRef field if it's non-nil, zero value otherwise. +func (f *FeedLink) GetHRef() string { + if f == nil || f.HRef == nil { + return "" + } + return *f.HRef +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (f *FeedLink) GetType() string { + if f == nil || f.Type == nil { + return "" + } + return *f.Type +} + +// GetCurrentUser returns the CurrentUser field. +func (f *FeedLinks) GetCurrentUser() *FeedLink { + if f == nil { + return nil + } + return f.CurrentUser +} + +// GetCurrentUserActor returns the CurrentUserActor field. +func (f *FeedLinks) GetCurrentUserActor() *FeedLink { + if f == nil { + return nil + } + return f.CurrentUserActor +} + +// GetCurrentUserOrganization returns the CurrentUserOrganization field. +func (f *FeedLinks) GetCurrentUserOrganization() *FeedLink { + if f == nil { + return nil + } + return f.CurrentUserOrganization +} + +// GetCurrentUserOrganizations returns the CurrentUserOrganizations slice if it's non-nil, nil otherwise. +func (f *FeedLinks) GetCurrentUserOrganizations() []*FeedLink { + if f == nil || f.CurrentUserOrganizations == nil { + return nil + } + return f.CurrentUserOrganizations +} + +// GetCurrentUserPublic returns the CurrentUserPublic field. +func (f *FeedLinks) GetCurrentUserPublic() *FeedLink { + if f == nil { + return nil + } + return f.CurrentUserPublic +} + +// GetTimeline returns the Timeline field. +func (f *FeedLinks) GetTimeline() *FeedLink { + if f == nil { + return nil + } + return f.Timeline +} + +// GetUser returns the User field. +func (f *FeedLinks) GetUser() *FeedLink { + if f == nil { + return nil + } + return f.User +} + +// GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetCurrentUserActorURL() string { + if f == nil || f.CurrentUserActorURL == nil { + return "" + } + return *f.CurrentUserActorURL +} + +// GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetCurrentUserOrganizationURL() string { + if f == nil || f.CurrentUserOrganizationURL == nil { + return "" + } + return *f.CurrentUserOrganizationURL +} + +// GetCurrentUserOrganizationURLs returns the CurrentUserOrganizationURLs slice if it's non-nil, nil otherwise. +func (f *Feeds) GetCurrentUserOrganizationURLs() []string { + if f == nil || f.CurrentUserOrganizationURLs == nil { + return nil + } + return f.CurrentUserOrganizationURLs +} + +// GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetCurrentUserPublicURL() string { + if f == nil || f.CurrentUserPublicURL == nil { + return "" + } + return *f.CurrentUserPublicURL +} + +// GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetCurrentUserURL() string { + if f == nil || f.CurrentUserURL == nil { + return "" + } + return *f.CurrentUserURL +} + +// GetLinks returns the Links field. +func (f *Feeds) GetLinks() *FeedLinks { + if f == nil { + return nil + } + return f.Links +} + +// GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetTimelineURL() string { + if f == nil || f.TimelineURL == nil { + return "" + } + return *f.TimelineURL +} + +// GetUserURL returns the UserURL field if it's non-nil, zero value otherwise. +func (f *Feeds) GetUserURL() string { + if f == nil || f.UserURL == nil { + return "" + } + return *f.UserURL +} + +// GetFieldName returns the FieldName field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldName() string { + if f == nil || f.FieldName == nil { + return "" + } + return *f.FieldName +} + +// GetFieldNodeID returns the FieldNodeID field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldNodeID() string { + if f == nil || f.FieldNodeID == nil { + return "" + } + return *f.FieldNodeID +} + +// GetFieldType returns the FieldType field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetFieldType() string { + if f == nil || f.FieldType == nil { + return "" + } + return *f.FieldType +} + +// GetFrom returns the From field. +func (f *FieldValue) GetFrom() json.RawMessage { + if f == nil { + return json.RawMessage{} + } + return f.From +} + +// GetProjectNumber returns the ProjectNumber field if it's non-nil, zero value otherwise. +func (f *FieldValue) GetProjectNumber() int64 { + if f == nil || f.ProjectNumber == nil { + return 0 + } + return *f.ProjectNumber +} + +// GetTo returns the To field. +func (f *FieldValue) GetTo() json.RawMessage { + if f == nil { + return json.RawMessage{} + } + return f.To +} + +// GetParameters returns the Parameters field. +func (f *FileExtensionRestrictionBranchRule) GetParameters() FileExtensionRestrictionRuleParameters { + if f == nil { + return FileExtensionRestrictionRuleParameters{} + } + return f.Parameters +} + +// GetRestrictedFileExtensions returns the RestrictedFileExtensions slice if it's non-nil, nil otherwise. +func (f *FileExtensionRestrictionRuleParameters) GetRestrictedFileExtensions() []string { + if f == nil || f.RestrictedFileExtensions == nil { + return nil + } + return f.RestrictedFileExtensions +} + +// GetParameters returns the Parameters field. +func (f *FilePathRestrictionBranchRule) GetParameters() FilePathRestrictionRuleParameters { + if f == nil { + return FilePathRestrictionRuleParameters{} + } + return f.Parameters +} + +// GetRestrictedFilePaths returns the RestrictedFilePaths slice if it's non-nil, nil otherwise. +func (f *FilePathRestrictionRuleParameters) GetRestrictedFilePaths() []string { + if f == nil || f.RestrictedFilePaths == nil { + return nil + } + return f.RestrictedFilePaths +} + +// 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 +} + +// GetID returns the ID field. +func (f *FineGrainedPersonalAccessTokenRequest) GetID() int64 { + if f == nil { + return 0 + } + return f.ID +} + +// GetOwner returns the Owner field. +func (f *FineGrainedPersonalAccessTokenRequest) GetOwner() User { + if f == nil { + return User{} + } + return f.Owner +} + +// GetPermissions returns the Permissions field. +func (f *FineGrainedPersonalAccessTokenRequest) GetPermissions() PersonalAccessTokenPermissions { + if f == nil { + return PersonalAccessTokenPermissions{} + } + return f.Permissions +} + +// GetReason returns the Reason field. +func (f *FineGrainedPersonalAccessTokenRequest) GetReason() string { + if f == nil { + return "" + } + return f.Reason +} + +// GetRepositoriesURL returns the RepositoriesURL field. +func (f *FineGrainedPersonalAccessTokenRequest) GetRepositoriesURL() string { + if f == nil { + return "" + } + return f.RepositoriesURL +} + +// GetRepositorySelection returns the RepositorySelection field. +func (f *FineGrainedPersonalAccessTokenRequest) GetRepositorySelection() string { + if f == nil { + return "" + } + return f.RepositorySelection +} + +// GetTokenExpired returns the TokenExpired field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenExpired() bool { + if f == nil { + return false + } + return f.TokenExpired +} + +// 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 +} + +// GetTokenID returns the TokenID field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenID() int64 { + if f == nil { + return 0 + } + return f.TokenID +} + +// 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 +} + +// GetTokenName returns the TokenName field. +func (f *FineGrainedPersonalAccessTokenRequest) GetTokenName() string { + if f == nil { + return "" + } + return f.TokenName +} + +// GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise. +func (f *FirstPatchedVersion) GetIdentifier() string { + if f == nil || f.Identifier == nil { + return "" + } + return *f.Identifier +} + +// GetForkee returns the Forkee field. +func (f *ForkEvent) GetForkee() *Repository { + if f == nil { + return nil + } + return f.Forkee +} + +// GetInstallation returns the Installation field. +func (f *ForkEvent) GetInstallation() *Installation { + if f == nil { + return nil + } + return f.Installation +} + +// GetRepo returns the Repo field. +func (f *ForkEvent) GetRepo() *Repository { + if f == nil { + return nil + } + return f.Repo +} + +// GetSender returns the Sender field. +func (f *ForkEvent) GetSender() *User { + if f == nil { + return nil + } + return f.Sender +} + +// GetConfigurationFilePath returns the ConfigurationFilePath field if it's non-nil, zero value otherwise. +func (g *GenerateNotesRequest) 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 *GenerateNotesRequest) GetPreviousTagName() string { + if g == nil || g.PreviousTagName == nil { + return "" + } + return *g.PreviousTagName +} + +// GetTagName returns the TagName field. +func (g *GenerateNotesRequest) GetTagName() string { + if g == nil { + return "" + } + return g.TagName +} + +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (g *GenerateNotesRequest) GetTargetCommitish() string { + if g == nil || g.TargetCommitish == nil { + return "" + } + return *g.TargetCommitish +} + +// GetInclude returns the Include field if it's non-nil, zero value otherwise. +func (g *GetAuditLogOptions) GetInclude() string { + if g == nil || g.Include == nil { + return "" + } + return *g.Include +} + +// GetOrder returns the Order field if it's non-nil, zero value otherwise. +func (g *GetAuditLogOptions) GetOrder() string { + if g == nil || g.Order == nil { + return "" + } + return *g.Order +} + +// GetPhrase returns the Phrase field if it's non-nil, zero value otherwise. +func (g *GetAuditLogOptions) GetPhrase() string { + if g == nil || g.Phrase == nil { + return "" + } + return *g.Phrase +} + +// GetRef returns the Ref field. +func (g *GetCodeownersErrorsOptions) GetRef() string { + if g == nil { + return "" + } + return g.Ref +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (g *GetProjectItemOptions) GetFields() []int64 { + if g == nil || g.Fields == nil { + return nil + } + return g.Fields +} + +// 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 { + return 0 + } + return *g.Comments +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (g *Gist) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { + return Timestamp{} + } + return *g.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (g *Gist) GetDescription() string { + if g == nil || g.Description == nil { + return "" + } + return *g.Description +} + +// GetFiles returns the Files map if it's non-nil, an empty map otherwise. +func (g *Gist) GetFiles() map[GistFilename]GistFile { + if g == nil || g.Files == nil { + return map[GistFilename]GistFile{} + } + return g.Files +} + +// GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise. +func (g *Gist) GetGitPullURL() string { + if g == nil || g.GitPullURL == nil { + return "" + } + return *g.GitPullURL +} + +// GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise. +func (g *Gist) GetGitPushURL() string { + if g == nil || g.GitPushURL == nil { + return "" + } + return *g.GitPushURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (g *Gist) GetHTMLURL() string { + if g == nil || g.HTMLURL == nil { + return "" + } + return *g.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *Gist) GetID() string { + if g == nil || g.ID == nil { + return "" + } + return *g.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (g *Gist) GetNodeID() string { + if g == nil || g.NodeID == nil { + return "" + } + return *g.NodeID +} + +// GetOwner returns the Owner field. +func (g *Gist) GetOwner() *User { + if g == nil { + return nil + } + return g.Owner +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (g *Gist) GetPublic() bool { + if g == nil || g.Public == nil { + return false + } + return *g.Public +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (g *Gist) GetUpdatedAt() Timestamp { + if g == nil || g.UpdatedAt == nil { + return Timestamp{} + } + return *g.UpdatedAt +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (g *GistComment) GetBody() string { + if g == nil || g.Body == nil { + return "" + } + return *g.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (g *GistComment) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { + return Timestamp{} + } + return *g.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *GistComment) GetID() int64 { + if g == nil || g.ID == nil { + return 0 + } + return *g.ID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (g *GistComment) GetURL() string { + if g == nil || g.URL == nil { + return "" + } + return *g.URL +} + +// GetUser returns the User field. +func (g *GistComment) GetUser() *User { + if g == nil { + return nil + } + return g.User +} + +// GetChangeStatus returns the ChangeStatus field. +func (g *GistCommit) GetChangeStatus() *CommitStats { + if g == nil { + return nil + } + return g.ChangeStatus +} + +// GetCommittedAt returns the CommittedAt field if it's non-nil, zero value otherwise. +func (g *GistCommit) GetCommittedAt() Timestamp { + if g == nil || g.CommittedAt == nil { + return Timestamp{} + } + return *g.CommittedAt +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (g *GistCommit) GetNodeID() string { + if g == nil || g.NodeID == nil { + return "" + } + return *g.NodeID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (g *GistCommit) GetURL() string { + if g == nil || g.URL == nil { + return "" + } + return *g.URL +} + +// GetUser returns the User field. +func (g *GistCommit) GetUser() *User { + if g == nil { + return nil + } + return g.User +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (g *GistCommit) GetVersion() string { + if g == nil || g.Version == nil { + return "" + } + return *g.Version +} + +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (g *GistFile) GetContent() string { + if g == nil || g.Content == nil { + return "" + } + return *g.Content +} + +// GetFilename returns the Filename field if it's non-nil, zero value otherwise. +func (g *GistFile) GetFilename() string { + if g == nil || g.Filename == nil { + return "" + } + return *g.Filename +} + +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (g *GistFile) GetLanguage() string { + if g == nil || g.Language == nil { + return "" + } + return *g.Language +} + +// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise. +func (g *GistFile) GetRawURL() string { + if g == nil || g.RawURL == nil { + return "" + } + return *g.RawURL +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (g *GistFile) GetSize() int { + if g == nil || g.Size == nil { + return 0 + } + return *g.Size +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (g *GistFile) GetType() string { + if g == nil || g.Type == nil { + return "" + } + return *g.Type +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (g *GistFork) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { + return Timestamp{} + } + return *g.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *GistFork) GetID() string { + if g == nil || g.ID == nil { + return "" + } + return *g.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (g *GistFork) GetNodeID() string { + if g == nil || g.NodeID == nil { + return "" + } + return *g.NodeID +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (g *GistFork) GetUpdatedAt() Timestamp { + if g == nil || g.UpdatedAt == nil { + return Timestamp{} + } + return *g.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (g *GistFork) GetURL() string { + if g == nil || g.URL == nil { + return "" + } + return *g.URL +} + +// GetUser returns the User field. +func (g *GistFork) GetUser() *User { + if g == nil { + return nil + } + return g.User +} + +// GetSince returns the Since field. +func (g *GistListOptions) GetSince() time.Time { + if g == nil { + return time.Time{} + } + return g.Since +} + +// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. +func (g *GistStats) GetPrivateGists() int { + if g == nil || g.PrivateGists == nil { + return 0 + } + return *g.PrivateGists +} + +// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. +func (g *GistStats) GetPublicGists() int { + if g == nil || g.PublicGists == nil { + return 0 + } + return *g.PublicGists +} + +// GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise. +func (g *GistStats) GetTotalGists() int { + if g == nil || g.TotalGists == nil { + return 0 + } + return *g.TotalGists +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (g *GitHubAppAuthorizationEvent) GetAction() string { + if g == nil || g.Action == nil { + return "" + } + return *g.Action +} + +// GetInstallation returns the Installation field. +func (g *GitHubAppAuthorizationEvent) GetInstallation() *Installation { + if g == nil { + return nil + } + return g.Installation +} + +// GetSender returns the Sender field. +func (g *GitHubAppAuthorizationEvent) GetSender() *User { + if g == nil { + return nil + } + return g.Sender +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (g *Gitignore) GetName() string { + if g == nil || g.Name == nil { + return "" + } + return *g.Name +} + +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (g *Gitignore) GetSource() string { + if g == nil || g.Source == nil { + return "" + } + return *g.Source +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (g *GitObject) GetSHA() string { + if g == nil || g.SHA == nil { + return "" + } + return *g.SHA +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (g *GitObject) GetType() string { + if g == nil || g.Type == nil { + return "" + } + return *g.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (g *GitObject) GetURL() string { + if g == nil || g.URL == nil { + return "" + } + return *g.URL +} + +// GetCredits returns the Credits slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetCredits() []*Credit { + if g == nil || g.Credits == nil { + return nil + } + return g.Credits +} + +// GetGithubReviewedAt returns the GithubReviewedAt field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetGithubReviewedAt() Timestamp { + if g == nil || g.GithubReviewedAt == nil { + return Timestamp{} + } + return *g.GithubReviewedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetID() int64 { + if g == nil || g.ID == nil { + return 0 + } + return *g.ID +} + +// GetNVDPublishedAt returns the NVDPublishedAt field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetNVDPublishedAt() Timestamp { + if g == nil || g.NVDPublishedAt == nil { + return Timestamp{} + } + return *g.NVDPublishedAt +} + +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetReferences() []string { + if g == nil || g.References == nil { + return nil + } + return g.References +} + +// GetRepositoryAdvisoryURL returns the RepositoryAdvisoryURL field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetRepositoryAdvisoryURL() string { + if g == nil || g.RepositoryAdvisoryURL == nil { + return "" + } + return *g.RepositoryAdvisoryURL +} + +// GetSourceCodeLocation returns the SourceCodeLocation field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetSourceCodeLocation() string { + if g == nil || g.SourceCodeLocation == nil { + return "" + } + return *g.SourceCodeLocation +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetType() string { + if g == nil || g.Type == nil { + return "" + } + return *g.Type +} + +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityAdvisory) GetVulnerabilities() []*GlobalSecurityVulnerability { + if g == nil || g.Vulnerabilities == nil { + return nil + } + return g.Vulnerabilities +} + +// GetFirstPatchedVersion returns the FirstPatchedVersion field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityVulnerability) GetFirstPatchedVersion() string { + if g == nil || g.FirstPatchedVersion == nil { + return "" + } + return *g.FirstPatchedVersion +} + +// GetPackage returns the Package field. +func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { + if g == nil { + return nil + } + return g.Package +} + +// GetVulnerableFunctions returns the VulnerableFunctions slice if it's non-nil, nil otherwise. +func (g *GlobalSecurityVulnerability) GetVulnerableFunctions() []string { + if g == nil || g.VulnerableFunctions == nil { + return nil + } + return g.VulnerableFunctions +} + +// GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityVulnerability) GetVulnerableVersionRange() string { + if g == nil || g.VulnerableVersionRange == nil { + return "" + } + return *g.VulnerableVersionRange +} + +// GetInstallation returns the Installation field. +func (g *GollumEvent) GetInstallation() *Installation { + if g == nil { + return nil + } + return g.Installation +} + +// GetOrg returns the Org field. +func (g *GollumEvent) GetOrg() *Organization { + if g == nil { + return nil + } + return g.Org +} + +// GetPages returns the Pages slice if it's non-nil, nil otherwise. +func (g *GollumEvent) GetPages() []*Page { + if g == nil || g.Pages == nil { + return nil + } + return g.Pages +} + +// GetRepo returns the Repo field. +func (g *GollumEvent) GetRepo() *Repository { + if g == nil { + return nil + } + return g.Repo +} + +// GetSender returns the Sender field. +func (g *GollumEvent) GetSender() *User { + if g == nil { + return nil + } + return g.Sender +} + +// GetBucket returns the Bucket field. +func (g *GoogleCloudConfig) GetBucket() string { + if g == nil { + return "" + } + return g.Bucket +} + +// GetEncryptedJSONCredentials returns the EncryptedJSONCredentials field. +func (g *GoogleCloudConfig) GetEncryptedJSONCredentials() string { + if g == nil { + return "" + } + return g.EncryptedJSONCredentials +} + +// GetKeyID returns the KeyID field. +func (g *GoogleCloudConfig) GetKeyID() string { + if g == nil { + return "" + } + return g.KeyID +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (g *GPGEmail) GetEmail() string { + if g == nil || g.Email == nil { + return "" + } + return *g.Email +} + +// GetVerified returns the Verified field if it's non-nil, zero value otherwise. +func (g *GPGEmail) GetVerified() bool { + if g == nil || g.Verified == nil { + return false + } + return *g.Verified +} + +// GetCanCertify returns the CanCertify field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetCanCertify() bool { + if g == nil || g.CanCertify == nil { + return false + } + return *g.CanCertify +} + +// GetCanEncryptComms returns the CanEncryptComms field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetCanEncryptComms() bool { + if g == nil || g.CanEncryptComms == nil { + return false + } + return *g.CanEncryptComms +} + +// GetCanEncryptStorage returns the CanEncryptStorage field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetCanEncryptStorage() bool { + if g == nil || g.CanEncryptStorage == nil { + return false + } + return *g.CanEncryptStorage +} + +// GetCanSign returns the CanSign field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetCanSign() bool { + if g == nil || g.CanSign == nil { + return false + } + return *g.CanSign +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { + return Timestamp{} + } + return *g.CreatedAt +} + +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (g *GPGKey) GetEmails() []*GPGEmail { + if g == nil || g.Emails == nil { + return nil + } + return g.Emails +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetExpiresAt() Timestamp { + if g == nil || g.ExpiresAt == nil { + return Timestamp{} + } + return *g.ExpiresAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetID() int64 { + if g == nil || g.ID == nil { + return 0 + } + return *g.ID +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetKeyID() string { + if g == nil || g.KeyID == nil { + return "" + } + return *g.KeyID +} + +// GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetPrimaryKeyID() int64 { + if g == nil || g.PrimaryKeyID == nil { + return 0 + } + return *g.PrimaryKeyID +} + +// GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetPublicKey() string { + if g == nil || g.PublicKey == nil { + return "" + } + return *g.PublicKey +} + +// GetRawKey returns the RawKey field if it's non-nil, zero value otherwise. +func (g *GPGKey) GetRawKey() string { + if g == nil || g.RawKey == nil { + return "" + } + return *g.RawKey +} + +// GetSubkeys returns the Subkeys slice if it's non-nil, nil otherwise. +func (g *GPGKey) GetSubkeys() []*GPGKey { + if g == nil || g.Subkeys == nil { + return nil + } + return g.Subkeys +} + +// GetApp returns the App field. +func (g *Grant) GetApp() *AuthorizationApp { + if g == nil { + return nil + } + return g.App +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (g *Grant) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { + return Timestamp{} + } + return *g.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *Grant) GetID() int64 { + if g == nil || g.ID == nil { + return 0 + } + return *g.ID +} + +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (g *Grant) GetScopes() []string { + if g == nil || g.Scopes == nil { + return nil + } + return g.Scopes +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (g *Grant) GetUpdatedAt() Timestamp { + if g == nil || g.UpdatedAt == nil { + return Timestamp{} + } + return *g.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (g *Grant) GetURL() string { + if g == nil || g.URL == nil { + return "" + } + return *g.URL +} + +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetAdded() []string { + if h == nil || h.Added == nil { + return nil + } + return h.Added +} + +// GetAuthor returns the Author field. +func (h *HeadCommit) GetAuthor() *CommitAuthor { + if h == nil { + return nil + } + return h.Author +} + +// GetCommitter returns the Committer field. +func (h *HeadCommit) GetCommitter() *CommitAuthor { + if h == nil { + return nil + } + return h.Committer +} + +// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetDistinct() bool { + if h == nil || h.Distinct == nil { + return false + } + return *h.Distinct +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetID() string { + if h == nil || h.ID == nil { + return "" + } + return *h.ID +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetMessage() string { + if h == nil || h.Message == nil { + return "" + } + return *h.Message +} + +// GetModified returns the Modified slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetModified() []string { + if h == nil || h.Modified == nil { + return nil + } + return h.Modified +} + +// GetRemoved returns the Removed slice if it's non-nil, nil otherwise. +func (h *HeadCommit) GetRemoved() []string { + if h == nil || h.Removed == nil { + return nil + } + return h.Removed +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetSHA() string { + if h == nil || h.SHA == nil { + return "" + } + return *h.SHA +} + +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetTimestamp() Timestamp { + if h == nil || h.Timestamp == nil { + return Timestamp{} + } + return *h.Timestamp +} + +// GetTreeID returns the TreeID field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetTreeID() string { + if h == nil || h.TreeID == nil { + return "" + } + return *h.TreeID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (h *HeadCommit) GetURL() string { + if h == nil || h.URL == nil { + return "" + } + return *h.URL +} + +// GetDomain returns the Domain field. +func (h *HecConfig) GetDomain() string { + if h == nil { + return "" + } + return h.Domain +} + +// GetEncryptedToken returns the EncryptedToken field. +func (h *HecConfig) GetEncryptedToken() string { + if h == nil { + return "" + } + return h.EncryptedToken +} + +// GetKeyID returns the KeyID field. +func (h *HecConfig) GetKeyID() string { + if h == nil { + return "" + } + return h.KeyID +} + +// GetPath returns the Path field. +func (h *HecConfig) GetPath() string { + if h == nil { + return "" + } + return h.Path +} + +// GetPort returns the Port field. +func (h *HecConfig) GetPort() uint16 { + if h == nil { + return 0 + } + return h.Port +} + +// GetSSLVerify returns the SSLVerify field. +func (h *HecConfig) GetSSLVerify() bool { + if h == nil { + return false + } + return h.SSLVerify +} + +// GetActive returns the Active field if it's non-nil, zero value otherwise. +func (h *Hook) GetActive() bool { + if h == nil || h.Active == nil { + return false + } + return *h.Active +} + +// GetConfig returns the Config field. +func (h *Hook) GetConfig() *HookConfig { + if h == nil { + return nil + } + return h.Config +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (h *Hook) GetCreatedAt() Timestamp { + if h == nil || h.CreatedAt == nil { + return Timestamp{} + } + return *h.CreatedAt +} + +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (h *Hook) GetEvents() []string { + if h == nil || h.Events == nil { + return nil + } + return h.Events +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *Hook) GetID() int64 { + if h == nil || h.ID == nil { + return 0 + } + return *h.ID +} + +// GetLastResponse returns the LastResponse map if it's non-nil, an empty map otherwise. +func (h *Hook) GetLastResponse() map[string]any { + if h == nil || h.LastResponse == nil { + return map[string]any{} + } + return h.LastResponse +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (h *Hook) GetName() string { + if h == nil || h.Name == nil { + return "" + } + return *h.Name +} + +// GetPingURL returns the PingURL field if it's non-nil, zero value otherwise. +func (h *Hook) GetPingURL() string { + if h == nil || h.PingURL == nil { + return "" + } + return *h.PingURL +} + +// GetTestURL returns the TestURL field if it's non-nil, zero value otherwise. +func (h *Hook) GetTestURL() string { + if h == nil || h.TestURL == nil { + return "" + } + return *h.TestURL +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (h *Hook) GetType() string { + if h == nil || h.Type == nil { + return "" + } + return *h.Type +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (h *Hook) GetUpdatedAt() Timestamp { + if h == nil || h.UpdatedAt == nil { + return Timestamp{} + } + return *h.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (h *Hook) GetURL() string { + if h == nil || h.URL == nil { + return "" + } + return *h.URL +} + +// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. +func (h *HookConfig) GetContentType() string { + if h == nil || h.ContentType == nil { + return "" + } + return *h.ContentType +} + +// GetInsecureSSL returns the InsecureSSL field if it's non-nil, zero value otherwise. +func (h *HookConfig) GetInsecureSSL() string { + if h == nil || h.InsecureSSL == nil { + return "" + } + return *h.InsecureSSL +} + +// GetSecret returns the Secret field if it's non-nil, zero value otherwise. +func (h *HookConfig) GetSecret() string { + if h == nil || h.Secret == nil { + return "" + } + return *h.Secret +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (h *HookConfig) GetURL() string { + if h == nil || h.URL == nil { + return "" + } + return *h.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetAction() string { + if h == nil || h.Action == nil { + return "" + } + return *h.Action +} + +// GetDeliveredAt returns the DeliveredAt field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetDeliveredAt() Timestamp { + if h == nil || h.DeliveredAt == nil { + return Timestamp{} + } + return *h.DeliveredAt +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetDuration() float64 { + if h == nil || h.Duration == nil { + return 0 + } + return *h.Duration +} + +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetEvent() string { + if h == nil || h.Event == nil { + return "" + } + return *h.Event +} + +// GetGUID returns the GUID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetGUID() string { + if h == nil || h.GUID == nil { + return "" + } + return *h.GUID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetID() int64 { + if h == nil || h.ID == nil { + return 0 + } + return *h.ID +} + +// GetInstallationID returns the InstallationID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetInstallationID() int64 { + if h == nil || h.InstallationID == nil { + return 0 + } + return *h.InstallationID +} + +// GetRedelivery returns the Redelivery field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetRedelivery() bool { + if h == nil || h.Redelivery == nil { + return false + } + return *h.Redelivery +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetRepositoryID() int64 { + if h == nil || h.RepositoryID == nil { + return 0 + } + return *h.RepositoryID +} + +// GetRequest returns the Request field. +func (h *HookDelivery) GetRequest() *HookRequest { + if h == nil { + return nil + } + return h.Request +} + +// GetResponse returns the Response field. +func (h *HookDelivery) GetResponse() *HookResponse { + if h == nil { + return nil + } + return h.Response +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetStatus() string { + if h == nil || h.Status == nil { + return "" + } + return *h.Status +} + +// GetStatusCode returns the StatusCode field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetStatusCode() int { + if h == nil || h.StatusCode == nil { + return 0 + } + return *h.StatusCode +} + +// GetThrottledAt returns the ThrottledAt field if it's non-nil, zero value otherwise. +func (h *HookDelivery) GetThrottledAt() Timestamp { + if h == nil || h.ThrottledAt == nil { + return Timestamp{} + } + return *h.ThrottledAt +} + +// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. +func (h *HookRequest) GetHeaders() map[string]string { + if h == nil || h.Headers == nil { + return map[string]string{} + } + return h.Headers +} + +// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. +func (h *HookRequest) GetRawPayload() json.RawMessage { + if h == nil || h.RawPayload == nil { + return json.RawMessage{} + } + return *h.RawPayload +} + +// GetHeaders returns the Headers map if it's non-nil, an empty map otherwise. +func (h *HookResponse) GetHeaders() map[string]string { + if h == nil || h.Headers == nil { + return map[string]string{} + } + return h.Headers +} + +// GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise. +func (h *HookResponse) GetRawPayload() json.RawMessage { + if h == nil || h.RawPayload == nil { + return json.RawMessage{} + } + return *h.RawPayload +} + +// GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise. +func (h *HookStats) GetActiveHooks() int { + if h == nil || h.ActiveHooks == nil { + return 0 + } + return *h.ActiveHooks +} + +// GetInactiveHooks returns the InactiveHooks field if it's non-nil, zero value otherwise. +func (h *HookStats) GetInactiveHooks() int { + if h == nil || h.InactiveHooks == nil { + return 0 + } + return *h.InactiveHooks +} + +// GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise. +func (h *HookStats) GetTotalHooks() int { + if h == nil || h.TotalHooks == nil { + return 0 + } + return *h.TotalHooks +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetID() int64 { + if h == nil || h.ID == nil { + return 0 + } + return *h.ID +} + +// GetImageDetails returns the ImageDetails field. +func (h *HostedRunner) GetImageDetails() *HostedRunnerImageDetail { + if h == nil { + return nil + } + return h.ImageDetails +} + +// GetImageGen returns the ImageGen field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetImageGen() bool { + if h == nil || h.ImageGen == nil { + return false + } + return *h.ImageGen +} + +// GetLastActiveOn returns the LastActiveOn field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetLastActiveOn() Timestamp { + if h == nil || h.LastActiveOn == nil { + return Timestamp{} + } + return *h.LastActiveOn +} + +// GetMachineSizeDetails returns the MachineSizeDetails field. +func (h *HostedRunner) GetMachineSizeDetails() *HostedRunnerMachineSpec { + if h == nil { + return nil + } + return h.MachineSizeDetails +} + +// GetMaximumRunners returns the MaximumRunners field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetMaximumRunners() int64 { + if h == nil || h.MaximumRunners == nil { + return 0 + } + return *h.MaximumRunners +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetName() string { + if h == nil || h.Name == nil { + return "" + } + return *h.Name +} + +// GetPlatform returns the Platform field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetPlatform() string { + if h == nil || h.Platform == nil { + return "" + } + return *h.Platform +} + +// GetPublicIPEnabled returns the PublicIPEnabled field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetPublicIPEnabled() bool { + if h == nil || h.PublicIPEnabled == nil { + return false + } + return *h.PublicIPEnabled +} + +// GetPublicIPs returns the PublicIPs slice if it's non-nil, nil otherwise. +func (h *HostedRunner) GetPublicIPs() []*HostedRunnerPublicIP { + if h == nil || h.PublicIPs == nil { + return nil + } + return h.PublicIPs +} + +// GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetRunnerGroupID() int64 { + if h == nil || h.RunnerGroupID == nil { + return 0 + } + return *h.RunnerGroupID +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (h *HostedRunner) GetStatus() string { + if h == nil || h.Status == nil { + return "" + } + return *h.Status +} + +// GetID returns the ID field. +func (h *HostedRunnerCustomImage) GetID() int64 { + if h == nil { + return 0 + } + return h.ID +} + +// GetLatestVersion returns the LatestVersion field. +func (h *HostedRunnerCustomImage) GetLatestVersion() string { + if h == nil { + return "" + } + return h.LatestVersion +} + +// GetName returns the Name field. +func (h *HostedRunnerCustomImage) GetName() string { + if h == nil { + return "" + } + return h.Name +} + +// GetPlatform returns the Platform field. +func (h *HostedRunnerCustomImage) GetPlatform() string { + if h == nil { + return "" + } + return h.Platform +} + +// GetSource returns the Source field. +func (h *HostedRunnerCustomImage) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// GetState returns the State field. +func (h *HostedRunnerCustomImage) GetState() string { + if h == nil { + return "" + } + return h.State +} + +// GetTotalVersionsSize returns the TotalVersionsSize field. +func (h *HostedRunnerCustomImage) GetTotalVersionsSize() int { + if h == nil { + return 0 + } + return h.TotalVersionsSize +} + +// GetVersionsCount returns the VersionsCount field. +func (h *HostedRunnerCustomImage) GetVersionsCount() int { + if h == nil { + return 0 + } + return h.VersionsCount +} + +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (h *HostedRunnerCustomImages) GetImages() []*HostedRunnerCustomImage { + if h == nil || h.Images == nil { + return nil + } + return h.Images +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerCustomImages) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetCreatedOn returns the CreatedOn field. +func (h *HostedRunnerCustomImageVersion) GetCreatedOn() Timestamp { + if h == nil { + return Timestamp{} + } + return h.CreatedOn +} + +// GetSizeGB returns the SizeGB field. +func (h *HostedRunnerCustomImageVersion) GetSizeGB() int { + if h == nil { + return 0 + } + return h.SizeGB +} + +// GetState returns the State field. +func (h *HostedRunnerCustomImageVersion) GetState() string { + if h == nil { + return "" + } + return h.State +} + +// GetStateDetails returns the StateDetails field. +func (h *HostedRunnerCustomImageVersion) GetStateDetails() string { + if h == nil { + return "" + } + return h.StateDetails +} + +// GetVersion returns the Version field. +func (h *HostedRunnerCustomImageVersion) GetVersion() string { + if h == nil { + return "" + } + return h.Version +} + +// GetImageVersions returns the ImageVersions slice if it's non-nil, nil otherwise. +func (h *HostedRunnerCustomImageVersions) GetImageVersions() []*HostedRunnerCustomImageVersion { + if h == nil || h.ImageVersions == nil { + return nil + } + return h.ImageVersions +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerCustomImageVersions) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetID returns the ID field. +func (h *HostedRunnerImage) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetSource returns the Source field. +func (h *HostedRunnerImage) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// 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 { + return "" + } + return *h.DisplayName +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImageDetail) GetID() string { + if h == nil || h.ID == nil { + return "" + } + return *h.ID +} + +// GetSizeGB returns the SizeGB field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImageDetail) GetSizeGB() int64 { + if h == nil || h.SizeGB == nil { + return 0 + } + return *h.SizeGB +} + +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImageDetail) GetSource() string { + if h == nil || h.Source == nil { + return "" + } + return *h.Source +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (h *HostedRunnerImageDetail) GetVersion() string { + if h == nil || h.Version == nil { + return "" + } + return *h.Version +} + +// GetImages returns the Images slice if it's non-nil, nil otherwise. +func (h *HostedRunnerImages) GetImages() []*HostedRunnerImageSpecs { + if h == nil || h.Images == nil { + return nil + } + return h.Images +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerImages) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetDisplayName returns the DisplayName field. +func (h *HostedRunnerImageSpecs) GetDisplayName() string { + if h == nil { + return "" + } + return h.DisplayName +} + +// GetID returns the ID field. +func (h *HostedRunnerImageSpecs) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetPlatform returns the Platform field. +func (h *HostedRunnerImageSpecs) GetPlatform() string { + if h == nil { + return "" + } + return h.Platform +} + +// GetSizeGB returns the SizeGB field. +func (h *HostedRunnerImageSpecs) GetSizeGB() int { + if h == nil { + return 0 + } + return h.SizeGB +} + +// GetSource returns the Source field. +func (h *HostedRunnerImageSpecs) GetSource() string { + if h == nil { + return "" + } + return h.Source +} + +// GetCPUCores returns the CPUCores field. +func (h *HostedRunnerMachineSpec) GetCPUCores() int { + if h == nil { + return 0 + } + return h.CPUCores +} + +// GetID returns the ID field. +func (h *HostedRunnerMachineSpec) GetID() string { + if h == nil { + return "" + } + return h.ID +} + +// GetMemoryGB returns the MemoryGB field. +func (h *HostedRunnerMachineSpec) GetMemoryGB() int { + if h == nil { + return 0 + } + return h.MemoryGB +} + +// GetStorageGB returns the StorageGB field. +func (h *HostedRunnerMachineSpec) GetStorageGB() int { + if h == nil { + return 0 + } + return h.StorageGB +} + +// GetMachineSpecs returns the MachineSpecs slice if it's non-nil, nil otherwise. +func (h *HostedRunnerMachineSpecs) GetMachineSpecs() []*HostedRunnerMachineSpec { + if h == nil || h.MachineSpecs == nil { + return nil + } + return h.MachineSpecs +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerMachineSpecs) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetPlatforms returns the Platforms slice if it's non-nil, nil otherwise. +func (h *HostedRunnerPlatforms) GetPlatforms() []string { + if h == nil || h.Platforms == nil { + return nil + } + return h.Platforms +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunnerPlatforms) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetEnabled returns the Enabled field. +func (h *HostedRunnerPublicIP) GetEnabled() bool { + if h == nil { + return false + } + return h.Enabled +} + +// GetLength returns the Length field. +func (h *HostedRunnerPublicIP) GetLength() int { + if h == nil { + return 0 + } + return h.Length +} + +// GetPrefix returns the Prefix field. +func (h *HostedRunnerPublicIP) GetPrefix() string { + if h == nil { + return "" + } + return h.Prefix +} + +// GetPublicIPs returns the PublicIPs field. +func (h *HostedRunnerPublicIPLimits) GetPublicIPs() *PublicIPUsage { + if h == nil { + return nil + } + return h.PublicIPs +} + +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (h *HostedRunners) GetRunners() []*HostedRunner { + if h == nil || h.Runners == nil { + return nil + } + return h.Runners +} + +// GetTotalCount returns the TotalCount field. +func (h *HostedRunners) GetTotalCount() int { + if h == nil { + return 0 + } + return h.TotalCount +} + +// GetContexts returns the Contexts slice if it's non-nil, nil otherwise. +func (h *Hovercard) GetContexts() []*UserContext { + if h == nil || h.Contexts == nil { + return nil + } + return h.Contexts +} + +// GetSubjectID returns the SubjectID field. +func (h *HovercardOptions) GetSubjectID() string { + if h == nil { + return "" + } + return h.SubjectID +} + +// GetSubjectType returns the SubjectType field. +func (h *HovercardOptions) GetSubjectType() string { + if h == nil { + return "" + } + return h.SubjectType +} + +// GetGroupDescription returns the GroupDescription field if it's non-nil, zero value otherwise. +func (i *IDPGroup) GetGroupDescription() string { + if i == nil || i.GroupDescription == nil { + return "" + } + return *i.GroupDescription +} + +// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. +func (i *IDPGroup) GetGroupID() string { + if i == nil || i.GroupID == nil { + return "" + } + return *i.GroupID +} + +// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. +func (i *IDPGroup) GetGroupName() string { + if i == nil || i.GroupName == nil { + return "" + } + return *i.GroupName +} + +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (i *IDPGroupList) GetGroups() []*IDPGroup { + if i == nil || i.Groups == nil { + return nil + } + return i.Groups +} + +// GetEnforcedRepositories returns the EnforcedRepositories field. +func (i *ImmutableReleasePolicy) GetEnforcedRepositories() string { + if i == nil { + return "" + } + return i.EnforcedRepositories +} + +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (i *ImmutableReleasePolicy) GetSelectedRepositoryIDs() []int64 { + if i == nil || i.SelectedRepositoryIDs == nil { + return nil + } + return i.SelectedRepositoryIDs +} + +// 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 { + return 0 + } + return *i.AuthorsCount +} + +// GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise. +func (i *Import) GetAuthorsURL() string { + if i == nil || i.AuthorsURL == nil { + return "" + } + return *i.AuthorsURL +} + +// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. +func (i *Import) GetCommitCount() int { + if i == nil || i.CommitCount == nil { + return 0 + } + return *i.CommitCount +} + +// GetFailedStep returns the FailedStep field if it's non-nil, zero value otherwise. +func (i *Import) GetFailedStep() string { + if i == nil || i.FailedStep == nil { + return "" + } + return *i.FailedStep +} + +// GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise. +func (i *Import) GetHasLargeFiles() bool { + if i == nil || i.HasLargeFiles == nil { + return false + } + return *i.HasLargeFiles +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (i *Import) GetHTMLURL() string { + if i == nil || i.HTMLURL == nil { + return "" + } + return *i.HTMLURL +} + +// GetHumanName returns the HumanName field if it's non-nil, zero value otherwise. +func (i *Import) GetHumanName() string { + if i == nil || i.HumanName == nil { + return "" + } + return *i.HumanName +} + +// GetLargeFilesCount returns the LargeFilesCount field if it's non-nil, zero value otherwise. +func (i *Import) GetLargeFilesCount() int { + if i == nil || i.LargeFilesCount == nil { + return 0 + } + return *i.LargeFilesCount +} + +// GetLargeFilesSize returns the LargeFilesSize field if it's non-nil, zero value otherwise. +func (i *Import) GetLargeFilesSize() int { + if i == nil || i.LargeFilesSize == nil { + return 0 + } + return *i.LargeFilesSize +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (i *Import) GetMessage() string { + if i == nil || i.Message == nil { + return "" + } + return *i.Message +} + +// GetPercent returns the Percent field if it's non-nil, zero value otherwise. +func (i *Import) GetPercent() int { + if i == nil || i.Percent == nil { + return 0 + } + return *i.Percent +} + +// GetProjectChoices returns the ProjectChoices slice if it's non-nil, nil otherwise. +func (i *Import) GetProjectChoices() []*Import { + if i == nil || i.ProjectChoices == nil { + return nil + } + return i.ProjectChoices +} + +// GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise. +func (i *Import) GetPushPercent() int { + if i == nil || i.PushPercent == nil { + return 0 + } + return *i.PushPercent +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (i *Import) GetRepositoryURL() string { + if i == nil || i.RepositoryURL == nil { + return "" + } + return *i.RepositoryURL +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (i *Import) GetStatus() string { + if i == nil || i.Status == nil { + return "" + } + return *i.Status +} + +// GetStatusText returns the StatusText field if it's non-nil, zero value otherwise. +func (i *Import) GetStatusText() string { + if i == nil || i.StatusText == nil { + return "" + } + return *i.StatusText +} + +// GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise. +func (i *Import) GetTFVCProject() string { + if i == nil || i.TFVCProject == nil { + return "" + } + return *i.TFVCProject +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (i *Import) GetURL() string { + if i == nil || i.URL == nil { + return "" + } + return *i.URL +} + +// GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise. +func (i *Import) GetUseLFS() string { + if i == nil || i.UseLFS == nil { + return "" + } + return *i.UseLFS +} + +// GetVCS returns the VCS field if it's non-nil, zero value otherwise. +func (i *Import) GetVCS() string { + if i == nil || i.VCS == nil { + return "" + } + return *i.VCS +} + +// GetVCSPassword returns the VCSPassword field if it's non-nil, zero value otherwise. +func (i *Import) GetVCSPassword() string { + if i == nil || i.VCSPassword == nil { + return "" + } + return *i.VCSPassword +} + +// GetVCSURL returns the VCSURL field if it's non-nil, zero value otherwise. +func (i *Import) GetVCSURL() string { + if i == nil || i.VCSURL == nil { + return "" + } + return *i.VCSURL +} + +// GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise. +func (i *Import) GetVCSUsername() string { + if i == nil || i.VCSUsername == nil { + return "" + } + return *i.VCSUsername +} + +// GetLicense returns the License field. +func (i *InitialConfigOptions) GetLicense() string { + if i == nil { + return "" + } + return i.License +} + +// GetPassword returns the Password field. +func (i *InitialConfigOptions) GetPassword() string { + if i == nil { + return "" + } + return i.Password +} + +// 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 +} + +// GetID returns the ID field. +func (i *InstallableOrganization) GetID() int64 { + if i == nil { + return 0 + } + return i.ID +} + +// GetLogin returns the Login field. +func (i *InstallableOrganization) GetLogin() string { + if i == nil { + return "" + } + return i.Login +} + +// GetClientID returns the ClientID field. +func (i *InstallAppRequest) GetClientID() string { + if i == nil { + return "" + } + return i.ClientID +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallAppRequest) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositorySelection returns the RepositorySelection field. +func (i *InstallAppRequest) GetRepositorySelection() string { + if i == nil { + return "" + } + return i.RepositorySelection +} + +// GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise. +func (i *Installation) GetAccessTokensURL() string { + if i == nil || i.AccessTokensURL == nil { + return "" + } + return *i.AccessTokensURL +} + +// GetAccount returns the Account field. +func (i *Installation) GetAccount() *User { + if i == nil { + return nil + } + return i.Account +} + +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (i *Installation) GetAppID() int64 { + if i == nil || i.AppID == nil { + return 0 + } + return *i.AppID +} + +// GetAppSlug returns the AppSlug field if it's non-nil, zero value otherwise. +func (i *Installation) GetAppSlug() string { + if i == nil || i.AppSlug == nil { + return "" + } + 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 { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetEvents returns the Events slice if it's non-nil, nil otherwise. +func (i *Installation) GetEvents() []string { + if i == nil || i.Events == nil { + return nil + } + return i.Events +} + +// GetHasMultipleSingleFiles returns the HasMultipleSingleFiles field if it's non-nil, zero value otherwise. +func (i *Installation) GetHasMultipleSingleFiles() bool { + if i == nil || i.HasMultipleSingleFiles == nil { + return false + } + return *i.HasMultipleSingleFiles +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (i *Installation) GetHTMLURL() string { + if i == nil || i.HTMLURL == nil { + return "" + } + return *i.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *Installation) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *Installation) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetPermissions returns the Permissions field. +func (i *Installation) GetPermissions() *InstallationPermissions { + if i == nil { + return nil + } + return i.Permissions +} + +// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. +func (i *Installation) GetRepositoriesURL() string { + if i == nil || i.RepositoriesURL == nil { + return "" + } + return *i.RepositoriesURL +} + +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (i *Installation) GetRepositorySelection() string { + if i == nil || i.RepositorySelection == nil { + return "" + } + return *i.RepositorySelection +} + +// GetSingleFileName returns the SingleFileName field if it's non-nil, zero value otherwise. +func (i *Installation) GetSingleFileName() string { + if i == nil || i.SingleFileName == nil { + return "" + } + return *i.SingleFileName +} + +// GetSingleFilePaths returns the SingleFilePaths slice if it's non-nil, nil otherwise. +func (i *Installation) GetSingleFilePaths() []string { + if i == nil || i.SingleFilePaths == nil { + return nil + } + return i.SingleFilePaths +} + +// GetSuspendedAt returns the SuspendedAt field if it's non-nil, zero value otherwise. +func (i *Installation) GetSuspendedAt() Timestamp { + if i == nil || i.SuspendedAt == nil { + return Timestamp{} + } + return *i.SuspendedAt +} + +// GetSuspendedBy returns the SuspendedBy field. +func (i *Installation) GetSuspendedBy() *User { + if i == nil { + return nil + } + return i.SuspendedBy +} + +// GetTargetID returns the TargetID field if it's non-nil, zero value otherwise. +func (i *Installation) GetTargetID() int64 { + if i == nil || i.TargetID == nil { + return 0 + } + return *i.TargetID +} + +// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. +func (i *Installation) GetTargetType() string { + if i == nil || i.TargetType == nil { + return "" + } + return *i.TargetType +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *Installation) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetLogin returns the Login field. +func (i *InstallationChanges) GetLogin() *InstallationLoginChange { + if i == nil { + return nil + } + return i.Login +} + +// GetSlug returns the Slug field. +func (i *InstallationChanges) GetSlug() *InstallationSlugChange { + if i == nil { + return nil + } + return i.Slug +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (i *InstallationEvent) GetAction() string { + if i == nil || i.Action == nil { + return "" + } + return *i.Action +} + +// GetInstallation returns the Installation field. +func (i *InstallationEvent) GetInstallation() *Installation { + if i == nil { + return nil + } + return i.Installation +} + +// GetOrg returns the Org field. +func (i *InstallationEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationEvent) GetRepositories() []*Repository { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRequester returns the Requester field. +func (i *InstallationEvent) GetRequester() *User { + if i == nil { + return nil + } + return i.Requester +} + +// GetSender returns the Sender field. +func (i *InstallationEvent) GetSender() *User { + if i == nil { + return nil + } + return i.Sender +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (i *InstallationLoginChange) GetFrom() string { + if i == nil || i.From == nil { + return "" + } + return *i.From +} + +// GetActions returns the Actions field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetActions() string { + if i == nil || i.Actions == nil { + return "" + } + return *i.Actions +} + +// GetActionsVariables returns the ActionsVariables field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetActionsVariables() string { + if i == nil || i.ActionsVariables == nil { + return "" + } + return *i.ActionsVariables +} + +// GetAdministration returns the Administration field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetAdministration() string { + if i == nil || i.Administration == nil { + return "" + } + return *i.Administration +} + +// GetAttestations returns the Attestations field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetAttestations() string { + if i == nil || i.Attestations == nil { + return "" + } + return *i.Attestations +} + +// GetBlocking returns the Blocking field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetBlocking() string { + if i == nil || i.Blocking == nil { + return "" + } + return *i.Blocking +} + +// GetChecks returns the Checks field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetChecks() string { + if i == nil || i.Checks == nil { + return "" + } + return *i.Checks +} + +// GetCodespaces returns the Codespaces field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCodespaces() string { + if i == nil || i.Codespaces == nil { + return "" + } + return *i.Codespaces +} + +// GetCodespacesLifecycleAdmin returns the CodespacesLifecycleAdmin field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCodespacesLifecycleAdmin() string { + if i == nil || i.CodespacesLifecycleAdmin == nil { + return "" + } + return *i.CodespacesLifecycleAdmin +} + +// GetCodespacesMetadata returns the CodespacesMetadata field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCodespacesMetadata() string { + if i == nil || i.CodespacesMetadata == nil { + return "" + } + return *i.CodespacesMetadata +} + +// GetCodespacesSecrets returns the CodespacesSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCodespacesSecrets() string { + if i == nil || i.CodespacesSecrets == nil { + return "" + } + return *i.CodespacesSecrets +} + +// GetCodespacesUserSecrets returns the CodespacesUserSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCodespacesUserSecrets() string { + if i == nil || i.CodespacesUserSecrets == nil { + return "" + } + return *i.CodespacesUserSecrets +} + +// GetContentReferences returns the ContentReferences field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetContentReferences() string { + if i == nil || i.ContentReferences == nil { + return "" + } + return *i.ContentReferences +} + +// GetContents returns the Contents field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetContents() string { + if i == nil || i.Contents == nil { + return "" + } + return *i.Contents +} + +// GetCopilotMessages returns the CopilotMessages field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetCopilotMessages() string { + if i == nil || i.CopilotMessages == nil { + return "" + } + return *i.CopilotMessages +} + +// GetDependabotSecrets returns the DependabotSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetDependabotSecrets() string { + if i == nil || i.DependabotSecrets == nil { + return "" + } + return *i.DependabotSecrets +} + +// GetDeployments returns the Deployments field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetDeployments() string { + if i == nil || i.Deployments == nil { + return "" + } + return *i.Deployments +} + +// GetDiscussions returns the Discussions field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetDiscussions() string { + if i == nil || i.Discussions == nil { + return "" + } + return *i.Discussions +} + +// GetEmails returns the Emails field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEmails() string { + if i == nil || i.Emails == nil { + return "" + } + return *i.Emails +} + +// GetEnterpriseAIControls returns the EnterpriseAIControls field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseAIControls() string { + if i == nil || i.EnterpriseAIControls == nil { + return "" + } + return *i.EnterpriseAIControls +} + +// GetEnterpriseCopilotMetrics returns the EnterpriseCopilotMetrics field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCopilotMetrics() string { + if i == nil || i.EnterpriseCopilotMetrics == nil { + return "" + } + return *i.EnterpriseCopilotMetrics +} + +// GetEnterpriseCredentials returns the EnterpriseCredentials field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCredentials() string { + if i == nil || i.EnterpriseCredentials == nil { + return "" + } + return *i.EnterpriseCredentials +} + +// GetEnterpriseCustomEnterpriseRoles returns the EnterpriseCustomEnterpriseRoles field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCustomEnterpriseRoles() string { + if i == nil || i.EnterpriseCustomEnterpriseRoles == nil { + return "" + } + return *i.EnterpriseCustomEnterpriseRoles +} + +// GetEnterpriseCustomOrgRoles returns the EnterpriseCustomOrgRoles field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCustomOrgRoles() string { + if i == nil || i.EnterpriseCustomOrgRoles == nil { + return "" + } + return *i.EnterpriseCustomOrgRoles +} + +// GetEnterpriseCustomProperties returns the EnterpriseCustomProperties field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCustomProperties() string { + if i == nil || i.EnterpriseCustomProperties == nil { + return "" + } + return *i.EnterpriseCustomProperties +} + +// GetEnterpriseCustomPropertiesForOrgs returns the EnterpriseCustomPropertiesForOrgs field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseCustomPropertiesForOrgs() string { + if i == nil || i.EnterpriseCustomPropertiesForOrgs == nil { + return "" + } + return *i.EnterpriseCustomPropertiesForOrgs +} + +// GetEnterpriseOrganizationInstallations returns the EnterpriseOrganizationInstallations field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseOrganizationInstallations() string { + if i == nil || i.EnterpriseOrganizationInstallations == nil { + return "" + } + return *i.EnterpriseOrganizationInstallations +} + +// GetEnterpriseOrganizations returns the EnterpriseOrganizations field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseOrganizations() string { + if i == nil || i.EnterpriseOrganizations == nil { + return "" + } + return *i.EnterpriseOrganizations +} + +// GetEnterpriseOrgInstallationRepos returns the EnterpriseOrgInstallationRepos field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseOrgInstallationRepos() string { + if i == nil || i.EnterpriseOrgInstallationRepos == nil { + return "" + } + return *i.EnterpriseOrgInstallationRepos +} + +// GetEnterprisePeople returns the EnterprisePeople field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterprisePeople() string { + if i == nil || i.EnterprisePeople == nil { + return "" + } + return *i.EnterprisePeople +} + +// GetEnterpriseSSO returns the EnterpriseSSO field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseSSO() string { + if i == nil || i.EnterpriseSSO == nil { + return "" + } + return *i.EnterpriseSSO +} + +// GetEnterpriseTeams returns the EnterpriseTeams field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnterpriseTeams() string { + if i == nil || i.EnterpriseTeams == nil { + return "" + } + return *i.EnterpriseTeams +} + +// GetEnvironments returns the Environments field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetEnvironments() string { + if i == nil || i.Environments == nil { + return "" + } + return *i.Environments +} + +// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetFollowers() string { + if i == nil || i.Followers == nil { + return "" + } + return *i.Followers +} + +// GetGists returns the Gists field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetGists() string { + if i == nil || i.Gists == nil { + return "" + } + return *i.Gists +} + +// GetGitSigningSSHPublicKeys returns the GitSigningSSHPublicKeys field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetGitSigningSSHPublicKeys() string { + if i == nil || i.GitSigningSSHPublicKeys == nil { + return "" + } + return *i.GitSigningSSHPublicKeys +} + +// GetGPGKeys returns the GPGKeys field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetGPGKeys() string { + if i == nil || i.GPGKeys == nil { + return "" + } + return *i.GPGKeys +} + +// GetInteractionLimits returns the InteractionLimits field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetInteractionLimits() string { + if i == nil || i.InteractionLimits == nil { + return "" + } + return *i.InteractionLimits +} + +// GetIssues returns the Issues field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetIssues() string { + if i == nil || i.Issues == nil { + return "" + } + return *i.Issues +} + +// GetKeys returns the Keys field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetKeys() string { + if i == nil || i.Keys == nil { + return "" + } + return *i.Keys +} + +// GetMembers returns the Members field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetMembers() string { + if i == nil || i.Members == nil { + return "" + } + return *i.Members +} + +// GetMergeQueues returns the MergeQueues field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetMergeQueues() string { + if i == nil || i.MergeQueues == nil { + return "" + } + return *i.MergeQueues +} + +// GetMetadata returns the Metadata field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetMetadata() string { + if i == nil || i.Metadata == nil { + return "" + } + return *i.Metadata +} + +// GetOrganizationActionsVariables returns the OrganizationActionsVariables field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationActionsVariables() string { + if i == nil || i.OrganizationActionsVariables == nil { + return "" + } + return *i.OrganizationActionsVariables +} + +// GetOrganizationAdministration returns the OrganizationAdministration field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationAdministration() string { + if i == nil || i.OrganizationAdministration == nil { + return "" + } + return *i.OrganizationAdministration +} + +// GetOrganizationAnnouncementBanners returns the OrganizationAnnouncementBanners field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationAnnouncementBanners() string { + if i == nil || i.OrganizationAnnouncementBanners == nil { + return "" + } + return *i.OrganizationAnnouncementBanners +} + +// GetOrganizationAPIInsights returns the OrganizationAPIInsights field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationAPIInsights() string { + if i == nil || i.OrganizationAPIInsights == nil { + return "" + } + return *i.OrganizationAPIInsights +} + +// GetOrganizationCodespaces returns the OrganizationCodespaces field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCodespaces() string { + if i == nil || i.OrganizationCodespaces == nil { + return "" + } + return *i.OrganizationCodespaces +} + +// GetOrganizationCodespacesSecrets returns the OrganizationCodespacesSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCodespacesSecrets() string { + if i == nil || i.OrganizationCodespacesSecrets == nil { + return "" + } + return *i.OrganizationCodespacesSecrets +} + +// GetOrganizationCodespacesSettings returns the OrganizationCodespacesSettings field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCodespacesSettings() string { + if i == nil || i.OrganizationCodespacesSettings == nil { + return "" + } + 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 { + return "" + } + return *i.OrganizationCopilotSeatManagement +} + +// GetOrganizationCustomOrgRoles returns the OrganizationCustomOrgRoles field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCustomOrgRoles() string { + if i == nil || i.OrganizationCustomOrgRoles == nil { + return "" + } + return *i.OrganizationCustomOrgRoles +} + +// GetOrganizationCustomProperties returns the OrganizationCustomProperties field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCustomProperties() string { + if i == nil || i.OrganizationCustomProperties == nil { + return "" + } + return *i.OrganizationCustomProperties +} + +// GetOrganizationCustomRoles returns the OrganizationCustomRoles field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCustomRoles() string { + if i == nil || i.OrganizationCustomRoles == nil { + return "" + } + return *i.OrganizationCustomRoles +} + +// GetOrganizationDependabotSecrets returns the OrganizationDependabotSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationDependabotSecrets() string { + if i == nil || i.OrganizationDependabotSecrets == nil { + return "" + } + return *i.OrganizationDependabotSecrets +} + +// GetOrganizationEvents returns the OrganizationEvents field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationEvents() string { + if i == nil || i.OrganizationEvents == nil { + return "" + } + return *i.OrganizationEvents +} + +// GetOrganizationHooks returns the OrganizationHooks field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationHooks() string { + if i == nil || i.OrganizationHooks == nil { + return "" + } + return *i.OrganizationHooks +} + +// GetOrganizationKnowledgeBases returns the OrganizationKnowledgeBases field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationKnowledgeBases() string { + if i == nil || i.OrganizationKnowledgeBases == nil { + return "" + } + return *i.OrganizationKnowledgeBases +} + +// GetOrganizationPackages returns the OrganizationPackages field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPackages() string { + if i == nil || i.OrganizationPackages == nil { + return "" + } + return *i.OrganizationPackages +} + +// GetOrganizationPersonalAccessTokenRequests returns the OrganizationPersonalAccessTokenRequests field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPersonalAccessTokenRequests() string { + if i == nil || i.OrganizationPersonalAccessTokenRequests == nil { + return "" + } + return *i.OrganizationPersonalAccessTokenRequests +} + +// GetOrganizationPersonalAccessTokens returns the OrganizationPersonalAccessTokens field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPersonalAccessTokens() string { + if i == nil || i.OrganizationPersonalAccessTokens == nil { + return "" + } + return *i.OrganizationPersonalAccessTokens +} + +// GetOrganizationPlan returns the OrganizationPlan field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPlan() string { + if i == nil || i.OrganizationPlan == nil { + return "" + } + return *i.OrganizationPlan +} + +// GetOrganizationPreReceiveHooks returns the OrganizationPreReceiveHooks field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPreReceiveHooks() string { + if i == nil || i.OrganizationPreReceiveHooks == nil { + return "" + } + return *i.OrganizationPreReceiveHooks +} + +// GetOrganizationPrivateRegistries returns the OrganizationPrivateRegistries field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationPrivateRegistries() string { + if i == nil || i.OrganizationPrivateRegistries == nil { + return "" + } + return *i.OrganizationPrivateRegistries +} + +// GetOrganizationProjects returns the OrganizationProjects field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationProjects() string { + if i == nil || i.OrganizationProjects == nil { + return "" + } + return *i.OrganizationProjects +} + +// GetOrganizationSecrets returns the OrganizationSecrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationSecrets() string { + if i == nil || i.OrganizationSecrets == nil { + return "" + } + return *i.OrganizationSecrets +} + +// GetOrganizationSelfHostedRunners returns the OrganizationSelfHostedRunners field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationSelfHostedRunners() string { + if i == nil || i.OrganizationSelfHostedRunners == nil { + return "" + } + return *i.OrganizationSelfHostedRunners +} + +// GetOrganizationUserBlocking returns the OrganizationUserBlocking field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationUserBlocking() string { + if i == nil || i.OrganizationUserBlocking == nil { + return "" + } + return *i.OrganizationUserBlocking +} + +// GetPackages returns the Packages field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetPackages() string { + if i == nil || i.Packages == nil { + return "" + } + return *i.Packages +} + +// GetPages returns the Pages field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetPages() string { + if i == nil || i.Pages == nil { + return "" + } + return *i.Pages +} + +// GetPlan returns the Plan field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetPlan() string { + if i == nil || i.Plan == nil { + return "" + } + return *i.Plan +} + +// GetProfile returns the Profile field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetProfile() string { + if i == nil || i.Profile == nil { + return "" + } + return *i.Profile +} + +// GetPullRequests returns the PullRequests field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetPullRequests() string { + if i == nil || i.PullRequests == nil { + return "" + } + return *i.PullRequests +} + +// GetRepositoryAdvisories returns the RepositoryAdvisories field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetRepositoryAdvisories() string { + if i == nil || i.RepositoryAdvisories == nil { + return "" + } + return *i.RepositoryAdvisories +} + +// GetRepositoryCustomProperties returns the RepositoryCustomProperties field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetRepositoryCustomProperties() string { + if i == nil || i.RepositoryCustomProperties == nil { + return "" + } + return *i.RepositoryCustomProperties +} + +// GetRepositoryHooks returns the RepositoryHooks field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetRepositoryHooks() string { + if i == nil || i.RepositoryHooks == nil { + return "" + } + return *i.RepositoryHooks +} + +// GetRepositoryPreReceiveHooks returns the RepositoryPreReceiveHooks field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetRepositoryPreReceiveHooks() string { + if i == nil || i.RepositoryPreReceiveHooks == nil { + return "" + } + return *i.RepositoryPreReceiveHooks +} + +// GetRepositoryProjects returns the RepositoryProjects field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetRepositoryProjects() string { + if i == nil || i.RepositoryProjects == nil { + return "" + } + return *i.RepositoryProjects +} + +// GetSecrets returns the Secrets field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetSecrets() string { + if i == nil || i.Secrets == nil { + return "" + } + return *i.Secrets +} + +// GetSecretScanningAlerts returns the SecretScanningAlerts field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetSecretScanningAlerts() string { + if i == nil || i.SecretScanningAlerts == nil { + return "" + } + return *i.SecretScanningAlerts +} + +// GetSecurityEvents returns the SecurityEvents field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetSecurityEvents() string { + if i == nil || i.SecurityEvents == nil { + return "" + } + return *i.SecurityEvents +} + +// GetSingleFile returns the SingleFile field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetSingleFile() string { + if i == nil || i.SingleFile == nil { + return "" + } + return *i.SingleFile +} + +// GetStarring returns the Starring field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetStarring() string { + if i == nil || i.Starring == nil { + return "" + } + return *i.Starring +} + +// GetStatuses returns the Statuses field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetStatuses() string { + if i == nil || i.Statuses == nil { + return "" + } + return *i.Statuses +} + +// GetTeamDiscussions returns the TeamDiscussions field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetTeamDiscussions() string { + if i == nil || i.TeamDiscussions == nil { + return "" + } + return *i.TeamDiscussions +} + +// GetUserEvents returns the UserEvents field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetUserEvents() string { + if i == nil || i.UserEvents == nil { + return "" + } + return *i.UserEvents +} + +// GetVulnerabilityAlerts returns the VulnerabilityAlerts field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetVulnerabilityAlerts() string { + if i == nil || i.VulnerabilityAlerts == nil { + return "" + } + return *i.VulnerabilityAlerts +} + +// GetWatching returns the Watching field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetWatching() string { + if i == nil || i.Watching == nil { + return "" + } + return *i.Watching +} + +// GetWorkflows returns the Workflows field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetWorkflows() string { + if i == nil || i.Workflows == nil { + return "" + } + return *i.Workflows +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (i *InstallationRepositoriesEvent) GetAction() string { + if i == nil || i.Action == nil { + return "" + } + return *i.Action +} + +// GetInstallation returns the Installation field. +func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { + if i == nil { + return nil + } + return i.Installation +} + +// GetOrg returns the Org field. +func (i *InstallationRepositoriesEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + +// GetRepositoriesAdded returns the RepositoriesAdded slice if it's non-nil, nil otherwise. +func (i *InstallationRepositoriesEvent) GetRepositoriesAdded() []*Repository { + if i == nil || i.RepositoriesAdded == nil { + return nil + } + return i.RepositoriesAdded +} + +// GetRepositoriesRemoved returns the RepositoriesRemoved slice if it's non-nil, nil otherwise. +func (i *InstallationRepositoriesEvent) GetRepositoriesRemoved() []*Repository { + if i == nil || i.RepositoriesRemoved == nil { + return nil + } + return i.RepositoriesRemoved +} + +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { + if i == nil || i.RepositorySelection == nil { + return "" + } + return *i.RepositorySelection +} + +// GetSender returns the Sender field. +func (i *InstallationRepositoriesEvent) GetSender() *User { + if i == nil { + return nil + } + return i.Sender +} + +// GetAccount returns the Account field. +func (i *InstallationRequest) GetAccount() *User { + if i == nil { + return nil + } + return i.Account +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetRequester returns the Requester field. +func (i *InstallationRequest) GetRequester() *User { + if i == nil { + return nil + } + return i.Requester +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (i *InstallationSlugChange) GetFrom() string { + if i == nil || i.From == nil { + return "" + } + return *i.From +} + +// GetAccount returns the Account field. +func (i *InstallationTargetEvent) GetAccount() *User { + if i == nil { + return nil + } + return i.Account +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (i *InstallationTargetEvent) GetAction() string { + if i == nil || i.Action == nil { + return "" + } + return *i.Action +} + +// GetChanges returns the Changes field. +func (i *InstallationTargetEvent) GetChanges() *InstallationChanges { + if i == nil { + return nil + } + return i.Changes +} + +// GetEnterprise returns the Enterprise field. +func (i *InstallationTargetEvent) GetEnterprise() *Enterprise { + if i == nil { + return nil + } + return i.Enterprise +} + +// GetInstallation returns the Installation field. +func (i *InstallationTargetEvent) GetInstallation() *Installation { + if i == nil { + return nil + } + return i.Installation +} + +// GetOrganization returns the Organization field. +func (i *InstallationTargetEvent) GetOrganization() *Organization { + if i == nil { + return nil + } + return i.Organization +} + +// GetRepository returns the Repository field. +func (i *InstallationTargetEvent) GetRepository() *Repository { + if i == nil { + return nil + } + return i.Repository +} + +// GetSender returns the Sender field. +func (i *InstallationTargetEvent) GetSender() *User { + if i == nil { + return nil + } + return i.Sender +} + +// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. +func (i *InstallationTargetEvent) GetTargetType() string { + if i == nil || i.TargetType == nil { + return "" + } + return *i.TargetType +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (i *InstallationToken) GetExpiresAt() Timestamp { + if i == nil || i.ExpiresAt == nil { + return Timestamp{} + } + return *i.ExpiresAt +} + +// GetPermissions returns the Permissions field. +func (i *InstallationToken) GetPermissions() *InstallationPermissions { + if i == nil { + return nil + } + return i.Permissions +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationToken) GetRepositories() []*Repository { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetToken returns the Token field if it's non-nil, zero value otherwise. +func (i *InstallationToken) GetToken() string { + if i == nil || i.Token == nil { + return "" + } + return *i.Token +} + +// GetPermissions returns the Permissions field. +func (i *InstallationTokenListRepoOptions) GetPermissions() *InstallationPermissions { + if i == nil { + return nil + } + return i.Permissions +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationTokenListRepoOptions) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (i *InstallationTokenListRepoOptions) GetRepositoryIDs() []int64 { + if i == nil || i.RepositoryIDs == nil { + return nil + } + return i.RepositoryIDs +} + +// GetPermissions returns the Permissions field. +func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { + if i == nil { + return nil + } + return i.Permissions +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (i *InstallationTokenOptions) GetRepositories() []string { + if i == nil || i.Repositories == nil { + return nil + } + return i.Repositories +} + +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (i *InstallationTokenOptions) GetRepositoryIDs() []int64 { + if i == nil || i.RepositoryIDs == nil { + return nil + } + return i.RepositoryIDs +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (i *InteractionRestriction) GetExpiresAt() Timestamp { + if i == nil || i.ExpiresAt == nil { + return Timestamp{} + } + return *i.ExpiresAt +} + +// GetLimit returns the Limit field if it's non-nil, zero value otherwise. +func (i *InteractionRestriction) GetLimit() string { + if i == nil || i.Limit == nil { + return "" + } + return *i.Limit +} + +// GetOrigin returns the Origin field if it's non-nil, zero value otherwise. +func (i *InteractionRestriction) GetOrigin() string { + if i == nil || i.Origin == nil { + return "" + } + return *i.Origin +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *Invitation) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (i *Invitation) GetEmail() string { + if i == nil || i.Email == nil { + return "" + } + return *i.Email +} + +// GetFailedAt returns the FailedAt field if it's non-nil, zero value otherwise. +func (i *Invitation) GetFailedAt() Timestamp { + if i == nil || i.FailedAt == nil { + return Timestamp{} + } + return *i.FailedAt +} + +// GetFailedReason returns the FailedReason field if it's non-nil, zero value otherwise. +func (i *Invitation) GetFailedReason() string { + if i == nil || i.FailedReason == nil { + return "" + } + return *i.FailedReason +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *Invitation) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetInvitationTeamURL returns the InvitationTeamURL field if it's non-nil, zero value otherwise. +func (i *Invitation) GetInvitationTeamURL() string { + if i == nil || i.InvitationTeamURL == nil { + return "" + } + return *i.InvitationTeamURL +} + +// GetInviter returns the Inviter field. +func (i *Invitation) GetInviter() *User { + if i == nil { + return nil + } + return i.Inviter +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (i *Invitation) GetLogin() string { + if i == nil || i.Login == nil { + return "" + } + return *i.Login +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *Invitation) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetRole returns the Role field if it's non-nil, zero value otherwise. +func (i *Invitation) GetRole() string { + if i == nil || i.Role == nil { + return "" + } + return *i.Role +} + +// GetTeamCount returns the TeamCount field if it's non-nil, zero value otherwise. +func (i *Invitation) GetTeamCount() int { + if i == nil || i.TeamCount == nil { + return 0 + } + return *i.TeamCount +} + +// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. +func (i *Issue) GetActiveLockReason() string { + if i == nil || i.ActiveLockReason == nil { + return "" + } + return *i.ActiveLockReason +} + +// GetAssignee returns the Assignee field. +func (i *Issue) GetAssignee() *User { + if i == nil { + return nil + } + return i.Assignee +} + +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (i *Issue) GetAssignees() []*User { + if i == nil || i.Assignees == nil { + return nil + } + return i.Assignees +} + +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (i *Issue) GetAuthorAssociation() string { + if i == nil || i.AuthorAssociation == nil { + return "" + } + return *i.AuthorAssociation +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (i *Issue) GetBody() string { + if i == nil || i.Body == nil { + return "" + } + return *i.Body +} + +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (i *Issue) GetClosedAt() Timestamp { + if i == nil || i.ClosedAt == nil { + return Timestamp{} + } + return *i.ClosedAt +} + +// GetClosedBy returns the ClosedBy field. +func (i *Issue) GetClosedBy() *User { + if i == nil { + return nil + } + return i.ClosedBy +} + +// GetComments returns the Comments field if it's non-nil, zero value otherwise. +func (i *Issue) GetComments() int { + if i == nil || i.Comments == nil { + return 0 + } + return *i.Comments +} + +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetCommentsURL() string { + if i == nil || i.CommentsURL == nil { + return "" + } + return *i.CommentsURL +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *Issue) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (i *Issue) GetDraft() bool { + if i == nil || i.Draft == nil { + return false + } + return *i.Draft +} + +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetEventsURL() string { + if i == nil || i.EventsURL == nil { + return "" + } + return *i.EventsURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetHTMLURL() string { + if i == nil || i.HTMLURL == nil { + return "" + } + return *i.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *Issue) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetIssueDependenciesSummary returns the IssueDependenciesSummary field. +func (i *Issue) GetIssueDependenciesSummary() *IssueDependenciesSummary { + if i == nil { + return nil + } + return i.IssueDependenciesSummary +} + +// GetIssueFieldValues returns the IssueFieldValues slice if it's non-nil, nil otherwise. +func (i *Issue) GetIssueFieldValues() []*IssueFieldValue { + if i == nil || i.IssueFieldValues == nil { + return nil + } + return i.IssueFieldValues +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *Issue) GetLabels() []*Label { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetLabelsURL() string { + if i == nil || i.LabelsURL == nil { + return "" + } + return *i.LabelsURL +} + +// GetLocked returns the Locked field if it's non-nil, zero value otherwise. +func (i *Issue) GetLocked() bool { + if i == nil || i.Locked == nil { + return false + } + return *i.Locked +} + +// GetMilestone returns the Milestone field. +func (i *Issue) GetMilestone() *Milestone { + if i == nil { + return nil + } + return i.Milestone +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *Issue) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (i *Issue) GetNumber() int { + if i == nil || i.Number == nil { + return 0 + } + 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 +} + +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (i *Issue) GetPerformedViaGithubApp() *App { + if i == nil { + return nil + } + return i.PerformedViaGithubApp +} + +// GetPinnedComment returns the PinnedComment field. +func (i *Issue) GetPinnedComment() *IssueComment { + if i == nil { + return nil + } + return i.PinnedComment +} + +// GetPullRequestLinks returns the PullRequestLinks field. +func (i *Issue) GetPullRequestLinks() *PullRequestLinks { + if i == nil { + return nil + } + return i.PullRequestLinks +} + +// GetReactions returns the Reactions field. +func (i *Issue) GetReactions() *Reactions { + if i == nil { + return nil + } + return i.Reactions +} + +// GetRepository returns the Repository field. +func (i *Issue) GetRepository() *Repository { + if i == nil { + return nil + } + return i.Repository +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (i *Issue) GetRepositoryURL() string { + if i == nil || i.RepositoryURL == nil { + return "" + } + return *i.RepositoryURL +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (i *Issue) GetState() string { + if i == nil || i.State == nil { + return "" + } + return *i.State +} + +// GetStateReason returns the StateReason field if it's non-nil, zero value otherwise. +func (i *Issue) GetStateReason() string { + if i == nil || i.StateReason == nil { + return "" + } + return *i.StateReason +} + +// GetSubIssuesSummary returns the SubIssuesSummary field. +func (i *Issue) GetSubIssuesSummary() *SubIssuesSummary { + if i == nil { + return nil + } + return i.SubIssuesSummary +} + +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (i *Issue) GetTextMatches() []*TextMatch { + if i == nil || i.TextMatches == nil { + return nil + } + return i.TextMatches +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (i *Issue) GetTitle() string { + if i == nil || i.Title == nil { + return "" + } + return *i.Title +} + +// GetType returns the Type field. +func (i *Issue) GetType() *IssueType { + if i == nil { + return nil + } + return i.Type +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *Issue) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (i *Issue) GetURL() string { + if i == nil || i.URL == nil { + return "" + } + return *i.URL +} + +// GetUser returns the User field. +func (i *Issue) GetUser() *User { + if i == nil { + return nil + } + return i.User +} + +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetAuthorAssociation() string { + if i == nil || i.AuthorAssociation == nil { + return "" + } + return *i.AuthorAssociation +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetBody() string { + if i == nil || i.Body == nil { + return "" + } + return *i.Body +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetHTMLURL() string { + if i == nil || i.HTMLURL == nil { + return "" + } + return *i.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetIssueURL() string { + if i == nil || i.IssueURL == nil { + return "" + } + return *i.IssueURL +} + +// GetMinimized returns the Minimized field. +func (i *IssueComment) GetMinimized() *MinimizedIssueComment { + if i == nil { + return nil + } + return i.Minimized +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (i *IssueComment) GetPerformedViaGithubApp() *App { + if i == nil { + return nil + } + return i.PerformedViaGithubApp +} + +// GetPin returns the Pin field. +func (i *IssueComment) GetPin() *PinnedIssueComment { + if i == nil { + return nil + } + return i.Pin +} + +// GetReactions returns the Reactions field. +func (i *IssueComment) GetReactions() *Reactions { + if i == nil { + return nil + } + return i.Reactions +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (i *IssueComment) GetURL() string { + if i == nil || i.URL == nil { + return "" + } + return *i.URL +} + +// GetUser returns the User field. +func (i *IssueComment) GetUser() *User { + if i == nil { + return nil + } + return i.User +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (i *IssueCommentEvent) GetAction() string { + if i == nil || i.Action == nil { + return "" + } + return *i.Action +} + +// GetChanges returns the Changes field. +func (i *IssueCommentEvent) GetChanges() *EditChange { + if i == nil { + return nil + } + return i.Changes +} + +// GetComment returns the Comment field. +func (i *IssueCommentEvent) GetComment() *IssueComment { + if i == nil { + return nil + } + return i.Comment +} + +// GetInstallation returns the Installation field. +func (i *IssueCommentEvent) GetInstallation() *Installation { + if i == nil { + return nil + } + return i.Installation +} + +// GetIssue returns the Issue field. +func (i *IssueCommentEvent) GetIssue() *Issue { + if i == nil { + return nil + } + return i.Issue +} + +// GetOrganization returns the Organization field. +func (i *IssueCommentEvent) GetOrganization() *Organization { + if i == nil { + return nil + } + return i.Organization +} + +// GetRepo returns the Repo field. +func (i *IssueCommentEvent) GetRepo() *Repository { + if i == nil { + return nil + } + return i.Repo +} + +// GetSender returns the Sender field. +func (i *IssueCommentEvent) GetSender() *User { + if i == nil { + return nil + } + return i.Sender +} + +// GetBody returns the Body field. +func (i *IssueCommentRequest) GetBody() string { + if i == nil { + return "" + } + return i.Body +} + +// GetBlockedBy returns the BlockedBy field if it's non-nil, zero value otherwise. +func (i *IssueDependenciesSummary) GetBlockedBy() int { + if i == nil || i.BlockedBy == nil { + return 0 + } + return *i.BlockedBy +} + +// GetBlocking returns the Blocking field if it's non-nil, zero value otherwise. +func (i *IssueDependenciesSummary) GetBlocking() int { + if i == nil || i.Blocking == nil { + return 0 + } + return *i.Blocking +} + +// GetTotalBlockedBy returns the TotalBlockedBy field if it's non-nil, zero value otherwise. +func (i *IssueDependenciesSummary) GetTotalBlockedBy() int { + if i == nil || i.TotalBlockedBy == nil { + return 0 + } + return *i.TotalBlockedBy +} + +// GetTotalBlocking returns the TotalBlocking field if it's non-nil, zero value otherwise. +func (i *IssueDependenciesSummary) GetTotalBlocking() int { + if i == nil || i.TotalBlocking == nil { + return 0 + } + return *i.TotalBlocking +} + +// GetIssueID returns the IssueID field. +func (i *IssueDependencyRequest) GetIssueID() int64 { + if i == nil { + return 0 + } + return i.IssueID +} + +// GetAction returns the Action field. +func (i *IssueEvent) GetAction() string { + if i == nil { + return "" + } + return i.Action +} + +// GetActor returns the Actor field. +func (i *IssueEvent) GetActor() *User { + if i == nil { + return nil + } + return i.Actor +} + +// GetAssignee returns the Assignee field. +func (i *IssueEvent) GetAssignee() *User { + if i == nil { + return nil + } + return i.Assignee +} + +// GetAssigner returns the Assigner field. +func (i *IssueEvent) GetAssigner() *User { + if i == nil { + return nil + } + return i.Assigner +} + +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetCommitID() string { + if i == nil || i.CommitID == nil { + return "" + } + return *i.CommitID +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetDismissedReview returns the DismissedReview field. +func (i *IssueEvent) GetDismissedReview() *DismissedReview { + if i == nil { + return nil + } + return i.DismissedReview +} + +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetEvent() string { + if i == nil || i.Event == nil { + return "" + } + return *i.Event +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetIssue returns the Issue field. +func (i *IssueEvent) GetIssue() *Issue { + if i == nil { + return nil + } + return i.Issue +} + +// GetLabel returns the Label field. +func (i *IssueEvent) GetLabel() *Label { + if i == nil { + return nil + } + return i.Label +} + +// GetLockReason returns the LockReason field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetLockReason() string { + if i == nil || i.LockReason == nil { + return "" + } + return *i.LockReason +} + +// GetMilestone returns the Milestone field. +func (i *IssueEvent) GetMilestone() *Milestone { + if i == nil { + return nil + } + return i.Milestone +} + +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (i *IssueEvent) GetPerformedViaGithubApp() *App { + if i == nil { + return nil + } + return i.PerformedViaGithubApp +} + +// GetRename returns the Rename field. +func (i *IssueEvent) GetRename() *Rename { + if i == nil { + return nil + } + return i.Rename +} + +// GetRepository returns the Repository field. +func (i *IssueEvent) GetRepository() *Repository { + if i == nil { + return nil + } + return i.Repository +} + +// GetRequestedReviewer returns the RequestedReviewer field. +func (i *IssueEvent) GetRequestedReviewer() *User { + if i == nil { + return nil + } + return i.RequestedReviewer +} + +// GetRequestedTeam returns the RequestedTeam field. +func (i *IssueEvent) GetRequestedTeam() *Team { + if i == nil { + return nil + } + return i.RequestedTeam +} + +// GetReviewRequester returns the ReviewRequester field. +func (i *IssueEvent) GetReviewRequester() *User { + if i == nil { + return nil + } + return i.ReviewRequester +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (i *IssueEvent) GetURL() string { + if i == nil || i.URL == nil { + return "" + } + return *i.URL +} + +// GetDataType returns the DataType field. +func (i *IssueFieldValue) GetDataType() string { + if i == nil { + return "" + } + return i.DataType +} + +// GetIssueFieldID returns the IssueFieldID field. +func (i *IssueFieldValue) GetIssueFieldID() int64 { + if i == nil { + return 0 + } + return i.IssueFieldID +} + +// GetNodeID returns the NodeID field. +func (i *IssueFieldValue) GetNodeID() string { + if i == nil { + return "" + } + return i.NodeID +} + +// GetSingleSelectOption returns the SingleSelectOption field. +func (i *IssueFieldValue) GetSingleSelectOption() *IssueFieldValueSingleSelectOption { + if i == nil { + return nil + } + return i.SingleSelectOption +} + +// GetValue returns the Value field. +func (i *IssueFieldValue) GetValue() any { + if i == nil { + return nil + } + return i.Value +} + +// GetColor returns the Color field. +func (i *IssueFieldValueSingleSelectOption) GetColor() string { + if i == nil { + return "" + } + return i.Color +} + +// GetID returns the ID field. +func (i *IssueFieldValueSingleSelectOption) GetID() int64 { + if i == nil { + return 0 + } + return i.ID +} + +// GetName returns the Name field. +func (i *IssueFieldValueSingleSelectOption) GetName() string { + if i == nil { + return "" + } + return i.Name +} + +// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetAssignee() string { + if i == nil || i.Assignee == nil { + return "" + } + return *i.Assignee +} + +// GetBody returns the Body field. +func (i *IssueImport) GetBody() string { + if i == nil { + return "" + } + return i.Body +} + +// GetClosed returns the Closed field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetClosed() bool { + if i == nil || i.Closed == nil { + return false + } + return *i.Closed +} + +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetClosedAt() Timestamp { + if i == nil || i.ClosedAt == nil { + return Timestamp{} + } + return *i.ClosedAt +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueImport) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetMilestone() int { + if i == nil || i.Milestone == nil { + return 0 + } + return *i.Milestone +} + +// GetTitle returns the Title field. +func (i *IssueImport) GetTitle() string { + if i == nil { + return "" + } + return i.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *IssueImport) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetCode returns the Code field if it's non-nil, zero value otherwise. +func (i *IssueImportError) GetCode() string { + if i == nil || i.Code == nil { + return "" + } + return *i.Code +} + +// GetField returns the Field field if it's non-nil, zero value otherwise. +func (i *IssueImportError) GetField() string { + if i == nil || i.Field == nil { + return "" + } + return *i.Field +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (i *IssueImportError) GetLocation() string { + if i == nil || i.Location == nil { + return "" + } + return *i.Location +} + +// GetResource returns the Resource field if it's non-nil, zero value otherwise. +func (i *IssueImportError) GetResource() string { + if i == nil || i.Resource == nil { + return "" + } + return *i.Resource +} + +// GetValue returns the Value field if it's non-nil, zero value otherwise. +func (i *IssueImportError) GetValue() string { + if i == nil || i.Value == nil { + return "" + } + return *i.Value +} + +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (i *IssueImportRequest) GetComments() []*Comment { + if i == nil || i.Comments == nil { + return nil + } + return i.Comments +} + +// GetIssueImport returns the IssueImport field. +func (i *IssueImportRequest) GetIssueImport() IssueImport { + if i == nil { + return IssueImport{} + } + return i.IssueImport +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetDocumentationURL returns the DocumentationURL field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetDocumentationURL() string { + if i == nil || i.DocumentationURL == nil { + return "" + } + return *i.DocumentationURL +} + +// GetErrors returns the Errors slice if it's non-nil, nil otherwise. +func (i *IssueImportResponse) GetErrors() []*IssueImportError { + if i == nil || i.Errors == nil { + return nil + } + return i.Errors +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetID() int { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetImportIssuesURL returns the ImportIssuesURL field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetImportIssuesURL() string { + if i == nil || i.ImportIssuesURL == nil { + return "" + } + return *i.ImportIssuesURL +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetMessage() string { + if i == nil || i.Message == nil { + return "" + } + return *i.Message +} + +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetRepositoryURL() string { + if i == nil || i.RepositoryURL == nil { + return "" + } + return *i.RepositoryURL +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetStatus() string { + if i == nil || i.Status == nil { + return "" + } + return *i.Status +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (i *IssueImportResponse) GetURL() string { + if i == nil || i.URL == nil { + return "" + } + return *i.URL +} + +// GetDirection returns the Direction field. +func (i *IssueListByOrgOptions) GetDirection() string { + if i == nil { + return "" + } + return i.Direction +} + +// GetFilter returns the Filter field. +func (i *IssueListByOrgOptions) GetFilter() string { + if i == nil { + return "" + } + return i.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueListByOrgOptions) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetSince returns the Since field. +func (i *IssueListByOrgOptions) GetSince() time.Time { + if i == nil { + return time.Time{} + } + return i.Since +} + +// GetSort returns the Sort field. +func (i *IssueListByOrgOptions) GetSort() string { + if i == nil { + return "" + } + return i.Sort +} + +// GetState returns the State field. +func (i *IssueListByOrgOptions) GetState() string { + if i == nil { + return "" + } + return i.State +} + +// GetType returns the Type field. +func (i *IssueListByOrgOptions) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +// GetAssignee returns the Assignee field. +func (i *IssueListByRepoOptions) GetAssignee() string { + if i == nil { + return "" + } + return i.Assignee +} + +// GetCreator returns the Creator field. +func (i *IssueListByRepoOptions) GetCreator() string { + if i == nil { + return "" + } + return i.Creator +} + +// GetDirection returns the Direction field. +func (i *IssueListByRepoOptions) GetDirection() string { + if i == nil { + return "" + } + return i.Direction +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (i *IssueListByRepoOptions) GetLabels() []string { + if i == nil || i.Labels == nil { + return nil + } + return i.Labels +} + +// GetMentioned returns the Mentioned field. +func (i *IssueListByRepoOptions) GetMentioned() string { + if i == nil { + return "" + } + return i.Mentioned +} + +// GetMilestone returns the Milestone field. +func (i *IssueListByRepoOptions) GetMilestone() string { + if i == nil { + return "" + } + return i.Milestone +} + +// GetSince returns the Since field. +func (i *IssueListByRepoOptions) GetSince() time.Time { + if i == nil { + return time.Time{} + } + return i.Since +} + +// GetSort returns the Sort field. +func (i *IssueListByRepoOptions) GetSort() string { + if i == nil { + return "" + } + return i.Sort +} + +// GetState returns the State field. +func (i *IssueListByRepoOptions) GetState() string { + if i == nil { + return "" + } + return i.State +} + +// GetType returns the Type field. +func (i *IssueListByRepoOptions) GetType() string { + if i == nil { + return "" + } + return i.Type +} + +// GetDirection returns the Direction field if it's non-nil, zero value otherwise. +func (i *IssueListCommentsOptions) GetDirection() string { + if i == nil || i.Direction == nil { + return "" + } + return *i.Direction +} + +// GetSince returns the Since field if it's non-nil, zero value otherwise. +func (i *IssueListCommentsOptions) GetSince() time.Time { + if i == nil || i.Since == nil { + return time.Time{} + } + return *i.Since +} + +// GetSort returns the Sort field if it's non-nil, zero value otherwise. +func (i *IssueListCommentsOptions) GetSort() string { + if i == nil || i.Sort == nil { + return "" + } + return *i.Sort +} + +// GetFieldID returns the FieldID field. +func (i *IssueRequestFieldValue) GetFieldID() int64 { + if i == nil { + return 0 + } + return i.FieldID +} + +// GetValue returns the Value field. +func (i *IssueRequestFieldValue) GetValue() any { + if i == nil { + return nil + } + return i.Value +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (i *IssuesEvent) GetAction() string { + if i == nil || i.Action == nil { + return "" + } + return *i.Action +} + +// GetAssignee returns the Assignee field. +func (i *IssuesEvent) GetAssignee() *User { + if i == nil { + return nil + } + return i.Assignee +} + +// GetChanges returns the Changes field. +func (i *IssuesEvent) GetChanges() *EditChange { + if i == nil { + return nil + } + return i.Changes +} + +// GetInstallation returns the Installation field. +func (i *IssuesEvent) GetInstallation() *Installation { + if i == nil { + return nil + } + return i.Installation +} + +// GetIssue returns the Issue field. +func (i *IssuesEvent) GetIssue() *Issue { + if i == nil { + return nil + } + return i.Issue +} + +// GetLabel returns the Label field. +func (i *IssuesEvent) GetLabel() *Label { + if i == nil { + return nil + } + return i.Label +} + +// GetMilestone returns the Milestone field. +func (i *IssuesEvent) GetMilestone() *Milestone { + if i == nil { + return nil + } + return i.Milestone +} + +// GetOrg returns the Org field. +func (i *IssuesEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + +// GetRepo returns the Repo field. +func (i *IssuesEvent) GetRepo() *Repository { + if i == nil { + return nil + } + return i.Repo +} + +// GetSender returns the Sender field. +func (i *IssuesEvent) GetSender() *User { + if i == nil { + return nil + } + return i.Sender +} + +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (i *IssuesSearchResult) GetIncompleteResults() bool { + if i == nil || i.IncompleteResults == nil { + return false + } + return *i.IncompleteResults +} + +// GetIssues returns the Issues slice if it's non-nil, nil otherwise. +func (i *IssuesSearchResult) GetIssues() []*Issue { + if i == nil || i.Issues == nil { + return nil + } + return i.Issues +} + +// GetSearchType returns the SearchType field if it's non-nil, zero value otherwise. +func (i *IssuesSearchResult) GetSearchType() string { + if i == nil || i.SearchType == nil { + return "" + } + return *i.SearchType +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (i *IssuesSearchResult) GetTotal() int { + if i == nil || i.Total == nil { + return 0 + } + return *i.Total +} + +// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. +func (i *IssueStats) GetClosedIssues() int { + if i == nil || i.ClosedIssues == nil { + return 0 + } + return *i.ClosedIssues +} + +// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. +func (i *IssueStats) GetOpenIssues() int { + if i == nil || i.OpenIssues == nil { + return 0 + } + return *i.OpenIssues +} + +// GetTotalIssues returns the TotalIssues field if it's non-nil, zero value otherwise. +func (i *IssueStats) GetTotalIssues() int { + if i == nil || i.TotalIssues == nil { + return 0 + } + return *i.TotalIssues +} + +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (i *IssueType) GetColor() string { + if i == nil || i.Color == nil { + return "" + } + return *i.Color +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *IssueType) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (i *IssueType) GetDescription() string { + if i == nil || i.Description == nil { + return "" + } + return *i.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *IssueType) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetIsEnabled returns the IsEnabled field if it's non-nil, zero value otherwise. +func (i *IssueType) GetIsEnabled() bool { + if i == nil || i.IsEnabled == nil { + return false + } + return *i.IsEnabled +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (i *IssueType) GetName() string { + if i == nil || i.Name == nil { + return "" + } + return *i.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *IssueType) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (i *IssueType) GetUpdatedAt() Timestamp { + if i == nil || i.UpdatedAt == nil { + return Timestamp{} + } + return *i.UpdatedAt +} + +// GetEncodedJITConfig returns the EncodedJITConfig field if it's non-nil, zero value otherwise. +func (j *JITRunnerConfig) GetEncodedJITConfig() string { + if j == nil || j.EncodedJITConfig == nil { + return "" + } + return *j.EncodedJITConfig +} + +// GetRunner returns the Runner field. +func (j *JITRunnerConfig) GetRunner() *Runner { + if j == nil { + return nil + } + return j.Runner +} + +// GetJobs returns the Jobs slice if it's non-nil, nil otherwise. +func (j *Jobs) GetJobs() []*WorkflowJob { + if j == nil || j.Jobs == nil { + return nil + } + return j.Jobs +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (j *Jobs) GetTotalCount() int { + if j == nil || j.TotalCount == nil { + return 0 + } + return *j.TotalCount +} + +// GetAddedBy returns the AddedBy field if it's non-nil, zero value otherwise. +func (k *Key) GetAddedBy() string { + if k == nil || k.AddedBy == nil { + return "" + } + return *k.AddedBy +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (k *Key) GetCreatedAt() Timestamp { + if k == nil || k.CreatedAt == nil { + return Timestamp{} + } + return *k.CreatedAt +} + +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (k *Key) GetEnabled() bool { + if k == nil || k.Enabled == nil { + return false + } + return *k.Enabled +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (k *Key) GetID() int64 { + if k == nil || k.ID == nil { + return 0 + } + return *k.ID +} + +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (k *Key) GetKey() string { + if k == nil || k.Key == nil { + return "" + } + return *k.Key +} + +// GetLastUsed returns the LastUsed field if it's non-nil, zero value otherwise. +func (k *Key) GetLastUsed() Timestamp { + if k == nil || k.LastUsed == nil { + return Timestamp{} + } + return *k.LastUsed +} + +// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise. +func (k *Key) GetReadOnly() bool { + if k == nil || k.ReadOnly == nil { + return false + } + return *k.ReadOnly +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (k *Key) GetTitle() string { + if k == nil || k.Title == nil { + return "" + } + return *k.Title +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (k *Key) GetURL() string { + if k == nil || k.URL == nil { + return "" + } + return *k.URL +} + +// GetVerified returns the Verified field if it's non-nil, zero value otherwise. +func (k *Key) GetVerified() bool { + if k == nil || k.Verified == nil { + return false + } + return *k.Verified +} + +// GetColor returns the Color field. +func (l *Label) GetColor() string { + if l == nil { + return "" + } + return l.Color +} + +// GetDefault returns the Default field. +func (l *Label) GetDefault() bool { + if l == nil { + return false + } + return l.Default +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (l *Label) GetDescription() string { + if l == nil || l.Description == nil { + return "" + } + return *l.Description +} + +// GetID returns the ID field. +func (l *Label) GetID() int64 { + if l == nil { + return 0 + } + return l.ID +} + +// GetName returns the Name field. +func (l *Label) GetName() string { + if l == nil { + return "" + } + return l.Name +} + +// GetNodeID returns the NodeID field. +func (l *Label) GetNodeID() string { + if l == nil { + return "" + } + return l.NodeID +} + +// GetURL returns the URL field. +func (l *Label) GetURL() string { + if l == nil { + return "" + } + return l.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (l *LabelEvent) GetAction() string { + if l == nil || l.Action == nil { + return "" + } + return *l.Action +} + +// GetChanges returns the Changes field. +func (l *LabelEvent) GetChanges() *EditChange { + if l == nil { + return nil + } + return l.Changes +} + +// GetInstallation returns the Installation field. +func (l *LabelEvent) GetInstallation() *Installation { + if l == nil { + return nil + } + return l.Installation +} + +// GetLabel returns the Label field. +func (l *LabelEvent) GetLabel() *Label { + if l == nil { + return nil + } + return l.Label +} + +// GetOrg returns the Org field. +func (l *LabelEvent) GetOrg() *Organization { + if l == nil { + return nil + } + return l.Org +} + +// GetRepo returns the Repo field. +func (l *LabelEvent) GetRepo() *Repository { + if l == nil { + return nil + } + return l.Repo +} + +// GetSender returns the Sender field. +func (l *LabelEvent) GetSender() *User { + if l == nil { + return nil + } + return l.Sender +} + +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetColor() string { + if l == nil || l.Color == nil { + return "" + } + return *l.Color +} + +// GetDefault returns the Default field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetDefault() bool { + if l == nil || l.Default == nil { + return false + } + return *l.Default +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetDescription() string { + if l == nil || l.Description == nil { + return "" + } + return *l.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetID() int64 { + if l == nil || l.ID == nil { + return 0 + } + return *l.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetName() string { + if l == nil || l.Name == nil { + return "" + } + return *l.Name +} + +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetScore() float64 { + if l == nil || l.Score == nil { + return 0 + } + return *l.Score +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (l *LabelResult) GetURL() string { + if l == nil || l.URL == nil { + return "" + } + return *l.URL +} + +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (l *LabelsSearchResult) GetIncompleteResults() bool { + if l == nil || l.IncompleteResults == nil { + return false + } + return *l.IncompleteResults +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *LabelsSearchResult) GetLabels() []*LabelResult { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (l *LabelsSearchResult) GetTotal() int { + if l == nil || l.Total == nil { + return 0 + } + return *l.Total +} + +// GetOID returns the OID field if it's non-nil, zero value otherwise. +func (l *LargeFile) GetOID() string { + if l == nil || l.OID == nil { + return "" + } + return *l.OID +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (l *LargeFile) GetPath() string { + if l == nil || l.Path == nil { + return "" + } + return *l.Path +} + +// GetRefName returns the RefName field if it's non-nil, zero value otherwise. +func (l *LargeFile) GetRefName() string { + if l == nil || l.RefName == nil { + return "" + } + return *l.RefName +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (l *LargeFile) GetSize() int { + if l == nil || l.Size == nil { + return 0 + } + return *l.Size +} + +// GetProperties returns the Properties field. +func (l *LastLicenseSync) GetProperties() *LastLicenseSyncProperties { + if l == nil { + return nil + } + return l.Properties +} + +// GetType returns the Type field. +func (l *LastLicenseSync) GetType() string { + if l == nil { + return "" + } + return l.Type +} + +// 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 +} + +// GetError returns the Error field. +func (l *LastLicenseSyncProperties) GetError() string { + if l == nil { + return "" + } + return l.Error +} + +// GetStatus returns the Status field. +func (l *LastLicenseSyncProperties) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (l *License) GetBody() string { + if l == nil || l.Body == nil { + return "" + } + return *l.Body +} + +// GetConditions returns the Conditions field if it's non-nil, zero value otherwise. +func (l *License) GetConditions() []string { + if l == nil || l.Conditions == nil { + return nil + } + return *l.Conditions +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (l *License) GetDescription() string { + if l == nil || l.Description == nil { + return "" + } + return *l.Description +} + +// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. +func (l *License) GetFeatured() bool { + if l == nil || l.Featured == nil { + return false + } + return *l.Featured +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (l *License) GetHTMLURL() string { + if l == nil || l.HTMLURL == nil { + return "" + } + return *l.HTMLURL +} + +// GetImplementation returns the Implementation field if it's non-nil, zero value otherwise. +func (l *License) GetImplementation() string { + if l == nil || l.Implementation == nil { + return "" + } + return *l.Implementation +} + +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (l *License) GetKey() string { + if l == nil || l.Key == nil { + return "" + } + return *l.Key +} + +// GetLimitations returns the Limitations field if it's non-nil, zero value otherwise. +func (l *License) GetLimitations() []string { + if l == nil || l.Limitations == nil { + return nil + } + return *l.Limitations +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (l *License) GetName() string { + if l == nil || l.Name == nil { + return "" + } + return *l.Name +} + +// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. +func (l *License) GetPermissions() []string { + if l == nil || l.Permissions == nil { + return nil + } + return *l.Permissions +} + +// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. +func (l *License) GetSPDXID() string { + if l == nil || l.SPDXID == nil { + return "" + } + return *l.SPDXID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (l *License) GetURL() string { + if l == nil || l.URL == nil { + return "" + } + return *l.URL +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (l *LicenseCheck) GetStatus() string { + if l == nil || l.Status == nil { + return "" + } + return *l.Status +} + +// GetAdvancedSecurityEnabled returns the AdvancedSecurityEnabled field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetAdvancedSecurityEnabled() bool { + if l == nil || l.AdvancedSecurityEnabled == nil { + return false + } + return *l.AdvancedSecurityEnabled +} + +// GetAdvancedSecuritySeats returns the AdvancedSecuritySeats field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetAdvancedSecuritySeats() int { + if l == nil || l.AdvancedSecuritySeats == nil { + return 0 + } + return *l.AdvancedSecuritySeats +} + +// GetClusterSupport returns the ClusterSupport field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetClusterSupport() bool { + if l == nil || l.ClusterSupport == nil { + return false + } + return *l.ClusterSupport +} + +// GetCompany returns the Company field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetCompany() string { + if l == nil || l.Company == nil { + return "" + } + return *l.Company +} + +// GetCroquetSupport returns the CroquetSupport field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetCroquetSupport() bool { + if l == nil || l.CroquetSupport == nil { + return false + } + return *l.CroquetSupport +} + +// GetCustomTerms returns the CustomTerms field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetCustomTerms() bool { + if l == nil || l.CustomTerms == nil { + return false + } + return *l.CustomTerms +} + +// GetEvaluation returns the Evaluation field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetEvaluation() bool { + if l == nil || l.Evaluation == nil { + return false + } + return *l.Evaluation +} + +// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetExpireAt() Timestamp { + if l == nil || l.ExpireAt == nil { + return Timestamp{} + } + return *l.ExpireAt +} + +// GetInsightsEnabled returns the InsightsEnabled field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetInsightsEnabled() bool { + if l == nil || l.InsightsEnabled == nil { + return false + } + return *l.InsightsEnabled +} + +// GetInsightsExpireAt returns the InsightsExpireAt field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetInsightsExpireAt() Timestamp { + if l == nil || l.InsightsExpireAt == nil { + return Timestamp{} + } + return *l.InsightsExpireAt +} + +// GetLearningLabEvaluationExpires returns the LearningLabEvaluationExpires field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetLearningLabEvaluationExpires() Timestamp { + if l == nil || l.LearningLabEvaluationExpires == nil { + return Timestamp{} + } + return *l.LearningLabEvaluationExpires +} + +// GetLearningLabSeats returns the LearningLabSeats field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetLearningLabSeats() int { + if l == nil || l.LearningLabSeats == nil { + return 0 + } + return *l.LearningLabSeats +} + +// GetPerpetual returns the Perpetual field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetPerpetual() bool { + if l == nil || l.Perpetual == nil { + return false + } + return *l.Perpetual +} + +// GetReferenceNumber returns the ReferenceNumber field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetReferenceNumber() string { + if l == nil || l.ReferenceNumber == nil { + return "" + } + return *l.ReferenceNumber +} + +// GetSeats returns the Seats field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetSeats() int { + if l == nil || l.Seats == nil { + return 0 + } + return *l.Seats +} + +// GetSSHAllowed returns the SSHAllowed field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetSSHAllowed() bool { + if l == nil || l.SSHAllowed == nil { + return false + } + return *l.SSHAllowed +} + +// GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetSupportKey() bool { + if l == nil || l.SupportKey == nil { + return false + } + return *l.SupportKey +} + +// GetUnlimitedSeating returns the UnlimitedSeating field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetUnlimitedSeating() bool { + if l == nil || l.UnlimitedSeating == nil { + return false + } + return *l.UnlimitedSeating +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (l *LinearHistoryRequirementEnforcementLevelChanges) GetFrom() string { + if l == nil || l.From == nil { + return "" + } + return *l.From +} + +// GetDirection returns the Direction field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetDirection() string { + if l == nil || l.Direction == nil { + return "" + } + return *l.Direction +} + +// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetEcosystem() string { + if l == nil || l.Ecosystem == nil { + return "" + } + return *l.Ecosystem +} + +// GetPackage returns the Package field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetPackage() string { + if l == nil || l.Package == nil { + return "" + } + return *l.Package +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetScope() string { + if l == nil || l.Scope == nil { + return "" + } + return *l.Scope +} + +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetSeverity() string { + if l == nil || l.Severity == nil { + return "" + } + return *l.Severity +} + +// GetSort returns the Sort field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetSort() string { + if l == nil || l.Sort == nil { + return "" + } + return *l.Sort +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (l *ListAlertsOptions) GetState() string { + if l == nil || l.State == nil { + return "" + } + return *l.State +} + +// GetCollab returns the Collab field. +func (l *ListAllIssuesOptions) GetCollab() bool { + if l == nil { + return false + } + return l.Collab +} + +// GetDirection returns the Direction field. +func (l *ListAllIssuesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetFilter returns the Filter field. +func (l *ListAllIssuesOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *ListAllIssuesOptions) GetLabels() []string { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + +// GetOrgs returns the Orgs field. +func (l *ListAllIssuesOptions) GetOrgs() bool { + if l == nil { + return false + } + return l.Orgs +} + +// GetOwned returns the Owned field. +func (l *ListAllIssuesOptions) GetOwned() bool { + if l == nil { + return false + } + return l.Owned +} + +// GetPulls returns the Pulls field. +func (l *ListAllIssuesOptions) GetPulls() bool { + if l == nil { + return false + } + return l.Pulls +} + +// GetSince returns the Since field. +func (l *ListAllIssuesOptions) GetSince() time.Time { + if l == nil { + return time.Time{} + } + return l.Since +} + +// GetSort returns the Sort field. +func (l *ListAllIssuesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListAllIssuesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (l *ListArtifactsOptions) GetName() string { + if l == nil || l.Name == nil { + return "" + } + return *l.Name +} + +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetAppID() int64 { + if l == nil || l.AppID == nil { + return 0 + } + return *l.AppID +} + +// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetCheckName() string { + if l == nil || l.CheckName == nil { + return "" + } + return *l.CheckName +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetFilter() string { + if l == nil || l.Filter == nil { + return "" + } + return *l.Filter +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsOptions) GetStatus() string { + if l == nil || l.Status == nil { + return "" + } + return *l.Status +} + +// GetCheckRuns returns the CheckRuns slice if it's non-nil, nil otherwise. +func (l *ListCheckRunsResults) GetCheckRuns() []*CheckRun { + if l == nil || l.CheckRuns == nil { + return nil + } + return l.CheckRuns +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (l *ListCheckRunsResults) GetTotal() int { + if l == nil || l.Total == nil { + return 0 + } + return *l.Total +} + +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteOptions) GetAppID() int64 { + if l == nil || l.AppID == nil { + return 0 + } + return *l.AppID +} + +// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteOptions) GetCheckName() string { + if l == nil || l.CheckName == nil { + return "" + } + return *l.CheckName +} + +// GetCheckSuites returns the CheckSuites slice if it's non-nil, nil otherwise. +func (l *ListCheckSuiteResults) GetCheckSuites() []*CheckSuite { + if l == nil || l.CheckSuites == nil { + return nil + } + return l.CheckSuites +} + +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (l *ListCheckSuiteResults) GetTotal() int { + if l == nil || l.Total == nil { + return 0 + } + return *l.Total +} + +// GetDirection returns the Direction field. +func (l *ListCodeQualityFindingsOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetState returns the State field. +func (l *ListCodeQualityFindingsOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetAfter returns the After field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetStatus returns the Status field. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + +// GetCodespaces returns the Codespaces slice if it's non-nil, nil otherwise. +func (l *ListCodespaces) GetCodespaces() []*Codespace { + if l == nil || l.Codespaces == nil { + return nil + } + return l.Codespaces +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListCodespaces) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + +// GetRepositoryID returns the RepositoryID field. +func (l *ListCodespacesOptions) GetRepositoryID() int64 { + if l == nil { + return 0 + } + return l.RepositoryID +} + +// GetAffiliation returns the Affiliation field. +func (l *ListCollaboratorsOptions) GetAffiliation() string { + if l == nil { + return "" + } + return l.Affiliation +} + +// GetPermission returns the Permission field. +func (l *ListCollaboratorsOptions) GetPermission() string { + if l == nil { + return "" + } + return l.Permission +} + +// GetAnon returns the Anon field. +func (l *ListContributorsOptions) GetAnon() string { + if l == nil { + return "" + } + return l.Anon +} + +// GetSeats returns the Seats slice if it's non-nil, nil otherwise. +func (l *ListCopilotSeatsResponse) GetSeats() []*CopilotSeatDetails { + if l == nil || l.Seats == nil { + return nil + } + return l.Seats +} + +// GetTotalSeats returns the TotalSeats field. +func (l *ListCopilotSeatsResponse) GetTotalSeats() int64 { + if l == nil { + return 0 + } + return l.TotalSeats +} + +// 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 +} + +// GetAfter returns the After field. +func (l *ListCursorOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListCursorOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetCursor returns the Cursor field. +func (l *ListCursorOptions) GetCursor() string { + if l == nil { + return "" + } + return l.Cursor +} + +// GetFirst returns the First field. +func (l *ListCursorOptions) GetFirst() int { + if l == nil { + return 0 + } + return l.First +} + +// GetLast returns the Last field. +func (l *ListCursorOptions) GetLast() int { + if l == nil { + return 0 + } + return l.Last +} + +// GetPage returns the Page field. +func (l *ListCursorOptions) GetPage() string { + if l == nil { + return "" + } + return l.Page +} + +// GetPerPage returns the PerPage field. +func (l *ListCursorOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetAvailableIntegrations returns the AvailableIntegrations slice if it's non-nil, nil otherwise. +func (l *ListCustomDeploymentRuleIntegrationsResponse) GetAvailableIntegrations() []*CustomDeploymentProtectionRuleApp { + if l == nil || l.AvailableIntegrations == nil { + return nil + } + return l.AvailableIntegrations +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + +// GetRepositoryQuery returns the RepositoryQuery field. +func (l *ListCustomPropertyValuesOptions) GetRepositoryQuery() string { + if l == nil { + return "" + } + return l.RepositoryQuery +} + +// GetProtectionRules returns the ProtectionRules slice if it's non-nil, nil otherwise. +func (l *ListDeploymentProtectionRuleResponse) GetProtectionRules() []*CustomDeploymentProtectionRule { + if l == nil || l.ProtectionRules == nil { + return nil + } + return l.ProtectionRules +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListDeploymentProtectionRuleResponse) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + +// GetAfter returns the After field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetVisibleToOrganization returns the VisibleToOrganization field. +func (l *ListEnterpriseRunnerGroupOptions) GetVisibleToOrganization() string { + if l == nil { + return "" + } + return l.VisibleToOrganization +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (l *ListExternalGroupsOptions) GetDisplayName() string { + if l == nil || l.DisplayName == nil { + return "" + } + return *l.DisplayName +} + +// GetDirection returns the Direction field. +func (l *ListFineGrainedPATOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetLastUsedAfter returns the LastUsedAfter field. +func (l *ListFineGrainedPATOptions) GetLastUsedAfter() string { + if l == nil { + return "" + } + return l.LastUsedAfter +} + +// GetLastUsedBefore returns the LastUsedBefore field. +func (l *ListFineGrainedPATOptions) GetLastUsedBefore() string { + if l == nil { + return "" + } + return l.LastUsedBefore +} + +// GetOwner returns the Owner slice if it's non-nil, nil otherwise. +func (l *ListFineGrainedPATOptions) GetOwner() []string { + if l == nil || l.Owner == nil { + return nil + } + return l.Owner +} + +// GetPermission returns the Permission field. +func (l *ListFineGrainedPATOptions) GetPermission() string { + if l == nil { + return "" + } + return l.Permission +} + +// GetRepository returns the Repository field. +func (l *ListFineGrainedPATOptions) GetRepository() string { + if l == nil { + return "" + } + return l.Repository +} + +// GetSort returns the Sort field. +func (l *ListFineGrainedPATOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetTokenID returns the TokenID slice if it's non-nil, nil otherwise. +func (l *ListFineGrainedPATOptions) GetTokenID() []int64 { + if l == nil || l.TokenID == nil { + return nil + } + return l.TokenID +} + +// GetAffects returns the Affects field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetAffects() string { + if l == nil || l.Affects == nil { + return "" + } + return *l.Affects +} + +// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetCVEID() string { + if l == nil || l.CVEID == nil { + return "" + } + return *l.CVEID +} + +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetCWEs() []string { + if l == nil || l.CWEs == nil { + return nil + } + return l.CWEs +} + +// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetEcosystem() string { + if l == nil || l.Ecosystem == nil { + return "" + } + return *l.Ecosystem +} + +// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetGHSAID() string { + if l == nil || l.GHSAID == nil { + return "" + } + return *l.GHSAID +} + +// GetIsWithdrawn returns the IsWithdrawn field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetIsWithdrawn() bool { + if l == nil || l.IsWithdrawn == nil { + return false + } + return *l.IsWithdrawn +} + +// GetModified returns the Modified field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetModified() string { + if l == nil || l.Modified == nil { + return "" + } + return *l.Modified +} + +// GetPublished returns the Published field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetPublished() string { + if l == nil || l.Published == nil { + return "" + } + return *l.Published +} + +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetSeverity() string { + if l == nil || l.Severity == nil { + return "" + } + return *l.Severity +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetType() string { + if l == nil || l.Type == nil { + return "" + } + return *l.Type +} + +// GetUpdated returns the Updated field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { + if l == nil || l.Updated == nil { + return "" + } + return *l.Updated +} + +// GetQuery returns the Query field. +func (l *ListIDPGroupsOptions) GetQuery() string { + if l == nil { + return "" + } + return l.Query +} + +// 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.Featured +} + +// GetFilter returns the Filter field. +func (l *ListMembersOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetPublicOnly returns the PublicOnly field. +func (l *ListMembersOptions) GetPublicOnly() bool { + if l == nil { + return false + } + return l.PublicOnly +} + +// GetRole returns the Role field. +func (l *ListMembersOptions) GetRole() string { + if l == nil { + return "" + } + return l.Role +} + +// GetPage returns the Page field. +func (l *ListOptions) GetPage() int { + if l == nil { + return 0 + } + return l.Page +} + +// GetPerPage returns the PerPage field. +func (l *ListOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (l *ListOrganizationCopilotCodingAgentRepositoriesResponse) GetRepositories() []*Repository { + if l == nil || l.Repositories == nil { + return nil + } + return l.Repositories +} + +// GetTotalCount returns the TotalCount field. +func (l *ListOrganizationCopilotCodingAgentRepositoriesResponse) GetTotalCount() int { + if l == nil { + return 0 + } + return l.TotalCount +} + +// GetOrganizations returns the Organizations slice if it's non-nil, nil otherwise. +func (l *ListOrganizations) GetOrganizations() []*Organization { + if l == nil || l.Organizations == nil { + return nil + } + return l.Organizations +} + +// 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 + } + return *l.TotalCount +} + +// GetAfter returns the After field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetTargetType returns the TargetType field. +func (l *ListOrgCodeSecurityConfigurationOptions) GetTargetType() string { + if l == nil { + return "" + } + return l.TargetType +} + +// GetState returns the State field. +func (l *ListOrgMembershipsOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetVisibleToRepository returns the VisibleToRepository field. +func (l *ListOrgRunnerGroupOptions) GetVisibleToRepository() string { + if l == nil { + return "" + } + return l.VisibleToRepository +} + +// GetFilter returns the Filter field. +func (l *ListOutsideCollaboratorsOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetState returns the State field. +func (l *ListPackageVersionsOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (l *ListProjectItemsOptions) GetFields() []int64 { + if l == nil || l.Fields == nil { + return nil + } + return l.Fields +} + +// GetQuery returns the Query field. +func (l *ListProjectsOptions) GetQuery() string { + if l == nil { + return "" + } + return l.Query +} + +// GetAfter returns the After field. +func (l *ListProjectsPaginationOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListProjectsPaginationOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetPerPage returns the PerPage field. +func (l *ListProjectsPaginationOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetCount() int { + if l == nil || l.Count == nil { + return 0 + } + return *l.Count +} + +// GetExcludedAttributes returns the ExcludedAttributes field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) GetExcludedAttributes() string { + if l == nil || l.ExcludedAttributes == nil { + return "" + } + return *l.ExcludedAttributes +} + +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMGroupsEnterpriseOptions) 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 *ListProvisionedSCIMGroupsEnterpriseOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (l *ListProvisionedSCIMUsersEnterpriseOptions) 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 *ListProvisionedSCIMUsersEnterpriseOptions) 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 *ListProvisionedSCIMUsersEnterpriseOptions) GetStartIndex() int { + if l == nil || l.StartIndex == nil { + return 0 + } + return *l.StartIndex +} + +// GetContent returns the Content field. +func (l *ListReactionOptions) GetContent() string { + if l == nil { + return "" + } + return l.Content +} + +// 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.ClientIP +} + +// 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.Location +} + +// 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.Ref +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (l *ListRepositories) GetRepositories() []*Repository { + if l == nil || l.Repositories == nil { + return nil + } + return l.Repositories +} + +// 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.TotalCount +} + +// GetActivityType returns the ActivityType field. +func (l *ListRepositoryActivityOptions) GetActivityType() string { + if l == nil { + return "" + } + return l.ActivityType +} + +// GetActor returns the Actor field. +func (l *ListRepositoryActivityOptions) GetActor() string { + if l == nil { + return "" + } + return l.Actor +} + +// GetAfter returns the After field. +func (l *ListRepositoryActivityOptions) GetAfter() string { + if l == nil { + return "" + } + return l.After +} + +// GetBefore returns the Before field. +func (l *ListRepositoryActivityOptions) GetBefore() string { + if l == nil { + return "" + } + return l.Before +} + +// GetDirection returns the Direction field. +func (l *ListRepositoryActivityOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetPerPage returns the PerPage field. +func (l *ListRepositoryActivityOptions) GetPerPage() int { + if l == nil { + return 0 + } + return l.PerPage +} + +// GetRef returns the Ref field. +func (l *ListRepositoryActivityOptions) GetRef() string { + if l == nil { + return "" + } + return l.Ref +} + +// GetTimePeriod returns the TimePeriod field. +func (l *ListRepositoryActivityOptions) GetTimePeriod() string { + if l == nil { + return "" + } + return l.TimePeriod +} + +// GetDirection returns the Direction field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetSort returns the Sort field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListRepositorySecurityAdvisoriesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// 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 +} + +// GetDirection returns the Direction field. +func (l *ListUserIssuesOptions) GetDirection() string { + if l == nil { + return "" + } + return l.Direction +} + +// GetFilter returns the Filter field. +func (l *ListUserIssuesOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (l *ListUserIssuesOptions) GetLabels() []string { + if l == nil || l.Labels == nil { + return nil + } + return l.Labels +} + +// GetSince returns the Since field. +func (l *ListUserIssuesOptions) GetSince() time.Time { + if l == nil { + return time.Time{} + } + return l.Since +} + +// GetSort returns the Sort field. +func (l *ListUserIssuesOptions) GetSort() string { + if l == nil { + return "" + } + return l.Sort +} + +// GetState returns the State field. +func (l *ListUserIssuesOptions) GetState() string { + if l == nil { + return "" + } + return l.State +} + +// GetIsUnmatchedOnly returns the IsUnmatchedOnly field. +func (l *ListVisualStudioSubscriptionsOptions) GetIsUnmatchedOnly() bool { + if l == nil { + return false + } + return l.IsUnmatchedOnly +} + +// GetFilter returns the Filter field. +func (l *ListWorkflowJobsOptions) GetFilter() string { + if l == nil { + return "" + } + return l.Filter +} + +// GetActor returns the Actor field. +func (l *ListWorkflowRunsOptions) GetActor() string { + if l == nil { + return "" + } + return l.Actor +} + +// GetBranch returns the Branch field. +func (l *ListWorkflowRunsOptions) GetBranch() string { + if l == nil { + return "" + } + return l.Branch +} + +// GetCheckSuiteID returns the CheckSuiteID field. +func (l *ListWorkflowRunsOptions) GetCheckSuiteID() int64 { + if l == nil { + return 0 + } + return l.CheckSuiteID +} + +// GetCreated returns the Created field. +func (l *ListWorkflowRunsOptions) GetCreated() string { + if l == nil { + return "" + } + return l.Created +} + +// GetEvent returns the Event field. +func (l *ListWorkflowRunsOptions) GetEvent() string { + if l == nil { + return "" + } + return l.Event +} + +// GetExcludePullRequests returns the ExcludePullRequests field. +func (l *ListWorkflowRunsOptions) GetExcludePullRequests() bool { + if l == nil { + return false + } + return l.ExcludePullRequests +} + +// GetHeadSHA returns the HeadSHA field. +func (l *ListWorkflowRunsOptions) GetHeadSHA() string { + if l == nil { + return "" + } + return l.HeadSHA +} + +// GetStatus returns the Status field. +func (l *ListWorkflowRunsOptions) GetStatus() string { + if l == nil { + return "" + } + return l.Status +} + +// 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 +} + +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (l *LockBranch) GetEnabled() bool { + if l == nil || l.Enabled == nil { + return false + } + return *l.Enabled +} + +// GetLockReason returns the LockReason field if it's non-nil, zero value otherwise. +func (l *LockIssueRequest) GetLockReason() string { + if l == nil || l.LockReason == nil { + return "" + } + return *l.LockReason +} + +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (m *MaintenanceOperationStatus) GetHostname() string { + if m == nil || m.Hostname == nil { + return "" + } + return *m.Hostname +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (m *MaintenanceOperationStatus) GetMessage() string { + if m == nil || m.Message == nil { + return "" + } + return *m.Message +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (m *MaintenanceOperationStatus) GetUUID() string { + if m == nil || m.UUID == nil { + return "" + } + return *m.UUID +} + +// GetEnabled returns the Enabled field. +func (m *MaintenanceOptions) GetEnabled() bool { + if m == nil { + return false + } + return m.Enabled +} + +// GetIPExceptionList returns the IPExceptionList slice if it's non-nil, nil otherwise. +func (m *MaintenanceOptions) GetIPExceptionList() []string { + if m == nil || m.IPExceptionList == nil { + return nil + } + return m.IPExceptionList +} + +// GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. +func (m *MaintenanceOptions) GetMaintenanceModeMessage() string { + if m == nil || m.MaintenanceModeMessage == nil { + return "" + } + return *m.MaintenanceModeMessage +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (m *MaintenanceOptions) GetUUID() string { + if m == nil || m.UUID == nil { + return "" + } + return *m.UUID +} + +// GetWhen returns the When field if it's non-nil, zero value otherwise. +func (m *MaintenanceOptions) GetWhen() string { + if m == nil || m.When == nil { + return "" + } + return *m.When +} + +// GetCanUnsetMaintenance returns the CanUnsetMaintenance field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetCanUnsetMaintenance() bool { + if m == nil || m.CanUnsetMaintenance == nil { + return false + } + return *m.CanUnsetMaintenance +} + +// GetConnectionServices returns the ConnectionServices slice if it's non-nil, nil otherwise. +func (m *MaintenanceStatus) GetConnectionServices() []*ConnectionServiceItem { + if m == nil || m.ConnectionServices == nil { + return nil + } + return m.ConnectionServices +} + +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetHostname() string { + if m == nil || m.Hostname == nil { + return "" + } + return *m.Hostname +} + +// GetIPExceptionList returns the IPExceptionList slice if it's non-nil, nil otherwise. +func (m *MaintenanceStatus) GetIPExceptionList() []string { + if m == nil || m.IPExceptionList == nil { + return nil + } + return m.IPExceptionList +} + +// GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetMaintenanceModeMessage() string { + if m == nil || m.MaintenanceModeMessage == nil { + return "" + } + return *m.MaintenanceModeMessage +} + +// GetScheduledTime returns the ScheduledTime field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetScheduledTime() Timestamp { + if m == nil || m.ScheduledTime == nil { + return Timestamp{} + } + return *m.ScheduledTime +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetStatus() string { + if m == nil || m.Status == nil { + return "" + } + return *m.Status +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (m *MaintenanceStatus) GetUUID() string { + if m == nil || m.UUID == nil { + return "" + } + return *m.UUID +} + +// GetContext returns the Context field. +func (m *MarkdownOptions) GetContext() string { + if m == nil { + return "" + } + return m.Context +} + +// GetMode returns the Mode field. +func (m *MarkdownOptions) GetMode() string { + if m == nil { + return "" + } + return m.Mode +} + +// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { + if m == nil || m.EffectiveDate == nil { + return Timestamp{} + } + return *m.EffectiveDate +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetPlan returns the Plan field. +func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { + if m == nil { + return nil + } + return m.Plan +} + +// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. +func (m *MarketplacePendingChange) GetUnitCount() int { + if m == nil || m.UnitCount == nil { + return 0 + } + return *m.UnitCount +} + +// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetAccountsURL() string { + if m == nil || m.AccountsURL == nil { + return "" + } + return *m.AccountsURL +} + +// GetBullets returns the Bullets field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetBullets() []string { + if m == nil || m.Bullets == nil { + return nil + } + return *m.Bullets +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetDescription() string { + if m == nil || m.Description == nil { + return "" + } + return *m.Description +} + +// GetHasFreeTrial returns the HasFreeTrial field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetHasFreeTrial() bool { + if m == nil || m.HasFreeTrial == nil { + return false + } + return *m.HasFreeTrial +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetMonthlyPriceInCents returns the MonthlyPriceInCents field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetMonthlyPriceInCents() int { + if m == nil || m.MonthlyPriceInCents == nil { + return 0 + } + return *m.MonthlyPriceInCents +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetName() string { + if m == nil || m.Name == nil { + return "" + } + return *m.Name +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetNumber() int { + if m == nil || m.Number == nil { + return 0 + } + return *m.Number +} + +// GetPriceModel returns the PriceModel field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetPriceModel() string { + if m == nil || m.PriceModel == nil { + return "" + } + return *m.PriceModel +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + +// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetUnitName() string { + if m == nil || m.UnitName == nil { + return "" + } + return *m.UnitName +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetYearlyPriceInCents returns the YearlyPriceInCents field if it's non-nil, zero value otherwise. +func (m *MarketplacePlan) GetYearlyPriceInCents() int { + if m == nil || m.YearlyPriceInCents == nil { + return 0 + } + return *m.YearlyPriceInCents +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *MarketplacePlanAccount) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (m *MarketplacePlanAccount) GetLogin() string { + if m == nil || m.Login == nil { + return "" + } + return *m.Login +} + +// GetMarketplacePendingChange returns the MarketplacePendingChange field. +func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { + if m == nil { + return nil + } + return m.MarketplacePendingChange +} + +// GetMarketplacePurchase returns the MarketplacePurchase field. +func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { + if m == nil { + return nil + } + return m.MarketplacePurchase +} + +// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise. +func (m *MarketplacePlanAccount) GetOrganizationBillingEmail() string { + if m == nil || m.OrganizationBillingEmail == nil { + return "" + } + return *m.OrganizationBillingEmail +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (m *MarketplacePlanAccount) GetType() string { + if m == nil || m.Type == nil { + return "" + } + return *m.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *MarketplacePlanAccount) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetAccount returns the Account field. +func (m *MarketplacePurchase) GetAccount() *MarketplacePurchaseAccount { + if m == nil { + return nil + } + return m.Account +} + +// GetBillingCycle returns the BillingCycle field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetBillingCycle() string { + if m == nil || m.BillingCycle == nil { + return "" + } + return *m.BillingCycle +} + +// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp { + if m == nil || m.FreeTrialEndsOn == nil { + return Timestamp{} + } + return *m.FreeTrialEndsOn +} + +// GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetNextBillingDate() Timestamp { + if m == nil || m.NextBillingDate == nil { + return Timestamp{} + } + return *m.NextBillingDate +} + +// GetOnFreeTrial returns the OnFreeTrial field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetOnFreeTrial() bool { + if m == nil || m.OnFreeTrial == nil { + return false + } + return *m.OnFreeTrial +} + +// GetPlan returns the Plan field. +func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { + if m == nil { + return nil + } + return m.Plan +} + +// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetUnitCount() int { + if m == nil || m.UnitCount == nil { + return 0 + } + return *m.UnitCount +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchase) GetUpdatedAt() Timestamp { + if m == nil || m.UpdatedAt == nil { + return Timestamp{} + } + return *m.UpdatedAt +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetEmail() string { + if m == nil || m.Email == nil { + return "" + } + return *m.Email +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetLogin() string { + if m == nil || m.Login == nil { + return "" + } + return *m.Login +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetNodeID() string { + if m == nil || m.NodeID == nil { + return "" + } + return *m.NodeID +} + +// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetOrganizationBillingEmail() string { + if m == nil || m.OrganizationBillingEmail == nil { + return "" + } + return *m.OrganizationBillingEmail +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetType() string { + if m == nil || m.Type == nil { + return "" + } + return *m.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseAccount) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. +func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp { + if m == nil || m.EffectiveDate == nil { + return Timestamp{} + } + return *m.EffectiveDate +} + +// GetInstallation returns the Installation field. +func (m *MarketplacePurchaseEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetMarketplacePurchase returns the MarketplacePurchase field. +func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase { + if m == nil { + return nil + } + return m.MarketplacePurchase +} + +// GetOrg returns the Org field. +func (m *MarketplacePurchaseEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. +func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { + if m == nil { + return nil + } + return m.PreviousMarketplacePurchase +} + +// GetSender returns the Sender field. +func (m *MarketplacePurchaseEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetIndices returns the Indices slice if it's non-nil, nil otherwise. +func (m *Match) GetIndices() []int { + if m == nil || m.Indices == nil { + return nil + } + return m.Indices +} + +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (m *Match) GetText() string { + if m == nil || m.Text == nil { + return "" + } + return *m.Text +} + +// GetParameters returns the Parameters field. +func (m *MaxFilePathLengthBranchRule) GetParameters() MaxFilePathLengthRuleParameters { + if m == nil { + return MaxFilePathLengthRuleParameters{} + } + return m.Parameters +} + +// GetMaxFilePathLength returns the MaxFilePathLength field. +func (m *MaxFilePathLengthRuleParameters) GetMaxFilePathLength() int { + if m == nil { + return 0 + } + return m.MaxFilePathLength +} + +// GetParameters returns the Parameters field. +func (m *MaxFileSizeBranchRule) GetParameters() MaxFileSizeRuleParameters { + if m == nil { + return MaxFileSizeRuleParameters{} + } + return m.Parameters +} + +// GetMaxFileSize returns the MaxFileSize field. +func (m *MaxFileSizeRuleParameters) GetMaxFileSize() int64 { + if m == nil { + return 0 + } + return m.MaxFileSize +} + +// GetPermission returns the Permission field. +func (m *MemberChanges) GetPermission() *MemberChangesPermission { + if m == nil { + return nil + } + return m.Permission +} + +// GetRoleName returns the RoleName field. +func (m *MemberChanges) GetRoleName() *MemberChangesRoleName { + if m == nil { + return nil + } + return m.RoleName +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (m *MemberChangesPermission) GetFrom() string { + if m == nil || m.From == nil { + return "" + } + return *m.From +} + +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (m *MemberChangesPermission) GetTo() string { + if m == nil || m.To == nil { + return "" + } + return *m.To +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (m *MemberChangesRoleName) GetFrom() string { + if m == nil || m.From == nil { + return "" + } + return *m.From +} + +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (m *MemberChangesRoleName) GetTo() string { + if m == nil || m.To == nil { + return "" + } + return *m.To +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MemberEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetChanges returns the Changes field. +func (m *MemberEvent) GetChanges() *MemberChanges { + if m == nil { + return nil + } + return m.Changes +} + +// GetInstallation returns the Installation field. +func (m *MemberEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetMember returns the Member field. +func (m *MemberEvent) GetMember() *User { + if m == nil { + return nil + } + return m.Member +} + +// GetOrg returns the Org field. +func (m *MemberEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetRepo returns the Repo field. +func (m *MemberEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MemberEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetOrganization returns the Organization field. +func (m *Membership) GetOrganization() *Organization { + if m == nil { + return nil + } + return m.Organization +} + +// GetOrganizationURL returns the OrganizationURL field if it's non-nil, zero value otherwise. +func (m *Membership) GetOrganizationURL() string { + if m == nil || m.OrganizationURL == nil { + return "" + } + return *m.OrganizationURL +} + +// GetRole returns the Role field if it's non-nil, zero value otherwise. +func (m *Membership) GetRole() string { + if m == nil || m.Role == nil { + return "" + } + return *m.Role +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *Membership) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *Membership) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetUser returns the User field. +func (m *Membership) GetUser() *User { + if m == nil { + return nil + } + return m.User +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MembershipEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetInstallation returns the Installation field. +func (m *MembershipEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetMember returns the Member field. +func (m *MembershipEvent) GetMember() *User { + if m == nil { + return nil + } + return m.Member +} + +// GetOrg returns the Org field. +func (m *MembershipEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (m *MembershipEvent) GetScope() string { + if m == nil || m.Scope == nil { + return "" + } + return *m.Scope +} + +// GetSender returns the Sender field. +func (m *MembershipEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetTeam returns the Team field. +func (m *MembershipEvent) GetTeam() *Team { + if m == nil { + return nil + } + return m.Team +} + +// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. +func (m *MergeGroup) GetBaseRef() string { + if m == nil || m.BaseRef == nil { + return "" + } + return *m.BaseRef +} + +// GetBaseSHA returns the BaseSHA field if it's non-nil, zero value otherwise. +func (m *MergeGroup) GetBaseSHA() string { + if m == nil || m.BaseSHA == nil { + return "" + } + return *m.BaseSHA +} + +// GetHeadCommit returns the HeadCommit field. +func (m *MergeGroup) GetHeadCommit() *Commit { + if m == nil { + return nil + } + return m.HeadCommit +} + +// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. +func (m *MergeGroup) GetHeadRef() string { + if m == nil || m.HeadRef == nil { + return "" + } + return *m.HeadRef +} + +// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. +func (m *MergeGroup) GetHeadSHA() string { + if m == nil || m.HeadSHA == nil { + return "" + } + return *m.HeadSHA +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MergeGroupEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetInstallation returns the Installation field. +func (m *MergeGroupEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetMergeGroup returns the MergeGroup field. +func (m *MergeGroupEvent) GetMergeGroup() *MergeGroup { + if m == nil { + return nil + } + return m.MergeGroup +} + +// GetOrg returns the Org field. +func (m *MergeGroupEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (m *MergeGroupEvent) GetReason() string { + if m == nil || m.Reason == nil { + return "" + } + return *m.Reason +} + +// GetRepo returns the Repo field. +func (m *MergeGroupEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MergeGroupEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetParameters returns the Parameters field. +func (m *MergeQueueBranchRule) GetParameters() MergeQueueRuleParameters { + if m == nil { + return MergeQueueRuleParameters{} + } + return m.Parameters +} + +// GetCheckResponseTimeoutMinutes returns the CheckResponseTimeoutMinutes field. +func (m *MergeQueueRuleParameters) GetCheckResponseTimeoutMinutes() int { + if m == nil { + return 0 + } + return m.CheckResponseTimeoutMinutes +} + +// GetGroupingStrategy returns the GroupingStrategy field. +func (m *MergeQueueRuleParameters) GetGroupingStrategy() MergeGroupingStrategy { + if m == nil { + return "" + } + return m.GroupingStrategy +} + +// GetMaxEntriesToBuild returns the MaxEntriesToBuild field. +func (m *MergeQueueRuleParameters) GetMaxEntriesToBuild() int { + if m == nil { + return 0 + } + return m.MaxEntriesToBuild +} + +// GetMaxEntriesToMerge returns the MaxEntriesToMerge field. +func (m *MergeQueueRuleParameters) GetMaxEntriesToMerge() int { + if m == nil { + return 0 + } + return m.MaxEntriesToMerge +} + +// GetMergeMethod returns the MergeMethod field. +func (m *MergeQueueRuleParameters) GetMergeMethod() MergeQueueMergeMethod { + if m == nil { + return "" + } + return m.MergeMethod +} + +// GetMinEntriesToMerge returns the MinEntriesToMerge field. +func (m *MergeQueueRuleParameters) GetMinEntriesToMerge() int { + if m == nil { + return 0 + } + return m.MinEntriesToMerge +} + +// GetMinEntriesToMergeWaitMinutes returns the MinEntriesToMergeWaitMinutes field. +func (m *MergeQueueRuleParameters) GetMinEntriesToMergeWaitMinutes() int { + if m == nil { + return 0 + } + return m.MinEntriesToMergeWaitMinutes +} + +// GetText returns the Text field if it's non-nil, zero value otherwise. +func (m *Message) GetText() string { + if m == nil || m.Text == nil { + return "" + } + return *m.Text +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MetaEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetHook returns the Hook field. +func (m *MetaEvent) GetHook() *Hook { + if m == nil { + return nil + } + return m.Hook +} + +// GetHookID returns the HookID field if it's non-nil, zero value otherwise. +func (m *MetaEvent) GetHookID() int64 { + if m == nil || m.HookID == nil { + return 0 + } + return *m.HookID +} + +// GetInstallation returns the Installation field. +func (m *MetaEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetOrg returns the Org field. +func (m *MetaEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetRepo returns the Repo field. +func (m *MetaEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MetaEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (m *Metric) GetHTMLURL() string { + if m == nil || m.HTMLURL == nil { + return "" + } + return *m.HTMLURL +} + +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (m *Metric) GetKey() string { + if m == nil || m.Key == nil { + return "" + } + return *m.Key +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (m *Metric) GetName() string { + if m == nil || m.Name == nil { + return "" + } + return *m.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (m *Metric) GetNodeID() string { + if m == nil || m.NodeID == nil { + return "" + } + return *m.NodeID +} + +// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. +func (m *Metric) GetSPDXID() string { + if m == nil || m.SPDXID == nil { + return "" + } + return *m.SPDXID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *Metric) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (m *Migration) GetCreatedAt() string { + if m == nil || m.CreatedAt == nil { + return "" + } + return *m.CreatedAt +} + +// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise. +func (m *Migration) GetExcludeAttachments() bool { + if m == nil || m.ExcludeAttachments == nil { + return false + } + return *m.ExcludeAttachments +} + +// GetGUID returns the GUID field if it's non-nil, zero value otherwise. +func (m *Migration) GetGUID() string { + if m == nil || m.GUID == nil { + return "" + } + return *m.GUID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *Migration) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. +func (m *Migration) GetLockRepositories() bool { + if m == nil || m.LockRepositories == nil { + return false + } + return *m.LockRepositories +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (m *Migration) GetRepositories() []*Repository { + if m == nil || m.Repositories == nil { + return nil + } + return m.Repositories +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *Migration) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (m *Migration) GetUpdatedAt() string { + if m == nil || m.UpdatedAt == nil { + return "" + } + return *m.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *Migration) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (m *MigrationOptions) GetExclude() []string { + if m == nil || m.Exclude == nil { + return nil + } + return m.Exclude +} + +// GetExcludeAttachments returns the ExcludeAttachments field. +func (m *MigrationOptions) GetExcludeAttachments() bool { + if m == nil { + return false + } + return m.ExcludeAttachments +} + +// GetExcludeReleases returns the ExcludeReleases field. +func (m *MigrationOptions) GetExcludeReleases() bool { + if m == nil { + return false + } + return m.ExcludeReleases +} + +// GetLockRepositories returns the LockRepositories field. +func (m *MigrationOptions) GetLockRepositories() bool { + if m == nil { + return false + } + return m.LockRepositories +} + +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (m *Milestone) GetClosedAt() Timestamp { + if m == nil || m.ClosedAt == nil { + return Timestamp{} + } + return *m.ClosedAt +} + +// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. +func (m *Milestone) GetClosedIssues() int { + if m == nil || m.ClosedIssues == nil { + return 0 + } + return *m.ClosedIssues +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (m *Milestone) GetCreatedAt() Timestamp { + if m == nil || m.CreatedAt == nil { + return Timestamp{} + } + return *m.CreatedAt +} + +// GetCreator returns the Creator field. +func (m *Milestone) GetCreator() *User { + if m == nil { + return nil + } + return m.Creator +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (m *Milestone) GetDescription() string { + if m == nil || m.Description == nil { + return "" + } + return *m.Description +} + +// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise. +func (m *Milestone) GetDueOn() Timestamp { + if m == nil || m.DueOn == nil { + return Timestamp{} + } + return *m.DueOn +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (m *Milestone) GetHTMLURL() string { + if m == nil || m.HTMLURL == nil { + return "" + } + return *m.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (m *Milestone) GetID() int64 { + if m == nil || m.ID == nil { + return 0 + } + return *m.ID +} + +// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. +func (m *Milestone) GetLabelsURL() string { + if m == nil || m.LabelsURL == nil { + return "" + } + return *m.LabelsURL +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (m *Milestone) GetNodeID() string { + if m == nil || m.NodeID == nil { + return "" + } + return *m.NodeID +} + +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (m *Milestone) GetNumber() int { + if m == nil || m.Number == nil { + return 0 + } + return *m.Number +} + +// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. +func (m *Milestone) GetOpenIssues() int { + if m == nil || m.OpenIssues == nil { + return 0 + } + return *m.OpenIssues +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *Milestone) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (m *Milestone) GetTitle() string { + if m == nil || m.Title == nil { + return "" + } + return *m.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (m *Milestone) GetUpdatedAt() Timestamp { + if m == nil || m.UpdatedAt == nil { + return Timestamp{} + } + return *m.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (m *Milestone) GetURL() string { + if m == nil || m.URL == nil { + return "" + } + return *m.URL +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (m *MilestoneEvent) GetAction() string { + if m == nil || m.Action == nil { + return "" + } + return *m.Action +} + +// GetChanges returns the Changes field. +func (m *MilestoneEvent) GetChanges() *EditChange { + if m == nil { + return nil + } + return m.Changes +} + +// GetInstallation returns the Installation field. +func (m *MilestoneEvent) GetInstallation() *Installation { + if m == nil { + return nil + } + return m.Installation +} + +// GetMilestone returns the Milestone field. +func (m *MilestoneEvent) GetMilestone() *Milestone { + if m == nil { + return nil + } + return m.Milestone +} + +// GetOrg returns the Org field. +func (m *MilestoneEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetRepo returns the Repo field. +func (m *MilestoneEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MilestoneEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + +// GetDirection returns the Direction field. +func (m *MilestoneListOptions) GetDirection() string { + if m == nil { + return "" + } + return m.Direction +} + +// GetSort returns the Sort field. +func (m *MilestoneListOptions) GetSort() string { + if m == nil { + return "" + } + return m.Sort +} + +// GetState returns the State field. +func (m *MilestoneListOptions) GetState() string { + if m == nil { + return "" + } + return m.State +} + +// GetClosedMilestones returns the ClosedMilestones field if it's non-nil, zero value otherwise. +func (m *MilestoneStats) GetClosedMilestones() int { + if m == nil || m.ClosedMilestones == nil { + return 0 + } + return *m.ClosedMilestones +} + +// GetOpenMilestones returns the OpenMilestones field if it's non-nil, zero value otherwise. +func (m *MilestoneStats) GetOpenMilestones() int { + if m == nil || m.OpenMilestones == nil { + return 0 + } + return *m.OpenMilestones +} + +// GetTotalMilestones returns the TotalMilestones field if it's non-nil, zero value otherwise. +func (m *MilestoneStats) GetTotalMilestones() int { + if m == nil || m.TotalMilestones == nil { + return 0 + } + return *m.TotalMilestones +} + +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (m *MinimizedIssueComment) GetReason() string { + if m == nil || m.Reason == nil { + return "" + } + return *m.Reason +} + +// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetAnalysisKey() string { + if m == nil || m.AnalysisKey == nil { + return "" + } + return *m.AnalysisKey +} + +// GetCategory returns the Category field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetCategory() string { + if m == nil || m.Category == nil { + return "" + } + return *m.Category +} + +// GetClassifications returns the Classifications slice if it's non-nil, nil otherwise. +func (m *MostRecentInstance) GetClassifications() []string { + if m == nil || m.Classifications == nil { + return nil + } + return m.Classifications +} + +// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetCommitSHA() string { + if m == nil || m.CommitSHA == nil { + return "" + } + return *m.CommitSHA +} + +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetEnvironment() string { + if m == nil || m.Environment == nil { + return "" + } + return *m.Environment +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetHTMLURL() string { + if m == nil || m.HTMLURL == nil { + return "" + } + return *m.HTMLURL +} + +// GetLocation returns the Location field. +func (m *MostRecentInstance) GetLocation() *Location { + if m == nil { + return nil + } + return m.Location +} + +// GetMessage returns the Message field. +func (m *MostRecentInstance) GetMessage() *Message { + if m == nil { + return nil + } + return m.Message +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetRef() string { + if m == nil || m.Ref == nil { + return "" + } + return *m.Ref +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetState() string { + if m == nil || m.State == nil { + return "" + } + return *m.State +} + +// GetComputeService returns the ComputeService field. +func (n *NetworkConfiguration) GetComputeService() *ComputeService { + if n == nil { + return nil + } + return n.ComputeService +} + +// GetCreatedOn returns the CreatedOn field if it's non-nil, zero value otherwise. +func (n *NetworkConfiguration) GetCreatedOn() Timestamp { + if n == nil || n.CreatedOn == nil { + return Timestamp{} + } + return *n.CreatedOn +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (n *NetworkConfiguration) GetID() string { + if n == nil || n.ID == nil { + return "" + } + return *n.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (n *NetworkConfiguration) GetName() string { + if n == nil || n.Name == nil { + return "" + } + return *n.Name +} + +// GetNetworkSettingsIDs returns the NetworkSettingsIDs slice if it's non-nil, nil otherwise. +func (n *NetworkConfiguration) GetNetworkSettingsIDs() []string { + if n == nil || n.NetworkSettingsIDs == nil { + return nil + } + return n.NetworkSettingsIDs +} + +// GetComputeService returns the ComputeService field. +func (n *NetworkConfigurationRequest) GetComputeService() *ComputeService { + if n == nil { + return nil + } + return n.ComputeService +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (n *NetworkConfigurationRequest) GetName() string { + if n == nil || n.Name == nil { + return "" + } + return *n.Name +} + +// GetNetworkSettingsIDs returns the NetworkSettingsIDs slice if it's non-nil, nil otherwise. +func (n *NetworkConfigurationRequest) GetNetworkSettingsIDs() []string { + if n == nil || n.NetworkSettingsIDs == nil { + return nil + } + return n.NetworkSettingsIDs +} + +// GetNetworkConfigurations returns the NetworkConfigurations slice if it's non-nil, nil otherwise. +func (n *NetworkConfigurations) GetNetworkConfigurations() []*NetworkConfiguration { + if n == nil || n.NetworkConfigurations == nil { + return nil + } + return n.NetworkConfigurations +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (n *NetworkConfigurations) GetTotalCount() int64 { + if n == nil || n.TotalCount == nil { + return 0 + } + return *n.TotalCount +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (n *NetworkSettingsResource) GetID() string { + if n == nil || n.ID == nil { + return "" + } + return *n.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (n *NetworkSettingsResource) GetName() string { + if n == nil || n.Name == nil { + return "" + } + return *n.Name +} + +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (n *NetworkSettingsResource) GetNetworkConfigurationID() string { + if n == nil || n.NetworkConfigurationID == nil { + return "" + } + return *n.NetworkConfigurationID +} + +// GetRegion returns the Region field if it's non-nil, zero value otherwise. +func (n *NetworkSettingsResource) GetRegion() string { + if n == nil || n.Region == nil { + return "" + } + return *n.Region +} + +// GetSubnetID returns the SubnetID field if it's non-nil, zero value otherwise. +func (n *NetworkSettingsResource) GetSubnetID() string { + if n == nil || n.SubnetID == nil { + return "" + } + return *n.SubnetID +} + +// GetClusterRoles returns the ClusterRoles slice if it's non-nil, nil otherwise. +func (n *NodeDetails) GetClusterRoles() []string { + if n == nil || n.ClusterRoles == nil { + return nil + } + return n.ClusterRoles +} + +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (n *NodeDetails) GetHostname() string { + if n == nil || n.Hostname == nil { + return "" + } + return *n.Hostname +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (n *NodeDetails) GetUUID() string { + if n == nil || n.UUID == nil { + return "" + } + return *n.UUID +} + +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (n *NodeMetadataStatus) GetNodes() []*NodeDetails { + if n == nil || n.Nodes == nil { + return nil + } + return n.Nodes +} + +// GetTopology returns the Topology field if it's non-nil, zero value otherwise. +func (n *NodeMetadataStatus) GetTopology() string { + if n == nil || n.Topology == nil { + return "" + } + return *n.Topology +} + +// GetClusterRoles returns the ClusterRoles field if it's non-nil, zero value otherwise. +func (n *NodeQueryOptions) GetClusterRoles() string { + if n == nil || n.ClusterRoles == nil { + return "" + } + return *n.ClusterRoles +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (n *NodeQueryOptions) GetUUID() string { + if n == nil || n.UUID == nil { + return "" + } + return *n.UUID +} + +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (n *NodeReleaseVersion) GetHostname() string { + if n == nil || n.Hostname == nil { + return "" + } + return *n.Hostname +} + +// GetVersion returns the Version field. +func (n *NodeReleaseVersion) GetVersion() *ReleaseVersion { + if n == nil { + return nil + } + return n.Version +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (n *Notification) GetID() string { + if n == nil || n.ID == nil { + return "" + } + return *n.ID +} + +// GetLastReadAt returns the LastReadAt field if it's non-nil, zero value otherwise. +func (n *Notification) GetLastReadAt() Timestamp { + if n == nil || n.LastReadAt == nil { + return Timestamp{} + } + return *n.LastReadAt +} + +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (n *Notification) GetReason() string { + if n == nil || n.Reason == nil { + return "" + } + return *n.Reason +} + +// GetRepository returns the Repository field. +func (n *Notification) GetRepository() *Repository { + if n == nil { + return nil + } + return n.Repository +} + +// GetSubject returns the Subject field. +func (n *Notification) GetSubject() *NotificationSubject { + if n == nil { + return nil + } + return n.Subject +} + +// GetUnread returns the Unread field if it's non-nil, zero value otherwise. +func (n *Notification) GetUnread() bool { + if n == nil || n.Unread == nil { + return false + } + return *n.Unread +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (n *Notification) GetUpdatedAt() Timestamp { + if n == nil || n.UpdatedAt == nil { + return Timestamp{} + } + return *n.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (n *Notification) GetURL() string { + if n == nil || n.URL == nil { + return "" + } + return *n.URL +} + +// GetAll returns the All field. +func (n *NotificationListOptions) GetAll() bool { + if n == nil { + return false + } + return n.All +} + +// GetBefore returns the Before field. +func (n *NotificationListOptions) GetBefore() time.Time { + if n == nil { + return time.Time{} + } + return n.Before +} + +// GetParticipating returns the Participating field. +func (n *NotificationListOptions) GetParticipating() bool { + if n == nil { + return false + } + return n.Participating +} + +// GetSince returns the Since field. +func (n *NotificationListOptions) GetSince() time.Time { + if n == nil { + return time.Time{} + } + return n.Since +} + +// GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise. +func (n *NotificationSubject) GetLatestCommentURL() string { + if n == nil || n.LatestCommentURL == nil { + return "" + } + return *n.LatestCommentURL +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (n *NotificationSubject) GetTitle() string { + if n == nil || n.Title == nil { + return "" + } + return *n.Title +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (n *NotificationSubject) GetType() string { + if n == nil || n.Type == nil { + return "" + } + return *n.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (n *NotificationSubject) GetURL() string { + if n == nil || n.URL == nil { + return "" + } + return *n.URL +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (o *OAuthAPP) GetClientID() string { + if o == nil || o.ClientID == nil { + return "" + } + return *o.ClientID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (o *OAuthAPP) GetName() string { + if o == nil || o.Name == nil { + return "" + } + return *o.Name +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (o *OAuthAPP) GetURL() string { + if o == nil || o.URL == nil { + return "" + } + return *o.URL +} + +// GetCustomPropertyName returns the CustomPropertyName field. +func (o *OIDCCustomPropertyClaim) GetCustomPropertyName() string { + if o == nil { + return "" + } + return o.CustomPropertyName +} + +// GetInclusionSource returns the InclusionSource field. +func (o *OIDCCustomPropertyClaimResponse) GetInclusionSource() InclusionSource { + if o == nil { + return "" + } + return o.InclusionSource +} + +// GetIncludeClaimKeys returns the IncludeClaimKeys slice if it's non-nil, nil otherwise. +func (o *OIDCSubjectClaimCustomTemplate) GetIncludeClaimKeys() []string { + if o == nil || o.IncludeClaimKeys == nil { + return nil + } + return o.IncludeClaimKeys +} + +// GetSubClaimPrefix returns the SubClaimPrefix field if it's non-nil, zero value otherwise. +func (o *OIDCSubjectClaimCustomTemplate) GetSubClaimPrefix() string { + if o == nil || o.SubClaimPrefix == nil { + return "" + } + return *o.SubClaimPrefix +} + +// GetUseDefault returns the UseDefault field if it's non-nil, zero value otherwise. +func (o *OIDCSubjectClaimCustomTemplate) GetUseDefault() bool { + if o == nil || o.UseDefault == nil { + return false + } + return *o.UseDefault +} + +// GetUseImmutableSubject returns the UseImmutableSubject field if it's non-nil, zero value otherwise. +func (o *OIDCSubjectClaimCustomTemplate) GetUseImmutableSubject() bool { + if o == nil || o.UseImmutableSubject == nil { + return false + } + return *o.UseImmutableSubject +} + +// GetAdvancedSecurityEnabledForNewRepos returns the AdvancedSecurityEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetAdvancedSecurityEnabledForNewRepos() bool { + if o == nil || o.AdvancedSecurityEnabledForNewRepos == nil { + return false + } + return *o.AdvancedSecurityEnabledForNewRepos +} + +// GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. +func (o *Organization) GetArchivedAt() Timestamp { + if o == nil || o.ArchivedAt == nil { + return Timestamp{} + } + return *o.ArchivedAt +} + +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetAvatarURL() string { + if o == nil || o.AvatarURL == nil { + return "" + } + return *o.AvatarURL +} + +// GetBillingEmail returns the BillingEmail field if it's non-nil, zero value otherwise. +func (o *Organization) GetBillingEmail() string { + if o == nil || o.BillingEmail == nil { + return "" + } + return *o.BillingEmail +} + +// GetBlog returns the Blog field if it's non-nil, zero value otherwise. +func (o *Organization) GetBlog() string { + if o == nil || o.Blog == nil { + return "" + } + return *o.Blog +} + +// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. +func (o *Organization) GetCollaborators() int { + if o == nil || o.Collaborators == nil { + return 0 + } + return *o.Collaborators +} + +// GetCompany returns the Company field if it's non-nil, zero value otherwise. +func (o *Organization) GetCompany() string { + if o == nil || o.Company == nil { + return "" + } + return *o.Company +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (o *Organization) GetCreatedAt() Timestamp { + if o == nil || o.CreatedAt == nil { + return Timestamp{} + } + return *o.CreatedAt +} + +// GetDefaultRepoPermission returns the DefaultRepoPermission field if it's non-nil, zero value otherwise. +func (o *Organization) GetDefaultRepoPermission() string { + if o == nil || o.DefaultRepoPermission == nil { + return "" + } + return *o.DefaultRepoPermission +} + +// GetDefaultRepoSettings returns the DefaultRepoSettings field if it's non-nil, zero value otherwise. +func (o *Organization) GetDefaultRepoSettings() string { + if o == nil || o.DefaultRepoSettings == nil { + return "" + } + return *o.DefaultRepoSettings +} + +// GetDefaultRepositoryBranch returns the DefaultRepositoryBranch field if it's non-nil, zero value otherwise. +func (o *Organization) GetDefaultRepositoryBranch() string { + if o == nil || o.DefaultRepositoryBranch == nil { + return "" + } + return *o.DefaultRepositoryBranch +} + +// GetDependabotAlertsEnabledForNewRepos returns the DependabotAlertsEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetDependabotAlertsEnabledForNewRepos() bool { + if o == nil || o.DependabotAlertsEnabledForNewRepos == nil { + return false + } + return *o.DependabotAlertsEnabledForNewRepos +} + +// GetDependabotSecurityUpdatesEnabledForNewRepos returns the DependabotSecurityUpdatesEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetDependabotSecurityUpdatesEnabledForNewRepos() bool { + if o == nil || o.DependabotSecurityUpdatesEnabledForNewRepos == nil { + return false + } + return *o.DependabotSecurityUpdatesEnabledForNewRepos +} + +// GetDependencyGraphEnabledForNewRepos returns the DependencyGraphEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetDependencyGraphEnabledForNewRepos() bool { + if o == nil || o.DependencyGraphEnabledForNewRepos == nil { + return false + } + return *o.DependencyGraphEnabledForNewRepos +} + +// GetDeployKeysEnabledForRepositories returns the DeployKeysEnabledForRepositories field if it's non-nil, zero value otherwise. +func (o *Organization) GetDeployKeysEnabledForRepositories() bool { + if o == nil || o.DeployKeysEnabledForRepositories == nil { + return false + } + return *o.DeployKeysEnabledForRepositories +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (o *Organization) GetDescription() string { + if o == nil || o.Description == nil { + return "" + } + return *o.Description +} + +// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise. +func (o *Organization) GetDiskUsage() int { + if o == nil || o.DiskUsage == nil { + return 0 + } + return *o.DiskUsage +} + +// GetDisplayCommenterFullNameSettingEnabled returns the DisplayCommenterFullNameSettingEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetDisplayCommenterFullNameSettingEnabled() bool { + if o == nil || o.DisplayCommenterFullNameSettingEnabled == nil { + return false + } + return *o.DisplayCommenterFullNameSettingEnabled +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (o *Organization) GetEmail() string { + if o == nil || o.Email == nil { + return "" + } + return *o.Email +} + +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetEventsURL() string { + if o == nil || o.EventsURL == nil { + return "" + } + return *o.EventsURL +} + +// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. +func (o *Organization) GetFollowers() int { + if o == nil || o.Followers == nil { + return 0 + } + return *o.Followers +} + +// GetFollowing returns the Following field if it's non-nil, zero value otherwise. +func (o *Organization) GetFollowing() int { + if o == nil || o.Following == nil { + return 0 + } + return *o.Following +} + +// GetHasOrganizationProjects returns the HasOrganizationProjects field if it's non-nil, zero value otherwise. +func (o *Organization) GetHasOrganizationProjects() bool { + if o == nil || o.HasOrganizationProjects == nil { + return false + } + return *o.HasOrganizationProjects +} + +// GetHasRepositoryProjects returns the HasRepositoryProjects field if it's non-nil, zero value otherwise. +func (o *Organization) GetHasRepositoryProjects() bool { + if o == nil || o.HasRepositoryProjects == nil { + return false + } + return *o.HasRepositoryProjects +} + +// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetHooksURL() string { + if o == nil || o.HooksURL == nil { + return "" + } + return *o.HooksURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetHTMLURL() string { + if o == nil || o.HTMLURL == nil { + return "" + } + return *o.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (o *Organization) GetID() int64 { + if o == nil || o.ID == nil { + return 0 + } + return *o.ID +} + +// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetIssuesURL() string { + if o == nil || o.IssuesURL == nil { + return "" + } + return *o.IssuesURL +} + +// GetIsVerified returns the IsVerified field if it's non-nil, zero value otherwise. +func (o *Organization) GetIsVerified() bool { + if o == nil || o.IsVerified == nil { + return false + } + return *o.IsVerified +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (o *Organization) GetLocation() string { + if o == nil || o.Location == nil { + return "" + } + return *o.Location +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (o *Organization) GetLogin() string { + if o == nil || o.Login == nil { + return "" + } + return *o.Login +} + +// GetMembersAllowedRepositoryCreationType returns the MembersAllowedRepositoryCreationType field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersAllowedRepositoryCreationType() string { + if o == nil || o.MembersAllowedRepositoryCreationType == nil { + return "" + } + return *o.MembersAllowedRepositoryCreationType +} + +// GetMembersCanChangeRepoVisibility returns the MembersCanChangeRepoVisibility field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanChangeRepoVisibility() bool { + if o == nil || o.MembersCanChangeRepoVisibility == nil { + return false + } + return *o.MembersCanChangeRepoVisibility +} + +// GetMembersCanCreateInternalRepos returns the MembersCanCreateInternalRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreateInternalRepos() bool { + if o == nil || o.MembersCanCreateInternalRepos == nil { + return false + } + return *o.MembersCanCreateInternalRepos +} + +// GetMembersCanCreatePages returns the MembersCanCreatePages field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreatePages() bool { + if o == nil || o.MembersCanCreatePages == nil { + return false + } + return *o.MembersCanCreatePages +} + +// GetMembersCanCreatePrivatePages returns the MembersCanCreatePrivatePages field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreatePrivatePages() bool { + if o == nil || o.MembersCanCreatePrivatePages == nil { + return false + } + return *o.MembersCanCreatePrivatePages +} + +// GetMembersCanCreatePrivateRepos returns the MembersCanCreatePrivateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreatePrivateRepos() bool { + if o == nil || o.MembersCanCreatePrivateRepos == nil { + return false + } + return *o.MembersCanCreatePrivateRepos +} + +// GetMembersCanCreatePublicPages returns the MembersCanCreatePublicPages field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreatePublicPages() bool { + if o == nil || o.MembersCanCreatePublicPages == nil { + return false + } + return *o.MembersCanCreatePublicPages +} + +// GetMembersCanCreatePublicRepos returns the MembersCanCreatePublicRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreatePublicRepos() bool { + if o == nil || o.MembersCanCreatePublicRepos == nil { + return false + } + return *o.MembersCanCreatePublicRepos +} + +// GetMembersCanCreateRepos returns the MembersCanCreateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreateRepos() bool { + if o == nil || o.MembersCanCreateRepos == nil { + return false + } + return *o.MembersCanCreateRepos +} + +// GetMembersCanCreateTeams returns the MembersCanCreateTeams field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanCreateTeams() bool { + if o == nil || o.MembersCanCreateTeams == nil { + return false + } + return *o.MembersCanCreateTeams +} + +// GetMembersCanDeleteIssues returns the MembersCanDeleteIssues field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanDeleteIssues() bool { + if o == nil || o.MembersCanDeleteIssues == nil { + return false + } + return *o.MembersCanDeleteIssues +} + +// GetMembersCanDeleteRepositories returns the MembersCanDeleteRepositories field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanDeleteRepositories() bool { + if o == nil || o.MembersCanDeleteRepositories == nil { + return false + } + return *o.MembersCanDeleteRepositories +} + +// GetMembersCanForkPrivateRepos returns the MembersCanForkPrivateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanForkPrivateRepos() bool { + if o == nil || o.MembersCanForkPrivateRepos == nil { + return false + } + return *o.MembersCanForkPrivateRepos +} + +// GetMembersCanInviteOutsideCollaborators returns the MembersCanInviteOutsideCollaborators field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanInviteOutsideCollaborators() bool { + if o == nil || o.MembersCanInviteOutsideCollaborators == nil { + return false + } + return *o.MembersCanInviteOutsideCollaborators +} + +// GetMembersCanViewDependencyInsights returns the MembersCanViewDependencyInsights field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanViewDependencyInsights() bool { + if o == nil || o.MembersCanViewDependencyInsights == nil { + return false + } + return *o.MembersCanViewDependencyInsights +} + +// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersURL() string { + if o == nil || o.MembersURL == nil { + return "" + } + return *o.MembersURL +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (o *Organization) GetName() string { + if o == nil || o.Name == nil { + return "" + } + return *o.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (o *Organization) GetNodeID() string { + if o == nil || o.NodeID == nil { + return "" + } + return *o.NodeID +} + +// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetOwnedPrivateRepos() int64 { + if o == nil || o.OwnedPrivateRepos == nil { + return 0 + } + return *o.OwnedPrivateRepos +} + +// GetPlan returns the Plan field. +func (o *Organization) GetPlan() *Plan { + if o == nil { + return nil + } + return o.Plan +} + +// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. +func (o *Organization) GetPrivateGists() int { + if o == nil || o.PrivateGists == nil { + return 0 + } + return *o.PrivateGists +} + +// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. +func (o *Organization) GetPublicGists() int { + if o == nil || o.PublicGists == nil { + return 0 + } + return *o.PublicGists +} + +// GetPublicMembersURL returns the PublicMembersURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetPublicMembersURL() string { + if o == nil || o.PublicMembersURL == nil { + return "" + } + return *o.PublicMembersURL +} + +// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetPublicRepos() int { + if o == nil || o.PublicRepos == nil { + return 0 + } + return *o.PublicRepos +} + +// GetReadersCanCreateDiscussions returns the ReadersCanCreateDiscussions field if it's non-nil, zero value otherwise. +func (o *Organization) GetReadersCanCreateDiscussions() bool { + if o == nil || o.ReadersCanCreateDiscussions == nil { + return false + } + return *o.ReadersCanCreateDiscussions +} + +// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. +func (o *Organization) GetReposURL() string { + if o == nil || o.ReposURL == nil { + return "" + } + return *o.ReposURL +} + +// GetSecretScanningEnabledForNewRepos returns the SecretScanningEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningEnabledForNewRepos() bool { + if o == nil || o.SecretScanningEnabledForNewRepos == nil { + return false + } + return *o.SecretScanningEnabledForNewRepos +} + +// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLink() string { + if o == nil || o.SecretScanningPushProtectionCustomLink == nil { + return "" + } + return *o.SecretScanningPushProtectionCustomLink +} + +// GetSecretScanningPushProtectionCustomLinkEnabled returns the SecretScanningPushProtectionCustomLinkEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionCustomLinkEnabled() bool { + if o == nil || o.SecretScanningPushProtectionCustomLinkEnabled == nil { + return false + } + return *o.SecretScanningPushProtectionCustomLinkEnabled +} + +// GetSecretScanningPushProtectionEnabledForNewRepos returns the SecretScanningPushProtectionEnabledForNewRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningPushProtectionEnabledForNewRepos() bool { + if o == nil || o.SecretScanningPushProtectionEnabledForNewRepos == nil { + return false + } + return *o.SecretScanningPushProtectionEnabledForNewRepos +} + +// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningValidityChecksEnabled() bool { + if o == nil || o.SecretScanningValidityChecksEnabled == nil { + return false + } + return *o.SecretScanningValidityChecksEnabled +} + +// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetTotalPrivateRepos() int64 { + if o == nil || o.TotalPrivateRepos == nil { + return 0 + } + return *o.TotalPrivateRepos +} + +// GetTwitterUsername returns the TwitterUsername field if it's non-nil, zero value otherwise. +func (o *Organization) GetTwitterUsername() string { + if o == nil || o.TwitterUsername == nil { + return "" + } + return *o.TwitterUsername +} + +// GetTwoFactorRequirementEnabled returns the TwoFactorRequirementEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetTwoFactorRequirementEnabled() bool { + if o == nil || o.TwoFactorRequirementEnabled == nil { + return false + } + return *o.TwoFactorRequirementEnabled +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (o *Organization) GetType() string { + if o == nil || o.Type == nil { + return "" + } + return *o.Type +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (o *Organization) GetUpdatedAt() Timestamp { + if o == nil || o.UpdatedAt == nil { + return Timestamp{} + } + return *o.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (o *Organization) GetURL() string { + if o == nil || o.URL == nil { + return "" + } + return *o.URL +} + +// GetWebCommitSignoffRequired returns the WebCommitSignoffRequired field if it's non-nil, zero value otherwise. +func (o *Organization) GetWebCommitSignoffRequired() bool { + if o == nil || o.WebCommitSignoffRequired == nil { + return false + } + return *o.WebCommitSignoffRequired +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomPropertyValues) GetProperties() []*CustomPropertyValue { + if o == nil || o.Properties == nil { + return nil + } + return o.Properties +} + +// GetCustomRepoRoles returns the CustomRepoRoles slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomRepoRoles) GetCustomRepoRoles() []*CustomRepoRoles { + if o == nil || o.CustomRepoRoles == nil { + return nil + } + return o.CustomRepoRoles +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (o *OrganizationCustomRepoRoles) GetTotalCount() int { + if o == nil || o.TotalCount == nil { + return 0 + } + return *o.TotalCount +} + +// GetCustomRepoRoles returns the CustomRepoRoles slice if it's non-nil, nil otherwise. +func (o *OrganizationCustomRoles) GetCustomRepoRoles() []*CustomOrgRole { + if o == nil || o.CustomRepoRoles == nil { + return nil + } + return o.CustomRepoRoles +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (o *OrganizationCustomRoles) GetTotalCount() int { + if o == nil || o.TotalCount == nil { + return 0 + } + return *o.TotalCount +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (o *OrganizationEvent) GetAction() string { + if o == nil || o.Action == nil { + return "" + } + return *o.Action +} + +// GetInstallation returns the Installation field. +func (o *OrganizationEvent) GetInstallation() *Installation { + if o == nil { + return nil + } + return o.Installation +} + +// GetInvitation returns the Invitation field. +func (o *OrganizationEvent) GetInvitation() *Invitation { + if o == nil { + return nil + } + return o.Invitation +} + +// GetMembership returns the Membership field. +func (o *OrganizationEvent) GetMembership() *Membership { + if o == nil { + return nil + } + return o.Membership +} + +// GetOrganization returns the Organization field. +func (o *OrganizationEvent) GetOrganization() *Organization { + if o == nil { + return nil + } + return o.Organization +} + +// GetSender returns the Sender field. +func (o *OrganizationEvent) GetSender() *User { + if o == nil { + return nil + } + return o.Sender +} + +// GetDescription returns the Description field. +func (o *OrganizationFineGrainedPermission) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +// GetName returns the Name field. +func (o *OrganizationFineGrainedPermission) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +// GetInstallations returns the Installations slice if it's non-nil, nil otherwise. +func (o *OrganizationInstallations) GetInstallations() []*Installation { + if o == nil || o.Installations == nil { + return nil + } + return o.Installations +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (o *OrganizationInstallations) GetTotalCount() int { + if o == nil || o.TotalCount == nil { + return 0 + } + return *o.TotalCount +} + +// GetPerPage returns the PerPage field. +func (o *OrganizationsListOptions) GetPerPage() int { + if o == nil { + return 0 + } + return o.PerPage +} + +// GetSince returns the Since field. +func (o *OrganizationsListOptions) GetSince() int64 { + if o == nil { + return 0 + } + return o.Since +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (o *OrgBlockEvent) GetAction() string { + if o == nil || o.Action == nil { + return "" + } + return *o.Action +} + +// GetBlockedUser returns the BlockedUser field. +func (o *OrgBlockEvent) GetBlockedUser() *User { + if o == nil { + return nil + } + return o.BlockedUser +} + +// GetInstallation returns the Installation field. +func (o *OrgBlockEvent) GetInstallation() *Installation { + if o == nil { + return nil + } + return o.Installation +} + +// GetOrganization returns the Organization field. +func (o *OrgBlockEvent) GetOrganization() *Organization { + if o == nil { + return nil + } + return o.Organization +} + +// GetSender returns the Sender field. +func (o *OrgBlockEvent) GetSender() *User { + if o == nil { + return nil + } + return o.Sender +} + +// GetDisabledOrgs returns the DisabledOrgs field if it's non-nil, zero value otherwise. +func (o *OrgStats) GetDisabledOrgs() int { + if o == nil || o.DisabledOrgs == nil { + return 0 + } + return *o.DisabledOrgs +} + +// GetTotalOrgs returns the TotalOrgs field if it's non-nil, zero value otherwise. +func (o *OrgStats) GetTotalOrgs() int { + if o == nil || o.TotalOrgs == nil { + return 0 + } + return *o.TotalOrgs +} + +// GetTotalTeamMembers returns the TotalTeamMembers field if it's non-nil, zero value otherwise. +func (o *OrgStats) GetTotalTeamMembers() int { + if o == nil || o.TotalTeamMembers == nil { + return 0 + } + return *o.TotalTeamMembers +} + +// GetTotalTeams returns the TotalTeams field if it's non-nil, zero value otherwise. +func (o *OrgStats) GetTotalTeams() int { + if o == nil || o.TotalTeams == nil { + return 0 + } + return *o.TotalTeams +} + +// GetOrg returns the Org field. +func (o *OwnerInfo) GetOrg() *User { + if o == nil { + return nil + } + return o.Org +} + +// GetUser returns the User field. +func (o *OwnerInfo) GetUser() *User { + if o == nil { + return nil + } + return o.User +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *Package) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *Package) GetDescription() string { + if p == nil || p.Description == nil { + return "" + } + return *p.Description +} + +// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. +func (p *Package) GetEcosystem() string { + if p == nil || p.Ecosystem == nil { + return "" + } + return *p.Ecosystem +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *Package) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *Package) 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 *Package) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNamespace returns the Namespace field if it's non-nil, zero value otherwise. +func (p *Package) GetNamespace() string { + if p == nil || p.Namespace == nil { + return "" + } + return *p.Namespace +} + +// GetOwner returns the Owner field. +func (p *Package) GetOwner() *User { + if p == nil { + return nil + } + return p.Owner +} + +// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. +func (p *Package) GetPackageType() string { + if p == nil || p.PackageType == nil { + return "" + } + return *p.PackageType +} + +// GetPackageVersion returns the PackageVersion field. +func (p *Package) GetPackageVersion() *PackageVersion { + if p == nil { + return nil + } + return p.PackageVersion +} + +// GetRegistry returns the Registry field. +func (p *Package) GetRegistry() *PackageRegistry { + if p == nil { + return nil + } + return p.Registry +} + +// GetRepository returns the Repository field. +func (p *Package) GetRepository() *Repository { + if p == nil { + return nil + } + return p.Repository +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *Package) 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 *Package) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetVersionCount returns the VersionCount field if it's non-nil, zero value otherwise. +func (p *Package) GetVersionCount() int64 { + if p == nil || p.VersionCount == nil { + return 0 + } + return *p.VersionCount +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (p *Package) GetVisibility() string { + if p == nil || p.Visibility == nil { + return "" + } + return *p.Visibility +} + +// GetTags returns the Tags slice if it's non-nil, nil otherwise. +func (p *PackageContainerMetadata) GetTags() []string { + if p == nil || p.Tags == nil { + return nil + } + return p.Tags +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PackageEvent) GetAction() string { + if p == nil || p.Action == nil { + return "" + } + return *p.Action +} + +// GetInstallation returns the Installation field. +func (p *PackageEvent) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + +// GetOrg returns the Org field. +func (p *PackageEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetPackage returns the Package field. +func (p *PackageEvent) GetPackage() *Package { + if p == nil { + return nil + } + return p.Package +} + +// GetRepo returns the Repo field. +func (p *PackageEvent) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetSender returns the Sender field. +func (p *PackageEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + +// GetLabels returns the Labels map if it's non-nil, an empty map otherwise. +func (p *PackageEventContainerMetadata) GetLabels() map[string]any { + if p == nil || p.Labels == nil { + return map[string]any{} + } + return p.Labels +} + +// GetManifest returns the Manifest map if it's non-nil, an empty map otherwise. +func (p *PackageEventContainerMetadata) GetManifest() map[string]any { + if p == nil || p.Manifest == nil { + return map[string]any{} + } + return p.Manifest +} + +// GetTag returns the Tag field. +func (p *PackageEventContainerMetadata) GetTag() *PackageEventContainerMetadataTag { + if p == nil { + return nil + } + return p.Tag +} + +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (p *PackageEventContainerMetadataTag) GetDigest() string { + if p == nil || p.Digest == nil { + return "" + } + return *p.Digest +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageEventContainerMetadataTag) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetReferenceCategory returns the ReferenceCategory field. +func (p *PackageExternalRef) GetReferenceCategory() string { + if p == nil { + return "" + } + return p.ReferenceCategory +} + +// GetReferenceLocator returns the ReferenceLocator field. +func (p *PackageExternalRef) GetReferenceLocator() string { + if p == nil { + return "" + } + return p.ReferenceLocator +} + +// GetReferenceType returns the ReferenceType field. +func (p *PackageExternalRef) GetReferenceType() string { + if p == nil { + return "" + } + return p.ReferenceType +} + +// GetAuthor returns the Author field. +func (p *PackageFile) GetAuthor() *User { + if p == nil { + return nil + } + return p.Author +} + +// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetContentType() string { + if p == nil || p.ContentType == nil { + return "" + } + return *p.ContentType +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetDownloadURL() string { + if p == nil || p.DownloadURL == nil { + return "" + } + return *p.DownloadURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetMD5 returns the MD5 field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetMD5() string { + if p == nil || p.MD5 == nil { + return "" + } + return *p.MD5 +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetSHA1 returns the SHA1 field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetSHA1() string { + if p == nil || p.SHA1 == nil { + return "" + } + return *p.SHA1 +} + +// GetSHA256 returns the SHA256 field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetSHA256() string { + if p == nil || p.SHA256 == nil { + return "" + } + return *p.SHA256 +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetSize() int64 { + if p == nil || p.Size == nil { + return 0 + } + return *p.Size +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PackageFile) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetPackageType() string { + if p == nil || p.PackageType == nil { + return "" + } + return *p.PackageType +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (p *PackageListOptions) GetVisibility() string { + if p == nil || p.Visibility == nil { + return "" + } + return *p.Visibility +} + +// GetContainer returns the Container field. +func (p *PackageMetadata) GetContainer() *PackageContainerMetadata { + if p == nil { + return nil + } + return p.Container +} + +// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. +func (p *PackageMetadata) GetPackageType() string { + if p == nil || p.PackageType == nil { + return "" + } + return *p.PackageType +} + +// GetAuthor returns the Author map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetAuthor() map[string]string { + if p == nil || p.Author == nil { + return map[string]string{} + } + return p.Author +} + +// GetBin returns the Bin map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetBin() map[string]any { + if p == nil || p.Bin == nil { + return map[string]any{} + } + return p.Bin +} + +// GetBugs returns the Bugs map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetBugs() map[string]string { + if p == nil || p.Bugs == nil { + return map[string]string{} + } + return p.Bugs +} + +// GetCommitOID returns the CommitOID field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetCommitOID() string { + if p == nil || p.CommitOID == nil { + return "" + } + return *p.CommitOID +} + +// GetContributors returns the Contributors slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetContributors() []any { + if p == nil || p.Contributors == nil { + return nil + } + return p.Contributors +} + +// GetCPU returns the CPU slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetCPU() []string { + if p == nil || p.CPU == nil { + return nil + } + return p.CPU +} + +// GetDeletedByID returns the DeletedByID field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetDeletedByID() int64 { + if p == nil || p.DeletedByID == nil { + return 0 + } + return *p.DeletedByID +} + +// GetDependencies returns the Dependencies map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetDependencies() map[string]string { + if p == nil || p.Dependencies == nil { + return map[string]string{} + } + return p.Dependencies +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetDescription() string { + if p == nil || p.Description == nil { + return "" + } + return *p.Description +} + +// GetDevDependencies returns the DevDependencies map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetDevDependencies() map[string]string { + if p == nil || p.DevDependencies == nil { + return map[string]string{} + } + return p.DevDependencies +} + +// GetDirectories returns the Directories map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetDirectories() map[string]string { + if p == nil || p.Directories == nil { + return map[string]string{} + } + return p.Directories +} + +// GetDist returns the Dist map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetDist() map[string]string { + if p == nil || p.Dist == nil { + return map[string]string{} + } + return p.Dist +} + +// GetEngines returns the Engines map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetEngines() map[string]string { + if p == nil || p.Engines == nil { + return map[string]string{} + } + return p.Engines +} + +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetFiles() []string { + if p == nil || p.Files == nil { + return nil + } + return p.Files +} + +// GetGitHead returns the GitHead field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetGitHead() string { + if p == nil || p.GitHead == nil { + return "" + } + return *p.GitHead +} + +// GetHasShrinkwrap returns the HasShrinkwrap field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetHasShrinkwrap() bool { + if p == nil || p.HasShrinkwrap == nil { + return false + } + return *p.HasShrinkwrap +} + +// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetHomepage() string { + if p == nil || p.Homepage == nil { + return "" + } + return *p.Homepage +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetID() string { + if p == nil || p.ID == nil { + return "" + } + return *p.ID +} + +// GetInstallationCommand returns the InstallationCommand field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetInstallationCommand() string { + if p == nil || p.InstallationCommand == nil { + return "" + } + return *p.InstallationCommand +} + +// GetKeywords returns the Keywords slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetKeywords() []string { + if p == nil || p.Keywords == nil { + return nil + } + return p.Keywords +} + +// GetLicense returns the License field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetLicense() string { + if p == nil || p.License == nil { + return "" + } + return *p.License +} + +// GetMain returns the Main field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetMain() string { + if p == nil || p.Main == nil { + return "" + } + return *p.Main +} + +// GetMaintainers returns the Maintainers slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetMaintainers() []any { + if p == nil || p.Maintainers == nil { + return nil + } + return p.Maintainers +} + +// GetMan returns the Man map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetMan() map[string]any { + if p == nil || p.Man == nil { + return map[string]any{} + } + return p.Man +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNodeVersion returns the NodeVersion field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetNodeVersion() string { + if p == nil || p.NodeVersion == nil { + return "" + } + return *p.NodeVersion +} + +// GetNPMUser returns the NPMUser field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetNPMUser() string { + if p == nil || p.NPMUser == nil { + return "" + } + return *p.NPMUser +} + +// GetNPMVersion returns the NPMVersion field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetNPMVersion() string { + if p == nil || p.NPMVersion == nil { + return "" + } + return *p.NPMVersion +} + +// GetOptionalDependencies returns the OptionalDependencies map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetOptionalDependencies() map[string]string { + if p == nil || p.OptionalDependencies == nil { + return map[string]string{} + } + return p.OptionalDependencies +} + +// GetOS returns the OS slice if it's non-nil, nil otherwise. +func (p *PackageNPMMetadata) GetOS() []string { + if p == nil || p.OS == nil { + return nil + } + return p.OS +} + +// GetPeerDependencies returns the PeerDependencies map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetPeerDependencies() map[string]string { + if p == nil || p.PeerDependencies == nil { + return map[string]string{} + } + return p.PeerDependencies +} + +// GetPublishedViaActions returns the PublishedViaActions field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetPublishedViaActions() bool { + if p == nil || p.PublishedViaActions == nil { + return false + } + return *p.PublishedViaActions +} + +// GetReadme returns the Readme field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetReadme() string { + if p == nil || p.Readme == nil { + return "" + } + return *p.Readme +} + +// GetReleaseID returns the ReleaseID field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetReleaseID() int64 { + if p == nil || p.ReleaseID == nil { + return 0 + } + return *p.ReleaseID +} + +// GetRepository returns the Repository map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetRepository() map[string]string { + if p == nil || p.Repository == nil { + return map[string]string{} + } + return p.Repository +} + +// GetScripts returns the Scripts map if it's non-nil, an empty map otherwise. +func (p *PackageNPMMetadata) GetScripts() map[string]any { + if p == nil || p.Scripts == nil { + return map[string]any{} + } + return p.Scripts +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (p *PackageNPMMetadata) GetVersion() string { + if p == nil || p.Version == nil { + return "" + } + return *p.Version +} + +// GetID returns the ID field. +func (p *PackageNugetMetadata) GetID() json.RawMessage { + if p == nil { + return json.RawMessage{} + } + return p.ID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageNugetMetadata) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetValue returns the Value field. +func (p *PackageNugetMetadata) GetValue() json.RawMessage { + if p == nil { + return json.RawMessage{} + } + return p.Value +} + +// GetAboutURL returns the AboutURL field if it's non-nil, zero value otherwise. +func (p *PackageRegistry) GetAboutURL() string { + if p == nil || p.AboutURL == nil { + return "" + } + return *p.AboutURL +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageRegistry) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (p *PackageRegistry) GetType() string { + if p == nil || p.Type == nil { + return "" + } + return *p.Type +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PackageRegistry) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetVendor returns the Vendor field if it's non-nil, zero value otherwise. +func (p *PackageRegistry) GetVendor() string { + if p == nil || p.Vendor == nil { + return "" + } + return *p.Vendor +} + +// GetAuthor returns the Author field. +func (p *PackageRelease) GetAuthor() *User { + if p == nil { + return nil + } + return p.Author +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetDraft() bool { + if p == nil || p.Draft == nil { + return false + } + return *p.Draft +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PackageRelease) 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 *PackageRelease) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetPrerelease() bool { + if p == nil || p.Prerelease == nil { + return false + } + return *p.Prerelease +} + +// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetPublishedAt() Timestamp { + if p == nil || p.PublishedAt == nil { + return Timestamp{} + } + return *p.PublishedAt +} + +// GetTagName returns the TagName field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetTagName() string { + if p == nil || p.TagName == nil { + return "" + } + return *p.TagName +} + +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetTargetCommitish() string { + if p == nil || p.TargetCommitish == nil { + return "" + } + return *p.TargetCommitish +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PackageRelease) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetIncludedGigabytesBandwidth returns the IncludedGigabytesBandwidth field. +func (p *PackagesBilling) GetIncludedGigabytesBandwidth() int { + if p == nil { + return 0 + } + return p.IncludedGigabytesBandwidth +} + +// GetTotalGigabytesBandwidthUsed returns the TotalGigabytesBandwidthUsed field. +func (p *PackagesBilling) GetTotalGigabytesBandwidthUsed() int { + if p == nil { + return 0 + } + return p.TotalGigabytesBandwidthUsed +} + +// GetTotalPaidGigabytesBandwidthUsed returns the TotalPaidGigabytesBandwidthUsed field. +func (p *PackagesBilling) GetTotalPaidGigabytesBandwidthUsed() int { + if p == nil { + return 0 + } + return p.TotalPaidGigabytesBandwidthUsed +} + +// GetAuthor returns the Author field. +func (p *PackageVersion) GetAuthor() *User { + if p == nil { + return nil + } + return p.Author +} + +// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetBodyHTML() string { + if p == nil || p.BodyHTML == nil { + return "" + } + return *p.BodyHTML +} + +// GetContainerMetadata returns the ContainerMetadata field. +func (p *PackageVersion) GetContainerMetadata() *PackageEventContainerMetadata { + if p == nil { + return nil + } + return p.ContainerMetadata +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDeletedAt returns the DeletedAt field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetDeletedAt() Timestamp { + if p == nil || p.DeletedAt == nil { + return Timestamp{} + } + return *p.DeletedAt +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetDescription() string { + if p == nil || p.Description == nil { + return "" + } + return *p.Description +} + +// GetDockerMetadata returns the DockerMetadata slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetDockerMetadata() []any { + if p == nil || p.DockerMetadata == nil { + return nil + } + return p.DockerMetadata +} + +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetDraft() bool { + if p == nil || p.Draft == nil { + return false + } + return *p.Draft +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetInstallationCommand returns the InstallationCommand field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetInstallationCommand() string { + if p == nil || p.InstallationCommand == nil { + return "" + } + return *p.InstallationCommand +} + +// GetLicense returns the License field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetLicense() string { + if p == nil || p.License == nil { + return "" + } + return *p.License +} + +// GetManifest returns the Manifest field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetManifest() string { + if p == nil || p.Manifest == nil { + return "" + } + return *p.Manifest +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNPMMetadata returns the NPMMetadata field. +func (p *PackageVersion) GetNPMMetadata() *PackageNPMMetadata { + if p == nil { + return nil + } + return p.NPMMetadata +} + +// GetNugetMetadata returns the NugetMetadata slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetNugetMetadata() []*PackageNugetMetadata { + if p == nil || p.NugetMetadata == nil { + return nil + } + return p.NugetMetadata +} + +// GetPackageFiles returns the PackageFiles slice if it's non-nil, nil otherwise. +func (p *PackageVersion) GetPackageFiles() []*PackageFile { + if p == nil || p.PackageFiles == nil { + return nil + } + return p.PackageFiles +} + +// GetPackageHTMLURL returns the PackageHTMLURL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetPackageHTMLURL() string { + if p == nil || p.PackageHTMLURL == nil { + return "" + } + return *p.PackageHTMLURL +} + +// GetPackageURL returns the PackageURL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetPackageURL() string { + if p == nil || p.PackageURL == nil { + return "" + } + return *p.PackageURL +} + +// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetPrerelease() bool { + if p == nil || p.Prerelease == nil { + return false + } + return *p.Prerelease +} + +// GetRelease returns the Release field. +func (p *PackageVersion) GetRelease() *PackageRelease { + if p == nil { + return nil + } + return p.Release +} + +// GetRubyMetadata returns the RubyMetadata map if it's non-nil, an empty map otherwise. +func (p *PackageVersion) GetRubyMetadata() map[string]any { + if p == nil || p.RubyMetadata == nil { + return map[string]any{} + } + return p.RubyMetadata +} + +// GetSourceURL returns the SourceURL field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetSourceURL() string { + if p == nil || p.SourceURL == nil { + return "" + } + return *p.SourceURL +} + +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetSummary() string { + if p == nil || p.Summary == nil { + return "" + } + return *p.Summary +} + +// GetTagName returns the TagName field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetTagName() string { + if p == nil || p.TagName == nil { + return "" + } + return *p.TagName +} + +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetTargetCommitish() string { + if p == nil || p.TargetCommitish == nil { + return "" + } + return *p.TargetCommitish +} + +// GetTargetOID returns the TargetOID field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetTargetOID() string { + if p == nil || p.TargetOID == nil { + return "" + } + return *p.TargetOID +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PackageVersion) 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 *PackageVersion) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (p *PackageVersion) GetVersion() string { + if p == nil || p.Version == nil { + return "" + } + return *p.Version +} + +// GetInfo returns the Info field. +func (p *PackageVersionBody) GetInfo() *PackageVersionBodyInfo { + if p == nil { + return nil + } + return p.Info +} + +// GetRepo returns the Repo field. +func (p *PackageVersionBody) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetCollection returns the Collection field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetCollection() bool { + if p == nil || p.Collection == nil { + return false + } + return *p.Collection +} + +// GetMode returns the Mode field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetMode() int64 { + if p == nil || p.Mode == nil { + return 0 + } + return *p.Mode +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetOID returns the OID field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetOID() string { + if p == nil || p.OID == nil { + return "" + } + return *p.OID +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetPath() string { + if p == nil || p.Path == nil { + return "" + } + return *p.Path +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetSize() int64 { + if p == nil || p.Size == nil { + return 0 + } + return *p.Size +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (p *PackageVersionBodyInfo) GetType() string { + if p == nil || p.Type == nil { + return "" + } + return *p.Type +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *Page) GetAction() string { + if p == nil || p.Action == nil { + return "" + } + return *p.Action +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *Page) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetPageName returns the PageName field if it's non-nil, zero value otherwise. +func (p *Page) GetPageName() string { + if p == nil || p.PageName == nil { + return "" + } + return *p.PageName +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (p *Page) GetSHA() string { + if p == nil || p.SHA == nil { + return "" + } + return *p.SHA +} + +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (p *Page) GetSummary() string { + if p == nil || p.Summary == nil { + return "" + } + return *p.Summary +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *Page) GetTitle() string { + if p == nil || p.Title == nil { + return "" + } + return *p.Title +} + +// GetBuild returns the Build field. +func (p *PageBuildEvent) GetBuild() *PagesBuild { + if p == nil { + return nil + } + return p.Build +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PageBuildEvent) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetInstallation returns the Installation field. +func (p *PageBuildEvent) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + +// GetOrg returns the Org field. +func (p *PageBuildEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetRepo returns the Repo field. +func (p *PageBuildEvent) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetSender returns the Sender field. +func (p *PageBuildEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + +// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. +func (p *Pages) GetBuildType() string { + if p == nil || p.BuildType == nil { + return "" + } + return *p.BuildType +} + +// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. +func (p *Pages) GetCNAME() string { + if p == nil || p.CNAME == nil { + return "" + } + return *p.CNAME +} + +// GetCustom404 returns the Custom404 field if it's non-nil, zero value otherwise. +func (p *Pages) GetCustom404() bool { + if p == nil || p.Custom404 == nil { + return false + } + return *p.Custom404 +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *Pages) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetHTTPSCertificate returns the HTTPSCertificate field. +func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { + if p == nil { + return nil + } + return p.HTTPSCertificate +} + +// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. +func (p *Pages) GetHTTPSEnforced() bool { + if p == nil || p.HTTPSEnforced == nil { + return false + } + return *p.HTTPSEnforced +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (p *Pages) GetPublic() bool { + if p == nil || p.Public == nil { + return false + } + return *p.Public +} + +// GetSource returns the Source field. +func (p *Pages) GetSource() *PagesSource { + if p == nil { + return nil + } + return p.Source +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (p *Pages) GetStatus() string { + if p == nil || p.Status == nil { + return "" + } + return *p.Status +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *Pages) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetCommit returns the Commit field if it's non-nil, zero value otherwise. +func (p *PagesBuild) GetCommit() string { + if p == nil || p.Commit == nil { + return "" + } + return *p.Commit +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PagesBuild) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} + } + return *p.CreatedAt +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *PagesBuild) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 + } + return *p.Duration +} + +// GetError returns the Error field. +func (p *PagesBuild) GetError() *PagesError { + if p == nil { + return nil + } + return p.Error +} + +// GetPusher returns the Pusher field. +func (p *PagesBuild) GetPusher() *User { + if p == nil { + return nil + } + return p.Pusher +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (p *PagesBuild) GetStatus() string { + if p == nil || p.Status == nil { + return "" + } + return *p.Status +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PagesBuild) 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 *PagesBuild) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetCAAError returns the CAAError field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetCAAError() string { + if p == nil || p.CAAError == nil { + return "" + } + return *p.CAAError +} + +// GetDNSResolves returns the DNSResolves field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetDNSResolves() bool { + if p == nil || p.DNSResolves == nil { + return false + } + return *p.DNSResolves +} + +// GetEnforcesHTTPS returns the EnforcesHTTPS field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetEnforcesHTTPS() bool { + if p == nil || p.EnforcesHTTPS == nil { + return false + } + return *p.EnforcesHTTPS +} + +// GetHasCNAMERecord returns the HasCNAMERecord field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetHasCNAMERecord() bool { + if p == nil || p.HasCNAMERecord == nil { + return false + } + return *p.HasCNAMERecord +} + +// GetHasMXRecordsPresent returns the HasMXRecordsPresent field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetHasMXRecordsPresent() bool { + if p == nil || p.HasMXRecordsPresent == nil { + return false + } + return *p.HasMXRecordsPresent +} + +// GetHost returns the Host field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetHost() string { + if p == nil || p.Host == nil { + return "" + } + return *p.Host +} + +// GetHTTPSError returns the HTTPSError field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetHTTPSError() string { + if p == nil || p.HTTPSError == nil { + return "" + } + return *p.HTTPSError +} + +// GetIsApexDomain returns the IsApexDomain field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsApexDomain() bool { + if p == nil || p.IsApexDomain == nil { + return false + } + return *p.IsApexDomain +} + +// GetIsARecord returns the IsARecord field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsARecord() bool { + if p == nil || p.IsARecord == nil { + return false + } + return *p.IsARecord +} + +// GetIsCloudflareIP returns the IsCloudflareIP field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsCloudflareIP() bool { + if p == nil || p.IsCloudflareIP == nil { + return false + } + return *p.IsCloudflareIP +} + +// GetIsCNAMEToFastly returns the IsCNAMEToFastly field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsCNAMEToFastly() bool { + if p == nil || p.IsCNAMEToFastly == nil { + return false + } + return *p.IsCNAMEToFastly +} + +// GetIsCNAMEToGithubUserDomain returns the IsCNAMEToGithubUserDomain field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsCNAMEToGithubUserDomain() bool { + if p == nil || p.IsCNAMEToGithubUserDomain == nil { + return false + } + return *p.IsCNAMEToGithubUserDomain +} + +// GetIsCNAMEToPagesDotGithubDotCom returns the IsCNAMEToPagesDotGithubDotCom field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsCNAMEToPagesDotGithubDotCom() bool { + if p == nil || p.IsCNAMEToPagesDotGithubDotCom == nil { + return false + } + return *p.IsCNAMEToPagesDotGithubDotCom +} + +// GetIsFastlyIP returns the IsFastlyIP field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsFastlyIP() bool { + if p == nil || p.IsFastlyIP == nil { + return false + } + return *p.IsFastlyIP +} + +// GetIsHTTPSEligible returns the IsHTTPSEligible field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsHTTPSEligible() bool { + if p == nil || p.IsHTTPSEligible == nil { + return false + } + return *p.IsHTTPSEligible +} + +// GetIsNonGithubPagesIPPresent returns the IsNonGithubPagesIPPresent field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsNonGithubPagesIPPresent() bool { + if p == nil || p.IsNonGithubPagesIPPresent == nil { + return false + } + return *p.IsNonGithubPagesIPPresent +} + +// GetIsOldIPAddress returns the IsOldIPAddress field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsOldIPAddress() bool { + if p == nil || p.IsOldIPAddress == nil { + return false + } + return *p.IsOldIPAddress +} + +// GetIsPagesDomain returns the IsPagesDomain field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsPagesDomain() bool { + if p == nil || p.IsPagesDomain == nil { + return false + } + return *p.IsPagesDomain +} + +// GetIsPointedToGithubPagesIP returns the IsPointedToGithubPagesIP field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsPointedToGithubPagesIP() bool { + if p == nil || p.IsPointedToGithubPagesIP == nil { + return false + } + return *p.IsPointedToGithubPagesIP +} + +// GetIsProxied returns the IsProxied field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsProxied() bool { + if p == nil || p.IsProxied == nil { + return false + } + return *p.IsProxied +} + +// GetIsServedByPages returns the IsServedByPages field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsServedByPages() bool { + if p == nil || p.IsServedByPages == nil { + return false + } + return *p.IsServedByPages +} + +// GetIsValid returns the IsValid field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsValid() bool { + if p == nil || p.IsValid == nil { + return false + } + return *p.IsValid +} + +// GetIsValidDomain returns the IsValidDomain field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetIsValidDomain() bool { + if p == nil || p.IsValidDomain == nil { + return false + } + return *p.IsValidDomain +} + +// GetNameservers returns the Nameservers field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetNameservers() string { + if p == nil || p.Nameservers == nil { + return "" + } + return *p.Nameservers +} + +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetReason() string { + if p == nil || p.Reason == nil { + return "" + } + return *p.Reason +} + +// GetRespondsToHTTPS returns the RespondsToHTTPS field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetRespondsToHTTPS() bool { + if p == nil || p.RespondsToHTTPS == nil { + return false + } + return *p.RespondsToHTTPS +} + +// GetShouldBeARecord returns the ShouldBeARecord field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetShouldBeARecord() bool { + if p == nil || p.ShouldBeARecord == nil { + return false + } + return *p.ShouldBeARecord +} + +// GetURI returns the URI field if it's non-nil, zero value otherwise. +func (p *PagesDomain) GetURI() string { + if p == nil || p.URI == nil { + return "" + } + return *p.URI +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (p *PagesError) GetMessage() string { + if p == nil || p.Message == nil { + return "" + } + return *p.Message +} + +// GetAltDomain returns the AltDomain field. +func (p *PagesHealthCheckResponse) GetAltDomain() *PagesDomain { + if p == nil { + return nil + } + return p.AltDomain +} + +// GetDomain returns the Domain field. +func (p *PagesHealthCheckResponse) GetDomain() *PagesDomain { + if p == nil { + return nil + } + return p.Domain +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *PagesHTTPSCertificate) GetDescription() string { + if p == nil || p.Description == nil { + return "" + } + return *p.Description +} + +// GetDomains returns the Domains slice if it's non-nil, nil otherwise. +func (p *PagesHTTPSCertificate) GetDomains() []string { + if p == nil || p.Domains == nil { + return nil + } + return p.Domains +} + +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (p *PagesHTTPSCertificate) GetExpiresAt() string { + if p == nil || p.ExpiresAt == nil { + return "" + } + return *p.ExpiresAt +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PagesHTTPSCertificate) GetState() string { + if p == nil || p.State == nil { + return "" + } + return *p.State +} + +// GetBranch returns the Branch field if it's non-nil, zero value otherwise. +func (p *PagesSource) GetBranch() string { + if p == nil || p.Branch == nil { + return "" + } + return *p.Branch +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (p *PagesSource) GetPath() string { + if p == nil || p.Path == nil { + return "" + } + return *p.Path +} + +// GetTotalPages returns the TotalPages field if it's non-nil, zero value otherwise. +func (p *PageStats) GetTotalPages() int { + if p == nil || p.TotalPages == nil { + return 0 + } + return *p.TotalPages +} + +// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. +func (p *PagesUpdate) GetBuildType() string { + if p == nil || p.BuildType == nil { + return "" + } + return *p.BuildType +} + +// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. +func (p *PagesUpdate) GetCNAME() string { + if p == nil || p.CNAME == nil { + return "" + } + return *p.CNAME +} + +// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. +func (p *PagesUpdate) GetHTTPSEnforced() bool { + if p == nil || p.HTTPSEnforced == nil { + return false + } + return *p.HTTPSEnforced +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (p *PagesUpdate) GetPublic() bool { + if p == nil || p.Public == nil { + return false + } + return *p.Public +} + +// GetSource returns the Source field. +func (p *PagesUpdate) GetSource() *PagesSource { + if p == nil { + return nil + } + return p.Source +} + +// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. +func (p *PagesUpdateWithoutCNAME) GetBuildType() string { + if p == nil || p.BuildType == nil { + return "" + } + return *p.BuildType +} + +// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. +func (p *PagesUpdateWithoutCNAME) GetHTTPSEnforced() bool { + if p == nil || p.HTTPSEnforced == nil { + return false + } + return *p.HTTPSEnforced +} + +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (p *PagesUpdateWithoutCNAME) GetPublic() bool { + if p == nil || p.Public == nil { + return false + } + return *p.Public +} + +// GetSource returns the Source field. +func (p *PagesUpdateWithoutCNAME) GetSource() *PagesSource { + if p == nil { + return nil + } + return p.Source +} + +// GetParameters returns the Parameters field. +func (p *PatternBranchRule) GetParameters() PatternRuleParameters { + if p == nil { + return PatternRuleParameters{} + } + return p.Parameters +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PatternRuleParameters) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNegate returns the Negate field if it's non-nil, zero value otherwise. +func (p *PatternRuleParameters) GetNegate() bool { + if p == nil || p.Negate == nil { + return false + } + return *p.Negate +} + +// GetOperator returns the Operator field. +func (p *PatternRuleParameters) GetOperator() PatternRuleOperator { + if p == nil { + return "" + } + return p.Operator +} + +// GetPattern returns the Pattern field. +func (p *PatternRuleParameters) GetPattern() string { + if p == nil { + return "" + } + return p.Pattern +} + +// GetCurrentUserCanApprove returns the CurrentUserCanApprove field if it's non-nil, zero value otherwise. +func (p *PendingDeployment) GetCurrentUserCanApprove() bool { + if p == nil || p.CurrentUserCanApprove == nil { + return false + } + return *p.CurrentUserCanApprove +} + +// GetEnvironment returns the Environment field. +func (p *PendingDeployment) GetEnvironment() *PendingDeploymentEnvironment { + if p == nil { + return nil + } + return p.Environment +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (p *PendingDeployment) GetReviewers() []*RequiredReviewer { + if p == nil || p.Reviewers == nil { + return nil + } + return p.Reviewers +} + +// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. +func (p *PendingDeployment) GetWaitTimer() int64 { + if p == nil || p.WaitTimer == nil { + return 0 + } + return *p.WaitTimer +} + +// GetWaitTimerStartedAt returns the WaitTimerStartedAt field if it's non-nil, zero value otherwise. +func (p *PendingDeployment) GetWaitTimerStartedAt() Timestamp { + if p == nil || p.WaitTimerStartedAt == nil { + return Timestamp{} + } + return *p.WaitTimerStartedAt +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PendingDeploymentEnvironment) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" + } + return *p.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PendingDeploymentEnvironment) 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 *PendingDeploymentEnvironment) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PendingDeploymentEnvironment) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.NodeID +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PendingDeploymentEnvironment) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL +} + +// GetComment returns the Comment field. +func (p *PendingDeploymentsRequest) GetComment() string { + if p == nil { + return "" + } + return p.Comment +} + +// GetEnvironmentIDs returns the EnvironmentIDs slice if it's non-nil, nil otherwise. +func (p *PendingDeploymentsRequest) GetEnvironmentIDs() []int64 { + if p == nil || p.EnvironmentIDs == nil { + return nil + } + return p.EnvironmentIDs +} + +// GetState returns the State field. +func (p *PendingDeploymentsRequest) GetState() string { + if p == nil { + return "" + } + return p.State +} + +// GetAccessGrantedAt returns the AccessGrantedAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetAccessGrantedAt() Timestamp { + if p == nil || p.AccessGrantedAt == nil { + return Timestamp{} + } + return *p.AccessGrantedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetOwner returns the Owner field. +func (p *PersonalAccessToken) GetOwner() *User { + if p == nil { + return nil + } + return p.Owner +} + +// GetPermissions returns the Permissions field. +func (p *PersonalAccessToken) GetPermissions() *PersonalAccessTokenPermissions { + if p == nil { + return nil + } + return p.Permissions +} + +// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetRepositoriesURL() string { + if p == nil || p.RepositoriesURL == nil { + return "" + } + return *p.RepositoriesURL +} + +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetRepositorySelection() string { + if p == nil || p.RepositorySelection == nil { + return "" + } + return *p.RepositorySelection +} + +// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenExpired() bool { + if p == nil || p.TokenExpired == nil { + return false + } + return *p.TokenExpired +} + +// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenExpiresAt() Timestamp { + if p == nil || p.TokenExpiresAt == nil { + return Timestamp{} + } + return *p.TokenExpiresAt +} + +// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenID() int64 { + if p == nil || p.TokenID == nil { + return 0 + } + return *p.TokenID +} + +// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenLastUsedAt() Timestamp { + if p == nil || p.TokenLastUsedAt == nil { + return Timestamp{} + } + return *p.TokenLastUsedAt +} + +// GetTokenName returns the TokenName field if it's non-nil, zero value otherwise. +func (p *PersonalAccessToken) GetTokenName() string { + if p == nil || p.TokenName == nil { + return "" + } + return *p.TokenName +} + +// GetOrg returns the Org map if it's non-nil, an empty map otherwise. +func (p *PersonalAccessTokenPermissions) GetOrg() map[string]string { + if p == nil || p.Org == nil { + return map[string]string{} + } + return p.Org +} + +// GetOther returns the Other map if it's non-nil, an empty map otherwise. +func (p *PersonalAccessTokenPermissions) GetOther() map[string]string { + if p == nil || p.Other == nil { + return map[string]string{} + } + return p.Other +} + +// GetRepo returns the Repo map if it's non-nil, an empty map otherwise. +func (p *PersonalAccessTokenPermissions) GetRepo() map[string]string { + if p == nil || p.Repo == nil { + return map[string]string{} + } + return p.Repo +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) 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 *PersonalAccessTokenRequest) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetOrg returns the Org field. +func (p *PersonalAccessTokenRequest) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetOwner returns the Owner field. +func (p *PersonalAccessTokenRequest) GetOwner() *User { + if p == nil { + return nil + } + return p.Owner +} + +// GetPermissionsAdded returns the PermissionsAdded field. +func (p *PersonalAccessTokenRequest) GetPermissionsAdded() *PersonalAccessTokenPermissions { + if p == nil { + return nil + } + return p.PermissionsAdded +} + +// GetPermissionsResult returns the PermissionsResult field. +func (p *PersonalAccessTokenRequest) GetPermissionsResult() *PersonalAccessTokenPermissions { + if p == nil { + return nil + } + return p.PermissionsResult +} + +// GetPermissionsUpgraded returns the PermissionsUpgraded field. +func (p *PersonalAccessTokenRequest) GetPermissionsUpgraded() *PersonalAccessTokenPermissions { + if p == nil { + return nil + } + return p.PermissionsUpgraded +} + +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (p *PersonalAccessTokenRequest) GetRepositories() []*Repository { + if p == nil || p.Repositories == nil { + return nil + } + return p.Repositories +} + +// GetRepositoryCount returns the RepositoryCount field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) GetRepositoryCount() int64 { + if p == nil || p.RepositoryCount == nil { + return 0 + } + return *p.RepositoryCount +} + +// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) GetRepositorySelection() string { + if p == nil || p.RepositorySelection == nil { + return "" + } + return *p.RepositorySelection +} + +// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) GetTokenExpired() bool { + if p == nil || p.TokenExpired == nil { + return false + } + return *p.TokenExpired +} + +// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) GetTokenExpiresAt() Timestamp { + if p == nil || p.TokenExpiresAt == nil { + return Timestamp{} + } + return *p.TokenExpiresAt +} + +// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequest) GetTokenLastUsedAt() Timestamp { + if p == nil || p.TokenLastUsedAt == nil { + return Timestamp{} + } + return *p.TokenLastUsedAt +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PersonalAccessTokenRequestEvent) GetAction() string { + if p == nil || p.Action == nil { + return "" + } + return *p.Action +} + +// GetInstallation returns the Installation field. +func (p *PersonalAccessTokenRequestEvent) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + +// GetOrg returns the Org field. +func (p *PersonalAccessTokenRequestEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetPersonalAccessTokenRequest returns the PersonalAccessTokenRequest field. +func (p *PersonalAccessTokenRequestEvent) GetPersonalAccessTokenRequest() *PersonalAccessTokenRequest { + if p == nil { + return nil + } + return p.PersonalAccessTokenRequest +} + +// GetSender returns the Sender field. +func (p *PersonalAccessTokenRequestEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + +// GetHook returns the Hook field. +func (p *PingEvent) GetHook() *Hook { + if p == nil { + return nil + } + return p.Hook +} + +// GetHookID returns the HookID field if it's non-nil, zero value otherwise. +func (p *PingEvent) GetHookID() int64 { + if p == nil || p.HookID == nil { + return 0 + } + return *p.HookID +} + +// GetInstallation returns the Installation field. +func (p *PingEvent) GetInstallation() *Installation { + if p == nil { + return nil + } + return p.Installation +} + +// GetOrg returns the Org field. +func (p *PingEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetRepo returns the Repo field. +func (p *PingEvent) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetSender returns the Sender field. +func (p *PingEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + +// GetZen returns the Zen field if it's non-nil, zero value otherwise. +func (p *PingEvent) GetZen() string { + if p == nil || p.Zen == nil { + return "" + } + return *p.Zen +} + +// GetPinnedAt returns the PinnedAt field if it's non-nil, zero value otherwise. +func (p *PinnedIssueComment) GetPinnedAt() Timestamp { + if p == nil || p.PinnedAt == nil { + return Timestamp{} + } + return *p.PinnedAt +} + +// GetPinnedBy returns the PinnedBy field. +func (p *PinnedIssueComment) GetPinnedBy() *User { + if p == nil { + return nil + } + return p.PinnedBy +} + +// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. +func (p *Plan) GetCollaborators() int { + if p == nil || p.Collaborators == nil { + return 0 + } + return *p.Collaborators +} + +// GetFilledSeats returns the FilledSeats field if it's non-nil, zero value otherwise. +func (p *Plan) GetFilledSeats() int { + if p == nil || p.FilledSeats == nil { + return 0 + } + return *p.FilledSeats +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *Plan) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + +// GetPrivateRepos returns the PrivateRepos field if it's non-nil, zero value otherwise. +func (p *Plan) GetPrivateRepos() int64 { + if p == nil || p.PrivateRepos == nil { + return 0 + } + return *p.PrivateRepos +} + +// GetSeats returns the Seats field if it's non-nil, zero value otherwise. +func (p *Plan) GetSeats() int { + if p == nil || p.Seats == nil { + return 0 + } + return *p.Seats +} + +// GetSpace returns the Space field if it's non-nil, zero value otherwise. +func (p *Plan) GetSpace() int { + if p == nil || p.Space == nil { + return 0 + } + return *p.Space +} + +// GetAutoTriggerChecks returns the AutoTriggerChecks slice if it's non-nil, nil otherwise. +func (p *PreferenceList) GetAutoTriggerChecks() []*AutoTriggerCheck { + if p == nil || p.AutoTriggerChecks == nil { + return nil + } + return p.AutoTriggerChecks +} + +// GetDiscountAmount returns the DiscountAmount field. +func (p *PremiumRequestUsageItem) GetDiscountAmount() float64 { + if p == nil { + return 0 + } + return p.DiscountAmount +} + +// GetDiscountQuantity returns the DiscountQuantity field. +func (p *PremiumRequestUsageItem) GetDiscountQuantity() float64 { + if p == nil { + return 0 + } + return p.DiscountQuantity +} + +// GetGrossAmount returns the GrossAmount field. +func (p *PremiumRequestUsageItem) GetGrossAmount() float64 { + if p == nil { + return 0 + } + return p.GrossAmount +} + +// GetGrossQuantity returns the GrossQuantity field. +func (p *PremiumRequestUsageItem) GetGrossQuantity() float64 { + if p == nil { + return 0 + } + return p.GrossQuantity +} + +// GetModel returns the Model field. +func (p *PremiumRequestUsageItem) GetModel() string { + if p == nil { + return "" + } + return p.Model } -// GetTargetID returns the TargetID field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetID() int64 { - if i == nil || i.TargetID == nil { +// GetNetAmount returns the NetAmount field. +func (p *PremiumRequestUsageItem) GetNetAmount() float64 { + if p == nil { return 0 } - return *i.TargetID + return p.NetAmount } -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetType() string { - if i == nil || i.TargetType == nil { - return "" +// GetNetQuantity returns the NetQuantity field. +func (p *PremiumRequestUsageItem) GetNetQuantity() float64 { + if p == nil { + return 0 } - return *i.TargetType + return p.NetQuantity } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// GetPricePerUnit returns the PricePerUnit field. +func (p *PremiumRequestUsageItem) GetPricePerUnit() float64 { + if p == nil { + return 0 } - return *i.UpdatedAt + return p.PricePerUnit } -// GetLogin returns the Login field. -func (i *InstallationChanges) GetLogin() *InstallationLoginChange { - if i == nil { - return nil +// GetProduct returns the Product field. +func (p *PremiumRequestUsageItem) GetProduct() string { + if p == nil { + return "" } - return i.Login + return p.Product } -// GetSlug returns the Slug field. -func (i *InstallationChanges) GetSlug() *InstallationSlugChange { - if i == nil { - return nil +// GetSKU returns the SKU field. +func (p *PremiumRequestUsageItem) GetSKU() string { + if p == nil { + return "" } - return i.Slug + return p.SKU } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationEvent) GetAction() string { - if i == nil || i.Action == nil { +// GetUnitType returns the UnitType field. +func (p *PremiumRequestUsageItem) GetUnitType() string { + if p == nil { return "" } - return *i.Action + return p.UnitType } -// GetInstallation returns the Installation field. -func (i *InstallationEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *p.Model } -// GetOrg returns the Org field. -func (i *InstallationEvent) GetOrg() *Organization { - if i == nil { - return nil +// 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 i.Org + return *p.Organization } -// GetRequester returns the Requester field. -func (i *InstallationEvent) GetRequester() *User { - if i == nil { - return nil +// 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 i.Requester + return *p.Product } -// GetSender returns the Sender field. -func (i *InstallationEvent) GetSender() *User { - if i == nil { - return nil +// GetTimePeriod returns the TimePeriod field. +func (p *PremiumRequestUsageReport) GetTimePeriod() PremiumRequestUsageTimePeriod { + if p == nil { + return PremiumRequestUsageTimePeriod{} } - return i.Sender + return p.TimePeriod } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (i *InstallationLoginChange) GetFrom() string { - if i == nil || i.From == nil { - return "" +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (p *PremiumRequestUsageReport) GetUsageItems() []*PremiumRequestUsageItem { + if p == nil || p.UsageItems == nil { + return nil } - return *i.From + return p.UsageItems } -// GetActions returns the Actions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetActions() string { - if i == nil || i.Actions == nil { +// 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 *i.Actions + return *p.User } -// GetActionsVariables returns the ActionsVariables field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetActionsVariables() string { - if i == nil || i.ActionsVariables == nil { - return "" +// 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 *i.ActionsVariables + return *p.Day } -// GetAdministration returns the Administration field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetAdministration() string { - if i == nil || i.Administration == nil { +// 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 *i.Administration + return *p.Model } -// GetAttestations returns the Attestations field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetAttestations() string { - if i == nil || i.Attestations == nil { - return "" +// 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 *i.Attestations + return *p.Month } -// GetBlocking returns the Blocking field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetBlocking() string { - if i == nil || i.Blocking == nil { +// 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 *i.Blocking + return *p.Product } -// GetChecks returns the Checks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetChecks() string { - if i == nil || i.Checks == nil { +// 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 *i.Checks + return *p.User } -// GetCodespaces returns the Codespaces field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespaces() string { - if i == nil || i.Codespaces == nil { - return "" +// 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 *i.Codespaces + return *p.Year } -// GetCodespacesLifecycleAdmin returns the CodespacesLifecycleAdmin field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesLifecycleAdmin() string { - if i == nil || i.CodespacesLifecycleAdmin == nil { - return "" +// 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 *i.CodespacesLifecycleAdmin + return *p.Day } -// GetCodespacesMetadata returns the CodespacesMetadata field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesMetadata() string { - if i == nil || i.CodespacesMetadata == nil { - return "" +// 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 *i.CodespacesMetadata + return *p.Month } -// GetCodespacesSecrets returns the CodespacesSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesSecrets() string { - if i == nil || i.CodespacesSecrets == nil { - return "" +// GetYear returns the Year field. +func (p *PremiumRequestUsageTimePeriod) GetYear() int { + if p == nil { + return 0 } - return *i.CodespacesSecrets + return p.Year } -// GetCodespacesUserSecrets returns the CodespacesUserSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesUserSecrets() string { - if i == nil || i.CodespacesUserSecrets == nil { +// GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. +func (p *PreReceiveHook) GetConfigURL() string { + if p == nil || p.ConfigURL == nil { return "" } - return *i.CodespacesUserSecrets + return *p.ConfigURL } -// GetContentReferences returns the ContentReferences field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetContentReferences() string { - if i == nil || i.ContentReferences == nil { +// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. +func (p *PreReceiveHook) GetEnforcement() string { + if p == nil || p.Enforcement == nil { return "" } - return *i.ContentReferences + return *p.Enforcement } -// GetContents returns the Contents field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetContents() string { - if i == nil || i.Contents == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PreReceiveHook) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *i.Contents + return *p.ID } -// GetCopilotMessages returns the CopilotMessages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCopilotMessages() string { - if i == nil || i.CopilotMessages == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PreReceiveHook) GetName() string { + if p == nil || p.Name == nil { return "" } - return *i.CopilotMessages + return *p.Name } -// GetDependabotSecrets returns the DependabotSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDependabotSecrets() string { - if i == nil || i.DependabotSecrets == nil { - return "" +// GetConfigurations returns the Configurations slice if it's non-nil, nil otherwise. +func (p *PrivateRegistries) GetConfigurations() []*PrivateRegistry { + if p == nil || p.Configurations == nil { + return nil } - return *i.DependabotSecrets + return p.Configurations } -// GetDeployments returns the Deployments field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDeployments() string { - if i == nil || i.Deployments == nil { - return "" +// 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 *i.Deployments + return *p.TotalCount } -// GetDiscussions returns the Discussions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDiscussions() string { - if i == nil || i.Discussions == nil { +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAccountID() string { + if p == nil || p.AccountID == nil { return "" } - return *i.Discussions + return *p.AccountID } -// GetEmails returns the Emails field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetEmails() string { - if i == nil || i.Emails == nil { +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAudience() string { + if p == nil || p.Audience == nil { return "" } - return *i.Emails + return *p.Audience } -// GetEnvironments returns the Environments field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetEnvironments() string { - if i == nil || i.Environments == nil { - return "" +// GetAuthType returns the AuthType field. +func (p *PrivateRegistry) GetAuthType() *PrivateRegistryAuthType { + if p == nil { + return nil } - return *i.Environments + return p.AuthType } -// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetFollowers() string { - if i == nil || i.Followers == nil { +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetAWSRegion() string { + if p == nil || p.AWSRegion == nil { return "" } - return *i.Followers + return *p.AWSRegion } -// GetGists returns the Gists field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetGists() string { - if i == nil || i.Gists == nil { +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetClientID() string { + if p == nil || p.ClientID == nil { return "" } - return *i.Gists + return *p.ClientID } -// GetGitSigningSSHPublicKeys returns the GitSigningSSHPublicKeys field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetGitSigningSSHPublicKeys() string { - if i == nil || i.GitSigningSSHPublicKeys == nil { - return "" +// 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 *i.GitSigningSSHPublicKeys + return *p.CreatedAt } -// GetGPGKeys returns the GPGKeys field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetGPGKeys() string { - if i == nil || i.GPGKeys == nil { +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomain() string { + if p == nil || p.Domain == nil { return "" } - return *i.GPGKeys + return *p.Domain } -// GetInteractionLimits returns the InteractionLimits field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetInteractionLimits() string { - if i == nil || i.InteractionLimits == nil { +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetDomainOwner() string { + if p == nil || p.DomainOwner == nil { return "" } - return *i.InteractionLimits + return *p.DomainOwner } -// GetIssues returns the Issues field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetIssues() string { - if i == nil || i.Issues == nil { +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetIdentityMappingName() string { + if p == nil || p.IdentityMappingName == nil { return "" } - return *i.Issues + return *p.IdentityMappingName } -// GetKeys returns the Keys field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetKeys() string { - if i == nil || i.Keys == nil { +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetJFrogOIDCProviderName() string { + if p == nil || p.JFrogOIDCProviderName == nil { return "" } - return *i.Keys + return *p.JFrogOIDCProviderName } -// GetMembers returns the Members field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetMembers() string { - if i == nil || i.Members == nil { +// 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 *i.Members + return *p.Name } -// GetMergeQueues returns the MergeQueues field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetMergeQueues() string { - if i == nil || i.MergeQueues == nil { - return "" +// GetRegistryType returns the RegistryType field. +func (p *PrivateRegistry) GetRegistryType() *PrivateRegistryType { + if p == nil { + return nil } - return *i.MergeQueues + return p.RegistryType } -// GetMetadata returns the Metadata field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetMetadata() string { - if i == nil || i.Metadata == nil { - return "" +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetReplacesBase() bool { + if p == nil || p.ReplacesBase == nil { + return false } - return *i.Metadata + return *p.ReplacesBase } -// GetOrganizationActionsVariables returns the OrganizationActionsVariables field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationActionsVariables() string { - if i == nil || i.OrganizationActionsVariables == nil { +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetRoleName() string { + if p == nil || p.RoleName == nil { return "" } - return *i.OrganizationActionsVariables + return *p.RoleName } -// GetOrganizationAdministration returns the OrganizationAdministration field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationAdministration() string { - if i == nil || i.OrganizationAdministration == nil { - return "" +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (p *PrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if p == nil || p.SelectedRepositoryIDs == nil { + return nil } - return *i.OrganizationAdministration + return p.SelectedRepositoryIDs } -// GetOrganizationAnnouncementBanners returns the OrganizationAnnouncementBanners field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationAnnouncementBanners() string { - if i == nil || i.OrganizationAnnouncementBanners == nil { +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetTenantID() string { + if p == nil || p.TenantID == nil { return "" } - return *i.OrganizationAnnouncementBanners + return *p.TenantID } -// GetOrganizationAPIInsights returns the OrganizationAPIInsights field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationAPIInsights() string { - if i == nil || i.OrganizationAPIInsights == nil { - return "" +// 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 *i.OrganizationAPIInsights + return *p.UpdatedAt } -// GetOrganizationCodespaces returns the OrganizationCodespaces field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCodespaces() string { - if i == nil || i.OrganizationCodespaces == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetURL() string { + if p == nil || p.URL == nil { return "" } - return *i.OrganizationCodespaces + return *p.URL } -// GetOrganizationCodespacesSecrets returns the OrganizationCodespacesSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCodespacesSecrets() string { - if i == nil || i.OrganizationCodespacesSecrets == nil { +// 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 *i.OrganizationCodespacesSecrets + return *p.Username } -// GetOrganizationCodespacesSettings returns the OrganizationCodespacesSettings field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCodespacesSettings() string { - if i == nil || i.OrganizationCodespacesSettings == nil { - return "" +// GetVisibility returns the Visibility field. +func (p *PrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if p == nil { + return nil } - return *i.OrganizationCodespacesSettings + return p.Visibility } -// GetOrganizationCopilotSeatManagement returns the OrganizationCopilotSeatManagement field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCopilotSeatManagement() string { - if i == nil || i.OrganizationCopilotSeatManagement == nil { +// GetHRef returns the HRef field if it's non-nil, zero value otherwise. +func (p *PRLink) GetHRef() string { + if p == nil || p.HRef == nil { return "" } - return *i.OrganizationCopilotSeatManagement + return *p.HRef } -// GetOrganizationCustomOrgRoles returns the OrganizationCustomOrgRoles field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomOrgRoles() string { - if i == nil || i.OrganizationCustomOrgRoles == nil { - return "" +// GetComments returns the Comments field. +func (p *PRLinks) GetComments() *PRLink { + if p == nil { + return nil } - return *i.OrganizationCustomOrgRoles + return p.Comments } -// GetOrganizationCustomProperties returns the OrganizationCustomProperties field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomProperties() string { - if i == nil || i.OrganizationCustomProperties == nil { - return "" +// GetCommits returns the Commits field. +func (p *PRLinks) GetCommits() *PRLink { + if p == nil { + return nil } - return *i.OrganizationCustomProperties + return p.Commits } -// GetOrganizationCustomRoles returns the OrganizationCustomRoles field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomRoles() string { - if i == nil || i.OrganizationCustomRoles == nil { - return "" +// GetHTML returns the HTML field. +func (p *PRLinks) GetHTML() *PRLink { + if p == nil { + return nil } - return *i.OrganizationCustomRoles + return p.HTML } -// GetOrganizationDependabotSecrets returns the OrganizationDependabotSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationDependabotSecrets() string { - if i == nil || i.OrganizationDependabotSecrets == nil { - return "" +// GetIssue returns the Issue field. +func (p *PRLinks) GetIssue() *PRLink { + if p == nil { + return nil } - return *i.OrganizationDependabotSecrets + return p.Issue } -// GetOrganizationEvents returns the OrganizationEvents field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationEvents() string { - if i == nil || i.OrganizationEvents == nil { - return "" +// GetReviewComment returns the ReviewComment field. +func (p *PRLinks) GetReviewComment() *PRLink { + if p == nil { + return nil } - return *i.OrganizationEvents + return p.ReviewComment } -// GetOrganizationHooks returns the OrganizationHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationHooks() string { - if i == nil || i.OrganizationHooks == nil { - return "" +// GetReviewComments returns the ReviewComments field. +func (p *PRLinks) GetReviewComments() *PRLink { + if p == nil { + return nil } - return *i.OrganizationHooks + return p.ReviewComments } -// GetOrganizationKnowledgeBases returns the OrganizationKnowledgeBases field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationKnowledgeBases() string { - if i == nil || i.OrganizationKnowledgeBases == nil { - return "" +// GetSelf returns the Self field. +func (p *PRLinks) GetSelf() *PRLink { + if p == nil { + return nil } - return *i.OrganizationKnowledgeBases + return p.Self } -// GetOrganizationPackages returns the OrganizationPackages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPackages() string { - if i == nil || i.OrganizationPackages == nil { - return "" +// GetStatuses returns the Statuses field. +func (p *PRLinks) GetStatuses() *PRLink { + if p == nil { + return nil } - return *i.OrganizationPackages + return p.Statuses } -// GetOrganizationPersonalAccessTokenRequests returns the OrganizationPersonalAccessTokenRequests field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPersonalAccessTokenRequests() string { - if i == nil || i.OrganizationPersonalAccessTokenRequests == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (p *ProjectBody) GetFrom() string { + if p == nil || p.From == nil { return "" } - return *i.OrganizationPersonalAccessTokenRequests + return *p.From } -// GetOrganizationPersonalAccessTokens returns the OrganizationPersonalAccessTokens field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPersonalAccessTokens() string { - if i == nil || i.OrganizationPersonalAccessTokens == nil { - return "" +// GetNote returns the Note field. +func (p *ProjectCardChange) GetNote() *ProjectCardNote { + if p == nil { + return nil } - return *i.OrganizationPersonalAccessTokens + return p.Note } -// GetOrganizationPlan returns the OrganizationPlan field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPlan() string { - if i == nil || i.OrganizationPlan == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (p *ProjectCardNote) GetFrom() string { + if p == nil || p.From == nil { return "" } - return *i.OrganizationPlan + return *p.From } -// GetOrganizationPreReceiveHooks returns the OrganizationPreReceiveHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPreReceiveHooks() string { - if i == nil || i.OrganizationPreReceiveHooks == nil { - return "" +// GetBody returns the Body field. +func (p *ProjectChange) GetBody() *ProjectBody { + if p == nil { + return nil } - return *i.OrganizationPreReceiveHooks + return p.Body } -// GetOrganizationProjects returns the OrganizationProjects field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationProjects() string { - if i == nil || i.OrganizationProjects == nil { - return "" +// GetName returns the Name field. +func (p *ProjectChange) GetName() *ProjectName { + if p == nil { + return nil } - return *i.OrganizationProjects + return p.Name } -// GetOrganizationSecrets returns the OrganizationSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationSecrets() string { - if i == nil || i.OrganizationSecrets == nil { - return "" +// GetName returns the Name field. +func (p *ProjectColumnChange) GetName() *ProjectColumnName { + if p == nil { + return nil } - return *i.OrganizationSecrets + return p.Name } -// GetOrganizationSelfHostedRunners returns the OrganizationSelfHostedRunners field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationSelfHostedRunners() string { - if i == nil || i.OrganizationSelfHostedRunners == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (p *ProjectColumnName) GetFrom() string { + if p == nil || p.From == nil { return "" } - return *i.OrganizationSelfHostedRunners + return *p.From } -// GetOrganizationUserBlocking returns the OrganizationUserBlocking field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationUserBlocking() string { - if i == nil || i.OrganizationUserBlocking == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (p *ProjectName) GetFrom() string { + if p == nil || p.From == nil { return "" } - return *i.OrganizationUserBlocking + return *p.From } -// GetPackages returns the Packages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPackages() string { - if i == nil || i.Packages == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetBody() string { + if p == nil || p.Body == nil { return "" } - return *i.Packages + return *p.Body } -// GetPages returns the Pages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPages() string { - if i == nil || i.Pages == nil { - return "" +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetClosedAt() Timestamp { + if p == nil || p.ClosedAt == nil { + return Timestamp{} } - return *i.Pages + return *p.ClosedAt } -// GetPlan returns the Plan field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPlan() string { - if i == nil || i.Plan == nil { +// GetColumnsURL returns the ColumnsURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetColumnsURL() string { + if p == nil || p.ColumnsURL == nil { return "" } - return *i.Plan + return *p.ColumnsURL } -// GetProfile returns the Profile field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetProfile() string { - if i == nil || i.Profile == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} } - return *i.Profile + return *p.CreatedAt } -// GetPullRequests returns the PullRequests field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPullRequests() string { - if i == nil || i.PullRequests == nil { - return "" +// GetCreator returns the Creator field. +func (p *ProjectV2) GetCreator() *User { + if p == nil { + return nil } - return *i.PullRequests + return p.Creator } -// GetRepositoryAdvisories returns the RepositoryAdvisories field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryAdvisories() string { - if i == nil || i.RepositoryAdvisories == nil { - return "" +// GetDeletedAt returns the DeletedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetDeletedAt() Timestamp { + if p == nil || p.DeletedAt == nil { + return Timestamp{} } - return *i.RepositoryAdvisories + return *p.DeletedAt } -// GetRepositoryCustomProperties returns the RepositoryCustomProperties field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryCustomProperties() string { - if i == nil || i.RepositoryCustomProperties == nil { - return "" +// GetDeletedBy returns the DeletedBy field. +func (p *ProjectV2) GetDeletedBy() *User { + if p == nil { + return nil } - return *i.RepositoryCustomProperties + return p.DeletedBy } -// GetRepositoryHooks returns the RepositoryHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryHooks() string { - if i == nil || i.RepositoryHooks == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetDescription() string { + if p == nil || p.Description == nil { return "" } - return *i.RepositoryHooks + return *p.Description } -// GetRepositoryPreReceiveHooks returns the RepositoryPreReceiveHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryPreReceiveHooks() string { - if i == nil || i.RepositoryPreReceiveHooks == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { return "" } - return *i.RepositoryPreReceiveHooks + return *p.HTMLURL } -// GetRepositoryProjects returns the RepositoryProjects field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryProjects() string { - if i == nil || i.RepositoryProjects == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *i.RepositoryProjects + return *p.ID } -// GetSecrets returns the Secrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetSecrets() string { - if i == nil || i.Secrets == nil { - return "" +// 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 *i.Secrets + return *p.IsTemplate } -// GetSecretScanningAlerts returns the SecretScanningAlerts field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetSecretScanningAlerts() string { - if i == nil || i.SecretScanningAlerts == nil { - return "" +// GetLatestStatusUpdate returns the LatestStatusUpdate field. +func (p *ProjectV2) GetLatestStatusUpdate() *ProjectV2StatusUpdate { + if p == nil { + return nil } - return *i.SecretScanningAlerts + return p.LatestStatusUpdate } -// GetSecurityEvents returns the SecurityEvents field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetSecurityEvents() string { - if i == nil || i.SecurityEvents == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetName() string { + if p == nil || p.Name == nil { return "" } - return *i.SecurityEvents + return *p.Name } -// GetSingleFile returns the SingleFile field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetSingleFile() string { - if i == nil || i.SingleFile == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *i.SingleFile + return *p.NodeID } -// GetStarring returns the Starring field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetStarring() string { - if i == nil || i.Starring == nil { - return "" +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetNumber() int { + if p == nil || p.Number == nil { + return 0 } - return *i.Starring + return *p.Number } -// GetStatuses returns the Statuses field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetStatuses() string { - if i == nil || i.Statuses == nil { +// GetOrganizationPermission returns the OrganizationPermission field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetOrganizationPermission() string { + if p == nil || p.OrganizationPermission == nil { return "" } - return *i.Statuses + return *p.OrganizationPermission } -// GetTeamDiscussions returns the TeamDiscussions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetTeamDiscussions() string { - if i == nil || i.TeamDiscussions == nil { - return "" +// GetOwner returns the Owner field. +func (p *ProjectV2) GetOwner() *User { + if p == nil { + return nil } - return *i.TeamDiscussions + return p.Owner } -// GetUserEvents returns the UserEvents field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetUserEvents() string { - if i == nil || i.UserEvents == nil { +// GetOwnerURL returns the OwnerURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetOwnerURL() string { + if p == nil || p.OwnerURL == nil { return "" } - return *i.UserEvents + return *p.OwnerURL } -// GetVulnerabilityAlerts returns the VulnerabilityAlerts field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetVulnerabilityAlerts() string { - if i == nil || i.VulnerabilityAlerts == nil { - return "" +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetPrivate() bool { + if p == nil || p.Private == nil { + return false } - return *i.VulnerabilityAlerts + return *p.Private } -// GetWatching returns the Watching field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetWatching() string { - if i == nil || i.Watching == nil { - return "" +// GetPublic returns the Public field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetPublic() bool { + if p == nil || p.Public == nil { + return false } - return *i.Watching + return *p.Public } -// GetWorkflows returns the Workflows field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetWorkflows() string { - if i == nil || i.Workflows == nil { +// GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetShortDescription() string { + if p == nil || p.ShortDescription == nil { return "" } - return *i.Workflows + return *p.ShortDescription } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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 *i.Action + return *p.State } -// GetInstallation returns the Installation field. -func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *p.Title } -// GetOrg returns the Org field. -func (i *InstallationRepositoriesEvent) GetOrg() *Organization { - if i == nil { - return nil +// 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 i.Org + return *p.UpdatedAt } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { - if i == nil || i.RepositorySelection == nil { +// 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 *i.RepositorySelection -} - -// GetSender returns the Sender field. -func (i *InstallationRepositoriesEvent) GetSender() *User { - if i == nil { - return nil - } - return i.Sender + return *p.URL } -// GetAccount returns the Account field. -func (i *InstallationRequest) GetAccount() *User { - if i == nil { - return nil +// 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 i.Account + return *p.Body } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *InstallationRequest) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { +func (p *ProjectV2DraftIssue) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { return Timestamp{} } - return *i.CreatedAt + return *p.CreatedAt } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *InstallationRequest) GetID() int64 { - if i == nil || i.ID == nil { +func (p *ProjectV2DraftIssue) GetID() int64 { + if p == nil || p.ID == nil { return 0 } - return *i.ID + return *p.ID } // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *InstallationRequest) GetNodeID() string { - if i == nil || i.NodeID == nil { +func (p *ProjectV2DraftIssue) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *i.NodeID + return *p.NodeID } -// GetRequester returns the Requester field. -func (i *InstallationRequest) GetRequester() *User { - if i == nil { - return nil +// 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 i.Requester + return *p.Title } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (i *InstallationSlugChange) GetFrom() string { - if i == nil || i.From == nil { - return "" +// 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 *i.From + return *p.UpdatedAt } -// GetAccount returns the Account field. -func (i *InstallationTargetEvent) GetAccount() *User { - if i == nil { +// GetUser returns the User field. +func (p *ProjectV2DraftIssue) GetUser() *User { + if p == nil { return nil } - return i.Account + return p.User } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationTargetEvent) GetAction() string { - if i == nil || i.Action == nil { +func (p *ProjectV2Event) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *i.Action + return *p.Action } -// GetChanges returns the Changes field. -func (i *InstallationTargetEvent) GetChanges() *InstallationChanges { - if i == nil { +// GetInstallation returns the Installation field. +func (p *ProjectV2Event) GetInstallation() *Installation { + if p == nil { return nil } - return i.Changes + return p.Installation } -// GetEnterprise returns the Enterprise field. -func (i *InstallationTargetEvent) GetEnterprise() *Enterprise { - if i == nil { +// GetOrg returns the Org field. +func (p *ProjectV2Event) GetOrg() *Organization { + if p == nil { return nil } - return i.Enterprise + return p.Org } -// GetInstallation returns the Installation field. -func (i *InstallationTargetEvent) GetInstallation() *Installation { - if i == nil { +// GetProjectsV2 returns the ProjectsV2 field. +func (p *ProjectV2Event) GetProjectsV2() *ProjectV2 { + if p == nil { return nil } - return i.Installation + return p.ProjectsV2 } -// GetOrganization returns the Organization field. -func (i *InstallationTargetEvent) GetOrganization() *Organization { - if i == nil { +// GetSender returns the Sender field. +func (p *ProjectV2Event) GetSender() *User { + if p == nil { return nil } - return i.Organization + return p.Sender } -// GetRepository returns the Repository field. -func (i *InstallationTargetEvent) GetRepository() *Repository { - if i == nil { +// GetConfiguration returns the Configuration field. +func (p *ProjectV2Field) GetConfiguration() *ProjectV2FieldConfiguration { + if p == nil { return nil } - return i.Repository + return p.Configuration } -// GetSender returns the Sender field. -func (i *InstallationTargetEvent) GetSender() *User { - if i == nil { - return nil +// 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 i.Sender + return *p.CreatedAt } -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (i *InstallationTargetEvent) GetTargetType() string { - if i == nil || i.TargetType == nil { +// 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 *i.TargetType + return *p.DataType } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (i *InstallationToken) GetExpiresAt() Timestamp { - if i == nil || i.ExpiresAt == nil { - return Timestamp{} +// 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 *i.ExpiresAt + return *p.ID } -// GetPermissions returns the Permissions field. -func (i *InstallationToken) GetPermissions() *InstallationPermissions { - if i == nil { - return nil +// 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 i.Permissions + return *p.Name } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (i *InstallationToken) GetToken() string { - if i == nil || i.Token == 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 *i.Token + return *p.NodeID } -// GetPermissions returns the Permissions field. -func (i *InstallationTokenListRepoOptions) GetPermissions() *InstallationPermissions { - if i == nil { +// GetOptions returns the Options slice if it's non-nil, nil otherwise. +func (p *ProjectV2Field) GetOptions() []*ProjectV2FieldOption { + if p == nil || p.Options == nil { return nil } - return i.Permissions + return p.Options } -// GetPermissions returns the Permissions field. -func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { - if i == nil { - return 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 i.Permissions + return *p.ProjectURL } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetExpiresAt() Timestamp { - if i == nil || i.ExpiresAt == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { return Timestamp{} } - return *i.ExpiresAt + return *p.UpdatedAt } -// GetLimit returns the Limit field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetLimit() string { - if i == nil || i.Limit == nil { - return "" +// 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 *i.Limit + return *p.Duration } -// GetOrigin returns the Origin field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetOrigin() string { - if i == nil || i.Origin == nil { - return "" +// GetIterations returns the Iterations slice if it's non-nil, nil otherwise. +func (p *ProjectV2FieldConfiguration) GetIterations() []*ProjectV2FieldIteration { + if p == nil || p.Iterations == nil { + return nil } - return *i.Origin + return p.Iterations } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Invitation) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} +// 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 *i.CreatedAt + return *p.StartDay } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (i *Invitation) GetEmail() string { - if i == nil || i.Email == nil { - return "" +// 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 *i.Email + return *p.Duration } -// GetFailedAt returns the FailedAt field if it's non-nil, zero value otherwise. -func (i *Invitation) GetFailedAt() Timestamp { - if i == nil || i.FailedAt == nil { - return Timestamp{} +// 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 *i.FailedAt + return *p.ID } -// GetFailedReason returns the FailedReason field if it's non-nil, zero value otherwise. -func (i *Invitation) GetFailedReason() string { - if i == nil || i.FailedReason == 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 *i.FailedReason + return *p.StartDate } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetID() int64 { - if i == nil || i.ID == nil { +// GetTitle returns the Title field. +func (p *ProjectV2FieldIteration) GetTitle() *ProjectV2TextContent { + if p == nil { + return nil + } + return p.Title +} + +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIterationConfiguration) GetDuration() int { + if p == nil || p.Duration == nil { return 0 } - return *i.ID + return *p.Duration } -// GetInvitationTeamURL returns the InvitationTeamURL field if it's non-nil, zero value otherwise. -func (i *Invitation) GetInvitationTeamURL() string { - if i == nil || i.InvitationTeamURL == nil { +// GetIterations returns the Iterations slice if it's non-nil, nil otherwise. +func (p *ProjectV2FieldIterationConfiguration) GetIterations() []*ProjectV2FieldIterationConfigurationIteration { + if p == nil || p.Iterations == nil { + return nil + } + return p.Iterations +} + +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIterationConfiguration) GetStartDate() string { + if p == nil || p.StartDate == nil { return "" } - return *i.InvitationTeamURL + return *p.StartDate } -// GetInviter returns the Inviter field. -func (i *Invitation) GetInviter() *User { - if i == nil { - return nil +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIterationConfigurationIteration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 } - return i.Inviter + return *p.Duration } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (i *Invitation) GetLogin() string { - if i == nil || i.Login == nil { +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIterationConfigurationIteration) GetStartDate() string { + if p == nil || p.StartDate == nil { return "" } - return *i.Login + return *p.StartDate } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetNodeID() string { - if i == nil || i.NodeID == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIterationConfigurationIteration) GetTitle() string { + if p == nil || p.Title == nil { return "" } - return *i.NodeID + return *p.Title } -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (i *Invitation) GetRole() string { - if i == nil || i.Role == 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 *i.Role + return *p.Color } -// GetTeamCount returns the TeamCount field if it's non-nil, zero value otherwise. -func (i *Invitation) GetTeamCount() int { - if i == nil || i.TeamCount == nil { - return 0 +// GetDescription returns the Description field. +func (p *ProjectV2FieldOption) GetDescription() *ProjectV2TextContent { + if p == nil { + return nil } - return *i.TeamCount + return p.Description } -// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. -func (i *Issue) GetActiveLockReason() string { - if i == nil || i.ActiveLockReason == nil { +// 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 *i.ActiveLockReason + return *p.ID } -// GetAssignee returns the Assignee field. -func (i *Issue) GetAssignee() *User { - if i == nil { +// GetName returns the Name field. +func (p *ProjectV2FieldOption) GetName() *ProjectV2TextContent { + if p == nil { return nil } - return i.Assignee + return p.Name } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (i *Issue) GetAuthorAssociation() string { - if i == nil || i.AuthorAssociation == nil { +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldSingleSelectOption) GetColor() string { + if p == nil || p.Color == nil { return "" } - return *i.AuthorAssociation + return *p.Color } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *Issue) GetBody() string { - if i == nil || i.Body == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldSingleSelectOption) GetDescription() string { + if p == nil || p.Description == nil { return "" } - return *i.Body + return *p.Description } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetClosedAt() Timestamp { - if i == nil || i.ClosedAt == nil { +// GetName returns the Name field. +func (p *ProjectV2FieldSingleSelectOption) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +// GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetArchivedAt() Timestamp { + if p == nil || p.ArchivedAt == nil { return Timestamp{} } - return *i.ClosedAt + return *p.ArchivedAt } -// GetClosedBy returns the ClosedBy field. -func (i *Issue) GetClosedBy() *User { - if i == nil { +// GetContent returns the Content field. +func (p *ProjectV2Item) GetContent() *ProjectV2ItemContent { + if p == nil { return nil } - return i.ClosedBy + return p.Content } -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (i *Issue) GetComments() int { - if i == nil || i.Comments == nil { - return 0 +// GetContentNodeID returns the ContentNodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetContentNodeID() string { + if p == nil || p.ContentNodeID == nil { + return "" } - return *i.Comments + return *p.ContentNodeID } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetCommentsURL() string { - if i == nil || i.CommentsURL == nil { - return "" +// GetContentType returns the ContentType field. +func (p *ProjectV2Item) GetContentType() *ProjectV2ItemContentType { + if p == nil { + return nil } - return *i.CommentsURL + return p.ContentType } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { +func (p *ProjectV2Item) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { return Timestamp{} } - return *i.CreatedAt + return *p.CreatedAt } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (i *Issue) GetDraft() bool { - if i == nil || i.Draft == nil { - return false +// GetCreator returns the Creator field. +func (p *ProjectV2Item) GetCreator() *User { + if p == nil { + return nil } - return *i.Draft + return p.Creator +} + +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (p *ProjectV2Item) GetFields() []*ProjectV2ItemFieldValue { + if p == nil || p.Fields == nil { + return nil + } + return p.Fields +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetEventsURL() string { - if i == nil || i.EventsURL == nil { +// 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 *i.EventsURL + return *p.ItemURL } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *i.HTMLURL + return *p.NodeID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *Issue) GetID() int64 { - if i == nil || i.ID == nil { - return 0 +// GetProjectNodeID returns the ProjectNodeID field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetProjectNodeID() string { + if p == nil || p.ProjectNodeID == nil { + return "" } - return *i.ID + return *p.ProjectNodeID } -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetLabelsURL() string { - if i == nil || i.LabelsURL == nil { +// 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 *i.LabelsURL + return *p.ProjectURL } -// GetLocked returns the Locked field if it's non-nil, zero value otherwise. -func (i *Issue) GetLocked() bool { - if i == nil || i.Locked == nil { - return false +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} } - return *i.Locked + return *p.UpdatedAt } -// GetMilestone returns the Milestone field. -func (i *Issue) GetMilestone() *Milestone { - if i == nil { +// GetArchivedAt returns the ArchivedAt field. +func (p *ProjectV2ItemChange) GetArchivedAt() *ArchivedAt { + if p == nil { return nil } - return i.Milestone -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Issue) GetNodeID() string { - if i == nil || i.NodeID == nil { - return "" - } - return *i.NodeID + return p.ArchivedAt } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (i *Issue) GetNumber() int { - if i == nil || i.Number == nil { - return 0 +// GetFieldValue returns the FieldValue field. +func (p *ProjectV2ItemChange) GetFieldValue() *FieldValue { + if p == nil { + return nil } - return *i.Number + return p.FieldValue } -// GetPullRequestLinks returns the PullRequestLinks field. -func (i *Issue) GetPullRequestLinks() *PullRequestLinks { - if i == nil { +// GetDraftIssue returns the DraftIssue field. +func (p *ProjectV2ItemContent) GetDraftIssue() *ProjectV2DraftIssue { + if p == nil { return nil } - return i.PullRequestLinks + return p.DraftIssue } -// GetReactions returns the Reactions field. -func (i *Issue) GetReactions() *Reactions { - if i == nil { +// GetIssue returns the Issue field. +func (p *ProjectV2ItemContent) GetIssue() *Issue { + if p == nil { return nil } - return i.Reactions + return p.Issue } -// GetRepository returns the Repository field. -func (i *Issue) GetRepository() *Repository { - if i == nil { +// GetPullRequest returns the PullRequest field. +func (p *ProjectV2ItemContent) GetPullRequest() *PullRequest { + if p == nil { return nil } - return i.Repository + return p.PullRequest } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemEvent) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *i.RepositoryURL + return *p.Action } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *Issue) GetState() string { - if i == nil || i.State == nil { - return "" +// GetChanges returns the Changes field. +func (p *ProjectV2ItemEvent) GetChanges() *ProjectV2ItemChange { + if p == nil { + return nil } - return *i.State + return p.Changes } -// GetStateReason returns the StateReason field if it's non-nil, zero value otherwise. -func (i *Issue) GetStateReason() string { - if i == nil || i.StateReason == nil { - return "" +// GetInstallation returns the Installation field. +func (p *ProjectV2ItemEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *i.StateReason + return p.Installation } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (i *Issue) GetTitle() string { - if i == nil || i.Title == nil { - return "" +// GetOrg returns the Org field. +func (p *ProjectV2ItemEvent) GetOrg() *Organization { + if p == nil { + return nil } - return *i.Title + return p.Org } -// GetType returns the Type field. -func (i *Issue) GetType() *IssueType { - if i == nil { +// GetProjectV2Item returns the ProjectV2Item field. +func (p *ProjectV2ItemEvent) GetProjectV2Item() *ProjectV2Item { + if p == nil { return nil } - return i.Type + return p.ProjectV2Item } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// GetSender returns the Sender field. +func (p *ProjectV2ItemEvent) GetSender() *User { + if p == nil { + return nil } - return *i.UpdatedAt + return p.Sender } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Issue) GetURL() string { - if i == nil || i.URL == nil { +// 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 *i.URL + return *p.DataType } -// GetUser returns the User field. -func (i *Issue) GetUser() *User { - if i == nil { - return nil +// 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 i.User + return *p.ID } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetAuthorAssociation() string { - if i == nil || i.AuthorAssociation == nil { +// 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 *i.AuthorAssociation + return *p.Name +} + +// GetValue returns the Value field. +func (p *ProjectV2ItemFieldValue) GetValue() any { + if p == nil { + return nil + } + return p.Value } // GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetBody() string { - if i == nil || i.Body == nil { +func (p *ProjectV2StatusUpdate) GetBody() string { + if p == nil || p.Body == nil { return "" } - return *i.Body + return *p.Body } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { +func (p *ProjectV2StatusUpdate) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { return Timestamp{} } - return *i.CreatedAt + return *p.CreatedAt } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { - return "" +// GetCreator returns the Creator field. +func (p *ProjectV2StatusUpdate) GetCreator() *User { + if p == nil { + return nil } - return *i.HTMLURL + return p.Creator } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetID() int64 { - if i == nil || i.ID == nil { +func (p *ProjectV2StatusUpdate) GetID() int64 { + if p == nil || p.ID == nil { return 0 } - return *i.ID + return *p.ID } -// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetIssueURL() string { - if i == nil || i.IssueURL == nil { +// 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 *i.IssueURL + return *p.NodeID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetNodeID() string { - if i == nil || i.NodeID == nil { +// 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 *i.NodeID + return *p.ProjectNodeID } -// GetReactions returns the Reactions field. -func (i *IssueComment) GetReactions() *Reactions { - if i == nil { - return nil +// 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 i.Reactions + return *p.StartDate } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// 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 *i.UpdatedAt + return *p.Status } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetURL() string { - if i == nil || i.URL == nil { +// 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 *i.URL + return *p.TargetDate } -// GetUser returns the User field. -func (i *IssueComment) GetUser() *User { - if i == nil { - return nil +// 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 i.User + return *p.UpdatedAt } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssueCommentEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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 *i.Action + return *p.HTML } -// GetChanges returns the Changes field. -func (i *IssueCommentEvent) GetChanges() *EditChange { - if i == nil { - return nil +// 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 i.Changes + return *p.Raw } -// GetComment returns the Comment field. -func (i *IssueCommentEvent) GetComment() *IssueComment { - if i == nil { - return nil +// GetCreatedAt returns the CreatedAt field. +func (p *ProjectV2View) GetCreatedAt() Timestamp { + if p == nil { + return Timestamp{} } - return i.Comment + return p.CreatedAt } -// GetInstallation returns the Installation field. -func (i *IssueCommentEvent) GetInstallation() *Installation { - if i == nil { - return nil +// GetCreator returns the Creator field. +func (p *ProjectV2View) GetCreator() User { + if p == nil { + return User{} } - return i.Installation + return p.Creator } -// GetIssue returns the Issue field. -func (i *IssueCommentEvent) GetIssue() *Issue { - if i == nil { - return nil +// GetFilter returns the Filter field if it's non-nil, zero value otherwise. +func (p *ProjectV2View) GetFilter() string { + if p == nil || p.Filter == nil { + return "" } - return i.Issue + return *p.Filter } -// GetOrganization returns the Organization field. -func (i *IssueCommentEvent) GetOrganization() *Organization { - if i == nil { +// GetGroupBy returns the GroupBy slice if it's non-nil, nil otherwise. +func (p *ProjectV2View) GetGroupBy() []int64 { + if p == nil || p.GroupBy == nil { return nil } - return i.Organization + return p.GroupBy } -// GetRepo returns the Repo field. -func (i *IssueCommentEvent) GetRepo() *Repository { - if i == nil { - return nil +// GetHTMLURL returns the HTMLURL field. +func (p *ProjectV2View) GetHTMLURL() string { + if p == nil { + return "" } - return i.Repo + return p.HTMLURL } -// GetSender returns the Sender field. -func (i *IssueCommentEvent) GetSender() *User { - if i == nil { - return nil +// GetID returns the ID field. +func (p *ProjectV2View) GetID() int64 { + if p == nil { + return 0 } - return i.Sender + return p.ID } -// GetActor returns the Actor field. -func (i *IssueEvent) GetActor() *User { - if i == nil { - return nil +// GetLayout returns the Layout field. +func (p *ProjectV2View) GetLayout() string { + if p == nil { + return "" } - return i.Actor + return p.Layout } -// GetAssignee returns the Assignee field. -func (i *IssueEvent) GetAssignee() *User { - if i == nil { - return nil +// GetName returns the Name field. +func (p *ProjectV2View) GetName() string { + if p == nil { + return "" } - return i.Assignee + return p.Name } -// GetAssigner returns the Assigner field. -func (i *IssueEvent) GetAssigner() *User { - if i == nil { - return nil +// GetNodeID returns the NodeID field. +func (p *ProjectV2View) GetNodeID() string { + if p == nil { + return "" } - return i.Assigner + return p.NodeID } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetCommitID() string { - if i == nil || i.CommitID == nil { +// GetNumber returns the Number field. +func (p *ProjectV2View) GetNumber() int { + if p == nil { + return 0 + } + return p.Number +} + +// GetProjectURL returns the ProjectURL field. +func (p *ProjectV2View) GetProjectURL() string { + if p == nil { return "" } - return *i.CommitID + return p.ProjectURL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { +// GetSortBy returns the SortBy slice if it's non-nil, nil otherwise. +func (p *ProjectV2View) GetSortBy() []*ProjectV2ViewSortBy { + if p == nil || p.SortBy == nil { + return nil + } + return p.SortBy +} + +// GetUpdatedAt returns the UpdatedAt field. +func (p *ProjectV2View) GetUpdatedAt() Timestamp { + if p == nil { return Timestamp{} } - return *i.CreatedAt + return p.UpdatedAt } -// GetDismissedReview returns the DismissedReview field. -func (i *IssueEvent) GetDismissedReview() *DismissedReview { - if i == nil { +// GetVerticalGroupBy returns the VerticalGroupBy slice if it's non-nil, nil otherwise. +func (p *ProjectV2View) GetVerticalGroupBy() []int64 { + if p == nil || p.VerticalGroupBy == nil { return nil } - return i.DismissedReview + return p.VerticalGroupBy } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetEvent() string { - if i == nil || i.Event == nil { - return "" +// GetVisibleFields returns the VisibleFields slice if it's non-nil, nil otherwise. +func (p *ProjectV2View) GetVisibleFields() []int64 { + if p == nil || p.VisibleFields == nil { + return nil } - return *i.Event + return p.VisibleFields } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetID() int64 { - if i == nil || i.ID == nil { - return 0 +// GetDirection returns the Direction field if it's non-nil, zero value otherwise. +func (p *ProjectV2ViewSortBy) GetDirection() string { + if p == nil || p.Direction == nil { + return "" } - return *i.ID + return *p.Direction } -// GetIssue returns the Issue field. -func (i *IssueEvent) GetIssue() *Issue { - if i == nil { - return nil +// GetFieldID returns the FieldID field if it's non-nil, zero value otherwise. +func (p *ProjectV2ViewSortBy) GetFieldID() int64 { + if p == nil || p.FieldID == nil { + return 0 } - return i.Issue + return *p.FieldID } -// GetLabel returns the Label field. -func (i *IssueEvent) GetLabel() *Label { - if i == nil { +// GetAllowDeletions returns the AllowDeletions field. +func (p *Protection) GetAllowDeletions() *AllowDeletions { + if p == nil { return nil } - return i.Label + return p.AllowDeletions } -// GetLockReason returns the LockReason field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetLockReason() string { - if i == nil || i.LockReason == nil { - return "" +// GetAllowForcePushes returns the AllowForcePushes field. +func (p *Protection) GetAllowForcePushes() *AllowForcePushes { + if p == nil { + return nil } - return *i.LockReason + return p.AllowForcePushes } -// GetMilestone returns the Milestone field. -func (i *IssueEvent) GetMilestone() *Milestone { - if i == nil { +// GetAllowForkSyncing returns the AllowForkSyncing field. +func (p *Protection) GetAllowForkSyncing() *AllowForkSyncing { + if p == nil { return nil } - return i.Milestone + return p.AllowForkSyncing } -// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. -func (i *IssueEvent) GetPerformedViaGithubApp() *App { - if i == nil { +// GetBlockCreations returns the BlockCreations field. +func (p *Protection) GetBlockCreations() *BlockCreations { + if p == nil { return nil } - return i.PerformedViaGithubApp + return p.BlockCreations } -// GetRename returns the Rename field. -func (i *IssueEvent) GetRename() *Rename { - if i == nil { +// GetEnforceAdmins returns the EnforceAdmins field. +func (p *Protection) GetEnforceAdmins() *AdminEnforcement { + if p == nil { return nil } - return i.Rename + return p.EnforceAdmins } -// GetRepository returns the Repository field. -func (i *IssueEvent) GetRepository() *Repository { - if i == nil { +// GetLockBranch returns the LockBranch field. +func (p *Protection) GetLockBranch() *LockBranch { + if p == nil { return nil } - return i.Repository + return p.LockBranch } -// GetRequestedReviewer returns the RequestedReviewer field. -func (i *IssueEvent) GetRequestedReviewer() *User { - if i == nil { +// GetRequiredConversationResolution returns the RequiredConversationResolution field. +func (p *Protection) GetRequiredConversationResolution() *RequiredConversationResolution { + if p == nil { return nil } - return i.RequestedReviewer + return p.RequiredConversationResolution } -// GetRequestedTeam returns the RequestedTeam field. -func (i *IssueEvent) GetRequestedTeam() *Team { - if i == nil { +// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. +func (p *Protection) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcement { + if p == nil { return nil } - return i.RequestedTeam + return p.RequiredPullRequestReviews } -// GetReviewRequester returns the ReviewRequester field. -func (i *IssueEvent) GetReviewRequester() *User { - if i == nil { +// GetRequiredSignatures returns the RequiredSignatures field. +func (p *Protection) GetRequiredSignatures() *SignaturesProtectedBranch { + if p == nil { return nil } - return i.ReviewRequester + return p.RequiredSignatures } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetURL() string { - if i == nil || i.URL == nil { - return "" +// GetRequiredStatusChecks returns the RequiredStatusChecks field. +func (p *Protection) GetRequiredStatusChecks() *RequiredStatusChecks { + if p == nil { + return nil } - return *i.URL + return p.RequiredStatusChecks } -// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetAssignee() string { - if i == nil || i.Assignee == nil { - return "" +// GetRequireLinearHistory returns the RequireLinearHistory field. +func (p *Protection) GetRequireLinearHistory() *RequireLinearHistory { + if p == nil { + return nil } - return *i.Assignee + return p.RequireLinearHistory } -// GetClosed returns the Closed field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetClosed() bool { - if i == nil || i.Closed == nil { - return false +// GetRestrictions returns the Restrictions field. +func (p *Protection) GetRestrictions() *BranchRestrictions { + if p == nil { + return nil } - return *i.Closed + return p.Restrictions } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetClosedAt() Timestamp { - if i == nil || i.ClosedAt == nil { - return Timestamp{} +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *Protection) GetURL() string { + if p == nil || p.URL == nil { + return "" } - return *i.ClosedAt + return *p.URL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} +// GetAdminEnforced returns the AdminEnforced field. +func (p *ProtectionChanges) GetAdminEnforced() *AdminEnforcedChanges { + if p == nil { + return nil } - return *i.CreatedAt + return p.AdminEnforced } -// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetMilestone() int { - if i == nil || i.Milestone == nil { - return 0 +// GetAllowDeletionsEnforcementLevel returns the AllowDeletionsEnforcementLevel field. +func (p *ProtectionChanges) GetAllowDeletionsEnforcementLevel() *AllowDeletionsEnforcementLevelChanges { + if p == nil { + return nil } - return *i.Milestone + return p.AllowDeletionsEnforcementLevel } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// GetAuthorizedActorNames returns the AuthorizedActorNames field. +func (p *ProtectionChanges) GetAuthorizedActorNames() *AuthorizedActorNames { + if p == nil { + return nil } - return *i.UpdatedAt + return p.AuthorizedActorNames } -// GetCode returns the Code field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetCode() string { - if i == nil || i.Code == nil { - return "" +// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field. +func (p *ProtectionChanges) GetAuthorizedActorsOnly() *AuthorizedActorsOnly { + if p == nil { + return nil } - return *i.Code + return p.AuthorizedActorsOnly } -// GetField returns the Field field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetField() string { - if i == nil || i.Field == nil { - return "" +// GetAuthorizedDismissalActorsOnly returns the AuthorizedDismissalActorsOnly field. +func (p *ProtectionChanges) GetAuthorizedDismissalActorsOnly() *AuthorizedDismissalActorsOnlyChanges { + if p == nil { + return nil } - return *i.Field + return p.AuthorizedDismissalActorsOnly } -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetLocation() string { - if i == nil || i.Location == nil { - return "" +// GetCreateProtected returns the CreateProtected field. +func (p *ProtectionChanges) GetCreateProtected() *CreateProtectedChanges { + if p == nil { + return nil } - return *i.Location + return p.CreateProtected } -// GetResource returns the Resource field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetResource() string { - if i == nil || i.Resource == nil { - return "" +// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field. +func (p *ProtectionChanges) GetDismissStaleReviewsOnPush() *DismissStaleReviewsOnPushChanges { + if p == nil { + return nil } - return *i.Resource + return p.DismissStaleReviewsOnPush } -// GetValue returns the Value field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetValue() string { - if i == nil || i.Value == nil { - return "" +// GetLinearHistoryRequirementEnforcementLevel returns the LinearHistoryRequirementEnforcementLevel field. +func (p *ProtectionChanges) GetLinearHistoryRequirementEnforcementLevel() *LinearHistoryRequirementEnforcementLevelChanges { + if p == nil { + return nil } - return *i.Value + return p.LinearHistoryRequirementEnforcementLevel } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} +// GetPullRequestReviewsEnforcementLevel returns the PullRequestReviewsEnforcementLevel field. +func (p *ProtectionChanges) GetPullRequestReviewsEnforcementLevel() *PullRequestReviewsEnforcementLevelChanges { + if p == nil { + return nil } - return *i.CreatedAt + return p.PullRequestReviewsEnforcementLevel } -// GetDocumentationURL returns the DocumentationURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetDocumentationURL() string { - if i == nil || i.DocumentationURL == nil { - return "" +// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field. +func (p *ProtectionChanges) GetRequireCodeOwnerReview() *RequireCodeOwnerReviewChanges { + if p == nil { + return nil } - return *i.DocumentationURL + return p.RequireCodeOwnerReview } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetID() int { - if i == nil || i.ID == nil { - return 0 +// GetRequiredConversationResolutionLevel returns the RequiredConversationResolutionLevel field. +func (p *ProtectionChanges) GetRequiredConversationResolutionLevel() *RequiredConversationResolutionLevelChanges { + if p == nil { + return nil } - return *i.ID + return p.RequiredConversationResolutionLevel } -// GetImportIssuesURL returns the ImportIssuesURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetImportIssuesURL() string { - if i == nil || i.ImportIssuesURL == nil { - return "" +// GetRequiredDeploymentsEnforcementLevel returns the RequiredDeploymentsEnforcementLevel field. +func (p *ProtectionChanges) GetRequiredDeploymentsEnforcementLevel() *RequiredDeploymentsEnforcementLevelChanges { + if p == nil { + return nil } - return *i.ImportIssuesURL + return p.RequiredDeploymentsEnforcementLevel } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetMessage() string { - if i == nil || i.Message == nil { - return "" +// GetRequiredStatusChecks returns the RequiredStatusChecks field. +func (p *ProtectionChanges) GetRequiredStatusChecks() *RequiredStatusChecksChanges { + if p == nil { + return nil } - return *i.Message + return p.RequiredStatusChecks } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { - return "" +// GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field. +func (p *ProtectionChanges) GetRequiredStatusChecksEnforcementLevel() *RequiredStatusChecksEnforcementLevelChanges { + if p == nil { + return nil } - return *i.RepositoryURL + return p.RequiredStatusChecksEnforcementLevel } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetStatus() string { - if i == nil || i.Status == nil { - return "" +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *ProtectionChanges) GetRequireLastPushApproval() *RequireLastPushApprovalChanges { + if p == nil { + return nil } - return *i.Status + return p.RequireLastPushApproval } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field. +func (p *ProtectionChanges) GetSignatureRequirementEnforcementLevel() *SignatureRequirementEnforcementLevelChanges { + if p == nil { + return nil } - return *i.UpdatedAt + return p.SignatureRequirementEnforcementLevel } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetURL() string { - if i == nil || i.URL == nil { - return "" +// GetAllowDeletions returns the AllowDeletions field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetAllowDeletions() bool { + if p == nil || p.AllowDeletions == nil { + return false } - return *i.URL + return *p.AllowDeletions } -// GetDirection returns the Direction field if it's non-nil, zero value otherwise. -func (i *IssueListCommentsOptions) GetDirection() string { - if i == nil || i.Direction == nil { - return "" +// GetAllowForcePushes returns the AllowForcePushes field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetAllowForcePushes() bool { + if p == nil || p.AllowForcePushes == nil { + return false } - return *i.Direction + return *p.AllowForcePushes } -// GetSince returns the Since field if it's non-nil, zero value otherwise. -func (i *IssueListCommentsOptions) GetSince() time.Time { - if i == nil || i.Since == nil { - return time.Time{} +// GetAllowForkSyncing returns the AllowForkSyncing field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetAllowForkSyncing() bool { + if p == nil || p.AllowForkSyncing == nil { + return false } - return *i.Since + return *p.AllowForkSyncing } -// GetSort returns the Sort field if it's non-nil, zero value otherwise. -func (i *IssueListCommentsOptions) GetSort() string { - if i == nil || i.Sort == nil { - return "" +// GetBlockCreations returns the BlockCreations field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetBlockCreations() bool { + if p == nil || p.BlockCreations == nil { + return false } - return *i.Sort + return *p.BlockCreations } -// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetAssignee() string { - if i == nil || i.Assignee == nil { - return "" +// GetEnforceAdmins returns the EnforceAdmins field. +func (p *ProtectionRequest) GetEnforceAdmins() bool { + if p == nil { + return false } - return *i.Assignee + return p.EnforceAdmins } -// GetAssignees returns the Assignees field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetAssignees() []string { - if i == nil || i.Assignees == nil { - return nil +// GetLockBranch returns the LockBranch field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetLockBranch() bool { + if p == nil || p.LockBranch == nil { + return false } - return *i.Assignees + return *p.LockBranch } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetBody() string { - if i == nil || i.Body == nil { - return "" +// GetRequiredConversationResolution returns the RequiredConversationResolution field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetRequiredConversationResolution() bool { + if p == nil || p.RequiredConversationResolution == nil { + return false } - return *i.Body + return *p.RequiredConversationResolution } -// GetLabels returns the Labels field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetLabels() []string { - if i == nil || i.Labels == nil { +// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. +func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest { + if p == nil { return nil } - return *i.Labels + return p.RequiredPullRequestReviews } -// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetMilestone() int { - if i == nil || i.Milestone == nil { - return 0 +// GetRequiredStatusChecks returns the RequiredStatusChecks field. +func (p *ProtectionRequest) GetRequiredStatusChecks() *RequiredStatusChecks { + if p == nil { + return nil } - return *i.Milestone + return p.RequiredStatusChecks } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetState() string { - if i == nil || i.State == nil { - return "" +// GetRequireLinearHistory returns the RequireLinearHistory field if it's non-nil, zero value otherwise. +func (p *ProtectionRequest) GetRequireLinearHistory() bool { + if p == nil || p.RequireLinearHistory == nil { + return false } - return *i.State + return *p.RequireLinearHistory } -// GetStateReason returns the StateReason field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetStateReason() string { - if i == nil || i.StateReason == nil { - return "" +// GetRestrictions returns the Restrictions field. +func (p *ProtectionRequest) GetRestrictions() *BranchRestrictionsRequest { + if p == nil { + return nil } - return *i.StateReason + return p.Restrictions } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetTitle() string { - if i == nil || i.Title == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *i.Title + return *p.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssuesEvent) GetAction() string { - if i == nil || i.Action == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *i.Action -} - -// GetAssignee returns the Assignee field. -func (i *IssuesEvent) GetAssignee() *User { - if i == nil { - return nil - } - return i.Assignee + return *p.NodeID } -// GetChanges returns the Changes field. -func (i *IssuesEvent) GetChanges() *EditChange { - if i == nil { - return nil +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetPreventSelfReview() bool { + if p == nil || p.PreventSelfReview == nil { + return false } - return i.Changes + return *p.PreventSelfReview } -// GetInstallation returns the Installation field. -func (i *IssuesEvent) GetInstallation() *Installation { - if i == nil { +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (p *ProtectionRule) GetReviewers() []*RequiredReviewer { + if p == nil || p.Reviewers == nil { return nil } - return i.Installation + return p.Reviewers } -// GetIssue returns the Issue field. -func (i *IssuesEvent) GetIssue() *Issue { - if i == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetType() string { + if p == nil || p.Type == nil { + return "" } - return i.Issue + return *p.Type } -// GetLabel returns the Label field. -func (i *IssuesEvent) GetLabel() *Label { - if i == nil { - return nil +// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetWaitTimer() int { + if p == nil || p.WaitTimer == nil { + return 0 } - return i.Label + return *p.WaitTimer } -// GetMilestone returns the Milestone field. -func (i *IssuesEvent) GetMilestone() *Milestone { - if i == nil { +// GetInstallation returns the Installation field. +func (p *PublicEvent) GetInstallation() *Installation { + if p == nil { return nil } - return i.Milestone + return p.Installation } // GetOrg returns the Org field. -func (i *IssuesEvent) GetOrg() *Organization { - if i == nil { +func (p *PublicEvent) GetOrg() *Organization { + if p == nil { return nil } - return i.Org + return p.Org } // GetRepo returns the Repo field. -func (i *IssuesEvent) GetRepo() *Repository { - if i == nil { +func (p *PublicEvent) GetRepo() *Repository { + if p == nil { return nil } - return i.Repo + return p.Repo } // GetSender returns the Sender field. -func (i *IssuesEvent) GetSender() *User { - if i == nil { +func (p *PublicEvent) GetSender() *User { + if p == nil { return nil } - return i.Sender -} - -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (i *IssuesSearchResult) GetIncompleteResults() bool { - if i == nil || i.IncompleteResults == nil { - return false - } - return *i.IncompleteResults + return p.Sender } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (i *IssuesSearchResult) GetTotal() int { - if i == nil || i.Total == nil { +// GetCurrentUsage returns the CurrentUsage field. +func (p *PublicIPUsage) GetCurrentUsage() int64 { + if p == nil { return 0 } - return *i.Total + return p.CurrentUsage } -// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetClosedIssues() int { - if i == nil || i.ClosedIssues == nil { +// GetMaximum returns the Maximum field. +func (p *PublicIPUsage) GetMaximum() int64 { + if p == nil { return 0 } - return *i.ClosedIssues + return p.Maximum } -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetOpenIssues() int { - if i == nil || i.OpenIssues == nil { - return 0 +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} } - return *i.OpenIssues + return *p.CreatedAt } -// GetTotalIssues returns the TotalIssues field if it's non-nil, zero value otherwise. -func (i *IssueStats) GetTotalIssues() int { - if i == nil || i.TotalIssues == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetID() int64 { + if p == nil || p.ID == nil { return 0 } - return *i.TotalIssues + return *p.ID } -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (i *IssueType) GetColor() string { - if i == nil || i.Color == nil { +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetKey() string { + if p == nil || p.Key == nil { return "" } - return *i.Color + return *p.Key } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *IssueType) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { - return Timestamp{} +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetKeyID() string { + if p == nil || p.KeyID == nil { + return "" } - return *i.CreatedAt + return *p.KeyID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (i *IssueType) GetDescription() string { - if i == nil || i.Description == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetTitle() string { + if p == nil || p.Title == nil { return "" } - return *i.Description + return *p.Title } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueType) GetID() int64 { - if i == nil || i.ID == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PublicKey) GetURL() string { + if p == nil || p.URL == nil { + return "" } - return *i.ID + return *p.URL } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (i *IssueType) GetName() string { - if i == nil || i.Name == nil { +func (p *PublishCodespaceRequest) GetName() string { + if p == nil || p.Name == nil { return "" } - return *i.Name + return *p.Name } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *IssueType) GetNodeID() string { - if i == nil || i.NodeID == nil { - return "" +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (p *PublishCodespaceRequest) GetPrivate() bool { + if p == nil || p.Private == nil { + return false } - return *i.NodeID + return *p.Private } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueType) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { - return Timestamp{} +// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetActiveLockReason() string { + if p == nil || p.ActiveLockReason == nil { + return "" } - return *i.UpdatedAt + return *p.ActiveLockReason } -// GetEncodedJITConfig returns the EncodedJITConfig field if it's non-nil, zero value otherwise. -func (j *JITRunnerConfig) GetEncodedJITConfig() string { - if j == nil || j.EncodedJITConfig == nil { - return "" +// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetAdditions() int { + if p == nil || p.Additions == nil { + return 0 } - return *j.EncodedJITConfig + return *p.Additions } -// GetRunner returns the Runner field. -func (j *JITRunnerConfig) GetRunner() *Runner { - if j == nil { +// GetAssignee returns the Assignee field. +func (p *PullRequest) GetAssignee() *User { + if p == nil { return nil } - return j.Runner + return p.Assignee } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (j *Jobs) GetTotalCount() int { - if j == nil || j.TotalCount == nil { - return 0 +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetAssignees() []*User { + if p == nil || p.Assignees == nil { + return nil } - return *j.TotalCount + return p.Assignees } -// GetAddedBy returns the AddedBy field if it's non-nil, zero value otherwise. -func (k *Key) GetAddedBy() string { - if k == nil || k.AddedBy == nil { +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetAuthorAssociation() string { + if p == nil || p.AuthorAssociation == nil { return "" } - return *k.AddedBy + return *p.AuthorAssociation } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (k *Key) GetCreatedAt() Timestamp { - if k == nil || k.CreatedAt == nil { - return Timestamp{} +// GetAutoMerge returns the AutoMerge field. +func (p *PullRequest) GetAutoMerge() *PullRequestAutoMerge { + if p == nil { + return nil } - return *k.CreatedAt + return p.AutoMerge } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (k *Key) GetID() int64 { - if k == nil || k.ID == nil { - return 0 +// GetBase returns the Base field. +func (p *PullRequest) GetBase() *PullRequestBranch { + if p == nil { + return nil } - return *k.ID + return p.Base } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (k *Key) GetKey() string { - if k == nil || k.Key == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetBody() string { + if p == nil || p.Body == nil { return "" } - return *k.Key + return *p.Body } -// GetLastUsed returns the LastUsed field if it's non-nil, zero value otherwise. -func (k *Key) GetLastUsed() Timestamp { - if k == nil || k.LastUsed == nil { - return Timestamp{} +// GetChangedFiles returns the ChangedFiles field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetChangedFiles() int { + if p == nil || p.ChangedFiles == nil { + return 0 } - return *k.LastUsed + return *p.ChangedFiles } -// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise. -func (k *Key) GetReadOnly() bool { - if k == nil || k.ReadOnly == nil { - return false +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetClosedAt() Timestamp { + if p == nil || p.ClosedAt == nil { + return Timestamp{} } - return *k.ReadOnly + return *p.ClosedAt } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (k *Key) GetTitle() string { - if k == nil || k.Title == nil { - return "" +// GetComments returns the Comments field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetComments() int { + if p == nil || p.Comments == nil { + return 0 } - return *k.Title + return *p.Comments } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (k *Key) GetURL() string { - if k == nil || k.URL == nil { +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetCommentsURL() string { + if p == nil || p.CommentsURL == nil { return "" } - return *k.URL + return *p.CommentsURL } -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (k *Key) GetVerified() bool { - if k == nil || k.Verified == nil { - return false +// GetCommits returns the Commits field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetCommits() int { + if p == nil || p.Commits == nil { + return 0 } - return *k.Verified + return *p.Commits } -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (l *Label) GetColor() string { - if l == nil || l.Color == nil { +// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetCommitsURL() string { + if p == nil || p.CommitsURL == nil { return "" } - return *l.Color -} - -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (l *Label) GetDefault() bool { - if l == nil || l.Default == nil { - return false - } - return *l.Default + return *p.CommitsURL } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *Label) GetDescription() string { - if l == nil || l.Description == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} } - return *l.Description + return *p.CreatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *Label) GetID() int64 { - if l == nil || l.ID == nil { +// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetDeletions() int { + if p == nil || p.Deletions == nil { return 0 } - return *l.ID + return *p.Deletions } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *Label) GetName() string { - if l == nil || l.Name == nil { +// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetDiffURL() string { + if p == nil || p.DiffURL == nil { return "" } - return *l.Name + return *p.DiffURL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (l *Label) GetNodeID() string { - if l == nil || l.NodeID == nil { - return "" +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetDraft() bool { + if p == nil || p.Draft == nil { + return false } - return *l.NodeID + return *p.Draft } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *Label) GetURL() string { - if l == nil || l.URL == nil { - return "" +// GetHead returns the Head field. +func (p *PullRequest) GetHead() *PullRequestBranch { + if p == nil { + return nil } - return *l.URL + return p.Head } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (l *LabelEvent) GetAction() string { - if l == nil || l.Action == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { return "" } - return *l.Action + return *p.HTMLURL } -// GetChanges returns the Changes field. -func (l *LabelEvent) GetChanges() *EditChange { - if l == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return l.Changes + return *p.ID } -// GetInstallation returns the Installation field. -func (l *LabelEvent) GetInstallation() *Installation { - if l == nil { - return nil +// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetIssueURL() string { + if p == nil || p.IssueURL == nil { + return "" } - return l.Installation + return *p.IssueURL } -// GetLabel returns the Label field. -func (l *LabelEvent) GetLabel() *Label { - if l == nil { +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetLabels() []*Label { + if p == nil || p.Labels == nil { return nil } - return l.Label + return p.Labels } -// GetOrg returns the Org field. -func (l *LabelEvent) GetOrg() *Organization { - if l == nil { +// GetLinks returns the Links field. +func (p *PullRequest) GetLinks() *PRLinks { + if p == nil { return nil } - return l.Org + return p.Links } -// GetRepo returns the Repo field. -func (l *LabelEvent) GetRepo() *Repository { - if l == nil { - return nil +// GetLocked returns the Locked field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetLocked() bool { + if p == nil || p.Locked == nil { + return false } - return l.Repo + return *p.Locked } -// GetSender returns the Sender field. -func (l *LabelEvent) GetSender() *User { - if l == nil { - return nil +// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMaintainerCanModify() bool { + if p == nil || p.MaintainerCanModify == nil { + return false } - return l.Sender + return *p.MaintainerCanModify } -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetColor() string { - if l == nil || l.Color == nil { - return "" +// GetMergeable returns the Mergeable field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMergeable() bool { + if p == nil || p.Mergeable == nil { + return false } - return *l.Color + return *p.Mergeable } -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetDefault() bool { - if l == nil || l.Default == nil { - return false +// GetMergeableState returns the MergeableState field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMergeableState() string { + if p == nil || p.MergeableState == nil { + return "" } - return *l.Default + return *p.MergeableState } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetDescription() string { - if l == nil || l.Description == nil { +// GetMergeCommitSHA returns the MergeCommitSHA field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMergeCommitSHA() string { + if p == nil || p.MergeCommitSHA == nil { return "" } - return *l.Description + return *p.MergeCommitSHA } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetID() int64 { - if l == nil || l.ID == nil { - return 0 +// GetMerged returns the Merged field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMerged() bool { + if p == nil || p.Merged == nil { + return false } - return *l.ID + return *p.Merged } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetName() string { - if l == nil || l.Name == nil { - return "" +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { + return Timestamp{} } - return *l.Name + return *p.MergedAt } -// GetScore returns the Score field. -func (l *LabelResult) GetScore() *float64 { - if l == nil { +// GetMergedBy returns the MergedBy field. +func (p *PullRequest) GetMergedBy() *User { + if p == nil { return nil } - return l.Score + return p.MergedBy } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetURL() string { - if l == nil || l.URL == nil { - return "" +// GetMilestone returns the Milestone field. +func (p *PullRequest) GetMilestone() *Milestone { + if p == nil { + return nil } - return *l.URL + return p.Milestone } -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (l *LabelsSearchResult) GetIncompleteResults() bool { - if l == nil || l.IncompleteResults == nil { - return false +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" } - return *l.IncompleteResults + return *p.NodeID } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *LabelsSearchResult) GetTotal() int { - if l == nil || l.Total == nil { +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetNumber() int { + if p == nil || p.Number == nil { return 0 } - return *l.Total + return *p.Number } -// GetOID returns the OID field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetOID() string { - if l == nil || l.OID == nil { +// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetPatchURL() string { + if p == nil || p.PatchURL == nil { return "" } - return *l.OID + return *p.PatchURL } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetPath() string { - if l == nil || l.Path == nil { - return "" +// GetRebaseable returns the Rebaseable field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetRebaseable() bool { + if p == nil || p.Rebaseable == nil { + return false } - return *l.Path + return *p.Rebaseable } -// GetRefName returns the RefName field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetRefName() string { - if l == nil || l.RefName == nil { - return "" +// GetRequestedReviewers returns the RequestedReviewers slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetRequestedReviewers() []*User { + if p == nil || p.RequestedReviewers == nil { + return nil } - return *l.RefName + return p.RequestedReviewers } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetSize() int { - if l == nil || l.Size == nil { - return 0 +// GetRequestedTeams returns the RequestedTeams slice if it's non-nil, nil otherwise. +func (p *PullRequest) GetRequestedTeams() []*Team { + if p == nil || p.RequestedTeams == nil { + return nil } - return *l.Size + return p.RequestedTeams } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (l *License) GetBody() string { - if l == nil || l.Body == nil { - return "" +// GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetReviewComments() int { + if p == nil || p.ReviewComments == nil { + return 0 } - return *l.Body + return *p.ReviewComments } -// GetConditions returns the Conditions field if it's non-nil, zero value otherwise. -func (l *License) GetConditions() []string { - if l == nil || l.Conditions == nil { - return nil +// GetReviewCommentsURL returns the ReviewCommentsURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetReviewCommentsURL() string { + if p == nil || p.ReviewCommentsURL == nil { + return "" } - return *l.Conditions + return *p.ReviewCommentsURL } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *License) GetDescription() string { - if l == nil || l.Description == nil { +// GetReviewCommentURL returns the ReviewCommentURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetReviewCommentURL() string { + if p == nil || p.ReviewCommentURL == nil { return "" } - return *l.Description + return *p.ReviewCommentURL } -// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. -func (l *License) GetFeatured() bool { - if l == nil || l.Featured == nil { - return false +// GetStack returns the Stack field. +func (p *PullRequest) GetStack() *PullRequestStack { + if p == nil { + return nil } - return *l.Featured + return p.Stack } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (l *License) GetHTMLURL() string { - if l == nil || l.HTMLURL == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetState() string { + if p == nil || p.State == nil { return "" } - return *l.HTMLURL + return *p.State } -// GetImplementation returns the Implementation field if it's non-nil, zero value otherwise. -func (l *License) GetImplementation() string { - if l == nil || l.Implementation == nil { +// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetStatusesURL() string { + if p == nil || p.StatusesURL == nil { return "" } - return *l.Implementation + return *p.StatusesURL } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (l *License) GetKey() string { - if l == nil || l.Key == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetTitle() string { + if p == nil || p.Title == nil { return "" } - return *l.Key + return *p.Title } -// GetLimitations returns the Limitations field if it's non-nil, zero value otherwise. -func (l *License) GetLimitations() []string { - if l == nil || l.Limitations == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} } - return *l.Limitations + return *p.UpdatedAt } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *License) GetName() string { - if l == nil || l.Name == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PullRequest) GetURL() string { + if p == nil || p.URL == nil { return "" } - return *l.Name + return *p.URL } -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (l *License) GetPermissions() []string { - if l == nil || l.Permissions == nil { +// GetUser returns the User field. +func (p *PullRequest) GetUser() *User { + if p == nil { return nil } - return *l.Permissions + return p.User } -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (l *License) GetSPDXID() string { - if l == nil || l.SPDXID == nil { - return "" +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (p *PullRequestAddToStackRequest) GetPullRequests() []int { + if p == nil || p.PullRequests == nil { + return nil } - return *l.SPDXID + return p.PullRequests } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *License) GetURL() string { - if l == nil || l.URL == nil { +// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. +func (p *PullRequestAutoMerge) GetCommitMessage() string { + if p == nil || p.CommitMessage == nil { return "" } - return *l.URL + return *p.CommitMessage } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (l *LicenseCheck) GetStatus() string { - if l == nil || l.Status == nil { +// GetCommitTitle returns the CommitTitle field if it's non-nil, zero value otherwise. +func (p *PullRequestAutoMerge) GetCommitTitle() string { + if p == nil || p.CommitTitle == nil { return "" } - return *l.Status + return *p.CommitTitle } -// GetAdvancedSecurityEnabled returns the AdvancedSecurityEnabled field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetAdvancedSecurityEnabled() bool { - if l == nil || l.AdvancedSecurityEnabled == nil { - return false +// GetEnabledBy returns the EnabledBy field. +func (p *PullRequestAutoMerge) GetEnabledBy() *User { + if p == nil { + return nil } - return *l.AdvancedSecurityEnabled + return p.EnabledBy } -// GetAdvancedSecuritySeats returns the AdvancedSecuritySeats field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetAdvancedSecuritySeats() int { - if l == nil || l.AdvancedSecuritySeats == nil { - return 0 +// GetMergeMethod returns the MergeMethod field if it's non-nil, zero value otherwise. +func (p *PullRequestAutoMerge) GetMergeMethod() string { + if p == nil || p.MergeMethod == nil { + return "" } - return *l.AdvancedSecuritySeats + return *p.MergeMethod } -// GetClusterSupport returns the ClusterSupport field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetClusterSupport() bool { - if l == nil || l.ClusterSupport == nil { - return false +// GetLabel returns the Label field if it's non-nil, zero value otherwise. +func (p *PullRequestBranch) GetLabel() string { + if p == nil || p.Label == nil { + return "" } - return *l.ClusterSupport + return *p.Label } -// GetCompany returns the Company field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetCompany() string { - if l == nil || l.Company == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (p *PullRequestBranch) GetRef() string { + if p == nil || p.Ref == nil { return "" } - return *l.Company + return *p.Ref } -// GetCroquetSupport returns the CroquetSupport field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetCroquetSupport() bool { - if l == nil || l.CroquetSupport == nil { - return false +// GetRepo returns the Repo field. +func (p *PullRequestBranch) GetRepo() *Repository { + if p == nil { + return nil } - return *l.CroquetSupport + return p.Repo } -// GetCustomTerms returns the CustomTerms field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetCustomTerms() bool { - if l == nil || l.CustomTerms == nil { - return false +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (p *PullRequestBranch) GetSHA() string { + if p == nil || p.SHA == nil { + return "" } - return *l.CustomTerms + return *p.SHA } -// GetEvaluation returns the Evaluation field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetEvaluation() bool { - if l == nil || l.Evaluation == nil { - return false +// GetUser returns the User field. +func (p *PullRequestBranch) GetUser() *User { + if p == nil { + return nil } - return *l.Evaluation + return p.User } -// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetExpireAt() Timestamp { - if l == nil || l.ExpireAt == nil { - return Timestamp{} +// GetParameters returns the Parameters field. +func (p *PullRequestBranchRule) GetParameters() PullRequestRuleParameters { + if p == nil { + return PullRequestRuleParameters{} } - return *l.ExpireAt + return p.Parameters } -// GetInsightsEnabled returns the InsightsEnabled field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetInsightsEnabled() bool { - if l == nil || l.InsightsEnabled == nil { - return false +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (p *PullRequestBranchUpdateResponse) GetMessage() string { + if p == nil || p.Message == nil { + return "" } - return *l.InsightsEnabled + return *p.Message } -// GetInsightsExpireAt returns the InsightsExpireAt field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetInsightsExpireAt() Timestamp { - if l == nil || l.InsightsExpireAt == nil { - return Timestamp{} +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PullRequestBranchUpdateResponse) GetURL() string { + if p == nil || p.URL == nil { + return "" } - return *l.InsightsExpireAt + return *p.URL } -// GetLearningLabEvaluationExpires returns the LearningLabEvaluationExpires field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetLearningLabEvaluationExpires() Timestamp { - if l == nil || l.LearningLabEvaluationExpires == nil { - return Timestamp{} +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetAuthorAssociation() string { + if p == nil || p.AuthorAssociation == nil { + return "" } - return *l.LearningLabEvaluationExpires + return *p.AuthorAssociation } -// GetLearningLabSeats returns the LearningLabSeats field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetLearningLabSeats() int { - if l == nil || l.LearningLabSeats == nil { - return 0 +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetBody() string { + if p == nil || p.Body == nil { + return "" } - return *l.LearningLabSeats + return *p.Body } -// GetPerpetual returns the Perpetual field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetPerpetual() bool { - if l == nil || l.Perpetual == nil { - return false +// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetBodyHTML() string { + if p == nil || p.BodyHTML == nil { + return "" } - return *l.Perpetual + return *p.BodyHTML } -// GetReferenceNumber returns the ReferenceNumber field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetReferenceNumber() string { - if l == nil || l.ReferenceNumber == nil { +// GetBodyText returns the BodyText field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetBodyText() string { + if p == nil || p.BodyText == nil { return "" } - return *l.ReferenceNumber + return *p.BodyText } -// GetSeats returns the Seats field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetSeats() int { - if l == nil || l.Seats == nil { - return 0 +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetCommitID() string { + if p == nil || p.CommitID == nil { + return "" } - return *l.Seats + return *p.CommitID } -// GetSSHAllowed returns the SSHAllowed field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetSSHAllowed() bool { - if l == nil || l.SSHAllowed == nil { - return false +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { + return Timestamp{} } - return *l.SSHAllowed + return *p.CreatedAt } -// GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetSupportKey() string { - if l == nil || l.SupportKey == nil { +// GetDiffHunk returns the DiffHunk field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetDiffHunk() string { + if p == nil || p.DiffHunk == nil { return "" } - return *l.SupportKey + return *p.DiffHunk } -// GetUnlimitedSeating returns the UnlimitedSeating field if it's non-nil, zero value otherwise. -func (l *LicenseStatus) GetUnlimitedSeating() bool { - if l == nil || l.UnlimitedSeating == nil { - return false +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" } - return *l.UnlimitedSeating + return *p.HTMLURL } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (l *LinearHistoryRequirementEnforcementLevelChanges) GetFrom() string { - if l == nil || l.From == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *l.From + return *p.ID } -// GetDirection returns the Direction field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetDirection() string { - if l == nil || l.Direction == nil { - return "" +// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetInReplyTo() int64 { + if p == nil || p.InReplyTo == nil { + return 0 } - return *l.Direction + return *p.InReplyTo } -// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetEcosystem() string { - if l == nil || l.Ecosystem == nil { +// GetLine returns the Line field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetLine() int { + if p == nil || p.Line == nil { + return 0 + } + return *p.Line +} + +// GetLinks returns the Links field. +func (p *PullRequestComment) GetLinks() *PullRequestCommentLinks { + if p == nil { + return nil + } + return p.Links +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *l.Ecosystem + return *p.NodeID } -// GetPackage returns the Package field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetPackage() string { - if l == nil || l.Package == nil { +// GetOriginalCommitID returns the OriginalCommitID field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetOriginalCommitID() string { + if p == nil || p.OriginalCommitID == nil { return "" } - return *l.Package + return *p.OriginalCommitID } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetScope() string { - if l == nil || l.Scope == nil { - return "" +// GetOriginalLine returns the OriginalLine field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetOriginalLine() int { + if p == nil || p.OriginalLine == nil { + return 0 } - return *l.Scope + return *p.OriginalLine } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetSeverity() string { - if l == nil || l.Severity == nil { - return "" +// GetOriginalPosition returns the OriginalPosition field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetOriginalPosition() int { + if p == nil || p.OriginalPosition == nil { + return 0 } - return *l.Severity + return *p.OriginalPosition } -// GetSort returns the Sort field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetSort() string { - if l == nil || l.Sort == nil { - return "" +// GetOriginalStartLine returns the OriginalStartLine field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetOriginalStartLine() int { + if p == nil || p.OriginalStartLine == nil { + return 0 } - return *l.Sort + return *p.OriginalStartLine } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetState() string { - if l == nil || l.State == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetPath() string { + if p == nil || p.Path == nil { return "" } - return *l.State + return *p.Path } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *ListArtifactsOptions) GetName() string { - if l == nil || l.Name == nil { - return "" +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetPosition() int { + if p == nil || p.Position == nil { + return 0 } - return *l.Name + return *p.Position } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetAppID() int64 { - if l == nil || l.AppID == nil { +// GetPullRequestReviewID returns the PullRequestReviewID field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetPullRequestReviewID() int64 { + if p == nil || p.PullRequestReviewID == nil { return 0 } - return *l.AppID + return *p.PullRequestReviewID } -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { +// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetPullRequestURL() string { + if p == nil || p.PullRequestURL == nil { return "" } - return *l.CheckName + return *p.PullRequestURL } -// GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetFilter() string { - if l == nil || l.Filter == nil { - return "" +// GetReactions returns the Reactions field. +func (p *PullRequestComment) GetReactions() *Reactions { + if p == nil { + return nil } - return *l.Filter + return p.Reactions } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetStatus() string { - if l == nil || l.Status == nil { +// GetSide returns the Side field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetSide() string { + if p == nil || p.Side == nil { return "" } - return *l.Status + return *p.Side } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsResults) GetTotal() int { - if l == nil || l.Total == nil { +// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetStartLine() int { + if p == nil || p.StartLine == nil { return 0 } - return *l.Total + return *p.StartLine } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetAppID() int { - if l == nil || l.AppID == nil { - return 0 +// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetStartSide() string { + if p == nil || p.StartSide == nil { + return "" } - return *l.AppID + return *p.StartSide } -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { +// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetSubjectType() string { + if p == nil || p.SubjectType == nil { return "" } - return *l.CheckName + return *p.SubjectType } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteResults) GetTotal() int { - if l == nil || l.Total == nil { - return 0 +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} } - return *l.Total + return *p.UpdatedAt } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListCodespaces) GetTotalCount() int { - if l == nil || l.TotalCount == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PullRequestComment) GetURL() string { + if p == nil || p.URL == nil { + return "" } - return *l.TotalCount + return *p.URL } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { - if l == nil || l.TotalCount == nil { - return 0 +// GetUser returns the User field. +func (p *PullRequestComment) GetUser() *User { + if p == nil { + return nil } - return *l.TotalCount + return p.User } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListDeploymentProtectionRuleResponse) GetTotalCount() int { - if l == nil || l.TotalCount == nil { - return 0 +// GetHTML returns the HTML field. +func (p *PullRequestCommentLinks) GetHTML() *PRLink { + if p == nil { + return nil } - return *l.TotalCount + return p.HTML } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (l *ListExternalGroupsOptions) GetDisplayName() string { - if l == nil || l.DisplayName == nil { - return "" +// GetPullRequest returns the PullRequest field. +func (p *PullRequestCommentLinks) GetPullRequest() *PRLink { + if p == nil { + return nil } - return *l.DisplayName + return p.PullRequest } -// GetAffects returns the Affects field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetAffects() string { - if l == nil || l.Affects == nil { - return "" +// GetSelf returns the Self field. +func (p *PullRequestCommentLinks) GetSelf() *PRLink { + if p == nil { + return nil } - return *l.Affects + return p.Self } -// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetCVEID() string { - if l == nil || l.CVEID == nil { - return "" +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (p *PullRequestCreateStackRequest) GetPullRequests() []int { + if p == nil || p.PullRequests == nil { + return nil } - return *l.CVEID + return p.PullRequests } -// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetEcosystem() string { - if l == nil || l.Ecosystem == nil { +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (p *PullRequestDismissReviewRequest) GetEvent() string { + if p == nil || p.Event == nil { return "" } - return *l.Ecosystem + return *p.Event } -// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetGHSAID() string { - if l == nil || l.GHSAID == nil { +// GetMessage returns the Message field. +func (p *PullRequestDismissReviewRequest) GetMessage() string { + if p == nil { return "" } - return *l.GHSAID + return p.Message } -// GetIsWithdrawn returns the IsWithdrawn field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetIsWithdrawn() bool { - if l == nil || l.IsWithdrawn == nil { - return false +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetAction() string { + if p == nil || p.Action == nil { + return "" } - return *l.IsWithdrawn + return *p.Action } -// GetModified returns the Modified field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetModified() string { - if l == nil || l.Modified == nil { +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetAfter() string { + if p == nil || p.After == nil { return "" } - return *l.Modified + return *p.After } -// GetPublished returns the Published field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetPublished() string { - if l == nil || l.Published == nil { - return "" +// GetAssignee returns the Assignee field. +func (p *PullRequestEvent) GetAssignee() *User { + if p == nil { + return nil } - return *l.Published + return p.Assignee } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetSeverity() string { - if l == nil || l.Severity == nil { +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetBefore() string { + if p == nil || p.Before == nil { return "" } - return *l.Severity + return *p.Before } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetType() string { - if l == nil || l.Type == nil { - return "" +// GetChanges returns the Changes field. +func (p *PullRequestEvent) GetChanges() *EditChange { + if p == nil { + return nil } - return *l.Type + return p.Changes } -// GetUpdated returns the Updated field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { - if l == nil || l.Updated == nil { - return "" +// GetInstallation returns the Installation field. +func (p *PullRequestEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *l.Updated + return p.Installation } -// 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 +// GetLabel returns the Label field. +func (p *PullRequestEvent) GetLabel() *Label { + if p == nil { + return nil } - return *l.TotalCount + return p.Label } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (l *ListRepositories) GetTotalCount() int { - if l == nil || l.TotalCount == nil { +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetNumber() int { + if p == nil || p.Number == nil { return 0 } - return *l.TotalCount + return *p.Number } -// 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 "" +// GetOrganization returns the Organization field. +func (p *PullRequestEvent) GetOrganization() *Organization { + if p == nil { + return nil } - return *l.Name + return p.Organization } -// 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 +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (p *PullRequestEvent) GetPerformedViaGithubApp() *App { + if p == nil { + return nil } - return *l.Count + return p.PerformedViaGithubApp } -// 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 "" +// GetPullRequest returns the PullRequest field. +func (p *PullRequestEvent) GetPullRequest() *PullRequest { + if p == nil { + return nil } - return *l.Filter + return p.PullRequest } -// 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 +// 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 *l.StartIndex + return *p.Reason } -// 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 +// GetRepo returns the Repo field. +func (p *PullRequestEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *l.EndColumn + return p.Repo } -// 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 +// GetRequestedReviewer returns the RequestedReviewer field. +func (p *PullRequestEvent) GetRequestedReviewer() *User { + if p == nil { + return nil } - return *l.EndLine + return p.RequestedReviewer } -// 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 "" +// GetRequestedTeam returns the RequestedTeam field. +func (p *PullRequestEvent) GetRequestedTeam() *Team { + if p == nil { + return nil } - return *l.Path + return p.RequestedTeam } -// 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 +// GetSender returns the Sender field. +func (p *PullRequestEvent) GetSender() *User { + if p == nil { + return nil } - return *l.StartColumn + return p.Sender } -// 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 +// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetDiffURL() string { + if p == nil || p.DiffURL == nil { + return "" } - return *l.StartLine + return *p.DiffURL } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (l *LockBranch) GetEnabled() bool { - if l == nil || l.Enabled == nil { - return false +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { + return "" } - return *l.Enabled + return *p.HTMLURL } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (m *MaintenanceOperationStatus) GetHostname() string { - if m == nil || m.Hostname == nil { - return "" +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { + return Timestamp{} } - return *m.Hostname + return *p.MergedAt } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (m *MaintenanceOperationStatus) GetMessage() string { - if m == nil || m.Message == nil { +// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetPatchURL() string { + if p == nil || p.PatchURL == nil { return "" } - return *m.Message + return *p.PatchURL } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (m *MaintenanceOperationStatus) GetUUID() string { - if m == nil || m.UUID == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetURL() string { + if p == nil || p.URL == nil { return "" } - return *m.UUID + return *p.URL } -// GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. -func (m *MaintenanceOptions) GetMaintenanceModeMessage() string { - if m == nil || m.MaintenanceModeMessage == nil { +// GetDirection returns the Direction field. +func (p *PullRequestListCommentsOptions) GetDirection() string { + if p == nil { return "" } - return *m.MaintenanceModeMessage + return p.Direction } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (m *MaintenanceOptions) GetUUID() string { - if m == nil || m.UUID == nil { - return "" +// GetSince returns the Since field. +func (p *PullRequestListCommentsOptions) GetSince() time.Time { + if p == nil { + return time.Time{} } - return *m.UUID + return p.Since } -// GetWhen returns the When field if it's non-nil, zero value otherwise. -func (m *MaintenanceOptions) GetWhen() string { - if m == nil || m.When == nil { +// GetSort returns the Sort field. +func (p *PullRequestListCommentsOptions) GetSort() string { + if p == nil { return "" } - return *m.When + return p.Sort } -// GetCanUnsetMaintenance returns the CanUnsetMaintenance field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetCanUnsetMaintenance() bool { - if m == nil || m.CanUnsetMaintenance == nil { - return false +// GetBase returns the Base field. +func (p *PullRequestListOptions) GetBase() string { + if p == nil { + return "" } - return *m.CanUnsetMaintenance + return p.Base } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetHostname() string { - if m == nil || m.Hostname == nil { +// GetDirection returns the Direction field. +func (p *PullRequestListOptions) GetDirection() string { + if p == nil { return "" } - return *m.Hostname + return p.Direction } -// GetMaintenanceModeMessage returns the MaintenanceModeMessage field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetMaintenanceModeMessage() string { - if m == nil || m.MaintenanceModeMessage == nil { +// GetHead returns the Head field. +func (p *PullRequestListOptions) GetHead() string { + if p == nil { return "" } - return *m.MaintenanceModeMessage + return p.Head } -// GetScheduledTime returns the ScheduledTime field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetScheduledTime() Timestamp { - if m == nil || m.ScheduledTime == nil { - return Timestamp{} +// GetSort returns the Sort field. +func (p *PullRequestListOptions) GetSort() string { + if p == nil { + return "" } - return *m.ScheduledTime + return p.Sort } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetStatus() string { - if m == nil || m.Status == nil { +// GetState returns the State field. +func (p *PullRequestListOptions) GetState() string { + if p == nil { return "" } - return *m.Status + return p.State } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (m *MaintenanceStatus) GetUUID() string { - if m == nil || m.UUID == nil { - return "" +// GetPullRequest returns the PullRequest field. +func (p *PullRequestListStacksOptions) GetPullRequest() int { + if p == nil { + return 0 } - return *m.UUID + return p.PullRequest } -// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp { - if m == nil || m.EffectiveDate == nil { - return Timestamp{} +// GetExpectedHeadSHA returns the ExpectedHeadSHA field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetExpectedHeadSHA() string { + if p == nil || p.ExpectedHeadSHA == nil { + return "" } - return *m.EffectiveDate + return *p.ExpectedHeadSHA } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetMergeAction returns the MergeAction field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetMergeAction() string { + if p == nil || p.MergeAction == nil { + return "" } - return *m.ID + return *p.MergeAction } -// GetPlan returns the Plan field. -func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { - if m == nil { - return nil +// GetMergeMethod returns the MergeMethod field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetMergeMethod() string { + if p == nil || p.MergeMethod == nil { + return "" } - return m.Plan + return *p.MergeMethod } -// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. -func (m *MarketplacePendingChange) GetUnitCount() int { - if m == nil || m.UnitCount == nil { - return 0 +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetMessage() string { + if p == nil || p.Message == nil { + return "" } - return *m.UnitCount + return *p.Message } -// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetAccountsURL() string { - if m == nil || m.AccountsURL == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetSHA() string { + if p == nil || p.SHA == nil { return "" } - return *m.AccountsURL + return *p.SHA } -// GetBullets returns the Bullets field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetBullets() []string { - if m == nil || m.Bullets == nil { - return nil +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncDetails) GetUUID() string { + if p == nil || p.UUID == nil { + return "" } - return *m.Bullets + return *p.UUID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetDescription() string { - if m == nil || m.Description == nil { +// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncRequest) GetCommitMessage() string { + if p == nil || p.CommitMessage == nil { return "" } - return *m.Description + return *p.CommitMessage } -// GetHasFreeTrial returns the HasFreeTrial field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetHasFreeTrial() bool { - if m == nil || m.HasFreeTrial == nil { - return false +// GetCommitTitle returns the CommitTitle field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncRequest) GetCommitTitle() string { + if p == nil || p.CommitTitle == nil { + return "" } - return *m.HasFreeTrial + return *p.CommitTitle } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetMergeAction returns the MergeAction field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncRequest) GetMergeAction() string { + if p == nil || p.MergeAction == nil { + return "" } - return *m.ID + return *p.MergeAction } -// GetMonthlyPriceInCents returns the MonthlyPriceInCents field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetMonthlyPriceInCents() int { - if m == nil || m.MonthlyPriceInCents == nil { - return 0 +// GetMergeMethod returns the MergeMethod field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncRequest) GetMergeMethod() string { + if p == nil || p.MergeMethod == nil { + return "" } - return *m.MonthlyPriceInCents + return *p.MergeMethod } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetName() string { - if m == nil || m.Name == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncRequest) GetSHA() string { + if p == nil || p.SHA == nil { return "" } - return *m.Name + return *p.SHA } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetNumber() int { - if m == nil || m.Number == nil { - return 0 +// GetDetails returns the Details field. +func (p *PullRequestMergeAsyncResult) GetDetails() *PullRequestMergeAsyncDetails { + if p == nil { + return nil } - return *m.Number + return p.Details } -// GetPriceModel returns the PriceModel field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetPriceModel() string { - if m == nil || m.PriceModel == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeAsyncResult) GetStatus() string { + if p == nil || p.Status == nil { return "" } - return *m.PriceModel + return *p.Status } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetState() string { - if m == nil || m.State == nil { - return "" +// GetMerged returns the Merged field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeResult) GetMerged() bool { + if p == nil || p.Merged == nil { + return false } - return *m.State + return *p.Merged } -// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetUnitName() string { - if m == nil || m.UnitName == nil { +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeResult) GetMessage() string { + if p == nil || p.Message == nil { return "" } - return *m.UnitName + return *p.Message } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetURL() string { - if m == nil || m.URL == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (p *PullRequestMergeResult) GetSHA() string { + if p == nil || p.SHA == nil { return "" } - return *m.URL + return *p.SHA } -// GetYearlyPriceInCents returns the YearlyPriceInCents field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetYearlyPriceInCents() int { - if m == nil || m.YearlyPriceInCents == nil { - return 0 +// GetCommitTitle returns the CommitTitle field. +func (p *PullRequestOptions) GetCommitTitle() string { + if p == nil { + return "" } - return *m.YearlyPriceInCents + return p.CommitTitle } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetDontDefaultIfBlank returns the DontDefaultIfBlank field. +func (p *PullRequestOptions) GetDontDefaultIfBlank() bool { + if p == nil { + return false } - return *m.ID + return p.DontDefaultIfBlank } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetLogin() string { - if m == nil || m.Login == nil { +// GetMergeMethod returns the MergeMethod field. +func (p *PullRequestOptions) GetMergeMethod() string { + if p == nil { return "" } - return *m.Login + return p.MergeMethod } -// GetMarketplacePendingChange returns the MarketplacePendingChange field. -func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { - if m == nil { - return nil +// GetSHA returns the SHA field. +func (p *PullRequestOptions) GetSHA() string { + if p == nil { + return "" } - return m.MarketplacePendingChange + return p.SHA } -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetAuthorAssociation() string { + if p == nil || p.AuthorAssociation == nil { + return "" } - return m.MarketplacePurchase + return *p.AuthorAssociation } -// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetOrganizationBillingEmail() string { - if m == nil || m.OrganizationBillingEmail == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetBody() string { + if p == nil || p.Body == nil { return "" } - return *m.OrganizationBillingEmail + return *p.Body } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetType() string { - if m == nil || m.Type == nil { +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetCommitID() string { + if p == nil || p.CommitID == nil { return "" } - return *m.Type + return *p.CommitID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetURL() string { - if m == nil || m.URL == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { return "" } - return *m.URL + return *p.HTMLURL } -// GetAccount returns the Account field. -func (m *MarketplacePurchase) GetAccount() *MarketplacePurchaseAccount { - if m == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return m.Account + return *p.ID } -// GetBillingCycle returns the BillingCycle field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetBillingCycle() string { - if m == nil || m.BillingCycle == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *m.BillingCycle + return *p.NodeID } -// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp { - if m == nil || m.FreeTrialEndsOn == nil { - return Timestamp{} +// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetPullRequestURL() string { + if p == nil || p.PullRequestURL == nil { + return "" } - return *m.FreeTrialEndsOn + return *p.PullRequestURL } -// GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetNextBillingDate() Timestamp { - if m == nil || m.NextBillingDate == nil { - return Timestamp{} +// GetState returns the State field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetState() string { + if p == nil || p.State == nil { + return "" } - return *m.NextBillingDate + return *p.State } -// GetOnFreeTrial returns the OnFreeTrial field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetOnFreeTrial() bool { - if m == nil || m.OnFreeTrial == nil { - return false +// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestReview) GetSubmittedAt() Timestamp { + if p == nil || p.SubmittedAt == nil { + return Timestamp{} } - return *m.OnFreeTrial + return *p.SubmittedAt } -// GetPlan returns the Plan field. -func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { - if m == nil { +// GetUser returns the User field. +func (p *PullRequestReview) GetUser() *User { + if p == nil { return nil } - return m.Plan + return p.User } -// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetUnitCount() int { - if m == nil || m.UnitCount == nil { - return 0 +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewCommentEvent) GetAction() string { + if p == nil || p.Action == nil { + return "" } - return *m.UnitCount + return *p.Action } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetUpdatedAt() Timestamp { - if m == nil || m.UpdatedAt == nil { - return Timestamp{} +// GetChanges returns the Changes field. +func (p *PullRequestReviewCommentEvent) GetChanges() *EditChange { + if p == nil { + return nil } - return *m.UpdatedAt + return p.Changes } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetEmail() string { - if m == nil || m.Email == nil { - return "" +// GetComment returns the Comment field. +func (p *PullRequestReviewCommentEvent) GetComment() *PullRequestComment { + if p == nil { + return nil } - return *m.Email + return p.Comment } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetInstallation returns the Installation field. +func (p *PullRequestReviewCommentEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *m.ID + return p.Installation } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetLogin() string { - if m == nil || m.Login == nil { - return "" +// GetOrg returns the Org field. +func (p *PullRequestReviewCommentEvent) GetOrg() *Organization { + if p == nil { + return nil } - return *m.Login + return p.Org } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetNodeID() string { - if m == nil || m.NodeID == nil { - return "" +// GetPullRequest returns the PullRequest field. +func (p *PullRequestReviewCommentEvent) GetPullRequest() *PullRequest { + if p == nil { + return nil } - return *m.NodeID + return p.PullRequest } -// GetOrganizationBillingEmail returns the OrganizationBillingEmail field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetOrganizationBillingEmail() string { - if m == nil || m.OrganizationBillingEmail == nil { - return "" +// GetRepo returns the Repo field. +func (p *PullRequestReviewCommentEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *m.OrganizationBillingEmail + return p.Repo } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetType() string { - if m == nil || m.Type == nil { - return "" +// GetSender returns the Sender field. +func (p *PullRequestReviewCommentEvent) GetSender() *User { + if p == nil { + return nil } - return *m.Type + return p.Sender } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetURL() string { - if m == nil || m.URL == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewEvent) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *m.URL + return *p.Action } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" +// GetChanges returns the Changes field. +func (p *PullRequestReviewEvent) GetChanges() *EditChange { + if p == nil { + return nil } - return *m.Action + return p.Changes } -// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp { - if m == nil || m.EffectiveDate == nil { - return Timestamp{} +// GetInstallation returns the Installation field. +func (p *PullRequestReviewEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *m.EffectiveDate + return p.Installation } -// GetInstallation returns the Installation field. -func (m *MarketplacePurchaseEvent) GetInstallation() *Installation { - if m == nil { +// GetOrganization returns the Organization field. +func (p *PullRequestReviewEvent) GetOrganization() *Organization { + if p == nil { return nil } - return m.Installation + return p.Organization } -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { +// GetPullRequest returns the PullRequest field. +func (p *PullRequestReviewEvent) GetPullRequest() *PullRequest { + if p == nil { return nil } - return m.MarketplacePurchase + return p.PullRequest } -// GetOrg returns the Org field. -func (m *MarketplacePurchaseEvent) GetOrg() *Organization { - if m == nil { +// GetRepo returns the Repo field. +func (p *PullRequestReviewEvent) GetRepo() *Repository { + if p == nil { return nil } - return m.Org + return p.Repo } -// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { - if m == nil { +// GetReview returns the Review field. +func (p *PullRequestReviewEvent) GetReview() *PullRequestReview { + if p == nil { return nil } - return m.PreviousMarketplacePurchase + return p.Review } // GetSender returns the Sender field. -func (m *MarketplacePurchaseEvent) GetSender() *User { - if m == nil { +func (p *PullRequestReviewEvent) GetSender() *User { + if p == nil { return nil } - return m.Sender + return p.Sender } -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (m *Match) GetText() string { - if m == nil || m.Text == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewRequest) GetBody() string { + if p == nil || p.Body == nil { return "" } - return *m.Text + return *p.Body } -// GetPermission returns the Permission field. -func (m *MemberChanges) GetPermission() *MemberChangesPermission { - if m == nil { +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (p *PullRequestReviewRequest) GetComments() []*DraftReviewComment { + if p == nil || p.Comments == nil { return nil } - return m.Permission + return p.Comments } -// GetRoleName returns the RoleName field. -func (m *MemberChanges) GetRoleName() *MemberChangesRoleName { - if m == nil { - return nil +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewRequest) GetCommitID() string { + if p == nil || p.CommitID == nil { + return "" } - return m.RoleName + return *p.CommitID } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (m *MemberChangesPermission) GetFrom() string { - if m == nil || m.From == nil { +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewRequest) GetEvent() string { + if p == nil || p.Event == nil { return "" } - return *m.From + return *p.Event } -// GetTo returns the To field if it's non-nil, zero value otherwise. -func (m *MemberChangesPermission) GetTo() string { - if m == nil || m.To == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewRequest) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *m.To + return *p.NodeID } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (m *MemberChangesRoleName) GetFrom() string { - if m == nil || m.From == nil { - return "" +// GetBypassPullRequestAllowances returns the BypassPullRequestAllowances field. +func (p *PullRequestReviewsEnforcement) GetBypassPullRequestAllowances() *BypassPullRequestAllowances { + if p == nil { + return nil } - return *m.From + return p.BypassPullRequestAllowances } -// GetTo returns the To field if it's non-nil, zero value otherwise. -func (m *MemberChangesRoleName) GetTo() string { - if m == nil || m.To == nil { - return "" +// GetDismissalRestrictions returns the DismissalRestrictions field. +func (p *PullRequestReviewsEnforcement) GetDismissalRestrictions() *DismissalRestrictions { + if p == nil { + return nil } - return *m.To + return p.DismissalRestrictions } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MemberEvent) GetAction() string { - if m == nil || m.Action == nil { +// GetDismissStaleReviews returns the DismissStaleReviews field. +func (p *PullRequestReviewsEnforcement) GetDismissStaleReviews() bool { + if p == nil { + return false + } + return p.DismissStaleReviews +} + +// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field. +func (p *PullRequestReviewsEnforcement) GetRequireCodeOwnerReviews() bool { + if p == nil { + return false + } + return p.RequireCodeOwnerReviews +} + +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcement) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 + } + return p.RequiredApprovingReviewCount +} + +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *PullRequestReviewsEnforcement) GetRequireLastPushApproval() bool { + if p == nil { + return false + } + return p.RequireLastPushApproval +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementLevelChanges) GetFrom() string { + if p == nil || p.From == nil { return "" } - return *m.Action + return *p.From } -// GetChanges returns the Changes field. -func (m *MemberEvent) GetChanges() *MemberChanges { - if m == nil { +// GetBypassPullRequestAllowancesRequest returns the BypassPullRequestAllowancesRequest field. +func (p *PullRequestReviewsEnforcementRequest) GetBypassPullRequestAllowancesRequest() *BypassPullRequestAllowancesRequest { + if p == nil { return nil } - return m.Changes + return p.BypassPullRequestAllowancesRequest } -// GetInstallation returns the Installation field. -func (m *MemberEvent) GetInstallation() *Installation { - if m == nil { +// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. +func (p *PullRequestReviewsEnforcementRequest) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { + if p == nil { return nil } - return m.Installation + return p.DismissalRestrictionsRequest } -// GetMember returns the Member field. -func (m *MemberEvent) GetMember() *User { - if m == nil { - return nil +// GetDismissStaleReviews returns the DismissStaleReviews field. +func (p *PullRequestReviewsEnforcementRequest) GetDismissStaleReviews() bool { + if p == nil { + return false } - return m.Member + return p.DismissStaleReviews } -// GetOrg returns the Org field. -func (m *MemberEvent) GetOrg() *Organization { - if m == nil { - return nil +// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field. +func (p *PullRequestReviewsEnforcementRequest) GetRequireCodeOwnerReviews() bool { + if p == nil { + return false } - return m.Org + return p.RequireCodeOwnerReviews } -// GetRepo returns the Repo field. -func (m *MemberEvent) GetRepo() *Repository { - if m == nil { - return nil +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcementRequest) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 } - return m.Repo + return p.RequiredApprovingReviewCount } -// GetSender returns the Sender field. -func (m *MemberEvent) GetSender() *User { - if m == nil { - return nil +// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementRequest) GetRequireLastPushApproval() bool { + if p == nil || p.RequireLastPushApproval == nil { + return false } - return m.Sender + return *p.RequireLastPushApproval } -// GetOrganization returns the Organization field. -func (m *Membership) GetOrganization() *Organization { - if m == nil { +// GetBypassPullRequestAllowancesRequest returns the BypassPullRequestAllowancesRequest field. +func (p *PullRequestReviewsEnforcementUpdate) GetBypassPullRequestAllowancesRequest() *BypassPullRequestAllowancesRequest { + if p == nil { return nil } - return m.Organization + return p.BypassPullRequestAllowancesRequest } -// GetOrganizationURL returns the OrganizationURL field if it's non-nil, zero value otherwise. -func (m *Membership) GetOrganizationURL() string { - if m == nil || m.OrganizationURL == nil { - return "" +// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. +func (p *PullRequestReviewsEnforcementUpdate) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { + if p == nil { + return nil } - return *m.OrganizationURL + return p.DismissalRestrictionsRequest } -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (m *Membership) GetRole() string { - if m == nil || m.Role == nil { - return "" +// GetDismissStaleReviews returns the DismissStaleReviews field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementUpdate) GetDismissStaleReviews() bool { + if p == nil || p.DismissStaleReviews == nil { + return false } - return *m.Role + return *p.DismissStaleReviews } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Membership) GetState() string { - if m == nil || m.State == nil { - return "" +// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementUpdate) GetRequireCodeOwnerReviews() bool { + if p == nil || p.RequireCodeOwnerReviews == nil { + return false } - return *m.State + return *p.RequireCodeOwnerReviews } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Membership) GetURL() string { - if m == nil || m.URL == nil { - return "" +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestReviewsEnforcementUpdate) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 } - return *m.URL + return p.RequiredApprovingReviewCount } -// GetUser returns the User field. -func (m *Membership) GetUser() *User { - if m == nil { - return nil +// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. +func (p *PullRequestReviewsEnforcementUpdate) GetRequireLastPushApproval() bool { + if p == nil || p.RequireLastPushApproval == nil { + return false } - return m.User + return *p.RequireLastPushApproval } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MembershipEvent) GetAction() string { - if m == nil || m.Action == nil { +func (p *PullRequestReviewThreadEvent) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *m.Action + return *p.Action } // GetInstallation returns the Installation field. -func (m *MembershipEvent) GetInstallation() *Installation { - if m == nil { +func (p *PullRequestReviewThreadEvent) GetInstallation() *Installation { + if p == nil { return nil } - return m.Installation + return p.Installation } -// GetMember returns the Member field. -func (m *MembershipEvent) GetMember() *User { - if m == nil { +// GetOrg returns the Org field. +func (p *PullRequestReviewThreadEvent) GetOrg() *Organization { + if p == nil { return nil } - return m.Member + return p.Org } -// GetOrg returns the Org field. -func (m *MembershipEvent) GetOrg() *Organization { - if m == nil { +// GetPullRequest returns the PullRequest field. +func (p *PullRequestReviewThreadEvent) GetPullRequest() *PullRequest { + if p == nil { return nil } - return m.Org + return p.PullRequest } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (m *MembershipEvent) GetScope() string { - if m == nil || m.Scope == nil { - return "" +// GetRepo returns the Repo field. +func (p *PullRequestReviewThreadEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *m.Scope + return p.Repo } // GetSender returns the Sender field. -func (m *MembershipEvent) GetSender() *User { - if m == nil { +func (p *PullRequestReviewThreadEvent) GetSender() *User { + if p == nil { return nil } - return m.Sender + return p.Sender } -// GetTeam returns the Team field. -func (m *MembershipEvent) GetTeam() *Team { - if m == nil { +// GetThread returns the Thread field. +func (p *PullRequestReviewThreadEvent) GetThread() *PullRequestThread { + if p == nil { return nil } - return m.Team -} - -// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetBaseRef() string { - if m == nil || m.BaseRef == nil { - return "" - } - return *m.BaseRef -} - -// GetBaseSHA returns the BaseSHA field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetBaseSHA() string { - if m == nil || m.BaseSHA == nil { - return "" - } - return *m.BaseSHA + return p.Thread } -// GetHeadCommit returns the HeadCommit field. -func (m *MergeGroup) GetHeadCommit() *Commit { - if m == nil { +// GetAllowedMergeMethods returns the AllowedMergeMethods slice if it's non-nil, nil otherwise. +func (p *PullRequestRuleParameters) GetAllowedMergeMethods() []PullRequestMergeMethod { + if p == nil || p.AllowedMergeMethods == nil { return nil } - return m.HeadCommit + return p.AllowedMergeMethods } -// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetHeadRef() string { - if m == nil || m.HeadRef == nil { - return "" +// GetDismissalRestriction returns the DismissalRestriction field. +func (p *PullRequestRuleParameters) GetDismissalRestriction() *DismissalRestriction { + if p == nil { + return nil } - return *m.HeadRef + return p.DismissalRestriction } -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetHeadSHA() string { - if m == nil || m.HeadSHA == nil { - return "" +// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field. +func (p *PullRequestRuleParameters) GetDismissStaleReviewsOnPush() bool { + if p == nil { + return false } - return *m.HeadSHA + return p.DismissStaleReviewsOnPush } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MergeGroupEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" +// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field. +func (p *PullRequestRuleParameters) GetRequireCodeOwnerReview() bool { + if p == nil { + return false } - return *m.Action + return p.RequireCodeOwnerReview } -// GetInstallation returns the Installation field. -func (m *MergeGroupEvent) GetInstallation() *Installation { - if m == nil { - return nil +// GetRequiredApprovingReviewCount returns the RequiredApprovingReviewCount field. +func (p *PullRequestRuleParameters) GetRequiredApprovingReviewCount() int { + if p == nil { + return 0 } - return m.Installation + return p.RequiredApprovingReviewCount } -// GetMergeGroup returns the MergeGroup field. -func (m *MergeGroupEvent) GetMergeGroup() *MergeGroup { - if m == nil { +// GetRequiredReviewers returns the RequiredReviewers slice if it's non-nil, nil otherwise. +func (p *PullRequestRuleParameters) GetRequiredReviewers() []*RulesetRequiredReviewer { + if p == nil || p.RequiredReviewers == nil { return nil } - return m.MergeGroup + return p.RequiredReviewers } -// GetOrg returns the Org field. -func (m *MergeGroupEvent) GetOrg() *Organization { - if m == nil { - return nil +// GetRequiredReviewThreadResolution returns the RequiredReviewThreadResolution field. +func (p *PullRequestRuleParameters) GetRequiredReviewThreadResolution() bool { + if p == nil { + return false } - return m.Org + return p.RequiredReviewThreadResolution } -// GetRepo returns the Repo field. -func (m *MergeGroupEvent) GetRepo() *Repository { - if m == nil { - return nil +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *PullRequestRuleParameters) GetRequireLastPushApproval() bool { + if p == nil { + return false } - return m.Repo + return p.RequireLastPushApproval } -// GetSender returns the Sender field. -func (m *MergeGroupEvent) GetSender() *User { - if m == nil { +// GetBase returns the Base field. +func (p *PullRequestStack) GetBase() *PullRequestStackBase { + if p == nil { return nil } - return m.Sender + return p.Base } -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (m *Message) GetText() string { - if m == nil || m.Text == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PullRequestStack) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *m.Text + return *p.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MetaEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (p *PullRequestStack) GetNumber() int { + if p == nil || p.Number == nil { + return 0 } - return *m.Action + return *p.Number } -// GetHook returns the Hook field. -func (m *MetaEvent) GetHook() *Hook { - if m == nil { - return nil +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (p *PullRequestStack) GetPosition() int { + if p == nil || p.Position == nil { + return 0 } - return m.Hook + return *p.Position } -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (m *MetaEvent) GetHookID() int64 { - if m == nil || m.HookID == nil { +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (p *PullRequestStack) GetSize() int { + if p == nil || p.Size == nil { return 0 } - return *m.HookID + return *p.Size } -// GetInstallation returns the Installation field. -func (m *MetaEvent) GetInstallation() *Installation { - if m == nil { - return nil +// GetRef returns the Ref field. +func (p *PullRequestStackBase) GetRef() string { + if p == nil { + return "" } - return m.Installation + return p.Ref } -// GetOrg returns the Org field. -func (m *MetaEvent) GetOrg() *Organization { - if m == nil { - return nil +// GetSHA returns the SHA field. +func (p *PullRequestStackBase) GetSHA() string { + if p == nil { + return "" } - return m.Org + return p.SHA } -// GetRepo returns the Repo field. -func (m *MetaEvent) GetRepo() *Repository { - if m == nil { - return nil +// GetRef returns the Ref field. +func (p *PullRequestStackBranch) GetRef() string { + if p == nil { + return "" } - return m.Repo + return p.Ref } -// GetSender returns the Sender field. -func (m *MetaEvent) GetSender() *User { - if m == nil { +// GetRepo returns the Repo field. +func (p *PullRequestStackBranch) GetRepo() *PullRequestStackRepository { + if p == nil { return nil } - return m.Sender + return p.Repo } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *Metric) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { +// GetSHA returns the SHA field. +func (p *PullRequestStackBranch) GetSHA() string { + if p == nil { return "" } - return *m.HTMLURL + return p.SHA } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (m *Metric) GetKey() string { - if m == nil || m.Key == nil { - return "" +// GetBase returns the Base field. +func (p *PullRequestStackDetails) GetBase() *PullRequestStackRef { + if p == nil { + return nil } - return *m.Key + return p.Base } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (m *Metric) GetName() string { - if m == nil || m.Name == nil { - return "" +// GetCreatedAt returns the CreatedAt field. +func (p *PullRequestStackDetails) GetCreatedAt() Timestamp { + if p == nil { + return Timestamp{} } - return *m.Name + return p.CreatedAt } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (m *Metric) GetNodeID() string { - if m == nil || m.NodeID == nil { - return "" +// GetID returns the ID field. +func (p *PullRequestStackDetails) GetID() int64 { + if p == nil { + return 0 } - return *m.NodeID + return p.ID } -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (m *Metric) GetSPDXID() string { - if m == nil || m.SPDXID == nil { +// GetNodeID returns the NodeID field. +func (p *PullRequestStackDetails) GetNodeID() string { + if p == nil { return "" } - return *m.SPDXID + return p.NodeID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Metric) GetURL() string { - if m == nil || m.URL == nil { - return "" +// GetNumber returns the Number field. +func (p *PullRequestStackDetails) GetNumber() int { + if p == nil { + return 0 } - return *m.URL + return p.Number } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (m *Migration) GetCreatedAt() string { - if m == nil || m.CreatedAt == nil { - return "" +// GetOpen returns the Open field. +func (p *PullRequestStackDetails) GetOpen() bool { + if p == nil { + return false } - return *m.CreatedAt + return p.Open } -// GetExcludeAttachments returns the ExcludeAttachments field if it's non-nil, zero value otherwise. -func (m *Migration) GetExcludeAttachments() bool { - if m == nil || m.ExcludeAttachments == nil { - return false +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (p *PullRequestStackDetails) GetPullRequests() []*PullRequestStackEntry { + if p == nil || p.PullRequests == nil { + return nil } - return *m.ExcludeAttachments + return p.PullRequests } -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (m *Migration) GetGUID() string { - if m == nil || m.GUID == nil { +// GetURL returns the URL field. +func (p *PullRequestStackDetails) GetURL() string { + if p == nil { return "" } - return *m.GUID + return p.URL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Migration) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetBase returns the Base field. +func (p *PullRequestStackEntry) GetBase() *PullRequestStackBranch { + if p == nil { + return nil } - return *m.ID + return p.Base } -// GetLockRepositories returns the LockRepositories field if it's non-nil, zero value otherwise. -func (m *Migration) GetLockRepositories() bool { - if m == nil || m.LockRepositories == nil { +// GetDraft returns the Draft field. +func (p *PullRequestStackEntry) GetDraft() bool { + if p == nil { return false } - return *m.LockRepositories + return p.Draft } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Migration) GetState() string { - if m == nil || m.State == nil { - return "" +// GetHead returns the Head field. +func (p *PullRequestStackEntry) GetHead() *PullRequestStackBranch { + if p == nil { + return nil } - return *m.State + return p.Head } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *Migration) GetUpdatedAt() string { - if m == nil || m.UpdatedAt == nil { +// GetHTMLURL returns the HTMLURL field. +func (p *PullRequestStackEntry) GetHTMLURL() string { + if p == nil { return "" } - return *m.UpdatedAt + return p.HTMLURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Migration) GetURL() string { - if m == nil || m.URL == nil { - return "" +// GetID returns the ID field. +func (p *PullRequestStackEntry) GetID() int64 { + if p == nil { + return 0 } - return *m.URL + return p.ID } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetClosedAt() Timestamp { - if m == nil || m.ClosedAt == nil { +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestStackEntry) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { return Timestamp{} } - return *m.ClosedAt + return *p.MergedAt } -// GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise. -func (m *Milestone) GetClosedIssues() int { - if m == nil || m.ClosedIssues == nil { +// GetNodeID returns the NodeID field. +func (p *PullRequestStackEntry) GetNodeID() string { + if p == nil { + return "" + } + return p.NodeID +} + +// GetNumber returns the Number field. +func (p *PullRequestStackEntry) GetNumber() int { + if p == nil { return 0 } - return *m.ClosedIssues + return p.Number } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetCreatedAt() Timestamp { - if m == nil || m.CreatedAt == nil { - return Timestamp{} +// GetState returns the State field. +func (p *PullRequestStackEntry) GetState() string { + if p == nil { + return "" } - return *m.CreatedAt + return p.State } -// GetCreator returns the Creator field. -func (m *Milestone) GetCreator() *User { - if m == nil { - return nil +// GetTitle returns the Title field. +func (p *PullRequestStackEntry) GetTitle() string { + if p == nil { + return "" } - return m.Creator + return p.Title } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (m *Milestone) GetDescription() string { - if m == nil || m.Description == nil { +// GetURL returns the URL field. +func (p *PullRequestStackEntry) GetURL() string { + if p == nil { return "" } - return *m.Description + return p.URL } -// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise. -func (m *Milestone) GetDueOn() Timestamp { - if m == nil || m.DueOn == nil { - return Timestamp{} +// GetUser returns the User field. +func (p *PullRequestStackEntry) GetUser() *User { + if p == nil { + return nil } - return *m.DueOn + return p.User } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { - return "" +// GetBase returns the Base field. +func (p *PullRequestStackMinimal) GetBase() *PullRequestStackRef { + if p == nil { + return nil } - return *m.HTMLURL + return p.Base } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Milestone) GetID() int64 { - if m == nil || m.ID == nil { - return 0 +// GetCreatedAt returns the CreatedAt field. +func (p *PullRequestStackMinimal) GetCreatedAt() Timestamp { + if p == nil { + return Timestamp{} } - return *m.ID + return p.CreatedAt } -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetLabelsURL() string { - if m == nil || m.LabelsURL == nil { - return "" +// GetID returns the ID field. +func (p *PullRequestStackMinimal) GetID() int64 { + if p == nil { + return 0 } - return *m.LabelsURL + return p.ID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (m *Milestone) GetNodeID() string { - if m == nil || m.NodeID == nil { +// GetNodeID returns the NodeID field. +func (p *PullRequestStackMinimal) GetNodeID() string { + if p == nil { return "" } - return *m.NodeID + return p.NodeID } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (m *Milestone) GetNumber() int { - if m == nil || m.Number == nil { +// GetNumber returns the Number field. +func (p *PullRequestStackMinimal) GetNumber() int { + if p == nil { return 0 } - return *m.Number + return p.Number } -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (m *Milestone) GetOpenIssues() int { - if m == nil || m.OpenIssues == nil { - return 0 +// GetOpen returns the Open field. +func (p *PullRequestStackMinimal) GetOpen() bool { + if p == nil { + return false } - return *m.OpenIssues + return p.Open } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *Milestone) GetState() string { - if m == nil || m.State == nil { - return "" +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (p *PullRequestStackMinimal) GetPullRequests() []*PullRequestStackMinimalEntry { + if p == nil || p.PullRequests == nil { + return nil } - return *m.State + return p.PullRequests } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (m *Milestone) GetTitle() string { - if m == nil || m.Title == nil { +// GetURL returns the URL field. +func (p *PullRequestStackMinimal) GetURL() string { + if p == nil { return "" } - return *m.Title + return p.URL } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *Milestone) GetUpdatedAt() Timestamp { - if m == nil || m.UpdatedAt == nil { - return Timestamp{} +// GetDraft returns the Draft field. +func (p *PullRequestStackMinimalEntry) GetDraft() bool { + if p == nil { + return false } - return *m.UpdatedAt + return p.Draft } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetURL() string { - if m == nil || m.URL == nil { - return "" +// GetHead returns the Head field. +func (p *PullRequestStackMinimalEntry) GetHead() *PullRequestStackMinimalHead { + if p == nil { + return nil } - return *m.URL + return p.Head } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MilestoneEvent) GetAction() string { - if m == nil || m.Action == nil { - return "" +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestStackMinimalEntry) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { + return Timestamp{} } - return *m.Action + return *p.MergedAt } -// GetChanges returns the Changes field. -func (m *MilestoneEvent) GetChanges() *EditChange { - if m == nil { - return nil +// GetNumber returns the Number field. +func (p *PullRequestStackMinimalEntry) GetNumber() int { + if p == nil { + return 0 } - return m.Changes + return p.Number } -// GetInstallation returns the Installation field. -func (m *MilestoneEvent) GetInstallation() *Installation { - if m == nil { - return nil +// GetState returns the State field. +func (p *PullRequestStackMinimalEntry) GetState() string { + if p == nil { + return "" } - return m.Installation + return p.State } -// GetMilestone returns the Milestone field. -func (m *MilestoneEvent) GetMilestone() *Milestone { - if m == nil { - return nil +// GetRef returns the Ref field. +func (p *PullRequestStackMinimalHead) GetRef() string { + if p == nil { + return "" } - return m.Milestone + return p.Ref } -// GetOrg returns the Org field. -func (m *MilestoneEvent) GetOrg() *Organization { - if m == nil { - return nil +// GetSHA returns the SHA field. +func (p *PullRequestStackMinimalHead) GetSHA() string { + if p == nil { + return "" } - return m.Org + return p.SHA } -// GetRepo returns the Repo field. -func (m *MilestoneEvent) GetRepo() *Repository { - if m == nil { - return nil +// GetRef returns the Ref field. +func (p *PullRequestStackRef) GetRef() string { + if p == nil { + return "" } - return m.Repo + return p.Ref } -// GetSender returns the Sender field. -func (m *MilestoneEvent) GetSender() *User { - if m == nil { - return nil +// GetID returns the ID field. +func (p *PullRequestStackRepository) GetID() int64 { + if p == nil { + return 0 } - return m.Sender + return p.ID } -// GetClosedMilestones returns the ClosedMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetClosedMilestones() int { - if m == nil || m.ClosedMilestones == nil { - return 0 +// GetName returns the Name field. +func (p *PullRequestStackRepository) GetName() string { + if p == nil { + return "" } - return *m.ClosedMilestones + return p.Name } -// GetOpenMilestones returns the OpenMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetOpenMilestones() int { - if m == nil || m.OpenMilestones == nil { - return 0 +// GetURL returns the URL field. +func (p *PullRequestStackRepository) GetURL() string { + if p == nil { + return "" } - return *m.OpenMilestones + return p.URL } -// GetTotalMilestones returns the TotalMilestones field if it's non-nil, zero value otherwise. -func (m *MilestoneStats) GetTotalMilestones() int { - if m == nil || m.TotalMilestones == nil { - return 0 +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (p *PullRequestSubmitReviewRequest) GetBody() string { + if p == nil || p.Body == nil { + return "" } - return *m.TotalMilestones + return *p.Body } -// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetAnalysisKey() string { - if m == nil || m.AnalysisKey == nil { +// GetEvent returns the Event field. +func (p *PullRequestSubmitReviewRequest) GetEvent() string { + if p == nil { return "" } - return *m.AnalysisKey + return p.Event } -// GetCategory returns the Category field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetCategory() string { - if m == nil || m.Category == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PullRequestTargetEvent) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *m.Category + return *p.Action } -// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetCommitSHA() string { - if m == nil || m.CommitSHA == nil { +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (p *PullRequestTargetEvent) GetAfter() string { + if p == nil || p.After == nil { return "" } - return *m.CommitSHA + return *p.After } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetEnvironment() string { - if m == nil || m.Environment == nil { - return "" +// GetAssignee returns the Assignee field. +func (p *PullRequestTargetEvent) GetAssignee() *User { + if p == nil { + return nil } - return *m.Environment + return p.Assignee } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (p *PullRequestTargetEvent) GetBefore() string { + if p == nil || p.Before == nil { return "" } - return *m.HTMLURL + return *p.Before } -// GetLocation returns the Location field. -func (m *MostRecentInstance) GetLocation() *Location { - if m == nil { +// GetChanges returns the Changes field. +func (p *PullRequestTargetEvent) GetChanges() *EditChange { + if p == nil { return nil } - return m.Location + return p.Changes } -// GetMessage returns the Message field. -func (m *MostRecentInstance) GetMessage() *Message { - if m == nil { +// GetInstallation returns the Installation field. +func (p *PullRequestTargetEvent) GetInstallation() *Installation { + if p == nil { return nil } - return m.Message + return p.Installation } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetRef() string { - if m == nil || m.Ref == nil { - return "" +// GetLabel returns the Label field. +func (p *PullRequestTargetEvent) GetLabel() *Label { + if p == nil { + return nil } - return *m.Ref + return p.Label } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetState() string { - if m == nil || m.State == nil { - return "" +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (p *PullRequestTargetEvent) GetNumber() int { + if p == nil || p.Number == nil { + return 0 } - return *m.State + return *p.Number } -// GetBase returns the Base field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBase() string { - if n == nil || n.Base == nil { - return "" +// GetOrganization returns the Organization field. +func (p *PullRequestTargetEvent) GetOrganization() *Organization { + if p == nil { + return nil } - return *n.Base + return p.Organization } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBody() string { - if n == nil || n.Body == nil { - return "" +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (p *PullRequestTargetEvent) GetPerformedViaGithubApp() *App { + if p == nil { + return nil } - return *n.Body + return p.PerformedViaGithubApp } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetDraft() bool { - if n == nil || n.Draft == nil { - return false +// GetPullRequest returns the PullRequest field. +func (p *PullRequestTargetEvent) GetPullRequest() *PullRequest { + if p == nil { + return nil } - return *n.Draft + return p.PullRequest } -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetHead() string { - if n == nil || n.Head == nil { - return "" +// GetRepo returns the Repo field. +func (p *PullRequestTargetEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *n.Head + return p.Repo } -// GetHeadRepo returns the HeadRepo field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetHeadRepo() string { - if n == nil || n.HeadRepo == nil { - return "" +// GetRequestedReviewer returns the RequestedReviewer field. +func (p *PullRequestTargetEvent) GetRequestedReviewer() *User { + if p == nil { + return nil } - return *n.HeadRepo + return p.RequestedReviewer } -// GetIssue returns the Issue field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetIssue() int { - if n == nil || n.Issue == nil { - return 0 +// GetRequestedTeam returns the RequestedTeam field. +func (p *PullRequestTargetEvent) GetRequestedTeam() *Team { + if p == nil { + return nil } - return *n.Issue + return p.RequestedTeam } -// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetMaintainerCanModify() bool { - if n == nil || n.MaintainerCanModify == nil { - return false +// GetSender returns the Sender field. +func (p *PullRequestTargetEvent) GetSender() *User { + if p == nil { + return nil } - return *n.MaintainerCanModify + return p.Sender } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetTitle() string { - if n == nil || n.Title == nil { - return "" +// GetComments returns the Comments slice if it's non-nil, nil otherwise. +func (p *PullRequestThread) GetComments() []*PullRequestComment { + if p == nil || p.Comments == nil { + return nil } - return *n.Title + return p.Comments } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetDescription() string { - if n == nil || n.Description == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *PullRequestThread) GetID() int64 { + if p == nil || p.ID == nil { + return 0 } - return *n.Description + return *p.ID } -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetLDAPDN() string { - if n == nil || n.LDAPDN == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PullRequestThread) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *n.LDAPDN + return *p.NodeID } -// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetNotificationSetting() string { - if n == nil || n.NotificationSetting == nil { - return "" +// GetMergeablePulls returns the MergeablePulls field if it's non-nil, zero value otherwise. +func (p *PullStats) GetMergeablePulls() int { + if p == nil || p.MergeablePulls == nil { + return 0 } - return *n.NotificationSetting + return *p.MergeablePulls } -// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetParentTeamID() int64 { - if n == nil || n.ParentTeamID == nil { +// GetMergedPulls returns the MergedPulls field if it's non-nil, zero value otherwise. +func (p *PullStats) GetMergedPulls() int { + if p == nil || p.MergedPulls == nil { return 0 } - return *n.ParentTeamID + return *p.MergedPulls } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetPermission() string { - if n == nil || n.Permission == nil { - return "" +// GetTotalPulls returns the TotalPulls field if it's non-nil, zero value otherwise. +func (p *PullStats) GetTotalPulls() int { + if p == nil || p.TotalPulls == nil { + return 0 } - return *n.Permission + return *p.TotalPulls } -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetPrivacy() string { - if n == nil || n.Privacy == nil { - return "" +// GetUnmergeablePulls returns the UnmergeablePulls field if it's non-nil, zero value otherwise. +func (p *PullStats) GetUnmergeablePulls() int { + if p == nil || p.UnmergeablePulls == nil { + return 0 } - return *n.Privacy + return *p.UnmergeablePulls } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (n *NodeDetails) GetHostname() string { - if n == nil || n.Hostname == nil { - return "" +// GetCommits returns the Commits field if it's non-nil, zero value otherwise. +func (p *PunchCard) GetCommits() int { + if p == nil || p.Commits == nil { + return 0 } - return *n.Hostname + return *p.Commits } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (n *NodeDetails) GetUUID() string { - if n == nil || n.UUID == nil { - return "" +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PunchCard) GetDay() int { + if p == nil || p.Day == nil { + return 0 } - return *n.UUID + return *p.Day } -// GetTopology returns the Topology field if it's non-nil, zero value otherwise. -func (n *NodeMetadataStatus) GetTopology() string { - if n == nil || n.Topology == nil { - return "" +// GetHour returns the Hour field if it's non-nil, zero value otherwise. +func (p *PunchCard) GetHour() int { + if p == nil || p.Hour == nil { + return 0 } - return *n.Topology + return *p.Hour } -// GetClusterRoles returns the ClusterRoles field if it's non-nil, zero value otherwise. -func (n *NodeQueryOptions) GetClusterRoles() string { - if n == nil || n.ClusterRoles == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *n.ClusterRoles + return *p.Action } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (n *NodeQueryOptions) GetUUID() string { - if n == nil || n.UUID == nil { +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetAfter() string { + if p == nil || p.After == nil { return "" } - return *n.UUID + return *p.After } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (n *NodeReleaseVersion) GetHostname() string { - if n == nil || n.Hostname == nil { +// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetBaseRef() string { + if p == nil || p.BaseRef == nil { return "" } - return *n.Hostname -} - -// GetVersion returns the Version field. -func (n *NodeReleaseVersion) GetVersion() *ReleaseVersion { - if n == nil { - return nil - } - return n.Version + return *p.BaseRef } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (n *Notification) GetID() string { - if n == nil || n.ID == nil { +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetBefore() string { + if p == nil || p.Before == nil { return "" } - return *n.ID + return *p.Before } -// GetLastReadAt returns the LastReadAt field if it's non-nil, zero value otherwise. -func (n *Notification) GetLastReadAt() Timestamp { - if n == nil || n.LastReadAt == nil { - return Timestamp{} +// GetCommits returns the Commits slice if it's non-nil, nil otherwise. +func (p *PushEvent) GetCommits() []*HeadCommit { + if p == nil || p.Commits == nil { + return nil } - return *n.LastReadAt + return p.Commits } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (n *Notification) GetReason() string { - if n == nil || n.Reason == nil { +// GetCompare returns the Compare field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetCompare() string { + if p == nil || p.Compare == nil { return "" } - return *n.Reason + return *p.Compare } -// GetRepository returns the Repository field. -func (n *Notification) GetRepository() *Repository { - if n == nil { - return nil +// GetCreated returns the Created field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetCreated() bool { + if p == nil || p.Created == nil { + return false } - return n.Repository + return *p.Created } -// GetSubject returns the Subject field. -func (n *Notification) GetSubject() *NotificationSubject { - if n == nil { - return nil +// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetDeleted() bool { + if p == nil || p.Deleted == nil { + return false } - return n.Subject + return *p.Deleted } -// GetUnread returns the Unread field if it's non-nil, zero value otherwise. -func (n *Notification) GetUnread() bool { - if n == nil || n.Unread == nil { - return false +// GetDistinctSize returns the DistinctSize field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetDistinctSize() int { + if p == nil || p.DistinctSize == nil { + return 0 } - return *n.Unread + return *p.DistinctSize } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (n *Notification) GetUpdatedAt() Timestamp { - if n == nil || n.UpdatedAt == nil { - return Timestamp{} +// GetForced returns the Forced field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetForced() bool { + if p == nil || p.Forced == nil { + return false } - return *n.UpdatedAt + return *p.Forced } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (n *Notification) GetURL() string { - if n == nil || n.URL == nil { +// GetHead returns the Head field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetHead() string { + if p == nil || p.Head == nil { return "" } - return *n.URL + return *p.Head } -// GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetLatestCommentURL() string { - if n == nil || n.LatestCommentURL == nil { - return "" +// GetHeadCommit returns the HeadCommit field. +func (p *PushEvent) GetHeadCommit() *HeadCommit { + if p == nil { + return nil } - return *n.LatestCommentURL + return p.HeadCommit } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetTitle() string { - if n == nil || n.Title == nil { - return "" +// GetInstallation returns the Installation field. +func (p *PushEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *n.Title + return p.Installation } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetType() string { - if n == nil || n.Type == nil { - return "" +// GetOrganization returns the Organization field. +func (p *PushEvent) GetOrganization() *Organization { + if p == nil { + return nil } - return *n.Type + return p.Organization } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetURL() string { - if n == nil || n.URL == nil { - return "" +// GetPusher returns the Pusher field. +func (p *PushEvent) GetPusher() *CommitAuthor { + if p == nil { + return nil } - return *n.URL + return p.Pusher } -// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (o *OAuthAPP) GetClientID() string { - if o == nil || o.ClientID == nil { - return "" +// GetPushID returns the PushID field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetPushID() int64 { + if p == nil || p.PushID == nil { + return 0 } - return *o.ClientID + return *p.PushID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *OAuthAPP) GetName() string { - if o == nil || o.Name == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetRef() string { + if p == nil || p.Ref == nil { return "" } - return *o.Name + return *p.Ref } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (o *OAuthAPP) GetURL() string { - if o == nil || o.URL == nil { - return "" +// GetRepo returns the Repo field. +func (p *PushEvent) GetRepo() *PushEventRepository { + if p == nil { + return nil } - return *o.URL + return p.Repo } -// GetUseDefault returns the UseDefault field if it's non-nil, zero value otherwise. -func (o *OIDCSubjectClaimCustomTemplate) GetUseDefault() bool { - if o == nil || o.UseDefault == nil { - return false +// GetSender returns the Sender field. +func (p *PushEvent) GetSender() *User { + if p == nil { + return nil } - return *o.UseDefault + return p.Sender } -// GetAdvancedSecurityEnabledForNewRepos returns the AdvancedSecurityEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetAdvancedSecurityEnabledForNewRepos() bool { - if o == nil || o.AdvancedSecurityEnabledForNewRepos == nil { - return false +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (p *PushEvent) GetSize() int { + if p == nil || p.Size == nil { + return 0 } - return *o.AdvancedSecurityEnabledForNewRepos + return *p.Size } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetAvatarURL() string { - if o == nil || o.AvatarURL == nil { +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (p *PushEventRepoOwner) GetEmail() string { + if p == nil || p.Email == nil { return "" } - return *o.AvatarURL + return *p.Email } -// GetBillingEmail returns the BillingEmail field if it's non-nil, zero value otherwise. -func (o *Organization) GetBillingEmail() string { - if o == nil || o.BillingEmail == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PushEventRepoOwner) GetName() string { + if p == nil || p.Name == nil { return "" } - return *o.BillingEmail + return *p.Name } -// GetBlog returns the Blog field if it's non-nil, zero value otherwise. -func (o *Organization) GetBlog() string { - if o == nil || o.Blog == nil { - return "" +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetArchived() bool { + if p == nil || p.Archived == nil { + return false } - return *o.Blog + return *p.Archived } -// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. -func (o *Organization) GetCollaborators() int { - if o == nil || o.Collaborators == nil { - return 0 +// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetArchiveURL() string { + if p == nil || p.ArchiveURL == nil { + return "" } - return *o.Collaborators + return *p.ArchiveURL } -// GetCompany returns the Company field if it's non-nil, zero value otherwise. -func (o *Organization) GetCompany() string { - if o == nil || o.Company == nil { +// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetCloneURL() string { + if p == nil || p.CloneURL == nil { return "" } - return *o.Company + return *p.CloneURL } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (o *Organization) GetCreatedAt() Timestamp { - if o == nil || o.CreatedAt == nil { +func (p *PushEventRepository) GetCreatedAt() Timestamp { + if p == nil || p.CreatedAt == nil { return Timestamp{} } - return *o.CreatedAt + return *p.CreatedAt } -// GetDefaultRepoPermission returns the DefaultRepoPermission field if it's non-nil, zero value otherwise. -func (o *Organization) GetDefaultRepoPermission() string { - if o == nil || o.DefaultRepoPermission == nil { - return "" +// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise. +func (p *PushEventRepository) GetCustomProperties() map[string]any { + if p == nil || p.CustomProperties == nil { + return map[string]any{} } - return *o.DefaultRepoPermission + return p.CustomProperties } -// GetDefaultRepoSettings returns the DefaultRepoSettings field if it's non-nil, zero value otherwise. -func (o *Organization) GetDefaultRepoSettings() string { - if o == nil || o.DefaultRepoSettings == nil { +// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetDefaultBranch() string { + if p == nil || p.DefaultBranch == nil { return "" } - return *o.DefaultRepoSettings + return *p.DefaultBranch } -// GetDependabotAlertsEnabledForNewRepos returns the DependabotAlertsEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetDependabotAlertsEnabledForNewRepos() bool { - if o == nil || o.DependabotAlertsEnabledForNewRepos == nil { - return false +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetDescription() string { + if p == nil || p.Description == nil { + return "" } - return *o.DependabotAlertsEnabledForNewRepos + return *p.Description } -// GetDependabotSecurityUpdatesEnabledForNewRepos returns the DependabotSecurityUpdatesEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetDependabotSecurityUpdatesEnabledForNewRepos() bool { - if o == nil || o.DependabotSecurityUpdatesEnabledForNewRepos == nil { +// GetDisabled returns the Disabled field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetDisabled() bool { + if p == nil || p.Disabled == nil { return false } - return *o.DependabotSecurityUpdatesEnabledForNewRepos + return *p.Disabled } -// GetDependencyGraphEnabledForNewRepos returns the DependencyGraphEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetDependencyGraphEnabledForNewRepos() bool { - if o == nil || o.DependencyGraphEnabledForNewRepos == nil { +// GetFork returns the Fork field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetFork() bool { + if p == nil || p.Fork == nil { return false } - return *o.DependencyGraphEnabledForNewRepos -} - -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (o *Organization) GetDescription() string { - if o == nil || o.Description == nil { - return "" - } - return *o.Description + return *p.Fork } -// GetDiskUsage returns the DiskUsage field if it's non-nil, zero value otherwise. -func (o *Organization) GetDiskUsage() int { - if o == nil || o.DiskUsage == nil { +// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetForksCount() int { + if p == nil || p.ForksCount == nil { return 0 } - return *o.DiskUsage + return *p.ForksCount } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (o *Organization) GetEmail() string { - if o == nil || o.Email == nil { +// GetFullName returns the FullName field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetFullName() string { + if p == nil || p.FullName == nil { return "" } - return *o.Email + return *p.FullName } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetEventsURL() string { - if o == nil || o.EventsURL == nil { +// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetGitURL() string { + if p == nil || p.GitURL == nil { return "" } - return *o.EventsURL + return *p.GitURL } -// GetFollowers returns the Followers field if it's non-nil, zero value otherwise. -func (o *Organization) GetFollowers() int { - if o == nil || o.Followers == nil { - return 0 +// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetHasDownloads() bool { + if p == nil || p.HasDownloads == nil { + return false } - return *o.Followers + return *p.HasDownloads } -// GetFollowing returns the Following field if it's non-nil, zero value otherwise. -func (o *Organization) GetFollowing() int { - if o == nil || o.Following == nil { - return 0 +// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetHasIssues() bool { + if p == nil || p.HasIssues == nil { + return false } - return *o.Following + return *p.HasIssues } -// GetHasOrganizationProjects returns the HasOrganizationProjects field if it's non-nil, zero value otherwise. -func (o *Organization) GetHasOrganizationProjects() bool { - if o == nil || o.HasOrganizationProjects == nil { +// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetHasPages() bool { + if p == nil || p.HasPages == nil { return false } - return *o.HasOrganizationProjects + return *p.HasPages } -// GetHasRepositoryProjects returns the HasRepositoryProjects field if it's non-nil, zero value otherwise. -func (o *Organization) GetHasRepositoryProjects() bool { - if o == nil || o.HasRepositoryProjects == nil { +// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetHasWiki() bool { + if p == nil || p.HasWiki == nil { return false } - return *o.HasRepositoryProjects + return *p.HasWiki } -// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetHooksURL() string { - if o == nil || o.HooksURL == nil { +// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetHomepage() string { + if p == nil || p.Homepage == nil { return "" } - return *o.HooksURL + return *p.Homepage } // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetHTMLURL() string { - if o == nil || o.HTMLURL == nil { +func (p *PushEventRepository) GetHTMLURL() string { + if p == nil || p.HTMLURL == nil { return "" } - return *o.HTMLURL + return *p.HTMLURL } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (o *Organization) GetID() int64 { - if o == nil || o.ID == nil { +func (p *PushEventRepository) GetID() int64 { + if p == nil || p.ID == nil { return 0 } - return *o.ID + return *p.ID } -// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetIssuesURL() string { - if o == nil || o.IssuesURL == nil { +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetLanguage() string { + if p == nil || p.Language == nil { return "" } - return *o.IssuesURL -} - -// GetIsVerified returns the IsVerified field if it's non-nil, zero value otherwise. -func (o *Organization) GetIsVerified() bool { - if o == nil || o.IsVerified == nil { - return false - } - return *o.IsVerified + return *p.Language } -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (o *Organization) GetLocation() string { - if o == nil || o.Location == nil { +// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetMasterBranch() string { + if p == nil || p.MasterBranch == nil { return "" } - return *o.Location + return *p.MasterBranch } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (o *Organization) GetLogin() string { - if o == nil || o.Login == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetName() string { + if p == nil || p.Name == nil { return "" } - return *o.Login + return *p.Name } -// GetMembersAllowedRepositoryCreationType returns the MembersAllowedRepositoryCreationType field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersAllowedRepositoryCreationType() string { - if o == nil || o.MembersAllowedRepositoryCreationType == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *o.MembersAllowedRepositoryCreationType -} - -// GetMembersCanCreateInternalRepos returns the MembersCanCreateInternalRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreateInternalRepos() bool { - if o == nil || o.MembersCanCreateInternalRepos == nil { - return false - } - return *o.MembersCanCreateInternalRepos + return *p.NodeID } -// GetMembersCanCreatePages returns the MembersCanCreatePages field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreatePages() bool { - if o == nil || o.MembersCanCreatePages == nil { - return false +// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetOpenIssuesCount() int { + if p == nil || p.OpenIssuesCount == nil { + return 0 } - return *o.MembersCanCreatePages + return *p.OpenIssuesCount } -// GetMembersCanCreatePrivatePages returns the MembersCanCreatePrivatePages field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreatePrivatePages() bool { - if o == nil || o.MembersCanCreatePrivatePages == nil { - return false +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetOrganization() string { + if p == nil || p.Organization == nil { + return "" } - return *o.MembersCanCreatePrivatePages + return *p.Organization } -// GetMembersCanCreatePrivateRepos returns the MembersCanCreatePrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreatePrivateRepos() bool { - if o == nil || o.MembersCanCreatePrivateRepos == nil { - return false +// GetOwner returns the Owner field. +func (p *PushEventRepository) GetOwner() *User { + if p == nil { + return nil } - return *o.MembersCanCreatePrivateRepos + return p.Owner } -// GetMembersCanCreatePublicPages returns the MembersCanCreatePublicPages field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreatePublicPages() bool { - if o == nil || o.MembersCanCreatePublicPages == nil { +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetPrivate() bool { + if p == nil || p.Private == nil { return false } - return *o.MembersCanCreatePublicPages + return *p.Private } -// GetMembersCanCreatePublicRepos returns the MembersCanCreatePublicRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreatePublicRepos() bool { - if o == nil || o.MembersCanCreatePublicRepos == nil { - return false +// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetPullsURL() string { + if p == nil || p.PullsURL == nil { + return "" } - return *o.MembersCanCreatePublicRepos + return *p.PullsURL } -// GetMembersCanCreateRepos returns the MembersCanCreateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreateRepos() bool { - if o == nil || o.MembersCanCreateRepos == nil { - return false +// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetPushedAt() Timestamp { + if p == nil || p.PushedAt == nil { + return Timestamp{} } - return *o.MembersCanCreateRepos + return *p.PushedAt } -// GetMembersCanForkPrivateRepos returns the MembersCanForkPrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanForkPrivateRepos() bool { - if o == nil || o.MembersCanForkPrivateRepos == nil { - return false +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetSize() int { + if p == nil || p.Size == nil { + return 0 } - return *o.MembersCanForkPrivateRepos + return *p.Size } -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersURL() string { - if o == nil || o.MembersURL == nil { +// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetSSHURL() string { + if p == nil || p.SSHURL == nil { return "" } - return *o.MembersURL + return *p.SSHURL } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *Organization) GetName() string { - if o == nil || o.Name == nil { - return "" +// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetStargazersCount() int { + if p == nil || p.StargazersCount == nil { + return 0 } - return *o.Name + return *p.StargazersCount } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (o *Organization) GetNodeID() string { - if o == nil || o.NodeID == nil { +// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetStatusesURL() string { + if p == nil || p.StatusesURL == nil { return "" } - return *o.NodeID + return *p.StatusesURL } -// GetOwnedPrivateRepos returns the OwnedPrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetOwnedPrivateRepos() int64 { - if o == nil || o.OwnedPrivateRepos == nil { - return 0 +// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetSVNURL() string { + if p == nil || p.SVNURL == nil { + return "" } - return *o.OwnedPrivateRepos + return *p.SVNURL } -// GetPlan returns the Plan field. -func (o *Organization) GetPlan() *Plan { - if o == nil { +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (p *PushEventRepository) GetTopics() []string { + if p == nil || p.Topics == nil { return nil } - return o.Plan + return p.Topics } -// GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise. -func (o *Organization) GetPrivateGists() int { - if o == nil || o.PrivateGists == nil { - return 0 +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} } - return *o.PrivateGists + return *p.UpdatedAt } -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicGists() int { - if o == nil || o.PublicGists == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetURL() string { + if p == nil || p.URL == nil { + return "" } - return *o.PublicGists + return *p.URL } -// GetPublicMembersURL returns the PublicMembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicMembersURL() string { - if o == nil || o.PublicMembersURL == nil { - return "" +// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. +func (p *PushEventRepository) GetWatchersCount() int { + if p == nil || p.WatchersCount == nil { + return 0 } - return *o.PublicMembersURL + return *p.WatchersCount } -// GetPublicRepos returns the PublicRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicRepos() int { - if o == nil || o.PublicRepos == nil { - return 0 +// 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 *o.PublicRepos + return *p.ExpireAt } -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetReposURL() string { - if o == nil || o.ReposURL == nil { +// GetReason returns the Reason field. +func (p *PushProtectionBypass) GetReason() string { + if p == nil { return "" } - return *o.ReposURL + return p.Reason } -// GetSecretScanningEnabledForNewRepos returns the SecretScanningEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetSecretScanningEnabledForNewRepos() bool { - if o == nil || o.SecretScanningEnabledForNewRepos == nil { - return false +// GetTokenType returns the TokenType field. +func (p *PushProtectionBypass) GetTokenType() string { + if p == nil { + return "" } - return *o.SecretScanningEnabledForNewRepos + return p.TokenType } -// GetSecretScanningPushProtectionEnabledForNewRepos returns the SecretScanningPushProtectionEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetSecretScanningPushProtectionEnabledForNewRepos() bool { - if o == nil || o.SecretScanningPushProtectionEnabledForNewRepos == nil { - return false +// GetPlaceholderID returns the PlaceholderID field. +func (p *PushProtectionBypassRequest) GetPlaceholderID() string { + if p == nil { + return "" } - return *o.SecretScanningPushProtectionEnabledForNewRepos + return p.PlaceholderID } -// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. -func (o *Organization) GetSecretScanningValidityChecksEnabled() bool { - if o == nil || o.SecretScanningValidityChecksEnabled == nil { - return false +// GetReason returns the Reason field. +func (p *PushProtectionBypassRequest) GetReason() string { + if p == nil { + return "" } - return *o.SecretScanningValidityChecksEnabled + return p.Reason } -// GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetTotalPrivateRepos() int64 { - if o == nil || o.TotalPrivateRepos == nil { +// GetLimit returns the Limit field. +func (r *Rate) GetLimit() int { + if r == nil { return 0 } - return *o.TotalPrivateRepos + return r.Limit } -// GetTwitterUsername returns the TwitterUsername field if it's non-nil, zero value otherwise. -func (o *Organization) GetTwitterUsername() string { - if o == nil || o.TwitterUsername == nil { - return "" +// GetRemaining returns the Remaining field. +func (r *Rate) GetRemaining() int { + if r == nil { + return 0 } - return *o.TwitterUsername + return r.Remaining } -// GetTwoFactorRequirementEnabled returns the TwoFactorRequirementEnabled field if it's non-nil, zero value otherwise. -func (o *Organization) GetTwoFactorRequirementEnabled() bool { - if o == nil || o.TwoFactorRequirementEnabled == nil { - return false +// GetReset returns the Reset field. +func (r *Rate) GetReset() Timestamp { + if r == nil { + return Timestamp{} } - return *o.TwoFactorRequirementEnabled + return r.Reset } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (o *Organization) GetType() string { - if o == nil || o.Type == nil { +// GetResource returns the Resource field. +func (r *Rate) GetResource() string { + if r == nil { return "" } - return *o.Type + return r.Resource } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (o *Organization) GetUpdatedAt() Timestamp { - if o == nil || o.UpdatedAt == nil { - return Timestamp{} +// GetUsed returns the Used field. +func (r *Rate) GetUsed() int { + if r == nil { + return 0 } - return *o.UpdatedAt + return r.Used } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (o *Organization) GetURL() string { - if o == nil || o.URL == nil { +// GetMessage returns the Message field. +func (r *RateLimitError) GetMessage() string { + if r == nil { return "" } - return *o.URL + return r.Message } -// GetWebCommitSignoffRequired returns the WebCommitSignoffRequired field if it's non-nil, zero value otherwise. -func (o *Organization) GetWebCommitSignoffRequired() bool { - if o == nil || o.WebCommitSignoffRequired == nil { - return false +// GetRate returns the Rate field. +func (r *RateLimitError) GetRate() Rate { + if r == nil { + return Rate{} } - return *o.WebCommitSignoffRequired + return r.Rate } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrganizationCustomRepoRoles) GetTotalCount() int { - if o == nil || o.TotalCount == nil { - return 0 +// GetActionsRunnerRegistration returns the ActionsRunnerRegistration field. +func (r *RateLimits) GetActionsRunnerRegistration() *Rate { + if r == nil { + return nil } - return *o.TotalCount + return r.ActionsRunnerRegistration } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrganizationCustomRoles) GetTotalCount() int { - if o == nil || o.TotalCount == nil { - return 0 +// GetAuditLog returns the AuditLog field. +func (r *RateLimits) GetAuditLog() *Rate { + if r == nil { + return nil } - return *o.TotalCount + return r.AuditLog } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (o *OrganizationEvent) GetAction() string { - if o == nil || o.Action == nil { - return "" +// GetCodeScanningUpload returns the CodeScanningUpload field. +func (r *RateLimits) GetCodeScanningUpload() *Rate { + if r == nil { + return nil } - return *o.Action + return r.CodeScanningUpload } -// GetInstallation returns the Installation field. -func (o *OrganizationEvent) GetInstallation() *Installation { - if o == nil { +// GetCodeSearch returns the CodeSearch field. +func (r *RateLimits) GetCodeSearch() *Rate { + if r == nil { return nil } - return o.Installation + return r.CodeSearch } -// GetInvitation returns the Invitation field. -func (o *OrganizationEvent) GetInvitation() *Invitation { - if o == nil { +// GetCore returns the Core field. +func (r *RateLimits) GetCore() *Rate { + if r == nil { return nil } - return o.Invitation + return r.Core } -// GetMembership returns the Membership field. -func (o *OrganizationEvent) GetMembership() *Membership { - if o == nil { +// GetDependencySBOM returns the DependencySBOM field. +func (r *RateLimits) GetDependencySBOM() *Rate { + if r == nil { return nil } - return o.Membership + return r.DependencySBOM } -// GetOrganization returns the Organization field. -func (o *OrganizationEvent) GetOrganization() *Organization { - if o == nil { +// GetDependencySnapshots returns the DependencySnapshots field. +func (r *RateLimits) GetDependencySnapshots() *Rate { + if r == nil { return nil } - return o.Organization + return r.DependencySnapshots } -// GetSender returns the Sender field. -func (o *OrganizationEvent) GetSender() *User { - if o == nil { +// GetGraphQL returns the GraphQL field. +func (r *RateLimits) GetGraphQL() *Rate { + if r == nil { return nil } - return o.Sender + return r.GraphQL } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrganizationInstallations) GetTotalCount() int { - if o == nil || o.TotalCount == nil { - return 0 +// GetIntegrationManifest returns the IntegrationManifest field. +func (r *RateLimits) GetIntegrationManifest() *Rate { + if r == nil { + return nil } - return *o.TotalCount + return r.IntegrationManifest } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (o *OrgBlockEvent) GetAction() string { - if o == nil || o.Action == nil { - return "" +// GetSCIM returns the SCIM field. +func (r *RateLimits) GetSCIM() *Rate { + if r == nil { + return nil } - return *o.Action + return r.SCIM } -// GetBlockedUser returns the BlockedUser field. -func (o *OrgBlockEvent) GetBlockedUser() *User { - if o == nil { +// GetSearch returns the Search field. +func (r *RateLimits) GetSearch() *Rate { + if r == nil { return nil } - return o.BlockedUser + return r.Search } -// GetInstallation returns the Installation field. -func (o *OrgBlockEvent) GetInstallation() *Installation { - if o == nil { +// GetSourceImport returns the SourceImport field. +func (r *RateLimits) GetSourceImport() *Rate { + if r == nil { return nil } - return o.Installation + return r.SourceImport } -// GetOrganization returns the Organization field. -func (o *OrgBlockEvent) GetOrganization() *Organization { - if o == nil { - return nil +// GetType returns the Type field. +func (r *RawOptions) GetType() RawType { + if r == nil { + return 0 } - return o.Organization + return r.Type } -// GetSender returns the Sender field. -func (o *OrgBlockEvent) GetSender() *User { - if o == nil { - return nil +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (r *Reaction) GetContent() string { + if r == nil || r.Content == nil { + return "" } - return o.Sender + return *r.Content } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetCreatedAt() Timestamp { - if o == nil || o.CreatedAt == nil { +func (r *Reaction) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { return Timestamp{} } - return *o.CreatedAt + return *r.CreatedAt } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetID() int64 { - if o == nil || o.ID == nil { +func (r *Reaction) GetID() int64 { + if r == nil || r.ID == nil { return 0 } - return *o.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetName() string { - if o == nil || o.Name == nil { - return "" - } - return *o.Name -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetPath() string { - if o == nil || o.Path == nil { - return "" - } - return *o.Path + return *r.ID } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetRef() string { - if o == nil || o.Ref == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *Reaction) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *o.Ref + return *r.NodeID } -// GetRepository returns the Repository field. -func (o *OrgRequiredWorkflow) GetRepository() *Repository { - if o == nil { +// GetUser returns the User field. +func (r *Reaction) GetUser() *User { + if r == nil { return nil } - return o.Repository + return r.User } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetScope() string { - if o == nil || o.Scope == nil { - return "" +// GetConfused returns the Confused field if it's non-nil, zero value otherwise. +func (r *Reactions) GetConfused() int { + if r == nil || r.Confused == nil { + return 0 } - return *o.Scope + return *r.Confused } -// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetSelectedRepositoriesURL() string { - if o == nil || o.SelectedRepositoriesURL == nil { - return "" +// GetEyes returns the Eyes field if it's non-nil, zero value otherwise. +func (r *Reactions) GetEyes() int { + if r == nil || r.Eyes == nil { + return 0 } - return *o.SelectedRepositoriesURL + return *r.Eyes } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetState() string { - if o == nil || o.State == nil { - return "" +// GetHeart returns the Heart field if it's non-nil, zero value otherwise. +func (r *Reactions) GetHeart() int { + if r == nil || r.Heart == nil { + return 0 } - return *o.State + return *r.Heart } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetUpdatedAt() Timestamp { - if o == nil || o.UpdatedAt == nil { - return Timestamp{} +// GetHooray returns the Hooray field if it's non-nil, zero value otherwise. +func (r *Reactions) GetHooray() int { + if r == nil || r.Hooray == nil { + return 0 } - return *o.UpdatedAt + return *r.Hooray } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflows) GetTotalCount() int { - if o == nil || o.TotalCount == nil { +// GetLaugh returns the Laugh field if it's non-nil, zero value otherwise. +func (r *Reactions) GetLaugh() int { + if r == nil || r.Laugh == nil { return 0 } - return *o.TotalCount + return *r.Laugh } -// GetDisabledOrgs returns the DisabledOrgs field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetDisabledOrgs() int { - if o == nil || o.DisabledOrgs == nil { +// GetMinusOne returns the MinusOne field if it's non-nil, zero value otherwise. +func (r *Reactions) GetMinusOne() int { + if r == nil || r.MinusOne == nil { return 0 } - return *o.DisabledOrgs + return *r.MinusOne } -// GetTotalOrgs returns the TotalOrgs field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalOrgs() int { - if o == nil || o.TotalOrgs == nil { +// GetPlusOne returns the PlusOne field if it's non-nil, zero value otherwise. +func (r *Reactions) GetPlusOne() int { + if r == nil || r.PlusOne == nil { return 0 } - return *o.TotalOrgs + return *r.PlusOne } -// GetTotalTeamMembers returns the TotalTeamMembers field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalTeamMembers() int { - if o == nil || o.TotalTeamMembers == nil { +// GetRocket returns the Rocket field if it's non-nil, zero value otherwise. +func (r *Reactions) GetRocket() int { + if r == nil || r.Rocket == nil { return 0 } - return *o.TotalTeamMembers + return *r.Rocket } -// GetTotalTeams returns the TotalTeams field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalTeams() int { - if o == nil || o.TotalTeams == nil { +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (r *Reactions) GetTotalCount() int { + if r == nil || r.TotalCount == nil { return 0 } - return *o.TotalTeams + return *r.TotalCount } -// GetOrg returns the Org field. -func (o *OwnerInfo) GetOrg() *User { - if o == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *Reactions) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return o.Org + return *r.URL } -// GetUser returns the User field. -func (o *OwnerInfo) GetUser() *User { - if o == nil { - return nil +// 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 o.User + return *r.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *Package) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// 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 *p.CreatedAt + return *r.PreviousCostCenter } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Package) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// 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 *p.HTMLURL + return *r.ResourceType } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *Package) GetID() int64 { - if p == nil || p.ID == nil { +// GetStatusCode returns the StatusCode field. +func (r *RedirectionError) GetStatusCode() int { + if r == nil { return 0 } - return *p.ID + return r.StatusCode } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *Package) GetName() string { - if p == nil || p.Name == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *Reference) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.Name + return *r.NodeID } -// GetOwner returns the Owner field. -func (p *Package) GetOwner() *User { - if p == nil { +// GetObject returns the Object field. +func (r *Reference) GetObject() *GitObject { + if r == nil { return nil } - return p.Owner + return r.Object } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *Package) GetPackageType() string { - if p == nil || p.PackageType == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (r *Reference) GetRef() string { + if r == nil || r.Ref == nil { return "" } - return *p.PackageType -} - -// GetPackageVersion returns the PackageVersion field. -func (p *Package) GetPackageVersion() *PackageVersion { - if p == nil { - return nil - } - return p.PackageVersion + return *r.Ref } -// GetRegistry returns the Registry field. -func (p *Package) GetRegistry() *PackageRegistry { - if p == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *Reference) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return p.Registry + return *r.URL } -// GetRepository returns the Repository field. -func (p *Package) GetRepository() *Repository { - if p == nil { - return nil +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetPath() string { + if r == nil || r.Path == nil { + return "" } - return p.Repository + return *r.Path } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *Package) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetRef() string { + if r == nil || r.Ref == nil { + return "" } - return *p.UpdatedAt + return *r.Ref } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Package) GetURL() string { - if p == nil || p.URL == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetSHA() string { + if r == nil || r.SHA == nil { return "" } - return *p.URL + return *r.SHA } -// GetVersionCount returns the VersionCount field if it's non-nil, zero value otherwise. -func (p *Package) GetVersionCount() int64 { - if p == nil || p.VersionCount == nil { - return 0 +// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. +func (r *RegistrationToken) GetExpiresAt() Timestamp { + if r == nil || r.ExpiresAt == nil { + return Timestamp{} } - return *p.VersionCount + return *r.ExpiresAt } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (p *Package) GetVisibility() string { - if p == nil || p.Visibility == nil { +// GetToken returns the Token field if it's non-nil, zero value otherwise. +func (r *RegistrationToken) GetToken() string { + if r == nil || r.Token == nil { return "" } - return *p.Visibility + return *r.Token } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PackageEvent) GetAction() string { - if p == nil || p.Action == nil { +func (r *RegistryPackageEvent) GetAction() string { + if r == nil || r.Action == nil { return "" } - return *p.Action + return *r.Action +} + +// GetEnterprise returns the Enterprise field. +func (r *RegistryPackageEvent) GetEnterprise() *Enterprise { + if r == nil { + return nil + } + return r.Enterprise } // GetInstallation returns the Installation field. -func (p *PackageEvent) GetInstallation() *Installation { - if p == nil { +func (r *RegistryPackageEvent) GetInstallation() *Installation { + if r == nil { return nil } - return p.Installation + return r.Installation } -// GetOrg returns the Org field. -func (p *PackageEvent) GetOrg() *Organization { - if p == nil { +// GetOrganization returns the Organization field. +func (r *RegistryPackageEvent) GetOrganization() *Organization { + if r == nil { return nil } - return p.Org + return r.Organization } -// GetPackage returns the Package field. -func (p *PackageEvent) GetPackage() *Package { - if p == nil { +// GetRegistryPackage returns the RegistryPackage field. +func (r *RegistryPackageEvent) GetRegistryPackage() *Package { + if r == nil { return nil } - return p.Package + return r.RegistryPackage } -// GetRepo returns the Repo field. -func (p *PackageEvent) GetRepo() *Repository { - if p == nil { +// GetRepository returns the Repository field. +func (r *RegistryPackageEvent) GetRepository() *Repository { + if r == nil { return nil } - return p.Repo + return r.Repository } // GetSender returns the Sender field. -func (p *PackageEvent) GetSender() *User { - if p == nil { +func (r *RegistryPackageEvent) GetSender() *User { + if r == nil { return nil } - return p.Sender + return r.Sender } -// GetAuthor returns the Author field. -func (p *PackageFile) GetAuthor() *User { - if p == nil { - return nil +// GetBrowserDownloadURL returns the BrowserDownloadURL field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetBrowserDownloadURL() string { + if r == nil || r.BrowserDownloadURL == nil { + return "" } - return p.Author + return *r.BrowserDownloadURL } // GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetContentType() string { - if p == nil || p.ContentType == nil { +func (r *ReleaseAsset) GetContentType() string { + if r == nil || r.ContentType == nil { return "" } - return *p.ContentType + return *r.ContentType } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { +func (r *ReleaseAsset) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { return Timestamp{} } - return *p.CreatedAt + return *r.CreatedAt } -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetDownloadURL() string { - if p == nil || p.DownloadURL == nil { +// GetDigest returns the Digest field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetDigest() string { + if r == nil || r.Digest == nil { return "" } - return *p.DownloadURL + return *r.Digest } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetID() int64 { - if p == nil || p.ID == nil { +// GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetDownloadCount() int { + if r == nil || r.DownloadCount == nil { return 0 } - return *p.ID + return *r.DownloadCount } -// GetMD5 returns the MD5 field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetMD5() string { - if p == nil || p.MD5 == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return *p.MD5 + return *r.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetName() string { - if p == nil || p.Name == nil { +// GetLabel returns the Label field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetLabel() string { + if r == nil || r.Label == nil { return "" } - return *p.Name + return *r.Label } -// GetSHA1 returns the SHA1 field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetSHA1() string { - if p == nil || p.SHA1 == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetName() string { + if r == nil || r.Name == nil { return "" } - return *p.SHA1 + return *r.Name } -// GetSHA256 returns the SHA256 field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetSHA256() string { - if p == nil || p.SHA256 == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.SHA256 + return *r.NodeID } // GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetSize() int64 { - if p == nil || p.Size == nil { +func (r *ReleaseAsset) GetSize() int { + if r == nil || r.Size == nil { return 0 } - return *p.Size + return *r.Size } // GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetState() string { - if p == nil || p.State == nil { +func (r *ReleaseAsset) GetState() string { + if r == nil || r.State == nil { return "" } - return *p.State + return *r.State } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { +func (r *ReleaseAsset) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { return Timestamp{} } - return *p.UpdatedAt + return *r.UpdatedAt } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *PackageListOptions) GetPackageType() string { - if p == nil || p.PackageType == nil { - return "" +// GetUploader returns the Uploader field. +func (r *ReleaseAsset) GetUploader() *User { + if r == nil { + return nil } - return *p.PackageType + return r.Uploader } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PackageListOptions) GetState() string { - if p == nil || p.State == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *ReleaseAsset) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.State + return *r.URL } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (p *PackageListOptions) GetVisibility() string { - if p == nil || p.Visibility == nil { +// GetFrom returns the From field. +func (r *ReleaseChangeFrom) GetFrom() string { + if r == nil { return "" } - return *p.Visibility + return r.From } -// GetContainer returns the Container field. -func (p *PackageMetadata) GetContainer() *PackageContainerMetadata { - if p == nil { +// GetBody returns the Body field. +func (r *ReleaseChanges) GetBody() *ReleaseChangeFrom { + if r == nil { return nil } - return p.Container + return r.Body } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *PackageMetadata) GetPackageType() string { - if p == nil || p.PackageType == nil { - return "" +// GetMakeLatest returns the MakeLatest field. +func (r *ReleaseChanges) GetMakeLatest() *ReleaseChangeToBool { + if r == nil { + return nil } - return *p.PackageType + return r.MakeLatest } -// GetAboutURL returns the AboutURL field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetAboutURL() string { - if p == nil || p.AboutURL == nil { - return "" +// GetName returns the Name field. +func (r *ReleaseChanges) GetName() *ReleaseChangeFrom { + if r == nil { + return nil } - return *p.AboutURL + return r.Name } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetName() string { - if p == nil || p.Name == nil { - return "" +// GetTagName returns the TagName field. +func (r *ReleaseChanges) GetTagName() *ReleaseChangeFrom { + if r == nil { + return nil } - return *p.Name + return r.TagName } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetType() string { - if p == nil || p.Type == nil { - return "" +// GetTo returns the To field. +func (r *ReleaseChangeToBool) GetTo() bool { + if r == nil { + return false } - return *p.Type + return r.To } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetURL() string { - if p == nil || p.URL == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *ReleaseEvent) GetAction() string { + if r == nil || r.Action == nil { return "" } - return *p.URL + return *r.Action } -// GetVendor returns the Vendor field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetVendor() string { - if p == nil || p.Vendor == nil { - return "" +// GetChanges returns the Changes field. +func (r *ReleaseEvent) GetChanges() *ReleaseChanges { + if r == nil { + return nil } - return *p.Vendor + return r.Changes } -// GetAuthor returns the Author field. -func (p *PackageRelease) GetAuthor() *User { - if p == nil { +// GetEnterprise returns the Enterprise field. +func (r *ReleaseEvent) GetEnterprise() *Enterprise { + if r == nil { return nil } - return p.Author + return r.Enterprise } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetInstallation returns the Installation field. +func (r *ReleaseEvent) GetInstallation() *Installation { + if r == nil { + return nil } - return *p.CreatedAt + return r.Installation } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetDraft() bool { - if p == nil || p.Draft == nil { - return false +// GetOrg returns the Org field. +func (r *ReleaseEvent) GetOrg() *Organization { + if r == nil { + return nil } - return *p.Draft + return r.Org } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetRelease returns the Release field. +func (r *ReleaseEvent) GetRelease() *RepositoryRelease { + if r == nil { + return nil + } + return r.Release +} + +// GetRepo returns the Repo field. +func (r *ReleaseEvent) GetRepo() *Repository { + if r == nil { + return nil + } + return r.Repo +} + +// GetSender returns the Sender field. +func (r *ReleaseEvent) GetSender() *User { + if r == nil { + return nil + } + return r.Sender +} + +// GetBuildDate returns the BuildDate field if it's non-nil, zero value otherwise. +func (r *ReleaseVersion) GetBuildDate() string { + if r == nil || r.BuildDate == nil { return "" } - return *p.HTMLURL + return *r.BuildDate } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetBuildID returns the BuildID field if it's non-nil, zero value otherwise. +func (r *ReleaseVersion) GetBuildID() string { + if r == nil || r.BuildID == nil { + return "" } - return *p.ID + return *r.BuildID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetName() string { - if p == nil || p.Name == nil { +// GetPlatform returns the Platform field if it's non-nil, zero value otherwise. +func (r *ReleaseVersion) GetPlatform() string { + if r == nil || r.Platform == nil { return "" } - return *p.Name + return *r.Platform } -// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetPrerelease() bool { - if p == nil || p.Prerelease == nil { - return false +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (r *ReleaseVersion) GetVersion() string { + if r == nil || r.Version == nil { + return "" } - return *p.Prerelease + return *r.Version } -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetPublishedAt() Timestamp { - if p == nil || p.PublishedAt == nil { +// 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 { return Timestamp{} } - return *p.PublishedAt + return *r.ExpiresAt } -// GetTagName returns the TagName field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetTagName() string { - if p == nil || p.TagName == nil { +// GetToken returns the Token field if it's non-nil, zero value otherwise. +func (r *RemoveToken) GetToken() string { + if r == nil || r.Token == nil { return "" } - return *p.TagName + return *r.Token } -// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetTargetCommitish() string { - if p == nil || p.TargetCommitish == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *Rename) GetFrom() string { + if r == nil || r.From == nil { return "" } - return *p.TargetCommitish + return *r.From +} + +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (r *Rename) GetTo() string { + if r == nil || r.To == nil { + return "" + } + return *r.To +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RenameOrgResponse) GetMessage() string { + if r == nil || r.Message == nil { + return "" + } + return *r.Message } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetURL() string { - if p == nil || p.URL == nil { +func (r *RenameOrgResponse) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.URL + return *r.URL } -// GetAuthor returns the Author field. -func (p *PackageVersion) GetAuthor() *User { - if p == nil { - return nil +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCredit) GetLogin() string { + if r == nil || r.Login == nil { + return "" } - return p.Author + return *r.Login } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetBody() string { - if p == nil || p.Body == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCredit) GetType() string { + if r == nil || r.Type == nil { return "" } - return *p.Body + return *r.Type } -// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetBodyHTML() string { - if p == nil || p.BodyHTML == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCreditDetailed) GetState() string { + if r == nil || r.State == nil { return "" } - return *p.BodyHTML + return *r.State } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCreditDetailed) GetType() string { + if r == nil || r.Type == nil { + return "" } - return *p.CreatedAt + return *r.Type } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetDraft() bool { - if p == nil || p.Draft == nil { - return false +// GetUser returns the User field. +func (r *RepoAdvisoryCreditDetailed) GetUser() *User { + if r == nil { + return nil + } + return r.User +} + +// GetProperties returns the Properties slice if it's non-nil, nil otherwise. +func (r *RepoCustomPropertyValue) GetProperties() []*CustomPropertyValue { + if r == nil || r.Properties == nil { + return nil } - return *p.Draft + return r.Properties } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetRepositoryFullName returns the RepositoryFullName field. +func (r *RepoCustomPropertyValue) GetRepositoryFullName() string { + if r == nil { return "" } - return *p.HTMLURL + return r.RepositoryFullName } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetID() int64 { - if p == nil || p.ID == nil { +// GetRepositoryID returns the RepositoryID field. +func (r *RepoCustomPropertyValue) GetRepositoryID() int64 { + if r == nil { return 0 } - return *p.ID + return r.RepositoryID } -// GetInstallationCommand returns the InstallationCommand field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetInstallationCommand() string { - if p == nil || p.InstallationCommand == nil { +// GetRepositoryName returns the RepositoryName field. +func (r *RepoCustomPropertyValue) GetRepositoryName() string { + if r == nil { return "" } - return *p.InstallationCommand + return r.RepositoryName } -// GetManifest returns the Manifest field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetManifest() string { - if p == nil || p.Manifest == nil { +// GetDownloadLocation returns the DownloadLocation field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetDownloadLocation() string { + if r == nil || r.DownloadLocation == nil { return "" } - return *p.Manifest + return *r.DownloadLocation } -// GetMetadata returns the Metadata field. -func (p *PackageVersion) GetMetadata() *PackageMetadata { - if p == nil { +// GetExternalRefs returns the ExternalRefs slice if it's non-nil, nil otherwise. +func (r *RepoDependencies) GetExternalRefs() []*PackageExternalRef { + if r == nil || r.ExternalRefs == nil { return nil } - return p.Metadata + return r.ExternalRefs } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetName() string { - if p == nil || p.Name == nil { - return "" +// GetFilesAnalyzed returns the FilesAnalyzed field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetFilesAnalyzed() bool { + if r == nil || r.FilesAnalyzed == nil { + return false } - return *p.Name + return *r.FilesAnalyzed } -// GetPackageHTMLURL returns the PackageHTMLURL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetPackageHTMLURL() string { - if p == nil || p.PackageHTMLURL == nil { +// GetLicenseConcluded returns the LicenseConcluded field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetLicenseConcluded() string { + if r == nil || r.LicenseConcluded == nil { return "" } - return *p.PackageHTMLURL + return *r.LicenseConcluded } -// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetPrerelease() bool { - if p == nil || p.Prerelease == nil { - return false +// GetLicenseDeclared returns the LicenseDeclared field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetLicenseDeclared() string { + if r == nil || r.LicenseDeclared == nil { + return "" } - return *p.Prerelease + return *r.LicenseDeclared } -// GetRelease returns the Release field. -func (p *PackageVersion) GetRelease() *PackageRelease { - if p == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetName() string { + if r == nil || r.Name == nil { + return "" } - return p.Release + return *r.Name } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetSummary() string { - if p == nil || p.Summary == nil { +// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetSPDXID() string { + if r == nil || r.SPDXID == nil { return "" } - return *p.Summary + return *r.SPDXID } -// GetTagName returns the TagName field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetTagName() string { - if p == nil || p.TagName == nil { +// GetVersionInfo returns the VersionInfo field if it's non-nil, zero value otherwise. +func (r *RepoDependencies) GetVersionInfo() string { + if r == nil || r.VersionInfo == nil { return "" } - return *p.TagName + return *r.VersionInfo } -// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetTargetCommitish() string { - if p == nil || p.TargetCommitish == nil { +// GetDescription returns the Description field. +func (r *RepoFineGrainedPermission) GetDescription() string { + if r == nil { return "" } - return *p.TargetCommitish + return r.Description } -// GetTargetOID returns the TargetOID field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetTargetOID() string { - if p == nil || p.TargetOID == nil { +// GetName returns the Name field. +func (r *RepoFineGrainedPermission) GetName() string { + if r == nil { return "" } - return *p.TargetOID + return r.Name } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (r *RepoImmutableReleasesStatus) GetEnabled() bool { + if r == nil || r.Enabled == nil { + return false } - return *p.UpdatedAt + return *r.Enabled } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetURL() string { - if p == nil || p.URL == nil { - return "" +// GetEnforcedByOwner returns the EnforcedByOwner field if it's non-nil, zero value otherwise. +func (r *RepoImmutableReleasesStatus) GetEnforcedByOwner() bool { + if r == nil || r.EnforcedByOwner == nil { + return false } - return *p.URL + return *r.EnforcedByOwner } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetVersion() string { - if p == nil || p.Version == nil { +// GetBranch returns the Branch field. +func (r *RepoMergeUpstreamRequest) GetBranch() string { + if r == nil { return "" } - return *p.Version + return r.Branch } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *Page) GetAction() string { - if p == nil || p.Action == nil { +// GetBaseBranch returns the BaseBranch field if it's non-nil, zero value otherwise. +func (r *RepoMergeUpstreamResult) GetBaseBranch() string { + if r == nil || r.BaseBranch == nil { return "" } - return *p.Action + return *r.BaseBranch } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Page) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetMergeType returns the MergeType field if it's non-nil, zero value otherwise. +func (r *RepoMergeUpstreamResult) GetMergeType() string { + if r == nil || r.MergeType == nil { return "" } - return *p.HTMLURL + return *r.MergeType } -// GetPageName returns the PageName field if it's non-nil, zero value otherwise. -func (p *Page) GetPageName() string { - if p == nil || p.PageName == nil { +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RepoMergeUpstreamResult) GetMessage() string { + if r == nil || r.Message == nil { return "" } - return *p.PageName + return *r.Message } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *Page) GetSHA() string { - if p == nil || p.SHA == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RepoName) GetFrom() string { + if r == nil || r.From == nil { return "" } - return *p.SHA + return *r.From } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (p *Page) GetSummary() string { - if p == nil || p.Summary == nil { - return "" +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (r *RepositoriesSearchResult) GetIncompleteResults() bool { + if r == nil || r.IncompleteResults == nil { + return false } - return *p.Summary + return *r.IncompleteResults } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *Page) GetTitle() string { - if p == nil || p.Title == nil { - return "" +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (r *RepositoriesSearchResult) GetRepositories() []*Repository { + if r == nil || r.Repositories == nil { + return nil } - return *p.Title + return r.Repositories } -// GetBuild returns the Build field. -func (p *PageBuildEvent) GetBuild() *PagesBuild { - if p == nil { - return nil +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (r *RepositoriesSearchResult) GetTotal() int { + if r == nil || r.Total == nil { + return 0 } - return p.Build + return *r.Total } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PageBuildEvent) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetAllowAutoMerge returns the AllowAutoMerge field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowAutoMerge() bool { + if r == nil || r.AllowAutoMerge == nil { + return false } - return *p.ID + return *r.AllowAutoMerge } -// GetInstallation returns the Installation field. -func (p *PageBuildEvent) GetInstallation() *Installation { - if p == nil { - return nil +// GetAllowForking returns the AllowForking field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowForking() bool { + if r == nil || r.AllowForking == nil { + return false } - return p.Installation + return *r.AllowForking } -// GetOrg returns the Org field. -func (p *PageBuildEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowMergeCommit() bool { + if r == nil || r.AllowMergeCommit == nil { + return false } - return p.Org + return *r.AllowMergeCommit } -// GetRepo returns the Repo field. -func (p *PageBuildEvent) GetRepo() *Repository { - if p == nil { - return nil +// GetAllowRebaseMerge returns the AllowRebaseMerge field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowRebaseMerge() bool { + if r == nil || r.AllowRebaseMerge == nil { + return false } - return p.Repo + return *r.AllowRebaseMerge } -// GetSender returns the Sender field. -func (p *PageBuildEvent) GetSender() *User { - if p == nil { - return nil +// GetAllowSquashMerge returns the AllowSquashMerge field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowSquashMerge() bool { + if r == nil || r.AllowSquashMerge == nil { + return false } - return p.Sender + return *r.AllowSquashMerge } -// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. -func (p *Pages) GetBuildType() string { - if p == nil || p.BuildType == nil { +// GetAllowUpdateBranch returns the AllowUpdateBranch field if it's non-nil, zero value otherwise. +func (r *Repository) GetAllowUpdateBranch() bool { + if r == nil || r.AllowUpdateBranch == nil { + return false + } + return *r.AllowUpdateBranch +} + +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (r *Repository) GetArchived() bool { + if r == nil || r.Archived == nil { + return false + } + return *r.Archived +} + +// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetArchiveURL() string { + if r == nil || r.ArchiveURL == nil { return "" } - return *p.BuildType + return *r.ArchiveURL } -// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. -func (p *Pages) GetCNAME() string { - if p == nil || p.CNAME == nil { +// GetAssigneesURL returns the AssigneesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetAssigneesURL() string { + if r == nil || r.AssigneesURL == nil { return "" } - return *p.CNAME + return *r.AssigneesURL } -// GetCustom404 returns the Custom404 field if it's non-nil, zero value otherwise. -func (p *Pages) GetCustom404() bool { - if p == nil || p.Custom404 == nil { +// GetAutoInit returns the AutoInit field if it's non-nil, zero value otherwise. +func (r *Repository) GetAutoInit() bool { + if r == nil || r.AutoInit == nil { return false } - return *p.Custom404 + return *r.AutoInit } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Pages) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetBlobsURL returns the BlobsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetBlobsURL() string { + if r == nil || r.BlobsURL == nil { return "" } - return *p.HTMLURL + return *r.BlobsURL } -// GetHTTPSCertificate returns the HTTPSCertificate field. -func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { - if p == nil { +// GetBranchesURL returns the BranchesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetBranchesURL() string { + if r == nil || r.BranchesURL == nil { + return "" + } + return *r.BranchesURL +} + +// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetCloneURL() string { + if r == nil || r.CloneURL == nil { + return "" + } + return *r.CloneURL +} + +// GetCodeOfConduct returns the CodeOfConduct field. +func (r *Repository) GetCodeOfConduct() *CodeOfConduct { + if r == nil { return nil } - return p.HTTPSCertificate + return r.CodeOfConduct } -// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. -func (p *Pages) GetHTTPSEnforced() bool { - if p == nil || p.HTTPSEnforced == nil { - return false +// GetCollaboratorsURL returns the CollaboratorsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetCollaboratorsURL() string { + if r == nil || r.CollaboratorsURL == nil { + return "" } - return *p.HTTPSEnforced + return *r.CollaboratorsURL } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *Pages) GetPublic() bool { - if p == nil || p.Public == nil { - return false +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetCommentsURL() string { + if r == nil || r.CommentsURL == nil { + return "" } - return *p.Public + return *r.CommentsURL } -// GetSource returns the Source field. -func (p *Pages) GetSource() *PagesSource { - if p == nil { - return nil +// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetCommitsURL() string { + if r == nil || r.CommitsURL == nil { + return "" } - return p.Source + return *r.CommitsURL } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (p *Pages) GetStatus() string { - if p == nil || p.Status == nil { +// GetCompareURL returns the CompareURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetCompareURL() string { + if r == nil || r.CompareURL == nil { return "" } - return *p.Status + return *r.CompareURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Pages) GetURL() string { - if p == nil || p.URL == nil { +// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetContentsURL() string { + if r == nil || r.ContentsURL == nil { return "" } - return *p.URL + return *r.ContentsURL } -// GetCommit returns the Commit field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetCommit() string { - if p == nil || p.Commit == nil { +// GetContributorsURL returns the ContributorsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetContributorsURL() string { + if r == nil || r.ContributorsURL == nil { return "" } - return *p.Commit + return *r.ContributorsURL } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { +func (r *Repository) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { return Timestamp{} } - return *p.CreatedAt + return *r.CreatedAt } -// GetDuration returns the Duration field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetDuration() int { - if p == nil || p.Duration == nil { - return 0 +// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise. +func (r *Repository) GetCustomProperties() map[string]any { + if r == nil || r.CustomProperties == nil { + return map[string]any{} } - return *p.Duration + return r.CustomProperties } -// GetError returns the Error field. -func (p *PagesBuild) GetError() *PagesError { - if p == nil { - return nil +// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. +func (r *Repository) GetDefaultBranch() string { + if r == nil || r.DefaultBranch == nil { + return "" } - return p.Error + return *r.DefaultBranch } -// GetPusher returns the Pusher field. -func (p *PagesBuild) GetPusher() *User { - if p == nil { - return nil +// GetDeleteBranchOnMerge returns the DeleteBranchOnMerge field if it's non-nil, zero value otherwise. +func (r *Repository) GetDeleteBranchOnMerge() bool { + if r == nil || r.DeleteBranchOnMerge == nil { + return false } - return p.Pusher + return *r.DeleteBranchOnMerge } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetStatus() string { - if p == nil || p.Status == nil { +// GetDeploymentsURL returns the DeploymentsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetDeploymentsURL() string { + if r == nil || r.DeploymentsURL == nil { return "" } - return *p.Status + return *r.DeploymentsURL } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (r *Repository) GetDescription() string { + if r == nil || r.Description == nil { + return "" } - return *p.UpdatedAt + return *r.Description } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetURL() string { - if p == nil || p.URL == nil { - return "" +// GetDisabled returns the Disabled field if it's non-nil, zero value otherwise. +func (r *Repository) GetDisabled() bool { + if r == nil || r.Disabled == nil { + return false } - return *p.URL + return *r.Disabled } -// GetCAAError returns the CAAError field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetCAAError() string { - if p == nil || p.CAAError == nil { +// GetDownloadsURL returns the DownloadsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetDownloadsURL() string { + if r == nil || r.DownloadsURL == nil { return "" } - return *p.CAAError + return *r.DownloadsURL } -// GetDNSResolves returns the DNSResolves field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetDNSResolves() bool { - if p == nil || p.DNSResolves == nil { - return false +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetEventsURL() string { + if r == nil || r.EventsURL == nil { + return "" } - return *p.DNSResolves + return *r.EventsURL } -// GetEnforcesHTTPS returns the EnforcesHTTPS field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetEnforcesHTTPS() bool { - if p == nil || p.EnforcesHTTPS == nil { +// GetFork returns the Fork field if it's non-nil, zero value otherwise. +func (r *Repository) GetFork() bool { + if r == nil || r.Fork == nil { return false } - return *p.EnforcesHTTPS + return *r.Fork } -// GetHasCNAMERecord returns the HasCNAMERecord field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHasCNAMERecord() bool { - if p == nil || p.HasCNAMERecord == nil { - return false +// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetForksCount() int { + if r == nil || r.ForksCount == nil { + return 0 } - return *p.HasCNAMERecord + return *r.ForksCount } -// GetHasMXRecordsPresent returns the HasMXRecordsPresent field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHasMXRecordsPresent() bool { - if p == nil || p.HasMXRecordsPresent == nil { - return false +// GetForksURL returns the ForksURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetForksURL() string { + if r == nil || r.ForksURL == nil { + return "" } - return *p.HasMXRecordsPresent + return *r.ForksURL } -// GetHost returns the Host field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHost() string { - if p == nil || p.Host == nil { +// GetFullName returns the FullName field if it's non-nil, zero value otherwise. +func (r *Repository) GetFullName() string { + if r == nil || r.FullName == nil { return "" } - return *p.Host + return *r.FullName } -// GetHTTPSError returns the HTTPSError field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHTTPSError() string { - if p == nil || p.HTTPSError == nil { +// GetGitCommitsURL returns the GitCommitsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetGitCommitsURL() string { + if r == nil || r.GitCommitsURL == nil { return "" } - return *p.HTTPSError + return *r.GitCommitsURL } -// GetIsApexDomain returns the IsApexDomain field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsApexDomain() bool { - if p == nil || p.IsApexDomain == nil { - return false +// GetGitignoreTemplate returns the GitignoreTemplate field if it's non-nil, zero value otherwise. +func (r *Repository) GetGitignoreTemplate() string { + if r == nil || r.GitignoreTemplate == nil { + return "" } - return *p.IsApexDomain + return *r.GitignoreTemplate } -// GetIsARecord returns the IsARecord field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsARecord() bool { - if p == nil || p.IsARecord == nil { - return false +// GetGitRefsURL returns the GitRefsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetGitRefsURL() string { + if r == nil || r.GitRefsURL == nil { + return "" } - return *p.IsARecord + return *r.GitRefsURL } -// GetIsCloudflareIP returns the IsCloudflareIP field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsCloudflareIP() bool { - if p == nil || p.IsCloudflareIP == nil { - return false +// GetGitTagsURL returns the GitTagsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetGitTagsURL() string { + if r == nil || r.GitTagsURL == nil { + return "" } - return *p.IsCloudflareIP + return *r.GitTagsURL } -// GetIsCNAMEToFastly returns the IsCNAMEToFastly field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsCNAMEToFastly() bool { - if p == nil || p.IsCNAMEToFastly == nil { - return false +// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetGitURL() string { + if r == nil || r.GitURL == nil { + return "" } - return *p.IsCNAMEToFastly + return *r.GitURL } -// GetIsCNAMEToGithubUserDomain returns the IsCNAMEToGithubUserDomain field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsCNAMEToGithubUserDomain() bool { - if p == nil || p.IsCNAMEToGithubUserDomain == nil { +// GetHasDiscussions returns the HasDiscussions field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasDiscussions() bool { + if r == nil || r.HasDiscussions == nil { return false } - return *p.IsCNAMEToGithubUserDomain + return *r.HasDiscussions } -// GetIsCNAMEToPagesDotGithubDotCom returns the IsCNAMEToPagesDotGithubDotCom field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsCNAMEToPagesDotGithubDotCom() bool { - if p == nil || p.IsCNAMEToPagesDotGithubDotCom == nil { +// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasDownloads() bool { + if r == nil || r.HasDownloads == nil { return false } - return *p.IsCNAMEToPagesDotGithubDotCom + return *r.HasDownloads } -// GetIsFastlyIP returns the IsFastlyIP field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsFastlyIP() bool { - if p == nil || p.IsFastlyIP == nil { +// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasIssues() bool { + if r == nil || r.HasIssues == nil { return false } - return *p.IsFastlyIP + return *r.HasIssues } -// GetIsHTTPSEligible returns the IsHTTPSEligible field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsHTTPSEligible() bool { - if p == nil || p.IsHTTPSEligible == nil { +// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasPages() bool { + if r == nil || r.HasPages == nil { return false } - return *p.IsHTTPSEligible + return *r.HasPages } -// GetIsNonGithubPagesIPPresent returns the IsNonGithubPagesIPPresent field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsNonGithubPagesIPPresent() bool { - if p == nil || p.IsNonGithubPagesIPPresent == nil { +// GetHasProjects returns the HasProjects field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasProjects() bool { + if r == nil || r.HasProjects == nil { return false } - return *p.IsNonGithubPagesIPPresent + return *r.HasProjects } -// GetIsOldIPAddress returns the IsOldIPAddress field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsOldIPAddress() bool { - if p == nil || p.IsOldIPAddress == nil { +// GetHasPullRequests returns the HasPullRequests field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasPullRequests() bool { + if r == nil || r.HasPullRequests == nil { return false } - return *p.IsOldIPAddress + return *r.HasPullRequests } -// GetIsPagesDomain returns the IsPagesDomain field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsPagesDomain() bool { - if p == nil || p.IsPagesDomain == nil { +// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. +func (r *Repository) GetHasWiki() bool { + if r == nil || r.HasWiki == nil { return false } - return *p.IsPagesDomain + return *r.HasWiki } -// GetIsPointedToGithubPagesIP returns the IsPointedToGithubPagesIP field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsPointedToGithubPagesIP() bool { - if p == nil || p.IsPointedToGithubPagesIP == nil { - return false +// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. +func (r *Repository) GetHomepage() string { + if r == nil || r.Homepage == nil { + return "" } - return *p.IsPointedToGithubPagesIP + return *r.Homepage } -// GetIsProxied returns the IsProxied field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsProxied() bool { - if p == nil || p.IsProxied == nil { - return false +// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetHooksURL() string { + if r == nil || r.HooksURL == nil { + return "" } - return *p.IsProxied + return *r.HooksURL } -// GetIsServedByPages returns the IsServedByPages field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsServedByPages() bool { - if p == nil || p.IsServedByPages == nil { - return false +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { + return "" } - return *p.IsServedByPages + return *r.HTMLURL } -// GetIsValid returns the IsValid field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsValid() bool { - if p == nil || p.IsValid == nil { - return false +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *Repository) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return *p.IsValid + return *r.ID } -// GetIsValidDomain returns the IsValidDomain field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsValidDomain() bool { - if p == nil || p.IsValidDomain == nil { - return false +// GetIssueCommentURL returns the IssueCommentURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetIssueCommentURL() string { + if r == nil || r.IssueCommentURL == nil { + return "" } - return *p.IsValidDomain + return *r.IssueCommentURL } -// GetNameservers returns the Nameservers field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetNameservers() string { - if p == nil || p.Nameservers == nil { +// GetIssueEventsURL returns the IssueEventsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetIssueEventsURL() string { + if r == nil || r.IssueEventsURL == nil { return "" } - return *p.Nameservers + return *r.IssueEventsURL } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetReason() string { - if p == nil || p.Reason == nil { +// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetIssuesURL() string { + if r == nil || r.IssuesURL == nil { return "" } - return *p.Reason + return *r.IssuesURL } -// GetRespondsToHTTPS returns the RespondsToHTTPS field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetRespondsToHTTPS() bool { - if p == nil || p.RespondsToHTTPS == nil { +// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. +func (r *Repository) GetIsTemplate() bool { + if r == nil || r.IsTemplate == nil { return false } - return *p.RespondsToHTTPS + return *r.IsTemplate } -// GetShouldBeARecord returns the ShouldBeARecord field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetShouldBeARecord() bool { - if p == nil || p.ShouldBeARecord == nil { - return false +// GetKeysURL returns the KeysURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetKeysURL() string { + if r == nil || r.KeysURL == nil { + return "" } - return *p.ShouldBeARecord + return *r.KeysURL } -// GetURI returns the URI field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetURI() string { - if p == nil || p.URI == nil { +// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetLabelsURL() string { + if r == nil || r.LabelsURL == nil { return "" } - return *p.URI + return *r.LabelsURL } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PagesError) GetMessage() string { - if p == nil || p.Message == nil { +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (r *Repository) GetLanguage() string { + if r == nil || r.Language == nil { return "" } - return *p.Message + return *r.Language } -// GetAltDomain returns the AltDomain field. -func (p *PagesHealthCheckResponse) GetAltDomain() *PagesDomain { - if p == nil { - return nil +// GetLanguagesURL returns the LanguagesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetLanguagesURL() string { + if r == nil || r.LanguagesURL == nil { + return "" } - return p.AltDomain + return *r.LanguagesURL } -// GetDomain returns the Domain field. -func (p *PagesHealthCheckResponse) GetDomain() *PagesDomain { - if p == nil { +// GetLicense returns the License field. +func (r *Repository) GetLicense() *License { + if r == nil { return nil } - return p.Domain + return r.License } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *PagesHTTPSCertificate) GetDescription() string { - if p == nil || p.Description == nil { +// GetLicenseTemplate returns the LicenseTemplate field if it's non-nil, zero value otherwise. +func (r *Repository) GetLicenseTemplate() string { + if r == nil || r.LicenseTemplate == nil { return "" } - return *p.Description + return *r.LicenseTemplate } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (p *PagesHTTPSCertificate) GetExpiresAt() string { - if p == nil || p.ExpiresAt == nil { +// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. +func (r *Repository) GetMasterBranch() string { + if r == nil || r.MasterBranch == nil { return "" } - return *p.ExpiresAt + return *r.MasterBranch } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PagesHTTPSCertificate) GetState() string { - if p == nil || p.State == nil { +// GetMergeCommitMessage returns the MergeCommitMessage field if it's non-nil, zero value otherwise. +func (r *Repository) GetMergeCommitMessage() string { + if r == nil || r.MergeCommitMessage == nil { return "" } - return *p.State + return *r.MergeCommitMessage } -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetBranch() string { - if p == nil || p.Branch == nil { +// GetMergeCommitTitle returns the MergeCommitTitle field if it's non-nil, zero value otherwise. +func (r *Repository) GetMergeCommitTitle() string { + if r == nil || r.MergeCommitTitle == nil { return "" } - return *p.Branch + return *r.MergeCommitTitle } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetPath() string { - if p == nil || p.Path == nil { +// GetMergesURL returns the MergesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetMergesURL() string { + if r == nil || r.MergesURL == nil { return "" } - return *p.Path + return *r.MergesURL } -// GetTotalPages returns the TotalPages field if it's non-nil, zero value otherwise. -func (p *PageStats) GetTotalPages() int { - if p == nil || p.TotalPages == nil { - return 0 +// GetMilestonesURL returns the MilestonesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetMilestonesURL() string { + if r == nil || r.MilestonesURL == nil { + return "" } - return *p.TotalPages + return *r.MilestonesURL } -// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetBuildType() string { - if p == nil || p.BuildType == nil { +// GetMirrorURL returns the MirrorURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetMirrorURL() string { + if r == nil || r.MirrorURL == nil { return "" } - return *p.BuildType + return *r.MirrorURL } -// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetCNAME() string { - if p == nil || p.CNAME == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *Repository) GetName() string { + if r == nil || r.Name == nil { return "" } - return *p.CNAME + return *r.Name } -// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetHTTPSEnforced() bool { - if p == nil || p.HTTPSEnforced == nil { - return false +// GetNetworkCount returns the NetworkCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetNetworkCount() int { + if r == nil || r.NetworkCount == nil { + return 0 } - return *p.HTTPSEnforced + return *r.NetworkCount } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetPublic() bool { - if p == nil || p.Public == nil { - return false +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *Repository) GetNodeID() string { + if r == nil || r.NodeID == nil { + return "" } - return *p.Public + return *r.NodeID } -// GetSource returns the Source field. -func (p *PagesUpdate) GetSource() *PagesSource { - if p == nil { - return nil +// GetNotificationsURL returns the NotificationsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetNotificationsURL() string { + if r == nil || r.NotificationsURL == nil { + return "" } - return p.Source + return *r.NotificationsURL } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PatternRuleParameters) GetName() string { - if p == nil || p.Name == nil { - return "" +// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. +func (r *Repository) GetOpenIssues() int { + if r == nil || r.OpenIssues == nil { + return 0 } - return *p.Name + return *r.OpenIssues } -// GetNegate returns the Negate field if it's non-nil, zero value otherwise. -func (p *PatternRuleParameters) GetNegate() bool { - if p == nil || p.Negate == nil { - return false +// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetOpenIssuesCount() int { + if r == nil || r.OpenIssuesCount == nil { + return 0 } - return *p.Negate + return *r.OpenIssuesCount } -// GetCurrentUserCanApprove returns the CurrentUserCanApprove field if it's non-nil, zero value otherwise. -func (p *PendingDeployment) GetCurrentUserCanApprove() bool { - if p == nil || p.CurrentUserCanApprove == nil { - return false +// GetOrganization returns the Organization field. +func (r *Repository) GetOrganization() *Organization { + if r == nil { + return nil } - return *p.CurrentUserCanApprove + return r.Organization } -// GetEnvironment returns the Environment field. -func (p *PendingDeployment) GetEnvironment() *PendingDeploymentEnvironment { - if p == nil { +// GetOwner returns the Owner field. +func (r *Repository) GetOwner() *User { + if r == nil { return nil } - return p.Environment + return r.Owner } -// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. -func (p *PendingDeployment) GetWaitTimer() int64 { - if p == nil || p.WaitTimer == nil { - return 0 +// GetParent returns the Parent field. +func (r *Repository) GetParent() *Repository { + if r == nil { + return nil } - return *p.WaitTimer + return r.Parent } -// GetWaitTimerStartedAt returns the WaitTimerStartedAt field if it's non-nil, zero value otherwise. -func (p *PendingDeployment) GetWaitTimerStartedAt() Timestamp { - if p == nil || p.WaitTimerStartedAt == nil { - return Timestamp{} +// GetPermissions returns the Permissions field. +func (r *Repository) GetPermissions() *RepositoryPermissions { + if r == nil { + return nil } - return *p.WaitTimerStartedAt + return r.Permissions } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (r *Repository) GetPrivate() bool { + if r == nil || r.Private == nil { + return false } - return *p.HTMLURL + return *r.Private } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetPullRequestCreationPolicy returns the PullRequestCreationPolicy field if it's non-nil, zero value otherwise. +func (r *Repository) GetPullRequestCreationPolicy() string { + if r == nil || r.PullRequestCreationPolicy == nil { + return "" } - return *p.ID + return *r.PullRequestCreationPolicy } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetName() string { - if p == nil || p.Name == nil { +// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetPullsURL() string { + if r == nil || r.PullsURL == nil { return "" } - return *p.Name + return *r.PullsURL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. +func (r *Repository) GetPushedAt() Timestamp { + if r == nil || r.PushedAt == nil { + return Timestamp{} } - return *p.NodeID + return *r.PushedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetURL() string { - if p == nil || p.URL == nil { +// GetReleasesURL returns the ReleasesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetReleasesURL() string { + if r == nil || r.ReleasesURL == nil { return "" } - return *p.URL + return *r.ReleasesURL } -// GetAccessGrantedAt returns the AccessGrantedAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetAccessGrantedAt() Timestamp { - if p == nil || p.AccessGrantedAt == nil { - return Timestamp{} +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (r *Repository) GetRoleName() string { + if r == nil || r.RoleName == nil { + return "" } - return *p.AccessGrantedAt + return *r.RoleName } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetSecurityAndAnalysis returns the SecurityAndAnalysis field. +func (r *Repository) GetSecurityAndAnalysis() *SecurityAndAnalysis { + if r == nil { + return nil } - return *p.ID + return r.SecurityAndAnalysis } -// GetOwner returns the Owner field. -func (p *PersonalAccessToken) GetOwner() *User { - if p == nil { - return nil +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (r *Repository) GetSize() int { + if r == nil || r.Size == nil { + return 0 } - return p.Owner + return *r.Size } -// GetPermissions returns the Permissions field. -func (p *PersonalAccessToken) GetPermissions() *PersonalAccessTokenPermissions { - if p == nil { +// GetSource returns the Source field. +func (r *Repository) GetSource() *Repository { + if r == nil { return nil } - return p.Permissions + return r.Source } -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetRepositoriesURL() string { - if p == nil || p.RepositoriesURL == nil { +// GetSquashMergeCommitMessage returns the SquashMergeCommitMessage field if it's non-nil, zero value otherwise. +func (r *Repository) GetSquashMergeCommitMessage() string { + if r == nil || r.SquashMergeCommitMessage == nil { return "" } - return *p.RepositoriesURL + return *r.SquashMergeCommitMessage } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetRepositorySelection() string { - if p == nil || p.RepositorySelection == nil { +// GetSquashMergeCommitTitle returns the SquashMergeCommitTitle field if it's non-nil, zero value otherwise. +func (r *Repository) GetSquashMergeCommitTitle() string { + if r == nil || r.SquashMergeCommitTitle == nil { return "" } - return *p.RepositorySelection + return *r.SquashMergeCommitTitle } -// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenExpired() bool { - if p == nil || p.TokenExpired == nil { - return false +// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetSSHURL() string { + if r == nil || r.SSHURL == nil { + return "" } - return *p.TokenExpired + return *r.SSHURL } -// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenExpiresAt() Timestamp { - if p == nil || p.TokenExpiresAt == nil { - return Timestamp{} +// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetStargazersCount() int { + if r == nil || r.StargazersCount == nil { + return 0 } - return *p.TokenExpiresAt + return *r.StargazersCount } -// GetTokenID returns the TokenID field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenID() int64 { - if p == nil || p.TokenID == nil { - return 0 +// GetStargazersURL returns the StargazersURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetStargazersURL() string { + if r == nil || r.StargazersURL == nil { + return "" } - return *p.TokenID + return *r.StargazersURL } -// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenLastUsedAt() Timestamp { - if p == nil || p.TokenLastUsedAt == nil { - return Timestamp{} +// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetStatusesURL() string { + if r == nil || r.StatusesURL == nil { + return "" } - return *p.TokenLastUsedAt + return *r.StatusesURL } -// GetTokenName returns the TokenName field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenName() string { - if p == nil || p.TokenName == nil { - return "" +// GetSubscribersCount returns the SubscribersCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetSubscribersCount() int { + if r == nil || r.SubscribersCount == nil { + return 0 } - return *p.TokenName + return *r.SubscribersCount } -// GetOrg returns the Org map if it's non-nil, an empty map otherwise. -func (p *PersonalAccessTokenPermissions) GetOrg() map[string]string { - if p == nil || p.Org == nil { - return map[string]string{} +// GetSubscribersURL returns the SubscribersURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetSubscribersURL() string { + if r == nil || r.SubscribersURL == nil { + return "" } - return p.Org + return *r.SubscribersURL } -// GetOther returns the Other map if it's non-nil, an empty map otherwise. -func (p *PersonalAccessTokenPermissions) GetOther() map[string]string { - if p == nil || p.Other == nil { - return map[string]string{} +// GetSubscriptionURL returns the SubscriptionURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetSubscriptionURL() string { + if r == nil || r.SubscriptionURL == nil { + return "" } - return p.Other + return *r.SubscriptionURL } -// GetRepo returns the Repo map if it's non-nil, an empty map otherwise. -func (p *PersonalAccessTokenPermissions) GetRepo() map[string]string { - if p == nil || p.Repo == nil { - return map[string]string{} +// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetSVNURL() string { + if r == nil || r.SVNURL == nil { + return "" } - return p.Repo + return *r.SVNURL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetTagsURL returns the TagsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetTagsURL() string { + if r == nil || r.TagsURL == nil { + return "" } - return *p.CreatedAt + return *r.TagsURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetID() int64 { - if p == nil || p.ID == nil { +// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. +func (r *Repository) GetTeamID() int64 { + if r == nil || r.TeamID == nil { return 0 } - return *p.ID + return *r.TeamID } -// GetOrg returns the Org field. -func (p *PersonalAccessTokenRequest) GetOrg() *Organization { - if p == nil { - return nil +// GetTeamsURL returns the TeamsURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetTeamsURL() string { + if r == nil || r.TeamsURL == nil { + return "" } - return p.Org + return *r.TeamsURL } -// GetOwner returns the Owner field. -func (p *PersonalAccessTokenRequest) GetOwner() *User { - if p == nil { +// GetTemplateRepository returns the TemplateRepository field. +func (r *Repository) GetTemplateRepository() *Repository { + if r == nil { return nil } - return p.Owner + return r.TemplateRepository } -// GetPermissionsAdded returns the PermissionsAdded field. -func (p *PersonalAccessTokenRequest) GetPermissionsAdded() *PersonalAccessTokenPermissions { - if p == nil { +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (r *Repository) GetTextMatches() []*TextMatch { + if r == nil || r.TextMatches == nil { return nil } - return p.PermissionsAdded + return r.TextMatches } -// GetPermissionsResult returns the PermissionsResult field. -func (p *PersonalAccessTokenRequest) GetPermissionsResult() *PersonalAccessTokenPermissions { - if p == nil { +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (r *Repository) GetTopics() []string { + if r == nil || r.Topics == nil { return nil } - return p.PermissionsResult + return r.Topics } -// GetPermissionsUpgraded returns the PermissionsUpgraded field. -func (p *PersonalAccessTokenRequest) GetPermissionsUpgraded() *PersonalAccessTokenPermissions { - if p == nil { - return nil +// GetTreesURL returns the TreesURL field if it's non-nil, zero value otherwise. +func (r *Repository) GetTreesURL() string { + if r == nil || r.TreesURL == nil { + return "" } - return p.PermissionsUpgraded + return *r.TreesURL } -// GetRepositoryCount returns the RepositoryCount field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetRepositoryCount() int64 { - if p == nil || p.RepositoryCount == nil { - return 0 +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *Repository) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { + return Timestamp{} } - return *p.RepositoryCount + return *r.UpdatedAt } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetRepositorySelection() string { - if p == nil || p.RepositorySelection == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *Repository) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.RepositorySelection + return *r.URL } -// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetTokenExpired() bool { - if p == nil || p.TokenExpired == nil { +// GetUseSquashPRTitleAsDefault returns the UseSquashPRTitleAsDefault field if it's non-nil, zero value otherwise. +func (r *Repository) GetUseSquashPRTitleAsDefault() bool { + if r == nil || r.UseSquashPRTitleAsDefault == nil { return false } - return *p.TokenExpired + return *r.UseSquashPRTitleAsDefault } -// GetTokenExpiresAt returns the TokenExpiresAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetTokenExpiresAt() Timestamp { - if p == nil || p.TokenExpiresAt == nil { - return Timestamp{} +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (r *Repository) GetVisibility() string { + if r == nil || r.Visibility == nil { + return "" } - return *p.TokenExpiresAt + return *r.Visibility } -// GetTokenLastUsedAt returns the TokenLastUsedAt field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetTokenLastUsedAt() Timestamp { - if p == nil || p.TokenLastUsedAt == nil { - return Timestamp{} +// GetWatchers returns the Watchers field if it's non-nil, zero value otherwise. +func (r *Repository) GetWatchers() int { + if r == nil || r.Watchers == nil { + return 0 } - return *p.TokenLastUsedAt + return *r.Watchers } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequestEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" +// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. +func (r *Repository) GetWatchersCount() int { + if r == nil || r.WatchersCount == nil { + return 0 } - return *p.Action + return *r.WatchersCount } -// GetInstallation returns the Installation field. -func (p *PersonalAccessTokenRequestEvent) GetInstallation() *Installation { - if p == nil { - return nil +// GetWebCommitSignoffRequired returns the WebCommitSignoffRequired field if it's non-nil, zero value otherwise. +func (r *Repository) GetWebCommitSignoffRequired() bool { + if r == nil || r.WebCommitSignoffRequired == nil { + return false } - return p.Installation + return *r.WebCommitSignoffRequired } -// GetOrg returns the Org field. -func (p *PersonalAccessTokenRequestEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetAccessLevel returns the AccessLevel field. +func (r *RepositoryActionsAccessLevel) GetAccessLevel() string { + if r == nil { + return "" } - return p.Org + return r.AccessLevel } -// GetPersonalAccessTokenRequest returns the PersonalAccessTokenRequest field. -func (p *PersonalAccessTokenRequestEvent) GetPersonalAccessTokenRequest() *PersonalAccessTokenRequest { - if p == nil { - return nil +// GetAdvancedSecurityCommitters returns the AdvancedSecurityCommitters field. +func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommitters() int { + if r == nil { + return 0 } - return p.PersonalAccessTokenRequest + return r.AdvancedSecurityCommitters } -// GetSender returns the Sender field. -func (p *PersonalAccessTokenRequestEvent) GetSender() *User { - if p == nil { +// GetAdvancedSecurityCommittersBreakdown returns the AdvancedSecurityCommittersBreakdown slice if it's non-nil, nil otherwise. +func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommittersBreakdown() []*AdvancedSecurityCommittersBreakdown { + if r == nil || r.AdvancedSecurityCommittersBreakdown == nil { return nil } - return p.Sender + return r.AdvancedSecurityCommittersBreakdown } -// GetHook returns the Hook field. -func (p *PingEvent) GetHook() *Hook { - if p == nil { - return nil +// GetName returns the Name field. +func (r *RepositoryActiveCommitters) GetName() string { + if r == nil { + return "" } - return p.Hook + return r.Name } -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetHookID() int64 { - if p == nil || p.HookID == nil { - return 0 +// GetActivityType returns the ActivityType field. +func (r *RepositoryActivity) GetActivityType() string { + if r == nil { + return "" } - return *p.HookID + return r.ActivityType } -// GetInstallation returns the Installation field. -func (p *PingEvent) GetInstallation() *Installation { - if p == nil { +// GetActor returns the Actor field. +func (r *RepositoryActivity) GetActor() *RepositoryActor { + if r == nil { return nil } - return p.Installation + return r.Actor } -// GetOrg returns the Org field. -func (p *PingEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetAfter returns the After field. +func (r *RepositoryActivity) GetAfter() string { + if r == nil { + return "" } - return p.Org + return r.After } -// GetRepo returns the Repo field. -func (p *PingEvent) GetRepo() *Repository { - if p == nil { - return nil +// GetBefore returns the Before field. +func (r *RepositoryActivity) GetBefore() string { + if r == nil { + return "" } - return p.Repo + return r.Before } -// GetSender returns the Sender field. -func (p *PingEvent) GetSender() *User { - if p == nil { - return nil +// GetID returns the ID field. +func (r *RepositoryActivity) GetID() int64 { + if r == nil { + return 0 } - return p.Sender + return r.ID } -// GetZen returns the Zen field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetZen() string { - if p == nil || p.Zen == nil { +// GetNodeID returns the NodeID field. +func (r *RepositoryActivity) GetNodeID() string { + if r == nil { return "" } - return *p.Zen + return r.NodeID } -// GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. -func (p *Plan) GetCollaborators() int { - if p == nil || p.Collaborators == nil { - return 0 +// GetRef returns the Ref field. +func (r *RepositoryActivity) GetRef() string { + if r == nil { + return "" } - return *p.Collaborators + return r.Ref } -// GetFilledSeats returns the FilledSeats field if it's non-nil, zero value otherwise. -func (p *Plan) GetFilledSeats() int { - if p == nil || p.FilledSeats == nil { - return 0 +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (r *RepositoryActivity) GetTimestamp() Timestamp { + if r == nil || r.Timestamp == nil { + return Timestamp{} } - return *p.FilledSeats + return *r.Timestamp } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *Plan) GetName() string { - if p == nil || p.Name == nil { +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetAvatarURL() string { + if r == nil || r.AvatarURL == nil { return "" } - return *p.Name + return *r.AvatarURL } -// GetPrivateRepos returns the PrivateRepos field if it's non-nil, zero value otherwise. -func (p *Plan) GetPrivateRepos() int64 { - if p == nil || p.PrivateRepos == nil { - return 0 +// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetEventsURL() string { + if r == nil || r.EventsURL == nil { + return "" } - return *p.PrivateRepos + return *r.EventsURL } -// GetSeats returns the Seats field if it's non-nil, zero value otherwise. -func (p *Plan) GetSeats() int { - if p == nil || p.Seats == nil { - return 0 +// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetFollowersURL() string { + if r == nil || r.FollowersURL == nil { + return "" } - return *p.Seats + return *r.FollowersURL } -// GetSpace returns the Space field if it's non-nil, zero value otherwise. -func (p *Plan) GetSpace() int { - if p == nil || p.Space == nil { - return 0 +// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetFollowingURL() string { + if r == nil || r.FollowingURL == nil { + return "" } - return *p.Space + return *r.FollowingURL } -// GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetConfigURL() string { - if p == nil || p.ConfigURL == nil { +// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetGistsURL() string { + if r == nil || r.GistsURL == nil { return "" } - return *p.ConfigURL + return *r.GistsURL } -// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetEnforcement() string { - if p == nil || p.Enforcement == nil { +// GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetGravatarID() string { + if r == nil || r.GravatarID == nil { return "" } - return *p.Enforcement + return *r.GravatarID +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { + return "" + } + return *r.HTMLURL } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetID() int64 { - if p == nil || p.ID == nil { +func (r *RepositoryActor) GetID() int64 { + if r == nil || r.ID == nil { return 0 } - return *p.ID + return *r.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetName() string { - if p == nil || p.Name == nil { +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetLogin() string { + if r == nil || r.Login == nil { return "" } - return *p.Name + return *r.Login } -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (p *PRLink) GetHRef() string { - if p == nil || p.HRef == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.HRef + return *r.NodeID } -// GetComments returns the Comments field. -func (p *PRLinks) GetComments() *PRLink { - if p == nil { - return nil +// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetOrganizationsURL() string { + if r == nil || r.OrganizationsURL == nil { + return "" } - return p.Comments + return *r.OrganizationsURL } -// GetCommits returns the Commits field. -func (p *PRLinks) GetCommits() *PRLink { - if p == nil { - return nil +// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetReceivedEventsURL() string { + if r == nil || r.ReceivedEventsURL == nil { + return "" } - return p.Commits + return *r.ReceivedEventsURL } -// GetHTML returns the HTML field. -func (p *PRLinks) GetHTML() *PRLink { - if p == nil { - return nil +// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetReposURL() string { + if r == nil || r.ReposURL == nil { + return "" } - return p.HTML + return *r.ReposURL } -// GetIssue returns the Issue field. -func (p *PRLinks) GetIssue() *PRLink { - if p == nil { - return nil +// GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetSiteAdmin() bool { + if r == nil || r.SiteAdmin == nil { + return false } - return p.Issue + return *r.SiteAdmin } -// GetReviewComment returns the ReviewComment field. -func (p *PRLinks) GetReviewComment() *PRLink { - if p == nil { - return nil +// GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetStarredURL() string { + if r == nil || r.StarredURL == nil { + return "" } - return p.ReviewComment + return *r.StarredURL } -// GetReviewComments returns the ReviewComments field. -func (p *PRLinks) GetReviewComments() *PRLink { - if p == nil { - return nil +// GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetSubscriptionsURL() string { + if r == nil || r.SubscriptionsURL == nil { + return "" } - return p.ReviewComments + return *r.SubscriptionsURL } -// GetSelf returns the Self field. -func (p *PRLinks) GetSelf() *PRLink { - if p == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetType() string { + if r == nil || r.Type == nil { + return "" } - return p.Self + return *r.Type } -// GetStatuses returns the Statuses field. -func (p *PRLinks) GetStatuses() *PRLink { - if p == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return p.Statuses + return *r.URL } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (p *ProjectBody) GetFrom() string { - if p == nil || p.From == nil { +// GetUserViewType returns the UserViewType field if it's non-nil, zero value otherwise. +func (r *RepositoryActor) GetUserViewType() string { + if r == nil || r.UserViewType == nil { return "" } - return *p.From + return *r.UserViewType } -// GetNote returns the Note field. -func (p *ProjectCardChange) GetNote() *ProjectCardNote { - if p == nil { +// GetRepository returns the Repository field. +func (r *RepositoryAttachment) GetRepository() *Repository { + if r == nil { return nil } - return p.Note + return r.Repository } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (p *ProjectCardNote) GetFrom() string { - if p == nil || p.From == nil { +// 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 *p.From + return *r.Status } -// GetBody returns the Body field. -func (p *ProjectChange) GetBody() *ProjectBody { - if p == nil { +// GetConfiguration returns the Configuration field. +func (r *RepositoryCodeSecurityConfiguration) GetConfiguration() *CodeSecurityConfiguration { + if r == nil { return nil } - return p.Body + return r.Configuration } -// GetName returns the Name field. -func (p *ProjectChange) GetName() *ProjectName { - if p == nil { - return nil +// GetState returns the State field if it's non-nil, zero value otherwise. +func (r *RepositoryCodeSecurityConfiguration) GetState() string { + if r == nil || r.State == nil { + return "" } - return p.Name + return *r.State } -// GetName returns the Name field. -func (p *ProjectColumnChange) GetName() *ProjectColumnName { - if p == nil { - return nil +// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetAuthorAssociation() string { + if r == nil || r.AuthorAssociation == nil { + return "" } - return p.Name + return *r.AuthorAssociation } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (p *ProjectColumnName) GetFrom() string { - if p == nil || p.From == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetBody() string { + if r == nil || r.Body == nil { return "" } - return *p.From + return *r.Body } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (p *ProjectName) GetFrom() string { - if p == nil || p.From == nil { +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetCommitID() string { + if r == nil || r.CommitID == nil { return "" } - return *p.From + return *r.CommitID } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetBody() string { - if p == nil || p.Body == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} + } + return *r.CreatedAt +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { return "" } - return *p.Body + return *r.HTMLURL } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetClosedAt() Timestamp { - if p == nil || p.ClosedAt == nil { - return Timestamp{} +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return *p.ClosedAt + return *r.ID } -// GetColumnsURL returns the ColumnsURL field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetColumnsURL() string { - if p == nil || p.ColumnsURL == nil { +// GetLine returns the Line field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetLine() int { + if r == nil || r.Line == nil { + return 0 + } + return *r.Line +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.ColumnsURL + return *r.NodeID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetPath() string { + if r == nil || r.Path == nil { + return "" } - return *p.CreatedAt + return *r.Path } -// GetCreator returns the Creator field. -func (p *ProjectV2) GetCreator() *User { - if p == nil { +// GetPosition returns the Position field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetPosition() int { + if r == nil || r.Position == nil { + return 0 + } + return *r.Position +} + +// GetReactions returns the Reactions field. +func (r *RepositoryComment) GetReactions() *Reactions { + if r == nil { return nil } - return p.Creator + return r.Reactions } -// GetDeletedAt returns the DeletedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetDeletedAt() Timestamp { - if p == nil || p.DeletedAt == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { return Timestamp{} } - return *p.DeletedAt + return *r.UpdatedAt } -// GetDeletedBy returns the DeletedBy field. -func (p *ProjectV2) GetDeletedBy() *User { - if p == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryComment) GetURL() string { + if r == nil || r.URL == nil { + return "" + } + return *r.URL +} + +// GetUser returns the User field. +func (r *RepositoryComment) GetUser() *User { + if r == nil { return nil } - return p.DeletedBy + return r.User } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetDescription() string { - if p == nil || p.Description == nil { - return "" +// GetAuthor returns the Author field. +func (r *RepositoryCommit) GetAuthor() *User { + if r == nil { + return nil } - return *p.Description + return r.Author } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (r *RepositoryCommit) GetCommentsURL() string { + if r == nil || r.CommentsURL == nil { return "" } - return *p.HTMLURL + return *r.CommentsURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetCommit returns the Commit field. +func (r *RepositoryCommit) GetCommit() *Commit { + if r == nil { + return nil } - return *p.ID + return r.Commit } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetName() string { - if p == nil || p.Name == nil { +// GetCommitter returns the Committer field. +func (r *RepositoryCommit) GetCommitter() *User { + if r == nil { + return nil + } + return r.Committer +} + +// GetFiles returns the Files slice if it's non-nil, nil otherwise. +func (r *RepositoryCommit) GetFiles() []*CommitFile { + if r == nil || r.Files == nil { + return nil + } + return r.Files +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryCommit) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { return "" } - return *p.Name + return *r.HTMLURL } // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetNodeID() string { - if p == nil || p.NodeID == nil { +func (r *RepositoryCommit) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.NodeID + return *r.NodeID } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (r *RepositoryCommit) GetParents() []*Commit { + if r == nil || r.Parents == nil { + return nil } - return *p.Number + return r.Parents } -// GetOrganizationPermission returns the OrganizationPermission field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetOrganizationPermission() string { - if p == nil || p.OrganizationPermission == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *RepositoryCommit) GetSHA() string { + if r == nil || r.SHA == nil { return "" } - return *p.OrganizationPermission + return *r.SHA } -// GetOwner returns the Owner field. -func (p *ProjectV2) GetOwner() *User { - if p == nil { +// GetStats returns the Stats field. +func (r *RepositoryCommit) GetStats() *CommitStats { + if r == nil { return nil } - return p.Owner + return r.Stats } -// GetOwnerURL returns the OwnerURL field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetOwnerURL() string { - if p == nil || p.OwnerURL == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryCommit) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.OwnerURL -} - -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetPrivate() bool { - if p == nil || p.Private == nil { - return false - } - return *p.Private + return *r.URL } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetPublic() bool { - if p == nil || p.Public == nil { - return false +// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetDownloadURL() string { + if r == nil || r.DownloadURL == nil { + return "" } - return *p.Public + return *r.DownloadURL } -// GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetShortDescription() string { - if p == nil || p.ShortDescription == nil { +// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetEncoding() string { + if r == nil || r.Encoding == nil { return "" } - return *p.ShortDescription + return *r.Encoding } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetState() string { - if p == nil || p.State == nil { +// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetGitURL() string { + if r == nil || r.GitURL == nil { return "" } - return *p.State + return *r.GitURL } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetTitle() string { - if p == nil || p.Title == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { return "" } - return *p.Title + return *r.HTMLURL } -// 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{} +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetName() string { + if r == nil || r.Name == nil { + return "" } - return *p.UpdatedAt + return *r.Name } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *ProjectV2) GetURL() string { - if p == nil || p.URL == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetPath() string { + if r == nil || r.Path == nil { return "" } - return *p.URL + return *r.Path } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectV2Event) GetAction() string { - if p == nil || p.Action == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetSHA() string { + if r == nil || r.SHA == nil { return "" } - return *p.Action + return *r.SHA } -// GetInstallation returns the Installation field. -func (p *ProjectV2Event) GetInstallation() *Installation { - if p == nil { - return nil +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetSize() int { + if r == nil || r.Size == nil { + return 0 } - return p.Installation + return *r.Size } -// GetOrg returns the Org field. -func (p *ProjectV2Event) GetOrg() *Organization { - if p == nil { - return nil +// GetSubmoduleGitURL returns the SubmoduleGitURL field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetSubmoduleGitURL() string { + if r == nil || r.SubmoduleGitURL == nil { + return "" } - return p.Org + return *r.SubmoduleGitURL } -// GetProjectsV2 returns the ProjectsV2 field. -func (p *ProjectV2Event) GetProjectsV2() *ProjectV2 { - if p == nil { - return nil +// GetTarget returns the Target field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetTarget() string { + if r == nil || r.Target == nil { + return "" } - return p.ProjectsV2 + return *r.Target } -// GetSender returns the Sender field. -func (p *ProjectV2Event) GetSender() *User { - if p == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetType() string { + if r == nil || r.Type == nil { + return "" } - return p.Sender + return *r.Type } -// GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetArchivedAt() Timestamp { - if p == nil || p.ArchivedAt == nil { - return Timestamp{} +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryContent) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return *p.ArchivedAt + return *r.URL } -// GetContentNodeID returns the ContentNodeID field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetContentNodeID() string { - if p == nil || p.ContentNodeID == nil { - return "" +// GetAuthor returns the Author field. +func (r *RepositoryContentFileOptions) GetAuthor() *CommitAuthor { + if r == nil { + return nil } - return *p.ContentNodeID + return r.Author } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetContentType() string { - if p == nil || p.ContentType == nil { +// GetBranch returns the Branch field if it's non-nil, zero value otherwise. +func (r *RepositoryContentFileOptions) GetBranch() string { + if r == nil || r.Branch == nil { return "" } - return *p.ContentType + return *r.Branch } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetCommitter returns the Committer field. +func (r *RepositoryContentFileOptions) GetCommitter() *CommitAuthor { + if r == nil { + return nil } - return *p.CreatedAt + return r.Committer } -// GetCreator returns the Creator field. -func (p *ProjectV2Item) GetCreator() *User { - if p == nil { +// GetContent returns the Content slice if it's non-nil, nil otherwise. +func (r *RepositoryContentFileOptions) GetContent() []byte { + if r == nil || r.Content == nil { return nil } - return p.Creator + return r.Content } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RepositoryContentFileOptions) GetMessage() string { + if r == nil || r.Message == nil { + return "" } - return *p.ID + return *r.Message } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetNodeID() string { - if p == nil || p.NodeID == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *RepositoryContentFileOptions) GetSHA() string { + if r == nil || r.SHA == nil { return "" } - return *p.NodeID + return *r.SHA } -// GetProjectNodeID returns the ProjectNodeID field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetProjectNodeID() string { - if p == nil || p.ProjectNodeID == nil { +// GetRef returns the Ref field. +func (r *RepositoryContentGetOptions) GetRef() string { + if r == nil { return "" } - return *p.ProjectNodeID + return r.Ref } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectV2Item) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetContent returns the Content field. +func (r *RepositoryContentResponse) GetContent() *RepositoryContent { + if r == nil { + return nil } - return *p.UpdatedAt + return r.Content } -// GetArchivedAt returns the ArchivedAt field. -func (p *ProjectV2ItemChange) GetArchivedAt() *ArchivedAt { - if p == nil { - return nil +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RepositoryDispatchEvent) GetAction() string { + if r == nil || r.Action == nil { + return "" } - return p.ArchivedAt + return *r.Action } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectV2ItemEvent) GetAction() string { - if p == nil || p.Action == nil { +// GetBranch returns the Branch field if it's non-nil, zero value otherwise. +func (r *RepositoryDispatchEvent) GetBranch() string { + if r == nil || r.Branch == nil { return "" } - return *p.Action + return *r.Branch } -// GetChanges returns the Changes field. -func (p *ProjectV2ItemEvent) GetChanges() *ProjectV2ItemChange { - if p == nil { - return nil +// GetClientPayload returns the ClientPayload field. +func (r *RepositoryDispatchEvent) GetClientPayload() json.RawMessage { + if r == nil { + return json.RawMessage{} } - return p.Changes + return r.ClientPayload } // GetInstallation returns the Installation field. -func (p *ProjectV2ItemEvent) GetInstallation() *Installation { - if p == nil { +func (r *RepositoryDispatchEvent) GetInstallation() *Installation { + if r == nil { return nil } - return p.Installation + return r.Installation } // GetOrg returns the Org field. -func (p *ProjectV2ItemEvent) GetOrg() *Organization { - if p == nil { +func (r *RepositoryDispatchEvent) GetOrg() *Organization { + if r == nil { return nil } - return p.Org + return r.Org } -// GetProjectV2Item returns the ProjectV2Item field. -func (p *ProjectV2ItemEvent) GetProjectV2Item() *ProjectV2Item { - if p == nil { +// GetRepo returns the Repo field. +func (r *RepositoryDispatchEvent) GetRepo() *Repository { + if r == nil { return nil } - return p.ProjectV2Item + return r.Repo } // GetSender returns the Sender field. -func (p *ProjectV2ItemEvent) GetSender() *User { - if p == nil { +func (r *RepositoryDispatchEvent) GetSender() *User { + if r == nil { return nil } - return p.Sender + return r.Sender } -// GetAllowDeletions returns the AllowDeletions field. -func (p *Protection) GetAllowDeletions() *AllowDeletions { - if p == nil { - return nil +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RepositoryEvent) GetAction() string { + if r == nil || r.Action == nil { + return "" } - return p.AllowDeletions + return *r.Action } -// GetAllowForcePushes returns the AllowForcePushes field. -func (p *Protection) GetAllowForcePushes() *AllowForcePushes { - if p == nil { +// GetChanges returns the Changes field. +func (r *RepositoryEvent) GetChanges() *EditChange { + if r == nil { return nil } - return p.AllowForcePushes + return r.Changes } -// GetAllowForkSyncing returns the AllowForkSyncing field. -func (p *Protection) GetAllowForkSyncing() *AllowForkSyncing { - if p == nil { +// GetInstallation returns the Installation field. +func (r *RepositoryEvent) GetInstallation() *Installation { + if r == nil { return nil } - return p.AllowForkSyncing + return r.Installation } -// GetBlockCreations returns the BlockCreations field. -func (p *Protection) GetBlockCreations() *BlockCreations { - if p == nil { +// GetOrg returns the Org field. +func (r *RepositoryEvent) GetOrg() *Organization { + if r == nil { return nil } - return p.BlockCreations + return r.Org } -// GetEnforceAdmins returns the EnforceAdmins field. -func (p *Protection) GetEnforceAdmins() *AdminEnforcement { - if p == nil { +// GetRepo returns the Repo field. +func (r *RepositoryEvent) GetRepo() *Repository { + if r == nil { return nil } - return p.EnforceAdmins + return r.Repo } -// GetLockBranch returns the LockBranch field. -func (p *Protection) GetLockBranch() *LockBranch { - if p == nil { +// GetSender returns the Sender field. +func (r *RepositoryEvent) GetSender() *User { + if r == nil { return nil } - return p.LockBranch + return r.Sender } -// GetRequiredConversationResolution returns the RequiredConversationResolution field. -func (p *Protection) GetRequiredConversationResolution() *RequiredConversationResolution { - if p == nil { +// GetOrg returns the Org field. +func (r *RepositoryImportEvent) GetOrg() *Organization { + if r == nil { return nil } - return p.RequiredConversationResolution + return r.Org } -// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. -func (p *Protection) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcement { - if p == nil { +// GetRepo returns the Repo field. +func (r *RepositoryImportEvent) GetRepo() *Repository { + if r == nil { return nil } - return p.RequiredPullRequestReviews + return r.Repo } -// GetRequiredSignatures returns the RequiredSignatures field. -func (p *Protection) GetRequiredSignatures() *SignaturesProtectedBranch { - if p == nil { +// GetSender returns the Sender field. +func (r *RepositoryImportEvent) GetSender() *User { + if r == nil { return nil } - return p.RequiredSignatures + return r.Sender } -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (p *Protection) GetRequiredStatusChecks() *RequiredStatusChecks { - if p == nil { - return nil +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (r *RepositoryImportEvent) GetStatus() string { + if r == nil || r.Status == nil { + return "" } - return p.RequiredStatusChecks + return *r.Status } -// GetRequireLinearHistory returns the RequireLinearHistory field. -func (p *Protection) GetRequireLinearHistory() *RequireLinearHistory { - if p == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} } - return p.RequireLinearHistory + return *r.CreatedAt } -// GetRestrictions returns the Restrictions field. -func (p *Protection) GetRestrictions() *BranchRestrictions { - if p == nil { - return nil +// GetExpired returns the Expired field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetExpired() bool { + if r == nil || r.Expired == nil { + return false } - return p.Restrictions + return *r.Expired } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Protection) GetURL() string { - if p == nil || p.URL == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { return "" } - return *p.URL + return *r.HTMLURL } -// GetAdminEnforced returns the AdminEnforced field. -func (p *ProtectionChanges) GetAdminEnforced() *AdminEnforcedChanges { - if p == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return p.AdminEnforced + return *r.ID } -// GetAllowDeletionsEnforcementLevel returns the AllowDeletionsEnforcementLevel field. -func (p *ProtectionChanges) GetAllowDeletionsEnforcementLevel() *AllowDeletionsEnforcementLevelChanges { - if p == nil { +// GetInvitee returns the Invitee field. +func (r *RepositoryInvitation) GetInvitee() *User { + if r == nil { return nil } - return p.AllowDeletionsEnforcementLevel + return r.Invitee } -// GetAuthorizedActorNames returns the AuthorizedActorNames field. -func (p *ProtectionChanges) GetAuthorizedActorNames() *AuthorizedActorNames { - if p == nil { +// GetInviter returns the Inviter field. +func (r *RepositoryInvitation) GetInviter() *User { + if r == nil { return nil } - return p.AuthorizedActorNames + return r.Inviter } -// GetAuthorizedActorsOnly returns the AuthorizedActorsOnly field. -func (p *ProtectionChanges) GetAuthorizedActorsOnly() *AuthorizedActorsOnly { - if p == nil { - return nil +// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetPermissions() string { + if r == nil || r.Permissions == nil { + return "" } - return p.AuthorizedActorsOnly + return *r.Permissions } -// GetAuthorizedDismissalActorsOnly returns the AuthorizedDismissalActorsOnly field. -func (p *ProtectionChanges) GetAuthorizedDismissalActorsOnly() *AuthorizedDismissalActorsOnlyChanges { - if p == nil { +// GetRepo returns the Repo field. +func (r *RepositoryInvitation) GetRepo() *Repository { + if r == nil { return nil } - return p.AuthorizedDismissalActorsOnly + return r.Repo } -// GetCreateProtected returns the CreateProtected field. -func (p *ProtectionChanges) GetCreateProtected() *CreateProtectedChanges { - if p == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryInvitation) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return p.CreateProtected + return *r.URL } -// GetDismissStaleReviewsOnPush returns the DismissStaleReviewsOnPush field. -func (p *ProtectionChanges) GetDismissStaleReviewsOnPush() *DismissStaleReviewsOnPushChanges { - if p == nil { - return nil +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetContent() string { + if r == nil || r.Content == nil { + return "" } - return p.DismissStaleReviewsOnPush + return *r.Content } -// GetLinearHistoryRequirementEnforcementLevel returns the LinearHistoryRequirementEnforcementLevel field. -func (p *ProtectionChanges) GetLinearHistoryRequirementEnforcementLevel() *LinearHistoryRequirementEnforcementLevelChanges { - if p == nil { - return nil +// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetDownloadURL() string { + if r == nil || r.DownloadURL == nil { + return "" } - return p.LinearHistoryRequirementEnforcementLevel + return *r.DownloadURL } -// GetPullRequestReviewsEnforcementLevel returns the PullRequestReviewsEnforcementLevel field. -func (p *ProtectionChanges) GetPullRequestReviewsEnforcementLevel() *PullRequestReviewsEnforcementLevelChanges { - if p == nil { - return nil +// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetEncoding() string { + if r == nil || r.Encoding == nil { + return "" } - return p.PullRequestReviewsEnforcementLevel + return *r.Encoding } -// GetRequireCodeOwnerReview returns the RequireCodeOwnerReview field. -func (p *ProtectionChanges) GetRequireCodeOwnerReview() *RequireCodeOwnerReviewChanges { - if p == nil { - return nil +// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetGitURL() string { + if r == nil || r.GitURL == nil { + return "" } - return p.RequireCodeOwnerReview + return *r.GitURL } -// GetRequiredConversationResolutionLevel returns the RequiredConversationResolutionLevel field. -func (p *ProtectionChanges) GetRequiredConversationResolutionLevel() *RequiredConversationResolutionLevelChanges { - if p == nil { +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetHTMLURL() string { + if r == nil || r.HTMLURL == nil { + return "" + } + return *r.HTMLURL +} + +// GetLicense returns the License field. +func (r *RepositoryLicense) GetLicense() *License { + if r == nil { return nil } - return p.RequiredConversationResolutionLevel + return r.License +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetPath() string { + if r == nil || r.Path == nil { + return "" + } + return *r.Path } -// GetRequiredDeploymentsEnforcementLevel returns the RequiredDeploymentsEnforcementLevel field. -func (p *ProtectionChanges) GetRequiredDeploymentsEnforcementLevel() *RequiredDeploymentsEnforcementLevelChanges { - if p == nil { - return nil +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetSHA() string { + if r == nil || r.SHA == nil { + return "" } - return p.RequiredDeploymentsEnforcementLevel + return *r.SHA } -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (p *ProtectionChanges) GetRequiredStatusChecks() *RequiredStatusChecksChanges { - if p == nil { - return nil +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetSize() int { + if r == nil || r.Size == nil { + return 0 } - return p.RequiredStatusChecks + return *r.Size } -// GetRequiredStatusChecksEnforcementLevel returns the RequiredStatusChecksEnforcementLevel field. -func (p *ProtectionChanges) GetRequiredStatusChecksEnforcementLevel() *RequiredStatusChecksEnforcementLevelChanges { - if p == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetType() string { + if r == nil || r.Type == nil { + return "" } - return p.RequiredStatusChecksEnforcementLevel + return *r.Type } -// GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field. -func (p *ProtectionChanges) GetSignatureRequirementEnforcementLevel() *SignatureRequirementEnforcementLevelChanges { - if p == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepositoryLicense) GetURL() string { + if r == nil || r.URL == nil { + return "" } - return p.SignatureRequirementEnforcementLevel + return *r.URL } -// GetAllowDeletions returns the AllowDeletions field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetAllowDeletions() bool { - if p == nil || p.AllowDeletions == nil { - return false +// GetSince returns the Since field. +func (r *RepositoryListAllOptions) GetSince() int64 { + if r == nil { + return 0 } - return *p.AllowDeletions + return r.Since } -// GetAllowForcePushes returns the AllowForcePushes field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetAllowForcePushes() bool { - if p == nil || p.AllowForcePushes == nil { - return false +// GetAffiliation returns the Affiliation field. +func (r *RepositoryListByAuthenticatedUserOptions) GetAffiliation() string { + if r == nil { + return "" } - return *p.AllowForcePushes + return r.Affiliation } -// GetAllowForkSyncing returns the AllowForkSyncing field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetAllowForkSyncing() bool { - if p == nil || p.AllowForkSyncing == nil { - return false +// GetDirection returns the Direction field. +func (r *RepositoryListByAuthenticatedUserOptions) GetDirection() string { + if r == nil { + return "" } - return *p.AllowForkSyncing + return r.Direction } -// GetBlockCreations returns the BlockCreations field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetBlockCreations() bool { - if p == nil || p.BlockCreations == nil { - return false +// GetSort returns the Sort field. +func (r *RepositoryListByAuthenticatedUserOptions) GetSort() string { + if r == nil { + return "" } - return *p.BlockCreations + return r.Sort } -// GetLockBranch returns the LockBranch field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetLockBranch() bool { - if p == nil || p.LockBranch == nil { - return false +// GetType returns the Type field. +func (r *RepositoryListByAuthenticatedUserOptions) GetType() string { + if r == nil { + return "" } - return *p.LockBranch + return r.Type } -// GetRequiredConversationResolution returns the RequiredConversationResolution field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetRequiredConversationResolution() bool { - if p == nil || p.RequiredConversationResolution == nil { - return false +// GetVisibility returns the Visibility field. +func (r *RepositoryListByAuthenticatedUserOptions) GetVisibility() string { + if r == nil { + return "" } - return *p.RequiredConversationResolution + return r.Visibility } -// GetRequiredPullRequestReviews returns the RequiredPullRequestReviews field. -func (p *ProtectionRequest) GetRequiredPullRequestReviews() *PullRequestReviewsEnforcementRequest { - if p == nil { - return nil +// GetDirection returns the Direction field. +func (r *RepositoryListByOrgOptions) GetDirection() string { + if r == nil { + return "" } - return p.RequiredPullRequestReviews + return r.Direction } -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (p *ProtectionRequest) GetRequiredStatusChecks() *RequiredStatusChecks { - if p == nil { - return nil +// GetSort returns the Sort field. +func (r *RepositoryListByOrgOptions) GetSort() string { + if r == nil { + return "" } - return p.RequiredStatusChecks + return r.Sort } -// GetRequireLinearHistory returns the RequireLinearHistory field if it's non-nil, zero value otherwise. -func (p *ProtectionRequest) GetRequireLinearHistory() bool { - if p == nil || p.RequireLinearHistory == nil { - return false +// GetType returns the Type field. +func (r *RepositoryListByOrgOptions) GetType() string { + if r == nil { + return "" } - return *p.RequireLinearHistory + return r.Type } -// GetRestrictions returns the Restrictions field. -func (p *ProtectionRequest) GetRestrictions() *BranchRestrictionsRequest { - if p == nil { - return nil +// GetDirection returns the Direction field. +func (r *RepositoryListByUserOptions) GetDirection() string { + if r == nil { + return "" } - return p.Restrictions + return r.Direction } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProtectionRule) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetSort returns the Sort field. +func (r *RepositoryListByUserOptions) GetSort() string { + if r == nil { + return "" } - return *p.ID + return r.Sort } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProtectionRule) GetNodeID() string { - if p == nil || p.NodeID == nil { +// GetType returns the Type field. +func (r *RepositoryListByUserOptions) GetType() string { + if r == nil { return "" } - return *p.NodeID + return r.Type } -// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. -func (p *ProtectionRule) GetPreventSelfReview() bool { - if p == nil || p.PreventSelfReview == nil { - return false +// GetSort returns the Sort field. +func (r *RepositoryListForksOptions) GetSort() string { + if r == nil { + return "" } - return *p.PreventSelfReview + return r.Sort } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (p *ProtectionRule) GetType() string { - if p == nil || p.Type == nil { +// GetAffiliation returns the Affiliation field. +func (r *RepositoryListOptions) GetAffiliation() string { + if r == nil { return "" } - return *p.Type + return r.Affiliation } -// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. -func (p *ProtectionRule) GetWaitTimer() int { - if p == nil || p.WaitTimer == nil { - return 0 +// GetDirection returns the Direction field. +func (r *RepositoryListOptions) GetDirection() string { + if r == nil { + return "" } - return *p.WaitTimer + return r.Direction } -// GetInstallation returns the Installation field. -func (p *PublicEvent) GetInstallation() *Installation { - if p == nil { - return nil +// GetSort returns the Sort field. +func (r *RepositoryListOptions) GetSort() string { + if r == nil { + return "" } - return p.Installation + return r.Sort } -// GetOrg returns the Org field. -func (p *PublicEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetType returns the Type field. +func (r *RepositoryListOptions) GetType() string { + if r == nil { + return "" } - return p.Org + return r.Type } -// GetRepo returns the Repo field. -func (p *PublicEvent) GetRepo() *Repository { - if p == nil { - return nil +// GetVisibility returns the Visibility field. +func (r *RepositoryListOptions) GetVisibility() string { + if r == nil { + return "" } - return p.Repo + return r.Visibility } -// GetSender returns the Sender field. -func (p *PublicEvent) GetSender() *User { - if p == nil { - return nil +// GetIncludesParents returns the IncludesParents field if it's non-nil, zero value otherwise. +func (r *RepositoryListRulesetsOptions) GetIncludesParents() bool { + if r == nil || r.IncludesParents == nil { + return false } - return p.Sender + return *r.IncludesParents } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (p *PublicKey) GetKey() string { - if p == nil || p.Key == nil { +// GetBase returns the Base field. +func (r *RepositoryMergeRequest) GetBase() string { + if r == nil { return "" } - return *p.Key + return r.Base } -// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. -func (p *PublicKey) GetKeyID() string { - if p == nil || p.KeyID == nil { +// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. +func (r *RepositoryMergeRequest) GetCommitMessage() string { + if r == nil || r.CommitMessage == nil { return "" } - return *p.KeyID + return *r.CommitMessage } -// GetActiveLockReason returns the ActiveLockReason field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetActiveLockReason() string { - if p == nil || p.ActiveLockReason == nil { +// GetHead returns the Head field. +func (r *RepositoryMergeRequest) GetHead() string { + if r == nil { return "" } - return *p.ActiveLockReason + return r.Head } -// GetAdditions returns the Additions field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetAdditions() int { - if p == nil || p.Additions == nil { - return 0 +// GetAll returns the All slice if it's non-nil, nil otherwise. +func (r *RepositoryParticipation) GetAll() []int { + if r == nil || r.All == nil { + return nil } - return *p.Additions + return r.All } -// GetAssignee returns the Assignee field. -func (p *PullRequest) GetAssignee() *User { - if p == nil { +// GetOwner returns the Owner slice if it's non-nil, nil otherwise. +func (r *RepositoryParticipation) GetOwner() []int { + if r == nil || r.Owner == nil { return nil } - return p.Assignee + return r.Owner } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetAuthorAssociation() string { - if p == nil || p.AuthorAssociation == nil { +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissionLevel) GetPermission() string { + if r == nil || r.Permission == nil { return "" } - return *p.AuthorAssociation + return *r.Permission } -// GetAutoMerge returns the AutoMerge field. -func (p *PullRequest) GetAutoMerge() *PullRequestAutoMerge { - if p == nil { - return nil +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (r *RepositoryPermissionLevel) GetRoleName() string { + if r == nil || r.RoleName == nil { + return "" } - return p.AutoMerge + return *r.RoleName } -// GetBase returns the Base field. -func (p *PullRequest) GetBase() *PullRequestBranch { - if p == nil { +// GetUser returns the User field. +func (r *RepositoryPermissionLevel) GetUser() *User { + if r == nil { return nil } - return p.Base + return r.User } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetBody() string { - if p == nil || p.Body == nil { - return "" +// 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 *p.Body + return *r.Admin } -// GetChangedFiles returns the ChangedFiles field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetChangedFiles() int { - if p == nil || p.ChangedFiles == nil { - return 0 +// 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 *p.ChangedFiles + return *r.Maintain } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetClosedAt() Timestamp { - if p == nil || p.ClosedAt == nil { - return Timestamp{} +// 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 *p.ClosedAt + return *r.Pull } -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetComments() int { - if p == nil || p.Comments == nil { - return 0 +// 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 *p.Comments + return *r.Push } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommentsURL() string { - if p == nil || p.CommentsURL == nil { - return "" +// 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 *p.CommentsURL + return *r.Triage } -// GetCommits returns the Commits field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommits() int { - if p == nil || p.Commits == nil { - return 0 +// GetAssets returns the Assets slice if it's non-nil, nil otherwise. +func (r *RepositoryRelease) GetAssets() []*ReleaseAsset { + if r == nil || r.Assets == nil { + return nil } - return *p.Commits + return r.Assets } -// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCommitsURL() string { - if p == nil || p.CommitsURL == nil { +// GetAssetsURL returns the AssetsURL field. +func (r *RepositoryRelease) GetAssetsURL() string { + if r == nil { return "" } - return *p.CommitsURL + return r.AssetsURL } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetAuthor returns the Author field. +func (r *RepositoryRelease) GetAuthor() *User { + if r == nil { + return nil } - return *p.CreatedAt + return r.Author } -// GetDeletions returns the Deletions field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDeletions() int { - if p == nil || p.Deletions == nil { - return 0 +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetBody() string { + if r == nil || r.Body == nil { + return "" } - return *p.Deletions + return *r.Body } -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDiffURL() string { - if p == nil || p.DiffURL == nil { +// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetBodyHTML() string { + if r == nil || r.BodyHTML == nil { return "" } - return *p.DiffURL + return *r.BodyHTML } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetDraft() bool { - if p == nil || p.Draft == nil { - return false +// GetBodyText returns the BodyText field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetBodyText() string { + if r == nil || r.BodyText == nil { + return "" } - return *p.Draft + return *r.BodyText } -// GetHead returns the Head field. -func (p *PullRequest) GetHead() *PullRequestBranch { - if p == nil { - return nil +// GetCreatedAt returns the CreatedAt field. +func (r *RepositoryRelease) GetCreatedAt() Timestamp { + if r == nil { + return Timestamp{} } - return p.Head + return r.CreatedAt } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetDiscussionURL returns the DiscussionURL field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetDiscussionURL() string { + if r == nil || r.DiscussionURL == nil { return "" } - return *p.HTMLURL + return *r.DiscussionURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetDraft returns the Draft field. +func (r *RepositoryRelease) GetDraft() bool { + if r == nil { + return false } - return *p.ID + return r.Draft } -// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetIssueURL() string { - if p == nil || p.IssueURL == nil { +// GetHTMLURL returns the HTMLURL field. +func (r *RepositoryRelease) GetHTMLURL() string { + if r == nil { return "" } - return *p.IssueURL -} - -// GetLinks returns the Links field. -func (p *PullRequest) GetLinks() *PRLinks { - if p == nil { - return nil - } - return p.Links + return r.HTMLURL } -// GetLocked returns the Locked field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetLocked() bool { - if p == nil || p.Locked == nil { - return false +// GetID returns the ID field. +func (r *RepositoryRelease) GetID() int64 { + if r == nil { + return 0 } - return *p.Locked + return r.ID } -// GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMaintainerCanModify() bool { - if p == nil || p.MaintainerCanModify == nil { +// 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 *p.MaintainerCanModify + return *r.Immutable } -// GetMergeable returns the Mergeable field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeable() bool { - if p == nil || p.Mergeable == nil { - return false +// GetMentionsCount returns the MentionsCount field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetMentionsCount() int { + if r == nil || r.MentionsCount == nil { + return 0 } - return *p.Mergeable + return *r.MentionsCount } -// GetMergeableState returns the MergeableState field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeableState() string { - if p == nil || p.MergeableState == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetName() string { + if r == nil || r.Name == nil { return "" } - return *p.MergeableState + return *r.Name } -// GetMergeCommitSHA returns the MergeCommitSHA field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergeCommitSHA() string { - if p == nil || p.MergeCommitSHA == nil { +// GetNodeID returns the NodeID field. +func (r *RepositoryRelease) GetNodeID() string { + if r == nil { return "" } - return *p.MergeCommitSHA + return r.NodeID } -// GetMerged returns the Merged field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMerged() bool { - if p == nil || p.Merged == nil { +// GetPrerelease returns the Prerelease field. +func (r *RepositoryRelease) GetPrerelease() bool { + if r == nil { return false } - return *p.Merged + return r.Prerelease } -// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetMergedAt() Timestamp { - if p == nil || p.MergedAt == nil { +// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetPublishedAt() Timestamp { + if r == nil || r.PublishedAt == nil { return Timestamp{} } - return *p.MergedAt + return *r.PublishedAt } -// GetMergedBy returns the MergedBy field. -func (p *PullRequest) GetMergedBy() *User { - if p == nil { +// GetReactions returns the Reactions field. +func (r *RepositoryRelease) GetReactions() *Reactions { + if r == nil { return nil } - return p.MergedBy + return r.Reactions } -// GetMilestone returns the Milestone field. -func (p *PullRequest) GetMilestone() *Milestone { - if p == nil { - return nil +// GetTagName returns the TagName field. +func (r *RepositoryRelease) GetTagName() string { + if r == nil { + return "" } - return p.Milestone + return r.TagName } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetNodeID() string { - if p == nil || p.NodeID == nil { +// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetTarballURL() string { + if r == nil || r.TarballURL == nil { return "" } - return *p.NodeID + return *r.TarballURL } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetTargetCommitish returns the TargetCommitish field. +func (r *RepositoryRelease) GetTargetCommitish() string { + if r == nil { + return "" } - return *p.Number + return r.TargetCommitish } -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetPatchURL() string { - if p == nil || p.PatchURL == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { + return Timestamp{} } - return *p.PatchURL + return *r.UpdatedAt } -// GetRebaseable returns the Rebaseable field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetRebaseable() bool { - if p == nil || p.Rebaseable == nil { - return false +// GetUploadURL returns the UploadURL field. +func (r *RepositoryRelease) GetUploadURL() string { + if r == nil { + return "" } - return *p.Rebaseable + return r.UploadURL } -// GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewComments() int { - if p == nil || p.ReviewComments == nil { - return 0 +// GetURL returns the URL field. +func (r *RepositoryRelease) GetURL() string { + if r == nil { + return "" } - return *p.ReviewComments + return r.URL } -// GetReviewCommentsURL returns the ReviewCommentsURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewCommentsURL() string { - if p == nil || p.ReviewCommentsURL == nil { +// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetZipballURL() string { + if r == nil || r.ZipballURL == nil { return "" } - return *p.ReviewCommentsURL + return *r.ZipballURL } -// GetReviewCommentURL returns the ReviewCommentURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetReviewCommentURL() string { - if p == nil || p.ReviewCommentURL == nil { +// GetBody returns the Body field. +func (r *RepositoryReleaseNotes) GetBody() string { + if r == nil { return "" } - return *p.ReviewCommentURL + return r.Body } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetState() string { - if p == nil || p.State == nil { +// GetName returns the Name field. +func (r *RepositoryReleaseNotes) GetName() string { + if r == nil { return "" } - return *p.State + return r.Name } -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetStatusesURL() string { - if p == nil || p.StatusesURL == nil { - return "" +// GetParameters returns the Parameters field. +func (r *RepositoryRule) GetParameters() any { + if r == nil { + return nil } - return *p.StatusesURL + return r.Parameters } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetTitle() string { - if p == nil || p.Title == nil { +// GetType returns the Type field. +func (r *RepositoryRule) GetType() RepositoryRuleType { + if r == nil { return "" } - return *p.Title + return r.Type } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetBypassActors returns the BypassActors slice if it's non-nil, nil otherwise. +func (r *RepositoryRuleset) GetBypassActors() []*BypassActor { + if r == nil || r.BypassActors == nil { + return nil } - return *p.UpdatedAt + return r.BypassActors } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequest) GetURL() string { - if p == nil || p.URL == nil { - return "" +// GetConditions returns the Conditions field. +func (r *RepositoryRuleset) GetConditions() *RepositoryRulesetConditions { + if r == nil { + return nil } - return *p.URL + return r.Conditions } -// GetUser returns the User field. -func (p *PullRequest) GetUser() *User { - if p == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleset) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} } - return p.User + return *r.CreatedAt } -// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. -func (p *PullRequestAutoMerge) GetCommitMessage() string { - if p == nil || p.CommitMessage == nil { - return "" +// GetCurrentUserCanBypass returns the CurrentUserCanBypass field. +func (r *RepositoryRuleset) GetCurrentUserCanBypass() *BypassMode { + if r == nil { + return nil } - return *p.CommitMessage + return r.CurrentUserCanBypass } -// GetCommitTitle returns the CommitTitle field if it's non-nil, zero value otherwise. -func (p *PullRequestAutoMerge) GetCommitTitle() string { - if p == nil || p.CommitTitle == nil { +// GetEnforcement returns the Enforcement field. +func (r *RepositoryRuleset) GetEnforcement() RulesetEnforcement { + if r == nil { return "" } - return *p.CommitTitle + return r.Enforcement } -// GetEnabledBy returns the EnabledBy field. -func (p *PullRequestAutoMerge) GetEnabledBy() *User { - if p == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleset) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return p.EnabledBy + return *r.ID } -// GetMergeMethod returns the MergeMethod field if it's non-nil, zero value otherwise. -func (p *PullRequestAutoMerge) GetMergeMethod() string { - if p == nil || p.MergeMethod == nil { - return "" +// GetLinks returns the Links field. +func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLinks { + if r == nil { + return nil } - return *p.MergeMethod + return r.Links } -// GetLabel returns the Label field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetLabel() string { - if p == nil || p.Label == nil { +// GetName returns the Name field. +func (r *RepositoryRuleset) GetName() string { + if r == nil { return "" } - return *p.Label + return r.Name } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetRef() string { - if p == nil || p.Ref == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleset) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.Ref + return *r.NodeID } -// GetRepo returns the Repo field. -func (p *PullRequestBranch) GetRepo() *Repository { - if p == nil { +// GetRules returns the Rules field. +func (r *RepositoryRuleset) GetRules() *RepositoryRulesetRules { + if r == nil { return nil } - return p.Repo + return r.Rules } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *PullRequestBranch) GetSHA() string { - if p == nil || p.SHA == nil { +// GetSource returns the Source field. +func (r *RepositoryRuleset) GetSource() string { + if r == nil { return "" } - return *p.SHA + return r.Source } -// GetUser returns the User field. -func (p *PullRequestBranch) GetUser() *User { - if p == nil { +// GetSourceType returns the SourceType field. +func (r *RepositoryRuleset) GetSourceType() *RulesetSourceType { + if r == nil { return nil } - return p.User + return r.SourceType } -// GetExpectedHeadSHA returns the ExpectedHeadSHA field if it's non-nil, zero value otherwise. -func (p *PullRequestBranchUpdateOptions) GetExpectedHeadSHA() string { - if p == nil || p.ExpectedHeadSHA == nil { - return "" +// GetTarget returns the Target field. +func (r *RepositoryRuleset) GetTarget() *RulesetTarget { + if r == nil { + return nil } - return *p.ExpectedHeadSHA + return r.Target } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestBranchUpdateResponse) GetMessage() string { - if p == nil || p.Message == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleset) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { + return Timestamp{} } - return *p.Message + return *r.UpdatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestBranchUpdateResponse) GetURL() string { - if p == nil || p.URL == nil { - return "" +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetAdded() []*RepositoryRulesetConditions { + if r == nil || r.Added == nil { + return nil } - return *p.URL + return r.Added } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetAuthorAssociation() string { - if p == nil || p.AuthorAssociation == nil { - return "" +// GetDeleted returns the Deleted slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetDeleted() []*RepositoryRulesetConditions { + if r == nil || r.Deleted == nil { + return nil } - return *p.AuthorAssociation + return r.Deleted } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetBody() string { - if p == nil || p.Body == nil { - return "" +// GetUpdated returns the Updated slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedConditions) GetUpdated() []*RepositoryRulesetUpdatedConditions { + if r == nil || r.Updated == nil { + return nil } - return *p.Body + return r.Updated } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" +// GetConfiguration returns the Configuration field. +func (r *RepositoryRulesetChangedRule) GetConfiguration() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.CommitID + return r.Configuration } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetPattern returns the Pattern field. +func (r *RepositoryRulesetChangedRule) GetPattern() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.CreatedAt + return r.Pattern } -// GetDiffHunk returns the DiffHunk field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetDiffHunk() string { - if p == nil || p.DiffHunk == nil { - return "" +// GetRuleType returns the RuleType field. +func (r *RepositoryRulesetChangedRule) GetRuleType() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.DiffHunk + return r.RuleType } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" +// GetAdded returns the Added slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetAdded() []*RepositoryRule { + if r == nil || r.Added == nil { + return nil } - return *p.HTMLURL + return r.Added } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetDeleted returns the Deleted slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetDeleted() []*RepositoryRule { + if r == nil || r.Deleted == nil { + return nil } - return *p.ID + return r.Deleted } -// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetInReplyTo() int64 { - if p == nil || p.InReplyTo == nil { - return 0 +// GetUpdated returns the Updated slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangedRules) GetUpdated() []*RepositoryRulesetUpdatedRules { + if r == nil || r.Updated == nil { + return nil } - return *p.InReplyTo + return r.Updated } -// GetLine returns the Line field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetLine() int { - if p == nil || p.Line == nil { - return 0 +// GetConditions returns the Conditions field. +func (r *RepositoryRulesetChanges) GetConditions() *RepositoryRulesetChangedConditions { + if r == nil { + return nil } - return *p.Line + return r.Conditions } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetEnforcement returns the Enforcement field. +func (r *RepositoryRulesetChanges) GetEnforcement() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.NodeID + return r.Enforcement } -// GetOriginalCommitID returns the OriginalCommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalCommitID() string { - if p == nil || p.OriginalCommitID == nil { - return "" +// GetName returns the Name field. +func (r *RepositoryRulesetChanges) GetName() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.OriginalCommitID + return r.Name } -// GetOriginalLine returns the OriginalLine field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalLine() int { - if p == nil || p.OriginalLine == nil { - return 0 +// GetRules returns the Rules field. +func (r *RepositoryRulesetChanges) GetRules() *RepositoryRulesetChangedRules { + if r == nil { + return nil } - return *p.OriginalLine + return r.Rules } -// GetOriginalPosition returns the OriginalPosition field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalPosition() int { - if p == nil || p.OriginalPosition == nil { - return 0 +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RepositoryRulesetChangeSource) GetFrom() string { + if r == nil || r.From == nil { + return "" } - return *p.OriginalPosition + return *r.From } -// GetOriginalStartLine returns the OriginalStartLine field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetOriginalStartLine() int { - if p == nil || p.OriginalStartLine == nil { - return 0 +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetChangeSources) GetFrom() []string { + if r == nil || r.From == nil { + return nil } - return *p.OriginalStartLine + return r.From } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPath() string { - if p == nil || p.Path == nil { - return "" +// GetOrganizationID returns the OrganizationID field. +func (r *RepositoryRulesetConditions) GetOrganizationID() *RepositoryRulesetOrganizationIDsConditionParameters { + if r == nil { + return nil } - return *p.Path + return r.OrganizationID } -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPosition() int { - if p == nil || p.Position == nil { - return 0 +// GetOrganizationName returns the OrganizationName field. +func (r *RepositoryRulesetConditions) GetOrganizationName() *RepositoryRulesetOrganizationNamesConditionParameters { + if r == nil { + return nil } - return *p.Position + return r.OrganizationName } -// GetPullRequestReviewID returns the PullRequestReviewID field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPullRequestReviewID() int64 { - if p == nil || p.PullRequestReviewID == nil { - return 0 +// GetOrganizationProperty returns the OrganizationProperty field. +func (r *RepositoryRulesetConditions) GetOrganizationProperty() *RepositoryRulesetOrganizationPropertyConditionParameters { + if r == nil { + return nil } - return *p.PullRequestReviewID + return r.OrganizationProperty } -// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetPullRequestURL() string { - if p == nil || p.PullRequestURL == nil { - return "" +// GetRefName returns the RefName field. +func (r *RepositoryRulesetConditions) GetRefName() *RepositoryRulesetRefConditionParameters { + if r == nil { + return nil } - return *p.PullRequestURL + return r.RefName } -// GetReactions returns the Reactions field. -func (p *PullRequestComment) GetReactions() *Reactions { - if p == nil { +// GetRepositoryID returns the RepositoryID field. +func (r *RepositoryRulesetConditions) GetRepositoryID() *RepositoryRulesetRepositoryIDsConditionParameters { + if r == nil { return nil } - return p.Reactions + return r.RepositoryID } -// GetSide returns the Side field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetSide() string { - if p == nil || p.Side == nil { - return "" +// GetRepositoryName returns the RepositoryName field. +func (r *RepositoryRulesetConditions) GetRepositoryName() *RepositoryRulesetRepositoryNamesConditionParameters { + if r == nil { + return nil } - return *p.Side + return r.RepositoryName } -// GetStartLine returns the StartLine field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetStartLine() int { - if p == nil || p.StartLine == nil { - return 0 +// GetRepositoryProperty returns the RepositoryProperty field. +func (r *RepositoryRulesetConditions) GetRepositoryProperty() *RepositoryRulesetRepositoryPropertyConditionParameters { + if r == nil { + return nil } - return *p.StartLine + return r.RepositoryProperty } -// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetStartSide() string { - if p == nil || p.StartSide == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RepositoryRulesetEvent) GetAction() string { + if r == nil || r.Action == nil { return "" } - return *p.StartSide + return *r.Action } -// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetSubjectType() string { - if p == nil || p.SubjectType == nil { - return "" +// GetChanges returns the Changes field. +func (r *RepositoryRulesetEvent) GetChanges() *RepositoryRulesetChanges { + if r == nil { + return nil } - return *p.SubjectType + return r.Changes } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetEnterprise returns the Enterprise field. +func (r *RepositoryRulesetEvent) GetEnterprise() *Enterprise { + if r == nil { + return nil } - return *p.UpdatedAt + return r.Enterprise } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestComment) GetURL() string { - if p == nil || p.URL == nil { - return "" +// GetInstallation returns the Installation field. +func (r *RepositoryRulesetEvent) GetInstallation() *Installation { + if r == nil { + return nil } - return *p.URL + return r.Installation } -// GetUser returns the User field. -func (p *PullRequestComment) GetUser() *User { - if p == nil { +// GetOrganization returns the Organization field. +func (r *RepositoryRulesetEvent) GetOrganization() *Organization { + if r == nil { return nil } - return p.User + return r.Organization } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" +// GetRepository returns the Repository field. +func (r *RepositoryRulesetEvent) GetRepository() *Repository { + if r == nil { + return nil } - return *p.Action + return r.Repository } -// GetAfter returns the After field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetAfter() string { - if p == nil || p.After == nil { - return "" +// GetRepositoryRuleset returns the RepositoryRuleset field. +func (r *RepositoryRulesetEvent) GetRepositoryRuleset() *RepositoryRuleset { + if r == nil { + return nil } - return *p.After + return r.RepositoryRuleset } -// GetAssignee returns the Assignee field. -func (p *PullRequestEvent) GetAssignee() *User { - if p == nil { +// GetSender returns the Sender field. +func (r *RepositoryRulesetEvent) GetSender() *User { + if r == nil { return nil } - return p.Assignee + return r.Sender } -// GetBefore returns the Before field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetBefore() string { - if p == nil || p.Before == nil { +// GetHRef returns the HRef field if it's non-nil, zero value otherwise. +func (r *RepositoryRulesetLink) GetHRef() string { + if r == nil || r.HRef == nil { return "" } - return *p.Before + return *r.HRef } -// GetChanges returns the Changes field. -func (p *PullRequestEvent) GetChanges() *EditChange { - if p == nil { +// GetHTML returns the HTML field. +func (r *RepositoryRulesetLinks) GetHTML() *RepositoryRulesetLink { + if r == nil { return nil } - return p.Changes + return r.HTML } -// GetInstallation returns the Installation field. -func (p *PullRequestEvent) GetInstallation() *Installation { - if p == nil { +// GetSelf returns the Self field. +func (r *RepositoryRulesetLinks) GetSelf() *RepositoryRulesetLink { + if r == nil { return nil } - return p.Installation + return r.Self } -// GetLabel returns the Label field. -func (p *PullRequestEvent) GetLabel() *Label { - if p == nil { +// GetOrganizationIDs returns the OrganizationIDs slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationIDsConditionParameters) GetOrganizationIDs() []int64 { + if r == nil || r.OrganizationIDs == nil { return nil } - return p.Label + return r.OrganizationIDs } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequestEvent) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationNamesConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { + return nil } - return *p.Number + return r.Exclude } -// GetOrganization returns the Organization field. -func (p *PullRequestEvent) GetOrganization() *Organization { - if p == nil { +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationNamesConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { return nil } - return p.Organization + return r.Include } -// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. -func (p *PullRequestEvent) GetPerformedViaGithubApp() *App { - if p == nil { +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationPropertyConditionParameters) GetExclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Exclude == nil { return nil } - return p.PerformedViaGithubApp + return r.Exclude } -// GetPullRequest returns the PullRequest field. -func (p *PullRequestEvent) GetPullRequest() *PullRequest { - if p == nil { +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetOrganizationPropertyConditionParameters) GetInclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Include == nil { return nil } - return p.PullRequest + return r.Include } -// GetRepo returns the Repo field. -func (p *PullRequestEvent) GetRepo() *Repository { - if p == nil { +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRefConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { return nil } - return p.Repo + return r.Exclude } -// GetRequestedReviewer returns the RequestedReviewer field. -func (p *PullRequestEvent) GetRequestedReviewer() *User { - if p == nil { +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRefConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { return nil } - return p.RequestedReviewer + return r.Include } -// GetRequestedTeam returns the RequestedTeam field. -func (p *PullRequestEvent) GetRequestedTeam() *Team { - if p == nil { +// GetRepositoryIDs returns the RepositoryIDs slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryIDsConditionParameters) GetRepositoryIDs() []int64 { + if r == nil || r.RepositoryIDs == nil { return nil } - return p.RequestedTeam + return r.RepositoryIDs } -// GetSender returns the Sender field. -func (p *PullRequestEvent) GetSender() *User { - if p == nil { +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetExclude() []string { + if r == nil || r.Exclude == nil { return nil } - return p.Sender + return r.Exclude } -// GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetDiffURL() string { - if p == nil || p.DiffURL == nil { - return "" +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetInclude() []string { + if r == nil || r.Include == nil { + return nil } - return *p.DiffURL + return r.Include } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" +// GetProtected returns the Protected field if it's non-nil, zero value otherwise. +func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetProtected() bool { + if r == nil || r.Protected == nil { + return false } - return *p.HTMLURL + return *r.Protected } -// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetMergedAt() Timestamp { - if p == nil || p.MergedAt == nil { - return Timestamp{} +// GetExclude returns the Exclude slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyConditionParameters) GetExclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Exclude == nil { + return nil } - return *p.MergedAt + return r.Exclude } -// GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetPatchURL() string { - if p == nil || p.PatchURL == nil { - return "" +// GetInclude returns the Include slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyConditionParameters) GetInclude() []*RepositoryRulesetRepositoryPropertyTargetParameters { + if r == nil || r.Include == nil { + return nil } - return *p.PatchURL + return r.Include } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PullRequestLinks) GetURL() string { - if p == nil || p.URL == nil { +// GetName returns the Name field. +func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetName() string { + if r == nil { return "" } - return *p.URL -} - -// GetMerged returns the Merged field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetMerged() bool { - if p == nil || p.Merged == nil { - return false - } - return *p.Merged + return r.Name } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetMessage() string { - if p == nil || p.Message == nil { - return "" +// GetPropertyValues returns the PropertyValues slice if it's non-nil, nil otherwise. +func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetPropertyValues() []string { + if r == nil || r.PropertyValues == nil { + return nil } - return *p.Message + return r.PropertyValues } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (p *PullRequestMergeResult) GetSHA() string { - if p == nil || p.SHA == nil { +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetSource() string { + if r == nil || r.Source == nil { return "" } - return *p.SHA + return *r.Source } -// GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetAuthorAssociation() string { - if p == nil || p.AuthorAssociation == nil { - return "" +// GetBranchNamePattern returns the BranchNamePattern field. +func (r *RepositoryRulesetRules) GetBranchNamePattern() *PatternRuleParameters { + if r == nil { + return nil } - return *p.AuthorAssociation + return r.BranchNamePattern } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetBody() string { - if p == nil || p.Body == nil { - return "" +// GetCodeCoverage returns the CodeCoverage field. +func (r *RepositoryRulesetRules) GetCodeCoverage() *CodeCoverageRuleParameters { + if r == nil { + return nil } - return *p.Body + return r.CodeCoverage } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" +// GetCodeScanning returns the CodeScanning field. +func (r *RepositoryRulesetRules) GetCodeScanning() *CodeScanningRuleParameters { + if r == nil { + return nil } - return *p.CommitID -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" + return r.CodeScanning +} + +// GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern field. +func (r *RepositoryRulesetRules) GetCommitAuthorEmailPattern() *PatternRuleParameters { + if r == nil { + return nil } - return *p.HTMLURL + return r.CommitAuthorEmailPattern } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetCommitMessagePattern returns the CommitMessagePattern field. +func (r *RepositoryRulesetRules) GetCommitMessagePattern() *PatternRuleParameters { + if r == nil { + return nil } - return *p.ID + return r.CommitMessagePattern } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetCommitterEmailPattern returns the CommitterEmailPattern field. +func (r *RepositoryRulesetRules) GetCommitterEmailPattern() *PatternRuleParameters { + if r == nil { + return nil } - return *p.NodeID + return r.CommitterEmailPattern } -// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetPullRequestURL() string { - if p == nil || p.PullRequestURL == nil { - return "" +// GetCopilotCodeReview returns the CopilotCodeReview field. +func (r *RepositoryRulesetRules) GetCopilotCodeReview() *CopilotCodeReviewRuleParameters { + if r == nil { + return nil } - return *p.PullRequestURL + return r.CopilotCodeReview } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetState() string { - if p == nil || p.State == nil { - return "" +// GetCreation returns the Creation field. +func (r *RepositoryRulesetRules) GetCreation() *EmptyRuleParameters { + if r == nil { + return nil } - return *p.State + return r.Creation } -// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. -func (p *PullRequestReview) GetSubmittedAt() Timestamp { - if p == nil || p.SubmittedAt == nil { - return Timestamp{} +// GetDeletion returns the Deletion field. +func (r *RepositoryRulesetRules) GetDeletion() *EmptyRuleParameters { + if r == nil { + return nil } - return *p.SubmittedAt + return r.Deletion } -// GetUser returns the User field. -func (p *PullRequestReview) GetUser() *User { - if p == nil { +// GetFileExtensionRestriction returns the FileExtensionRestriction field. +func (r *RepositoryRulesetRules) GetFileExtensionRestriction() *FileExtensionRestrictionRuleParameters { + if r == nil { return nil } - return p.User + return r.FileExtensionRestriction } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewCommentEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" +// GetFilePathRestriction returns the FilePathRestriction field. +func (r *RepositoryRulesetRules) GetFilePathRestriction() *FilePathRestrictionRuleParameters { + if r == nil { + return nil } - return *p.Action + return r.FilePathRestriction } -// GetChanges returns the Changes field. -func (p *PullRequestReviewCommentEvent) GetChanges() *EditChange { - if p == nil { +// GetMaxFilePathLength returns the MaxFilePathLength field. +func (r *RepositoryRulesetRules) GetMaxFilePathLength() *MaxFilePathLengthRuleParameters { + if r == nil { return nil } - return p.Changes + return r.MaxFilePathLength } -// GetComment returns the Comment field. -func (p *PullRequestReviewCommentEvent) GetComment() *PullRequestComment { - if p == nil { +// GetMaxFileSize returns the MaxFileSize field. +func (r *RepositoryRulesetRules) GetMaxFileSize() *MaxFileSizeRuleParameters { + if r == nil { return nil } - return p.Comment + return r.MaxFileSize } -// GetInstallation returns the Installation field. -func (p *PullRequestReviewCommentEvent) GetInstallation() *Installation { - if p == nil { +// GetMergeQueue returns the MergeQueue field. +func (r *RepositoryRulesetRules) GetMergeQueue() *MergeQueueRuleParameters { + if r == nil { return nil } - return p.Installation + return r.MergeQueue } -// GetOrg returns the Org field. -func (p *PullRequestReviewCommentEvent) GetOrg() *Organization { - if p == nil { +// GetNonFastForward returns the NonFastForward field. +func (r *RepositoryRulesetRules) GetNonFastForward() *EmptyRuleParameters { + if r == nil { return nil } - return p.Org + return r.NonFastForward } // GetPullRequest returns the PullRequest field. -func (p *PullRequestReviewCommentEvent) GetPullRequest() *PullRequest { - if p == nil { +func (r *RepositoryRulesetRules) GetPullRequest() *PullRequestRuleParameters { + if r == nil { return nil } - return p.PullRequest + return r.PullRequest } -// GetRepo returns the Repo field. -func (p *PullRequestReviewCommentEvent) GetRepo() *Repository { - if p == nil { +// GetRepositoryCreate returns the RepositoryCreate field. +func (r *RepositoryRulesetRules) GetRepositoryCreate() *EmptyRuleParameters { + if r == nil { return nil } - return p.Repo + return r.RepositoryCreate } -// GetSender returns the Sender field. -func (p *PullRequestReviewCommentEvent) GetSender() *User { - if p == nil { +// GetRepositoryDelete returns the RepositoryDelete field. +func (r *RepositoryRulesetRules) GetRepositoryDelete() *EmptyRuleParameters { + if r == nil { return nil } - return p.Sender + return r.RepositoryDelete } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewDismissalRequest) GetMessage() string { - if p == nil || p.Message == nil { - return "" +// GetRepositoryName returns the RepositoryName field. +func (r *RepositoryRulesetRules) GetRepositoryName() *SimplePatternRuleParameters { + if r == nil { + return nil } - return *p.Message + return r.RepositoryName } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" +// GetRepositoryTransfer returns the RepositoryTransfer field. +func (r *RepositoryRulesetRules) GetRepositoryTransfer() *EmptyRuleParameters { + if r == nil { + return nil } - return *p.Action + return r.RepositoryTransfer } -// GetInstallation returns the Installation field. -func (p *PullRequestReviewEvent) GetInstallation() *Installation { - if p == nil { +// GetRepositoryVisibility returns the RepositoryVisibility field. +func (r *RepositoryRulesetRules) GetRepositoryVisibility() *RepositoryVisibilityRuleParameters { + if r == nil { return nil } - return p.Installation + return r.RepositoryVisibility } -// GetOrganization returns the Organization field. -func (p *PullRequestReviewEvent) GetOrganization() *Organization { - if p == nil { +// GetRequiredDeployments returns the RequiredDeployments field. +func (r *RepositoryRulesetRules) GetRequiredDeployments() *RequiredDeploymentsRuleParameters { + if r == nil { return nil } - return p.Organization + return r.RequiredDeployments } -// GetPullRequest returns the PullRequest field. -func (p *PullRequestReviewEvent) GetPullRequest() *PullRequest { - if p == nil { +// GetRequiredLinearHistory returns the RequiredLinearHistory field. +func (r *RepositoryRulesetRules) GetRequiredLinearHistory() *EmptyRuleParameters { + if r == nil { return nil } - return p.PullRequest + return r.RequiredLinearHistory } -// GetRepo returns the Repo field. -func (p *PullRequestReviewEvent) GetRepo() *Repository { - if p == nil { +// GetRequiredSignatures returns the RequiredSignatures field. +func (r *RepositoryRulesetRules) GetRequiredSignatures() *EmptyRuleParameters { + if r == nil { return nil } - return p.Repo + return r.RequiredSignatures } -// GetReview returns the Review field. -func (p *PullRequestReviewEvent) GetReview() *PullRequestReview { - if p == nil { +// GetRequiredStatusChecks returns the RequiredStatusChecks field. +func (r *RepositoryRulesetRules) GetRequiredStatusChecks() *RequiredStatusChecksRuleParameters { + if r == nil { return nil } - return p.Review + return r.RequiredStatusChecks } -// GetSender returns the Sender field. -func (p *PullRequestReviewEvent) GetSender() *User { - if p == nil { +// GetTagNamePattern returns the TagNamePattern field. +func (r *RepositoryRulesetRules) GetTagNamePattern() *PatternRuleParameters { + if r == nil { return nil } - return p.Sender + return r.TagNamePattern } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetBody() string { - if p == nil || p.Body == nil { - return "" +// GetUpdate returns the Update field. +func (r *RepositoryRulesetRules) GetUpdate() *UpdateRuleParameters { + if r == nil { + return nil } - return *p.Body + return r.Update } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetCommitID() string { - if p == nil || p.CommitID == nil { - return "" +// GetWorkflows returns the Workflows field. +func (r *RepositoryRulesetRules) GetWorkflows() *WorkflowsRuleParameters { + if r == nil { + return nil } - return *p.CommitID + return r.Workflows } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetEvent() string { - if p == nil || p.Event == nil { - return "" +// GetConditionType returns the ConditionType field. +func (r *RepositoryRulesetUpdatedCondition) GetConditionType() *RepositoryRulesetChangeSource { + if r == nil { + return nil } - return *p.Event + return r.ConditionType } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewRequest) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetExclude returns the Exclude field. +func (r *RepositoryRulesetUpdatedCondition) GetExclude() *RepositoryRulesetChangeSources { + if r == nil { + return nil } - return *p.NodeID + return r.Exclude } -// GetBypassPullRequestAllowances returns the BypassPullRequestAllowances field. -func (p *PullRequestReviewsEnforcement) GetBypassPullRequestAllowances() *BypassPullRequestAllowances { - if p == nil { +// GetInclude returns the Include field. +func (r *RepositoryRulesetUpdatedCondition) GetInclude() *RepositoryRulesetChangeSources { + if r == nil { return nil } - return p.BypassPullRequestAllowances + return r.Include } -// GetDismissalRestrictions returns the DismissalRestrictions field. -func (p *PullRequestReviewsEnforcement) GetDismissalRestrictions() *DismissalRestrictions { - if p == nil { +// GetTarget returns the Target field. +func (r *RepositoryRulesetUpdatedCondition) GetTarget() *RepositoryRulesetChangeSource { + if r == nil { return nil } - return p.DismissalRestrictions + return r.Target } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementLevelChanges) GetFrom() string { - if p == nil || p.From == nil { - return "" +// GetChanges returns the Changes field. +func (r *RepositoryRulesetUpdatedConditions) GetChanges() *RepositoryRulesetUpdatedCondition { + if r == nil { + return nil } - return *p.From + return r.Changes } -// GetBypassPullRequestAllowancesRequest returns the BypassPullRequestAllowancesRequest field. -func (p *PullRequestReviewsEnforcementRequest) GetBypassPullRequestAllowancesRequest() *BypassPullRequestAllowancesRequest { - if p == nil { +// GetCondition returns the Condition field. +func (r *RepositoryRulesetUpdatedConditions) GetCondition() *RepositoryRulesetConditions { + if r == nil { return nil } - return p.BypassPullRequestAllowancesRequest + return r.Condition } -// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. -func (p *PullRequestReviewsEnforcementRequest) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { - if p == nil { +// GetChanges returns the Changes field. +func (r *RepositoryRulesetUpdatedRules) GetChanges() *RepositoryRulesetChangedRule { + if r == nil { return nil } - return p.DismissalRestrictionsRequest + return r.Changes } -// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementRequest) GetRequireLastPushApproval() bool { - if p == nil || p.RequireLastPushApproval == nil { - return false +// GetRule returns the Rule field. +func (r *RepositoryRulesetUpdatedRules) GetRule() *RepositoryRule { + if r == nil { + return nil } - return *p.RequireLastPushApproval + return r.Rule } -// GetBypassPullRequestAllowancesRequest returns the BypassPullRequestAllowancesRequest field. -func (p *PullRequestReviewsEnforcementUpdate) GetBypassPullRequestAllowancesRequest() *BypassPullRequestAllowancesRequest { - if p == nil { +// GetCommit returns the Commit field. +func (r *RepositoryTag) GetCommit() *Commit { + if r == nil { return nil } - return p.BypassPullRequestAllowancesRequest + return r.Commit } -// GetDismissalRestrictionsRequest returns the DismissalRestrictionsRequest field. -func (p *PullRequestReviewsEnforcementUpdate) GetDismissalRestrictionsRequest() *DismissalRestrictionsRequest { - if p == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RepositoryTag) GetName() string { + if r == nil || r.Name == nil { + return "" } - return p.DismissalRestrictionsRequest + return *r.Name } -// GetDismissStaleReviews returns the DismissStaleReviews field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementUpdate) GetDismissStaleReviews() bool { - if p == nil || p.DismissStaleReviews == nil { - return false +// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. +func (r *RepositoryTag) GetTarballURL() string { + if r == nil || r.TarballURL == nil { + return "" } - return *p.DismissStaleReviews + return *r.TarballURL } -// GetRequireCodeOwnerReviews returns the RequireCodeOwnerReviews field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementUpdate) GetRequireCodeOwnerReviews() bool { - if p == nil || p.RequireCodeOwnerReviews == nil { - return false +// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. +func (r *RepositoryTag) GetZipballURL() string { + if r == nil || r.ZipballURL == nil { + return "" } - return *p.RequireCodeOwnerReviews + return *r.ZipballURL } -// GetRequireLastPushApproval returns the RequireLastPushApproval field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewsEnforcementUpdate) GetRequireLastPushApproval() bool { - if p == nil || p.RequireLastPushApproval == nil { +// GetInternal returns the Internal field. +func (r *RepositoryVisibilityRuleParameters) GetInternal() bool { + if r == nil { return false } - return *p.RequireLastPushApproval + return r.Internal } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestReviewThreadEvent) GetAction() string { - if p == nil || p.Action == nil { - return "" +// GetPrivate returns the Private field. +func (r *RepositoryVisibilityRuleParameters) GetPrivate() bool { + if r == nil { + return false } - return *p.Action + return r.Private } -// GetInstallation returns the Installation field. -func (p *PullRequestReviewThreadEvent) GetInstallation() *Installation { - if p == nil { - return nil +// GetPublic returns the Public field. +func (r *RepositoryVisibilityRuleParameters) GetPublic() bool { + if r == nil { + return false } - return p.Installation + return r.Public } -// GetOrg returns the Org field. -func (p *PullRequestReviewThreadEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetAffectedPackageName returns the AffectedPackageName field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetAffectedPackageName() string { + if r == nil || r.AffectedPackageName == nil { + return "" } - return p.Org + return *r.AffectedPackageName } -// GetPullRequest returns the PullRequest field. -func (p *PullRequestReviewThreadEvent) GetPullRequest() *PullRequest { - if p == nil { - return nil +// GetAffectedRange returns the AffectedRange field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetAffectedRange() string { + if r == nil || r.AffectedRange == nil { + return "" } - return p.PullRequest + return *r.AffectedRange } -// GetRepo returns the Repo field. -func (p *PullRequestReviewThreadEvent) GetRepo() *Repository { - if p == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} } - return p.Repo + return *r.CreatedAt } -// GetSender returns the Sender field. -func (p *PullRequestReviewThreadEvent) GetSender() *User { - if p == nil { - return nil +// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetDismissedAt() Timestamp { + if r == nil || r.DismissedAt == nil { + return Timestamp{} } - return p.Sender + return *r.DismissedAt } -// GetThread returns the Thread field. -func (p *PullRequestReviewThreadEvent) GetThread() *PullRequestThread { - if p == nil { +// GetDismisser returns the Dismisser field. +func (r *RepositoryVulnerabilityAlert) GetDismisser() *User { + if r == nil { return nil } - return p.Thread + return r.Dismisser } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PullRequestTargetEvent) GetAction() string { - if p == nil || p.Action == nil { +// GetDismissReason returns the DismissReason field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetDismissReason() string { + if r == nil || r.DismissReason == nil { return "" } - return *p.Action + return *r.DismissReason } -// GetAfter returns the After field if it's non-nil, zero value otherwise. -func (p *PullRequestTargetEvent) GetAfter() string { - if p == nil || p.After == nil { +// GetExternalIdentifier returns the ExternalIdentifier field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetExternalIdentifier() string { + if r == nil || r.ExternalIdentifier == nil { return "" } - return *p.After + return *r.ExternalIdentifier } -// GetAssignee returns the Assignee field. -func (p *PullRequestTargetEvent) GetAssignee() *User { - if p == nil { - return nil +// GetExternalReference returns the ExternalReference field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetExternalReference() string { + if r == nil || r.ExternalReference == nil { + return "" } - return p.Assignee + return *r.ExternalReference } -// GetBefore returns the Before field if it's non-nil, zero value otherwise. -func (p *PullRequestTargetEvent) GetBefore() string { - if p == nil || p.Before == nil { +// GetFixedIn returns the FixedIn field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetFixedIn() string { + if r == nil || r.FixedIn == nil { return "" } - return *p.Before + return *r.FixedIn } -// GetChanges returns the Changes field. -func (p *PullRequestTargetEvent) GetChanges() *EditChange { - if p == nil { - return nil +// GetGitHubSecurityAdvisoryID returns the GitHubSecurityAdvisoryID field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetGitHubSecurityAdvisoryID() string { + if r == nil || r.GitHubSecurityAdvisoryID == nil { + return "" } - return p.Changes + return *r.GitHubSecurityAdvisoryID } -// GetInstallation returns the Installation field. -func (p *PullRequestTargetEvent) GetInstallation() *Installation { - if p == nil { - return nil +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetID() int64 { + if r == nil || r.ID == nil { + return 0 } - return p.Installation + return *r.ID } -// GetLabel returns the Label field. -func (p *PullRequestTargetEvent) GetLabel() *Label { - if p == nil { - return nil +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlert) GetSeverity() string { + if r == nil || r.Severity == nil { + return "" } - return p.Label + return *r.Severity } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *PullRequestTargetEvent) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RepositoryVulnerabilityAlertEvent) GetAction() string { + if r == nil || r.Action == nil { + return "" } - return *p.Number + return *r.Action } -// GetOrganization returns the Organization field. -func (p *PullRequestTargetEvent) GetOrganization() *Organization { - if p == nil { +// GetAlert returns the Alert field. +func (r *RepositoryVulnerabilityAlertEvent) GetAlert() *RepositoryVulnerabilityAlert { + if r == nil { return nil } - return p.Organization + return r.Alert } -// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. -func (p *PullRequestTargetEvent) GetPerformedViaGithubApp() *App { - if p == nil { +// GetInstallation returns the Installation field. +func (r *RepositoryVulnerabilityAlertEvent) GetInstallation() *Installation { + if r == nil { return nil } - return p.PerformedViaGithubApp + return r.Installation } -// GetPullRequest returns the PullRequest field. -func (p *PullRequestTargetEvent) GetPullRequest() *PullRequest { - if p == nil { +// GetOrg returns the Org field. +func (r *RepositoryVulnerabilityAlertEvent) GetOrg() *Organization { + if r == nil { return nil } - return p.PullRequest + return r.Org } -// GetRepo returns the Repo field. -func (p *PullRequestTargetEvent) GetRepo() *Repository { - if p == nil { +// GetRepository returns the Repository field. +func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository { + if r == nil { return nil } - return p.Repo + return r.Repository } -// GetRequestedReviewer returns the RequestedReviewer field. -func (p *PullRequestTargetEvent) GetRequestedReviewer() *User { - if p == nil { +// GetSender returns the Sender field. +func (r *RepositoryVulnerabilityAlertEvent) GetSender() *User { + if r == nil { return nil } - return p.RequestedReviewer + return r.Sender } -// GetRequestedTeam returns the RequestedTeam field. -func (p *PullRequestTargetEvent) GetRequestedTeam() *Team { - if p == nil { - return nil +// GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetForkRepos() int { + if r == nil || r.ForkRepos == nil { + return 0 } - return p.RequestedTeam + return *r.ForkRepos } -// GetSender returns the Sender field. -func (p *PullRequestTargetEvent) GetSender() *User { - if p == nil { - return nil +// GetOrgRepos returns the OrgRepos field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetOrgRepos() int { + if r == nil || r.OrgRepos == nil { + return 0 } - return p.Sender + return *r.OrgRepos } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PullRequestThread) GetID() int64 { - if p == nil || p.ID == nil { +// GetRootRepos returns the RootRepos field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetRootRepos() int { + if r == nil || r.RootRepos == nil { return 0 } - return *p.ID + return *r.RootRepos } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PullRequestThread) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetTotalPushes returns the TotalPushes field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetTotalPushes() int { + if r == nil || r.TotalPushes == nil { + return 0 } - return *p.NodeID + return *r.TotalPushes } -// GetMergeablePulls returns the MergeablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetMergeablePulls() int { - if p == nil || p.MergeablePulls == nil { +// GetTotalRepos returns the TotalRepos field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetTotalRepos() int { + if r == nil || r.TotalRepos == nil { return 0 } - return *p.MergeablePulls + return *r.TotalRepos } -// GetMergedPulls returns the MergedPulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetMergedPulls() int { - if p == nil || p.MergedPulls == nil { +// GetTotalWikis returns the TotalWikis field if it's non-nil, zero value otherwise. +func (r *RepoStats) GetTotalWikis() int { + if r == nil || r.TotalWikis == nil { return 0 } - return *p.MergedPulls + return *r.TotalWikis } -// GetTotalPulls returns the TotalPulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetTotalPulls() int { - if p == nil || p.TotalPulls == nil { - return 0 +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetAvatarURL() string { + if r == nil || r.AvatarURL == nil { + return "" } - return *p.TotalPulls + return *r.AvatarURL } -// GetUnmergeablePulls returns the UnmergeablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetUnmergeablePulls() int { - if p == nil || p.UnmergeablePulls == nil { - return 0 +// GetContext returns the Context field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetContext() string { + if r == nil || r.Context == nil { + return "" } - return *p.UnmergeablePulls + return *r.Context } -// GetCommits returns the Commits field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetCommits() int { - if p == nil || p.Commits == nil { - return 0 +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} } - return *p.Commits + return *r.CreatedAt } -// GetDay returns the Day field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetDay() int { - if p == nil || p.Day == nil { - return 0 +// GetCreator returns the Creator field. +func (r *RepoStatus) GetCreator() *User { + if r == nil { + return nil } - return *p.Day + return r.Creator } -// GetHour returns the Hour field if it's non-nil, zero value otherwise. -func (p *PunchCard) GetHour() int { - if p == nil || p.Hour == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetDescription() string { + if r == nil || r.Description == nil { + return "" + } + return *r.Description +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetID() int64 { + if r == nil || r.ID == nil { return 0 } - return *p.Hour + return *r.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetAction() string { - if p == nil || p.Action == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.Action + return *r.NodeID } -// GetAfter returns the After field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetAfter() string { - if p == nil || p.After == nil { - return "" +// GetRequired returns the Required field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetRequired() bool { + if r == nil || r.Required == nil { + return false } - return *p.After + return *r.Required } -// GetBaseRef returns the BaseRef field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetBaseRef() string { - if p == nil || p.BaseRef == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetState() string { + if r == nil || r.State == nil { return "" } - return *p.BaseRef + return *r.State } -// GetBefore returns the Before field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetBefore() string { - if p == nil || p.Before == nil { +// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetTargetURL() string { + if r == nil || r.TargetURL == nil { return "" } - return *p.Before + return *r.TargetURL } -// GetCommits returns the Commits slice if it's non-nil, nil otherwise. -func (p *PushEvent) GetCommits() []*HeadCommit { - if p == nil || p.Commits == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { + return Timestamp{} } - return p.Commits + return *r.UpdatedAt } -// GetCompare returns the Compare field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetCompare() string { - if p == nil || p.Compare == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RepoStatus) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.Compare + return *r.URL } -// GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetCreated() bool { - if p == nil || p.Created == nil { - return false +// GetIdentifier returns the Identifier field. +func (r *RequestedAction) GetIdentifier() string { + if r == nil { + return "" } - return *p.Created + return r.Identifier } -// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetDeleted() bool { - if p == nil || p.Deleted == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequireCodeOwnerReviewChanges) GetFrom() bool { + if r == nil || r.From == nil { return false } - return *p.Deleted + return *r.From } -// GetDistinctSize returns the DistinctSize field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetDistinctSize() int { - if p == nil || p.DistinctSize == nil { - return 0 +// GetEnabled returns the Enabled field. +func (r *RequiredConversationResolution) GetEnabled() bool { + if r == nil { + return false } - return *p.DistinctSize + return r.Enabled } -// GetForced returns the Forced field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetForced() bool { - if p == nil || p.Forced == nil { - return false +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequiredConversationResolutionLevelChanges) GetFrom() string { + if r == nil || r.From == nil { + return "" } - return *p.Forced + return *r.From } -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetHead() string { - if p == nil || p.Head == nil { - return "" +// GetParameters returns the Parameters field. +func (r *RequiredDeploymentsBranchRule) GetParameters() RequiredDeploymentsRuleParameters { + if r == nil { + return RequiredDeploymentsRuleParameters{} } - return *p.Head + return r.Parameters } -// GetHeadCommit returns the HeadCommit field. -func (p *PushEvent) GetHeadCommit() *HeadCommit { - if p == nil { - return nil +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequiredDeploymentsEnforcementLevelChanges) GetFrom() string { + if r == nil || r.From == nil { + return "" } - return p.HeadCommit + return *r.From } -// GetInstallation returns the Installation field. -func (p *PushEvent) GetInstallation() *Installation { - if p == nil { +// GetRequiredDeploymentEnvironments returns the RequiredDeploymentEnvironments slice if it's non-nil, nil otherwise. +func (r *RequiredDeploymentsRuleParameters) GetRequiredDeploymentEnvironments() []string { + if r == nil || r.RequiredDeploymentEnvironments == nil { return nil } - return p.Installation + return r.RequiredDeploymentEnvironments } -// GetOrganization returns the Organization field. -func (p *PushEvent) GetOrganization() *Organization { - if p == nil { +// GetReviewer returns the Reviewer field. +func (r *RequiredReviewer) GetReviewer() any { + if r == nil { return nil } - return p.Organization + return r.Reviewer } -// GetPusher returns the Pusher field. -func (p *PushEvent) GetPusher() *CommitAuthor { - if p == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RequiredReviewer) GetType() string { + if r == nil || r.Type == nil { + return "" } - return p.Pusher + return *r.Type } -// GetPushID returns the PushID field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetPushID() int64 { - if p == nil || p.PushID == nil { +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (r *RequiredStatusCheck) GetAppID() int64 { + if r == nil || r.AppID == nil { return 0 } - return *p.PushID + return *r.AppID } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetRef() string { - if p == nil || p.Ref == nil { +// GetContext returns the Context field. +func (r *RequiredStatusCheck) GetContext() string { + if r == nil { return "" } - return *p.Ref + return r.Context } -// GetRepo returns the Repo field. -func (p *PushEvent) GetRepo() *PushEventRepository { - if p == nil { +// GetChecks returns the Checks field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetChecks() []*RequiredStatusCheck { + if r == nil || r.Checks == nil { return nil } - return p.Repo + return *r.Checks } -// GetSender returns the Sender field. -func (p *PushEvent) GetSender() *User { - if p == nil { +// GetContexts returns the Contexts field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetContexts() []string { + if r == nil || r.Contexts == nil { return nil } - return p.Sender + return *r.Contexts } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PushEvent) GetSize() int { - if p == nil || p.Size == nil { - return 0 +// GetContextsURL returns the ContextsURL field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetContextsURL() string { + if r == nil || r.ContextsURL == nil { + return "" } - return *p.Size + return *r.ContextsURL } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (p *PushEventRepoOwner) GetEmail() string { - if p == nil || p.Email == nil { - return "" +// GetStrict returns the Strict field. +func (r *RequiredStatusChecks) GetStrict() bool { + if r == nil { + return false } - return *p.Email + return r.Strict } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PushEventRepoOwner) GetName() string { - if p == nil || p.Name == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetURL() string { + if r == nil || r.URL == nil { return "" } - return *p.Name + return *r.URL } -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetArchived() bool { - if p == nil || p.Archived == nil { - return false +// GetParameters returns the Parameters field. +func (r *RequiredStatusChecksBranchRule) GetParameters() RequiredStatusChecksRuleParameters { + if r == nil { + return RequiredStatusChecksRuleParameters{} } - return *p.Archived + return r.Parameters } -// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetArchiveURL() string { - if p == nil || p.ArchiveURL == nil { - return "" +// GetFrom returns the From slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksChanges) GetFrom() []string { + if r == nil || r.From == nil { + return nil } - return *p.ArchiveURL + return r.From } -// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetCloneURL() string { - if p == nil || p.CloneURL == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecksEnforcementLevelChanges) GetFrom() string { + if r == nil || r.From == nil { return "" } - return *p.CloneURL + return *r.From } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetChecks returns the Checks slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRequest) GetChecks() []*RequiredStatusCheck { + if r == nil || r.Checks == nil { + return nil } - return *p.CreatedAt + return r.Checks } -// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetDefaultBranch() string { - if p == nil || p.DefaultBranch == nil { - return "" +// GetContexts returns the Contexts slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRequest) GetContexts() []string { + if r == nil || r.Contexts == nil { + return nil } - return *p.DefaultBranch + return r.Contexts } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetDescription() string { - if p == nil || p.Description == nil { - return "" +// GetStrict returns the Strict field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecksRequest) GetStrict() bool { + if r == nil || r.Strict == nil { + return false } - return *p.Description + return *r.Strict } -// GetDisabled returns the Disabled field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetDisabled() bool { - if p == nil || p.Disabled == nil { +// GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecksRuleParameters) GetDoNotEnforceOnCreate() bool { + if r == nil || r.DoNotEnforceOnCreate == nil { return false } - return *p.Disabled + return *r.DoNotEnforceOnCreate } -// GetFork returns the Fork field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetFork() bool { - if p == nil || p.Fork == nil { +// GetRequiredStatusChecks returns the RequiredStatusChecks slice if it's non-nil, nil otherwise. +func (r *RequiredStatusChecksRuleParameters) GetRequiredStatusChecks() []*RuleStatusCheck { + if r == nil || r.RequiredStatusChecks == nil { + return nil + } + return r.RequiredStatusChecks +} + +// GetStrictRequiredStatusChecksPolicy returns the StrictRequiredStatusChecksPolicy field. +func (r *RequiredStatusChecksRuleParameters) GetStrictRequiredStatusChecksPolicy() bool { + if r == nil { return false } - return *p.Fork + return r.StrictRequiredStatusChecksPolicy } -// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetForksCount() int { - if p == nil || p.ForksCount == nil { - return 0 +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RequireLastPushApprovalChanges) GetFrom() bool { + if r == nil || r.From == nil { + return false } - return *p.ForksCount + return *r.From } -// GetFullName returns the FullName field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetFullName() string { - if p == nil || p.FullName == nil { - return "" +// GetEnabled returns the Enabled field. +func (r *RequireLinearHistory) GetEnabled() bool { + if r == nil { + return false } - return *p.FullName + return r.Enabled } -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetGitURL() string { - if p == nil || p.GitURL == nil { +// GetAfter returns the After field. +func (r *Response) GetAfter() string { + if r == nil { return "" } - return *p.GitURL + return r.After } -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasDownloads() bool { - if p == nil || p.HasDownloads == nil { - return false +// GetBefore returns the Before field. +func (r *Response) GetBefore() string { + if r == nil { + return "" } - return *p.HasDownloads + return r.Before } -// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasIssues() bool { - if p == nil || p.HasIssues == nil { - return false +// GetCursor returns the Cursor field. +func (r *Response) GetCursor() string { + if r == nil { + return "" } - return *p.HasIssues + return r.Cursor } -// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasPages() bool { - if p == nil || p.HasPages == nil { - return false +// GetFirstPage returns the FirstPage field. +func (r *Response) GetFirstPage() int { + if r == nil { + return 0 } - return *p.HasPages + return r.FirstPage } -// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHasWiki() bool { - if p == nil || p.HasWiki == nil { - return false +// GetLastPage returns the LastPage field. +func (r *Response) GetLastPage() int { + if r == nil { + return 0 } - return *p.HasWiki + return r.LastPage } -// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHomepage() string { - if p == nil || p.Homepage == nil { - return "" +// GetNextPage returns the NextPage field. +func (r *Response) GetNextPage() int { + if r == nil { + return 0 } - return *p.Homepage + return r.NextPage } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// GetNextPageToken returns the NextPageToken field. +func (r *Response) GetNextPageToken() string { + if r == nil { return "" } - return *p.HTMLURL + return r.NextPageToken } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetID() int64 { - if p == nil || p.ID == nil { +// GetPrevPage returns the PrevPage field. +func (r *Response) GetPrevPage() int { + if r == nil { return 0 } - return *p.ID + return r.PrevPage } -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetLanguage() string { - if p == nil || p.Language == nil { - return "" +// GetRate returns the Rate field. +func (r *Response) GetRate() Rate { + if r == nil { + return Rate{} } - return *p.Language + return r.Rate } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetMasterBranch() string { - if p == nil || p.MasterBranch == nil { +// GetTokenExpiration returns the TokenExpiration field. +func (r *Response) GetTokenExpiration() Timestamp { + if r == nil { + return Timestamp{} + } + return r.TokenExpiration +} + +// GetComment returns the Comment field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetComment() string { + if r == nil { return "" } - return *p.MasterBranch + return r.Comment } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetName() string { - if p == nil || p.Name == nil { +// GetEnvironmentName returns the EnvironmentName field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetEnvironmentName() string { + if r == nil { return "" } - return *p.Name + return r.EnvironmentName } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetNodeID() string { - if p == nil || p.NodeID == nil { +// GetState returns the State field. +func (r *ReviewCustomDeploymentProtectionRuleRequest) GetState() string { + if r == nil { return "" } - return *p.NodeID + return r.State } -// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetOpenIssuesCount() int { - if p == nil || p.OpenIssuesCount == nil { - return 0 +// GetTeams returns the Teams slice if it's non-nil, nil otherwise. +func (r *Reviewers) GetTeams() []*Team { + if r == nil || r.Teams == nil { + return nil } - return *p.OpenIssuesCount + return r.Teams } -// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetOrganization() string { - if p == nil || p.Organization == nil { +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (r *Reviewers) GetUsers() []*User { + if r == nil || r.Users == nil { + return nil + } + return r.Users +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *ReviewersRequest) GetNodeID() string { + if r == nil || r.NodeID == nil { return "" } - return *p.Organization + return *r.NodeID } -// GetOwner returns the Owner field. -func (p *PushEventRepository) GetOwner() *User { - if p == nil { +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (r *ReviewersRequest) GetReviewers() []string { + if r == nil || r.Reviewers == nil { return nil } - return p.Owner + return r.Reviewers } -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPrivate() bool { - if p == nil || p.Private == nil { - return false +// GetTeamReviewers returns the TeamReviewers slice if it's non-nil, nil otherwise. +func (r *ReviewersRequest) GetTeamReviewers() []string { + if r == nil || r.TeamReviewers == nil { + return nil } - return *p.Private + return r.TeamReviewers } -// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPullsURL() string { - if p == nil || p.PullsURL == nil { +// GetAction returns the Action field. +func (r *ReviewPersonalAccessTokenRequestOptions) GetAction() string { + if r == nil { return "" } - return *p.PullsURL + return r.Action } -// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetPushedAt() Timestamp { - if p == nil || p.PushedAt == nil { - return Timestamp{} +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (r *ReviewPersonalAccessTokenRequestOptions) GetReason() string { + if r == nil || r.Reason == nil { + return "" } - return *p.PushedAt + return *r.Reason } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSize() int { - if p == nil || p.Size == nil { - return 0 +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (r *Rule) GetDescription() string { + if r == nil || r.Description == nil { + return "" } - return *p.Size + return *r.Description } -// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSSHURL() string { - if p == nil || p.SSHURL == nil { +// GetFullDescription returns the FullDescription field if it's non-nil, zero value otherwise. +func (r *Rule) GetFullDescription() string { + if r == nil || r.FullDescription == nil { return "" } - return *p.SSHURL + return *r.FullDescription } -// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetStargazersCount() int { - if p == nil || p.StargazersCount == nil { - return 0 +// GetHelp returns the Help field if it's non-nil, zero value otherwise. +func (r *Rule) GetHelp() string { + if r == nil || r.Help == nil { + return "" } - return *p.StargazersCount + return *r.Help } -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetStatusesURL() string { - if p == nil || p.StatusesURL == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *Rule) GetID() string { + if r == nil || r.ID == nil { return "" } - return *p.StatusesURL + return *r.ID } -// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetSVNURL() string { - if p == nil || p.SVNURL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *Rule) GetName() string { + if r == nil || r.Name == nil { return "" } - return *p.SVNURL + return *r.Name } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// GetSecuritySeverityLevel returns the SecuritySeverityLevel field if it's non-nil, zero value otherwise. +func (r *Rule) GetSecuritySeverityLevel() string { + if r == nil || r.SecuritySeverityLevel == nil { + return "" } - return *p.UpdatedAt + return *r.SecuritySeverityLevel } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetURL() string { - if p == nil || p.URL == nil { +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (r *Rule) GetSeverity() string { + if r == nil || r.Severity == nil { return "" } - return *p.URL + return *r.Severity } -// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. -func (p *PushEventRepository) GetWatchersCount() int { - if p == nil || p.WatchersCount == nil { - return 0 +// GetTags returns the Tags slice if it's non-nil, nil otherwise. +func (r *Rule) GetTags() []string { + if r == nil || r.Tags == nil { + return nil } - return *p.WatchersCount + return r.Tags } -// GetActionsRunnerRegistration returns the ActionsRunnerRegistration field. -func (r *RateLimits) GetActionsRunnerRegistration() *Rate { +// GetAlertsThreshold returns the AlertsThreshold field. +func (r *RuleCodeScanningTool) GetAlertsThreshold() CodeScanningAlertsThreshold { if r == nil { - return nil + return "" } - return r.ActionsRunnerRegistration + return r.AlertsThreshold } -// GetAuditLog returns the AuditLog field. -func (r *RateLimits) GetAuditLog() *Rate { +// GetSecurityAlertsThreshold returns the SecurityAlertsThreshold field. +func (r *RuleCodeScanningTool) GetSecurityAlertsThreshold() CodeScanningSecurityAlertsThreshold { if r == nil { - return nil + return "" } - return r.AuditLog + return r.SecurityAlertsThreshold } -// GetCodeScanningUpload returns the CodeScanningUpload field. -func (r *RateLimits) GetCodeScanningUpload() *Rate { +// GetTool returns the Tool field. +func (r *RuleCodeScanningTool) GetTool() string { if r == nil { - return nil + return "" } - return r.CodeScanningUpload + return r.Tool } -// GetCodeSearch returns the CodeSearch field. -func (r *RateLimits) GetCodeSearch() *Rate { - if r == nil { +// GetFilePatterns returns the FilePatterns slice if it's non-nil, nil otherwise. +func (r *RulesetRequiredReviewer) GetFilePatterns() []string { + if r == nil || r.FilePatterns == nil { return nil } - return r.CodeSearch + return r.FilePatterns } -// GetCore returns the Core field. -func (r *RateLimits) GetCore() *Rate { - if r == nil { - return nil +// 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.Core + return *r.MinimumApprovals } -// GetDependencySnapshots returns the DependencySnapshots field. -func (r *RateLimits) GetDependencySnapshots() *Rate { +// GetReviewer returns the Reviewer field. +func (r *RulesetRequiredReviewer) GetReviewer() *RulesetReviewer { if r == nil { return nil } - return r.DependencySnapshots + return r.Reviewer } -// GetGraphQL returns the GraphQL field. -func (r *RateLimits) GetGraphQL() *Rate { - if r == nil { - return nil +// 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.GraphQL + return *r.ID } -// GetIntegrationManifest returns the IntegrationManifest field. -func (r *RateLimits) GetIntegrationManifest() *Rate { +// GetType returns the Type field. +func (r *RulesetReviewer) GetType() *RulesetReviewerType { if r == nil { return nil } - return r.IntegrationManifest + return r.Type } -// GetSCIM returns the SCIM field. -func (r *RateLimits) GetSCIM() *Rate { +// GetContext returns the Context field. +func (r *RuleStatusCheck) GetContext() string { if r == nil { - return nil + return "" } - return r.SCIM + return r.Context } -// GetSearch returns the Search field. -func (r *RateLimits) GetSearch() *Rate { - if r == nil { - return nil +// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. +func (r *RuleStatusCheck) GetIntegrationID() int64 { + if r == nil || r.IntegrationID == nil { + return 0 } - return r.Search + return *r.IntegrationID } -// GetSourceImport returns the SourceImport field. -func (r *RateLimits) GetSourceImport() *Rate { +// GetPath returns the Path field. +func (r *RuleWorkflow) GetPath() string { if r == nil { - return nil + return "" } - return r.SourceImport + return r.Path } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (r *Reaction) GetContent() string { - if r == nil || r.Content == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (r *RuleWorkflow) GetRef() string { + if r == nil || r.Ref == nil { return "" } - return *r.Content + return *r.Ref } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Reaction) GetID() int64 { - if r == nil || r.ID == nil { +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (r *RuleWorkflow) GetRepositoryID() int64 { + if r == nil || r.RepositoryID == nil { return 0 } - return *r.ID + return *r.RepositoryID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Reaction) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *RuleWorkflow) GetSHA() string { + if r == nil || r.SHA == nil { return "" } - return *r.NodeID + return *r.SHA } -// GetUser returns the User field. -func (r *Reaction) GetUser() *User { - if r == nil { - return nil +// GetBusy returns the Busy field if it's non-nil, zero value otherwise. +func (r *Runner) GetBusy() bool { + if r == nil || r.Busy == nil { + return false } - return r.User + return *r.Busy } -// GetConfused returns the Confused field if it's non-nil, zero value otherwise. -func (r *Reactions) GetConfused() int { - if r == nil || r.Confused == nil { - return 0 +// GetEphemeral returns the Ephemeral field if it's non-nil, zero value otherwise. +func (r *Runner) GetEphemeral() bool { + if r == nil || r.Ephemeral == nil { + return false } - return *r.Confused + return *r.Ephemeral } -// GetEyes returns the Eyes field if it's non-nil, zero value otherwise. -func (r *Reactions) GetEyes() int { - if r == nil || r.Eyes == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *Runner) GetID() int64 { + if r == nil || r.ID == nil { return 0 } - return *r.Eyes + return *r.ID } -// GetHeart returns the Heart field if it's non-nil, zero value otherwise. -func (r *Reactions) GetHeart() int { - if r == nil || r.Heart == nil { - return 0 +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (r *Runner) GetLabels() []*RunnerLabels { + if r == nil || r.Labels == nil { + return nil } - return *r.Heart + return r.Labels } -// GetHooray returns the Hooray field if it's non-nil, zero value otherwise. -func (r *Reactions) GetHooray() int { - if r == nil || r.Hooray == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *Runner) GetName() string { + if r == nil || r.Name == nil { + return "" } - return *r.Hooray + return *r.Name } -// GetLaugh returns the Laugh field if it's non-nil, zero value otherwise. -func (r *Reactions) GetLaugh() int { - if r == nil || r.Laugh == nil { - return 0 +// GetOS returns the OS field if it's non-nil, zero value otherwise. +func (r *Runner) GetOS() string { + if r == nil || r.OS == nil { + return "" } - return *r.Laugh + return *r.OS } -// GetMinusOne returns the MinusOne field if it's non-nil, zero value otherwise. -func (r *Reactions) GetMinusOne() int { - if r == nil || r.MinusOne == nil { +// GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. +func (r *Runner) GetRunnerGroupID() int64 { + if r == nil || r.RunnerGroupID == nil { return 0 } - return *r.MinusOne + return *r.RunnerGroupID } -// GetPlusOne returns the PlusOne field if it's non-nil, zero value otherwise. -func (r *Reactions) GetPlusOne() int { - if r == nil || r.PlusOne == nil { - return 0 +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (r *Runner) GetStatus() string { + if r == nil || r.Status == nil { + return "" } - return *r.PlusOne + return *r.Status } -// GetRocket returns the Rocket field if it's non-nil, zero value otherwise. -func (r *Reactions) GetRocket() int { - if r == nil || r.Rocket == nil { - return 0 +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (r *Runner) GetVersion() string { + if r == nil || r.Version == nil { + return "" } - return *r.Rocket + return *r.Version } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (r *Reactions) GetTotalCount() int { - if r == nil || r.TotalCount == nil { - return 0 +// GetArchitecture returns the Architecture field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetArchitecture() string { + if r == nil || r.Architecture == nil { + return "" } - return *r.TotalCount + return *r.Architecture } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Reactions) GetURL() string { - if r == nil || r.URL == nil { +// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetDownloadURL() string { + if r == nil || r.DownloadURL == nil { return "" } - return *r.URL + return *r.DownloadURL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Reference) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetFilename returns the Filename field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetFilename() string { + if r == nil || r.Filename == nil { return "" } - return *r.NodeID + return *r.Filename } -// GetObject returns the Object field. -func (r *Reference) GetObject() *GitObject { - if r == nil { - return nil +// GetOS returns the OS field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetOS() string { + if r == nil || r.OS == nil { + return "" } - return r.Object + return *r.OS } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (r *Reference) GetRef() string { - if r == nil || r.Ref == nil { +// GetSHA256Checksum returns the SHA256Checksum field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetSHA256Checksum() string { + if r == nil || r.SHA256Checksum == nil { return "" } - return *r.Ref + return *r.SHA256Checksum } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Reference) GetURL() string { - if r == nil || r.URL == nil { +// GetTempDownloadToken returns the TempDownloadToken field if it's non-nil, zero value otherwise. +func (r *RunnerApplicationDownload) GetTempDownloadToken() string { + if r == nil || r.TempDownloadToken == nil { return "" } - return *r.URL + return *r.TempDownloadToken } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *ReferencedWorkflow) GetPath() string { - if r == nil || r.Path == nil { +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetAllowsPublicRepositories() bool { + if r == nil || r.AllowsPublicRepositories == nil { + return false + } + return *r.AllowsPublicRepositories +} + +// GetDefault returns the Default field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetDefault() bool { + if r == nil || r.Default == nil { + return false + } + 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.Path + return *r.HostedRunnersURL } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (r *ReferencedWorkflow) GetRef() string { - if r == nil || r.Ref == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetID() int64 { + if r == nil || r.ID == nil { + return 0 + } + return *r.ID +} + +// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetInherited() bool { + if r == nil || r.Inherited == nil { + return false + } + return *r.Inherited +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetName() string { + if r == nil || r.Name == nil { return "" } - return *r.Ref + return *r.Name } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *ReferencedWorkflow) GetSHA() string { - if r == nil || r.SHA == nil { +// 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.SHA + return *r.NetworkConfigurationID } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (r *RegistrationToken) GetExpiresAt() Timestamp { - if r == nil || r.ExpiresAt == nil { - return Timestamp{} +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetRestrictedToWorkflows() bool { + if r == nil || r.RestrictedToWorkflows == nil { + return false } - return *r.ExpiresAt + return *r.RestrictedToWorkflows } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (r *RegistrationToken) GetToken() string { - if r == nil || r.Token == nil { +// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetRunnersURL() string { + if r == nil || r.RunnersURL == nil { return "" } - return *r.Token + return *r.RunnersURL } -// GetBrowserDownloadURL returns the BrowserDownloadURL field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetBrowserDownloadURL() string { - if r == nil || r.BrowserDownloadURL == nil { +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetSelectedRepositoriesURL() string { + if r == nil || r.SelectedRepositoriesURL == nil { return "" } - return *r.BrowserDownloadURL + return *r.SelectedRepositoriesURL } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetContentType() string { - if r == nil || r.ContentType == nil { +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (r *RunnerGroup) GetSelectedWorkflows() []string { + if r == nil || r.SelectedWorkflows == nil { + return nil + } + return r.SelectedWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetVisibility() string { + if r == nil || r.Visibility == nil { return "" } - return *r.ContentType + return *r.Visibility } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetWorkflowRestrictionsReadOnly returns the WorkflowRestrictionsReadOnly field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetWorkflowRestrictionsReadOnly() bool { + if r == nil || r.WorkflowRestrictionsReadOnly == nil { + return false } - return *r.CreatedAt + return *r.WorkflowRestrictionsReadOnly } -// GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetDownloadCount() int { - if r == nil || r.DownloadCount == nil { +// GetRunnerGroups returns the RunnerGroups slice if it's non-nil, nil otherwise. +func (r *RunnerGroups) GetRunnerGroups() []*RunnerGroup { + if r == nil || r.RunnerGroups == nil { + return nil + } + return r.RunnerGroups +} + +// GetTotalCount returns the TotalCount field. +func (r *RunnerGroups) GetTotalCount() int { + if r == nil { return 0 } - return *r.DownloadCount + return r.TotalCount } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetID() int64 { +func (r *RunnerLabels) GetID() int64 { if r == nil || r.ID == nil { return 0 } return *r.ID } -// GetLabel returns the Label field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetLabel() string { - if r == nil || r.Label == nil { - return "" - } - return *r.Label -} - // GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetName() string { +func (r *RunnerLabels) GetName() string { if r == nil || r.Name == nil { return "" } return *r.Name } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RunnerLabels) GetType() string { + if r == nil || r.Type == nil { return "" } - return *r.NodeID + return *r.Type } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetSize() int { - if r == nil || r.Size == nil { +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (r *Runners) GetRunners() []*Runner { + if r == nil || r.Runners == nil { + return nil + } + return r.Runners +} + +// GetTotalCount returns the TotalCount field. +func (r *Runners) GetTotalCount() int { + if r == nil { return 0 } - return *r.Size + return r.TotalCount } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetState() string { - if r == nil || r.State == nil { +// GetCheckoutURI returns the CheckoutURI field if it's non-nil, zero value otherwise. +func (s *SarifAnalysis) GetCheckoutURI() string { + if s == nil || s.CheckoutURI == nil { return "" } - return *r.State + return *s.CheckoutURI } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { +// GetCommitSHA returns the CommitSHA field. +func (s *SarifAnalysis) GetCommitSHA() string { + if s == nil { + return "" + } + return s.CommitSHA +} + +// GetRef returns the Ref field. +func (s *SarifAnalysis) GetRef() string { + if s == nil { + return "" + } + return s.Ref +} + +// GetSarif returns the Sarif field. +func (s *SarifAnalysis) GetSarif() string { + if s == nil { + return "" + } + return s.Sarif +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (s *SarifAnalysis) GetStartedAt() Timestamp { + if s == nil || s.StartedAt == nil { return Timestamp{} } - return *r.UpdatedAt + return *s.StartedAt } -// GetUploader returns the Uploader field. -func (r *ReleaseAsset) GetUploader() *User { - if r == nil { - return nil +// GetToolName returns the ToolName field if it's non-nil, zero value otherwise. +func (s *SarifAnalysis) GetToolName() string { + if s == nil || s.ToolName == nil { + return "" } - return r.Uploader + return *s.ToolName +} + +// GetValidate returns the Validate field if it's non-nil, zero value otherwise. +func (s *SarifAnalysis) GetValidate() bool { + if s == nil || s.Validate == nil { + return false + } + return *s.Validate +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SarifID) GetID() string { + if s == nil || s.ID == nil { + return "" + } + return *s.ID } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *ReleaseAsset) GetURL() string { - if r == nil || r.URL == nil { +func (s *SarifID) GetURL() string { + if s == nil || s.URL == nil { return "" } - return *r.URL + return *s.URL } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *ReleaseEvent) GetAction() string { - if r == nil || r.Action == nil { +// GetAnalysesURL returns the AnalysesURL field if it's non-nil, zero value otherwise. +func (s *SARIFUpload) GetAnalysesURL() string { + if s == nil || s.AnalysesURL == nil { return "" } - return *r.Action + return *s.AnalysesURL } -// GetInstallation returns the Installation field. -func (r *ReleaseEvent) GetInstallation() *Installation { - if r == nil { - return nil +// GetProcessingStatus returns the ProcessingStatus field if it's non-nil, zero value otherwise. +func (s *SARIFUpload) GetProcessingStatus() string { + if s == nil || s.ProcessingStatus == nil { + return "" } - return r.Installation + return *s.ProcessingStatus } -// GetOrg returns the Org field. -func (r *ReleaseEvent) GetOrg() *Organization { - if r == nil { +// GetSBOM returns the SBOM field. +func (s *SBOM) GetSBOM() *SBOMInfo { + if s == nil { return nil } - return r.Org + return s.SBOM } -// GetRelease returns the Release field. -func (r *ReleaseEvent) GetRelease() *RepositoryRelease { - if r == nil { - return nil +// GetSBOMURL returns the SBOMURL field if it's non-nil, zero value otherwise. +func (s *SBOMGeneration) GetSBOMURL() string { + if s == nil || s.SBOMURL == nil { + return "" } - return r.Release + return *s.SBOMURL } -// GetRepo returns the Repo field. -func (r *ReleaseEvent) GetRepo() *Repository { - if r == nil { +// GetCreationInfo returns the CreationInfo field. +func (s *SBOMInfo) GetCreationInfo() *CreationInfo { + if s == nil { return nil } - return r.Repo + return s.CreationInfo } -// GetSender returns the Sender field. -func (r *ReleaseEvent) GetSender() *User { - if r == nil { +// GetDataLicense returns the DataLicense field if it's non-nil, zero value otherwise. +func (s *SBOMInfo) GetDataLicense() string { + if s == nil || s.DataLicense == nil { + return "" + } + return *s.DataLicense +} + +// GetDocumentDescribes returns the DocumentDescribes slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetDocumentDescribes() []string { + if s == nil || s.DocumentDescribes == nil { return nil } - return r.Sender + return s.DocumentDescribes } -// GetBuildDate returns the BuildDate field if it's non-nil, zero value otherwise. -func (r *ReleaseVersion) GetBuildDate() string { - if r == nil || r.BuildDate == nil { +// GetDocumentNamespace returns the DocumentNamespace field if it's non-nil, zero value otherwise. +func (s *SBOMInfo) GetDocumentNamespace() string { + if s == nil || s.DocumentNamespace == nil { return "" } - return *r.BuildDate + return *s.DocumentNamespace } -// GetBuildID returns the BuildID field if it's non-nil, zero value otherwise. -func (r *ReleaseVersion) GetBuildID() string { - if r == nil || r.BuildID == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (s *SBOMInfo) GetName() string { + if s == nil || s.Name == nil { return "" } - return *r.BuildID + return *s.Name } -// GetPlatform returns the Platform field if it's non-nil, zero value otherwise. -func (r *ReleaseVersion) GetPlatform() string { - if r == nil || r.Platform == nil { - return "" +// GetPackages returns the Packages slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetPackages() []*RepoDependencies { + if s == nil || s.Packages == nil { + return nil } - return *r.Platform + return s.Packages } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (r *ReleaseVersion) GetVersion() string { - if r == nil || r.Version == nil { - return "" +// GetRelationships returns the Relationships slice if it's non-nil, nil otherwise. +func (s *SBOMInfo) GetRelationships() []*SBOMRelationship { + if s == nil || s.Relationships == nil { + return nil } - return *r.Version + return s.Relationships } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (r *RemoveToken) GetExpiresAt() Timestamp { - if r == nil || r.ExpiresAt == nil { - return Timestamp{} +// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. +func (s *SBOMInfo) GetSPDXID() string { + if s == nil || s.SPDXID == nil { + return "" } - return *r.ExpiresAt + return *s.SPDXID } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (r *RemoveToken) GetToken() string { - if r == nil || r.Token == nil { +// GetSPDXVersion returns the SPDXVersion field if it's non-nil, zero value otherwise. +func (s *SBOMInfo) GetSPDXVersion() string { + if s == nil || s.SPDXVersion == nil { return "" } - return *r.Token + return *s.SPDXVersion } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *Rename) GetFrom() string { - if r == nil || r.From == nil { +// GetRelatedSPDXElement returns the RelatedSPDXElement field. +func (s *SBOMRelationship) GetRelatedSPDXElement() string { + if s == nil { return "" } - return *r.From + return s.RelatedSPDXElement } -// GetTo returns the To field if it's non-nil, zero value otherwise. -func (r *Rename) GetTo() string { - if r == nil || r.To == nil { +// GetRelationshipType returns the RelationshipType field. +func (s *SBOMRelationship) GetRelationshipType() string { + if s == nil { return "" } - return *r.To + return s.RelationshipType } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (r *RenameOrgResponse) GetMessage() string { - if r == nil || r.Message == nil { +// GetSPDXElementID returns the SPDXElementID field. +func (s *SBOMRelationship) GetSPDXElementID() string { + if s == nil { return "" } - return *r.Message + return s.SPDXElementID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RenameOrgResponse) GetURL() string { - if r == nil || r.URL == nil { +// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetAnalysisKey() string { + if s == nil || s.AnalysisKey == nil { return "" } - return *r.URL + return *s.AnalysisKey } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (r *RepoAdvisoryCredit) GetLogin() string { - if r == nil || r.Login == nil { +// GetCategory returns the Category field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetCategory() string { + if s == nil || s.Category == nil { return "" } - return *r.Login + return *s.Category } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepoAdvisoryCredit) GetType() string { - if r == nil || r.Type == nil { +// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetCommitSHA() string { + if s == nil || s.CommitSHA == nil { return "" } - return *r.Type + return *s.CommitSHA } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *RepoAdvisoryCreditDetailed) GetState() string { - if r == nil || r.State == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} } - return *r.State + return *s.CreatedAt } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepoAdvisoryCreditDetailed) GetType() string { - if r == nil || r.Type == nil { - return "" +// GetDeletable returns the Deletable field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetDeletable() bool { + if s == nil || s.Deletable == nil { + return false } - return *r.Type + return *s.Deletable } -// GetUser returns the User field. -func (r *RepoAdvisoryCreditDetailed) GetUser() *User { - if r == nil { - return nil +// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetEnvironment() string { + if s == nil || s.Environment == nil { + return "" } - return r.User + return *s.Environment } -// GetDownloadLocation returns the DownloadLocation field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetDownloadLocation() string { - if r == nil || r.DownloadLocation == nil { +// GetError returns the Error field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetError() string { + if s == nil || s.Error == nil { return "" } - return *r.DownloadLocation + return *s.Error } -// GetFilesAnalyzed returns the FilesAnalyzed field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetFilesAnalyzed() bool { - if r == nil || r.FilesAnalyzed == nil { - return false +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetID() int64 { + if s == nil || s.ID == nil { + return 0 } - return *r.FilesAnalyzed + return *s.ID } -// GetLicenseConcluded returns the LicenseConcluded field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetLicenseConcluded() string { - if r == nil || r.LicenseConcluded == nil { +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetRef() string { + if s == nil || s.Ref == nil { return "" } - return *r.LicenseConcluded + return *s.Ref } -// GetLicenseDeclared returns the LicenseDeclared field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetLicenseDeclared() string { - if r == nil || r.LicenseDeclared == nil { - return "" +// GetResultsCount returns the ResultsCount field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetResultsCount() int { + if s == nil || s.ResultsCount == nil { + return 0 } - return *r.LicenseDeclared + return *s.ResultsCount } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetName() string { - if r == nil || r.Name == nil { - return "" +// GetRulesCount returns the RulesCount field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetRulesCount() int { + if s == nil || s.RulesCount == nil { + return 0 } - return *r.Name + return *s.RulesCount } -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetSPDXID() string { - if r == nil || r.SPDXID == nil { +// GetSarifID returns the SarifID field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetSarifID() string { + if s == nil || s.SarifID == nil { return "" } - return *r.SPDXID + return *s.SarifID } -// GetVersionInfo returns the VersionInfo field if it's non-nil, zero value otherwise. -func (r *RepoDependencies) GetVersionInfo() string { - if r == nil || r.VersionInfo == nil { - return "" +// GetTool returns the Tool field. +func (s *ScanningAnalysis) GetTool() *Tool { + if s == nil { + return nil } - return *r.VersionInfo + return s.Tool } -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (r *RepoMergeUpstreamRequest) GetBranch() string { - if r == nil || r.Branch == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetURL() string { + if s == nil || s.URL == nil { return "" } - return *r.Branch + return *s.URL } -// GetBaseBranch returns the BaseBranch field if it's non-nil, zero value otherwise. -func (r *RepoMergeUpstreamResult) GetBaseBranch() string { - if r == nil || r.BaseBranch == nil { +// GetWarning returns the Warning field if it's non-nil, zero value otherwise. +func (s *ScanningAnalysis) GetWarning() string { + if s == nil || s.Warning == nil { return "" } - return *r.BaseBranch + return *s.Warning } -// GetMergeType returns the MergeType field if it's non-nil, zero value otherwise. -func (r *RepoMergeUpstreamResult) GetMergeType() string { - if r == nil || r.MergeType == nil { - return "" +// GetOperations returns the Operations slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseAttribute) GetOperations() []*SCIMEnterpriseAttributeOperation { + if s == nil || s.Operations == nil { + return nil } - return *r.MergeType + return s.Operations } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (r *RepoMergeUpstreamResult) GetMessage() string { - if r == nil || r.Message == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseAttribute) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.Message + return s.Schemas } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RepoName) GetFrom() string { - if r == nil || r.From == nil { +// GetOp returns the Op field. +func (s *SCIMEnterpriseAttributeOperation) GetOp() string { + if s == nil { return "" } - return *r.From + return s.Op } -// GetBadgeURL returns the BadgeURL field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetBadgeURL() string { - if r == nil || r.BadgeURL == nil { +// 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 *r.BadgeURL + return *s.Path } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetValue returns the Value field. +func (s *SCIMEnterpriseAttributeOperation) GetValue() any { + if s == nil { + return nil } - return *r.CreatedAt + return s.Value } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// 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 *r.HTMLURL + return *s.Display } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// 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 *r.ID + return *s.Ref } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetName() string { - if r == nil || r.Name == nil { +// GetValue returns the Value field. +func (s *SCIMEnterpriseDisplayReference) GetValue() string { + if s == nil { return "" } - return *r.Name + return s.Value } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetDisplayName returns the DisplayName field. +func (s *SCIMEnterpriseGroupAttributes) GetDisplayName() string { + if s == nil { return "" } - return *r.NodeID + return s.DisplayName } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetPath() string { - if r == nil || r.Path == nil { +// GetExternalID returns the ExternalID field. +func (s *SCIMEnterpriseGroupAttributes) GetExternalID() string { + if s == nil { return "" } - return *r.Path + return s.ExternalID } -// GetSourceRepository returns the SourceRepository field. -func (r *RepoRequiredWorkflow) GetSourceRepository() *Repository { - if r == nil { - return nil +// 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 r.SourceRepository + return *s.ID } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetState() string { - if r == nil || r.State == nil { - return "" +// GetMembers returns the Members slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetMembers() []*SCIMEnterpriseDisplayReference { + if s == nil || s.Members == nil { + return nil } - return *r.State + return s.Members } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseGroupAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil } - return *r.UpdatedAt + return s.Meta } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetURL() string { - if r == nil || r.URL == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.URL + return s.Schemas } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflows) GetTotalCount() int { - if r == nil || r.TotalCount == nil { +// 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 *r.TotalCount + return *s.ItemsPerPage } -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (r *RepositoriesSearchResult) GetIncompleteResults() bool { - if r == nil || r.IncompleteResults == nil { - return false +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroups) GetResources() []*SCIMEnterpriseGroupAttributes { + if s == nil || s.Resources == nil { + return nil } - return *r.IncompleteResults + return s.Resources } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (r *RepositoriesSearchResult) GetTotal() int { - if r == nil || r.Total == nil { - return 0 +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseGroups) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.Total + return s.Schemas } -// GetAllowAutoMerge returns the AllowAutoMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowAutoMerge() bool { - if r == nil || r.AllowAutoMerge == nil { - return false +// 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 *r.AllowAutoMerge + return *s.StartIndex } -// GetAllowForking returns the AllowForking field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowForking() bool { - if r == nil || r.AllowForking == nil { - return false +// 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 *r.AllowForking + return *s.TotalResults } -// GetAllowMergeCommit returns the AllowMergeCommit field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowMergeCommit() bool { - if r == nil || r.AllowMergeCommit == nil { - return false +// 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 *r.AllowMergeCommit + return *s.Created } -// GetAllowRebaseMerge returns the AllowRebaseMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowRebaseMerge() bool { - if r == nil || r.AllowRebaseMerge == nil { - return false +// 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 *r.AllowRebaseMerge + return *s.LastModified } -// GetAllowSquashMerge returns the AllowSquashMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowSquashMerge() bool { - if r == nil || r.AllowSquashMerge == nil { - return false +// 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 *r.AllowSquashMerge + return *s.Location } -// GetAllowUpdateBranch returns the AllowUpdateBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetAllowUpdateBranch() bool { - if r == nil || r.AllowUpdateBranch == nil { - return false +// GetResourceType returns the ResourceType field. +func (s *SCIMEnterpriseMeta) GetResourceType() string { + if s == nil { + return "" } - return *r.AllowUpdateBranch + return s.ResourceType } -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (r *Repository) GetArchived() bool { - if r == nil || r.Archived == nil { +// GetActive returns the Active field. +func (s *SCIMEnterpriseUserAttributes) GetActive() bool { + if s == nil { return false } - return *r.Archived + return s.Active } -// GetArchiveURL returns the ArchiveURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetArchiveURL() string { - if r == nil || r.ArchiveURL == nil { +// GetDisplayName returns the DisplayName field. +func (s *SCIMEnterpriseUserAttributes) GetDisplayName() string { + if s == nil { return "" } - return *r.ArchiveURL + return s.DisplayName } -// GetAssigneesURL returns the AssigneesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetAssigneesURL() string { - if r == nil || r.AssigneesURL == nil { - return "" +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetEmails() []*SCIMEnterpriseUserEmail { + if s == nil || s.Emails == nil { + return nil } - return *r.AssigneesURL + return s.Emails } -// GetAutoInit returns the AutoInit field if it's non-nil, zero value otherwise. -func (r *Repository) GetAutoInit() bool { - if r == nil || r.AutoInit == nil { - return false +// GetExternalID returns the ExternalID field. +func (s *SCIMEnterpriseUserAttributes) GetExternalID() string { + if s == nil { + return "" } - return *r.AutoInit + return s.ExternalID } -// GetBlobsURL returns the BlobsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetBlobsURL() string { - if r == nil || r.BlobsURL == nil { - return "" +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetGroups() []*SCIMEnterpriseDisplayReference { + if s == nil || s.Groups == nil { + return nil } - return *r.BlobsURL + return s.Groups } -// GetBranchesURL returns the BranchesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetBranchesURL() string { - if r == nil || r.BranchesURL == nil { +// 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 *r.BranchesURL + return *s.ID } -// GetCloneURL returns the CloneURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCloneURL() string { - if r == nil || r.CloneURL == nil { - return "" +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseUserAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil } - return *r.CloneURL + return s.Meta } -// GetCodeOfConduct returns the CodeOfConduct field. -func (r *Repository) GetCodeOfConduct() *CodeOfConduct { - if r == nil { +// GetName returns the Name field. +func (s *SCIMEnterpriseUserAttributes) GetName() *SCIMEnterpriseUserName { + if s == nil { return nil } - return r.CodeOfConduct + return s.Name } -// GetCollaboratorsURL returns the CollaboratorsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCollaboratorsURL() string { - if r == nil || r.CollaboratorsURL == nil { - return "" +// GetRoles returns the Roles slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetRoles() []*SCIMEnterpriseUserRole { + if s == nil || s.Roles == nil { + return nil } - return *r.CollaboratorsURL + return s.Roles } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCommentsURL() string { - if r == nil || r.CommentsURL == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUserAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.CommentsURL + return s.Schemas } -// GetCommitsURL returns the CommitsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCommitsURL() string { - if r == nil || r.CommitsURL == nil { +// GetUserName returns the UserName field. +func (s *SCIMEnterpriseUserAttributes) GetUserName() string { + if s == nil { return "" } - return *r.CommitsURL + return s.UserName } -// GetCompareURL returns the CompareURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetCompareURL() string { - if r == nil || r.CompareURL == nil { - return "" +// GetPrimary returns the Primary field. +func (s *SCIMEnterpriseUserEmail) GetPrimary() bool { + if s == nil { + return false } - return *r.CompareURL + return s.Primary } -// GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetContentsURL() string { - if r == nil || r.ContentsURL == nil { +// GetType returns the Type field. +func (s *SCIMEnterpriseUserEmail) GetType() string { + if s == nil { return "" } - return *r.ContentsURL + return s.Type } -// GetContributorsURL returns the ContributorsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetContributorsURL() string { - if r == nil || r.ContributorsURL == nil { +// GetValue returns the Value field. +func (s *SCIMEnterpriseUserEmail) GetValue() string { + if s == nil { return "" } - return *r.ContributorsURL + return s.Value } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetFamilyName returns the FamilyName field. +func (s *SCIMEnterpriseUserName) GetFamilyName() string { + if s == nil { + return "" } - return *r.CreatedAt + return s.FamilyName } -// GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetDefaultBranch() string { - if r == nil || r.DefaultBranch == nil { +// 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 *r.DefaultBranch + return *s.Formatted } -// GetDeleteBranchOnMerge returns the DeleteBranchOnMerge field if it's non-nil, zero value otherwise. -func (r *Repository) GetDeleteBranchOnMerge() bool { - if r == nil || r.DeleteBranchOnMerge == nil { - return false +// GetGivenName returns the GivenName field. +func (s *SCIMEnterpriseUserName) GetGivenName() string { + if s == nil { + return "" } - return *r.DeleteBranchOnMerge + return s.GivenName } -// GetDeploymentsURL returns the DeploymentsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetDeploymentsURL() string { - if r == nil || r.DeploymentsURL == nil { +// 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 *r.DeploymentsURL + return *s.MiddleName } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (r *Repository) GetDescription() string { - if r == nil || r.Description == nil { +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseUserRole) GetDisplay() string { + if s == nil || s.Display == nil { return "" } - return *r.Description + return *s.Display } -// GetDisabled returns the Disabled field if it's non-nil, zero value otherwise. -func (r *Repository) GetDisabled() bool { - if r == nil || r.Disabled == nil { +// 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 *r.Disabled + return *s.Primary } -// GetDownloadsURL returns the DownloadsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetDownloadsURL() string { - if r == nil || r.DownloadsURL == 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 *r.DownloadsURL + return *s.Type } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetEventsURL() string { - if r == nil || r.EventsURL == nil { +// GetValue returns the Value field. +func (s *SCIMEnterpriseUserRole) GetValue() string { + if s == nil { return "" } - return *r.EventsURL + return s.Value } -// GetFork returns the Fork field if it's non-nil, zero value otherwise. -func (r *Repository) GetFork() bool { - if r == nil || r.Fork == nil { - return false +// 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 *r.Fork + return *s.ItemsPerPage } -// GetForksCount returns the ForksCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetForksCount() int { - if r == nil || r.ForksCount == nil { - return 0 +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUsers) GetResources() []*SCIMEnterpriseUserAttributes { + if s == nil || s.Resources == nil { + return nil } - return *r.ForksCount + return s.Resources } -// GetForksURL returns the ForksURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetForksURL() string { - if r == nil || r.ForksURL == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMEnterpriseUsers) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.ForksURL + return s.Schemas } -// GetFullName returns the FullName field if it's non-nil, zero value otherwise. -func (r *Repository) GetFullName() string { - if r == nil || r.FullName == 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 *r.FullName + return *s.StartIndex } -// GetGitCommitsURL returns the GitCommitsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitCommitsURL() string { - if r == nil || r.GitCommitsURL == nil { - return "" +// 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 *r.GitCommitsURL + return *s.TotalResults } -// GetGitignoreTemplate returns the GitignoreTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitignoreTemplate() string { - if r == nil || r.GitignoreTemplate == nil { - return "" +// GetCreated returns the Created field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetCreated() Timestamp { + if s == nil || s.Created == nil { + return Timestamp{} } - return *r.GitignoreTemplate + return *s.Created } -// GetGitRefsURL returns the GitRefsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitRefsURL() string { - if r == nil || r.GitRefsURL == nil { - return "" +// GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetLastModified() Timestamp { + if s == nil || s.LastModified == nil { + return Timestamp{} } - return *r.GitRefsURL + return *s.LastModified } -// GetGitTagsURL returns the GitTagsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitTagsURL() string { - if r == nil || r.GitTagsURL == nil { +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetLocation() string { + if s == nil || s.Location == nil { return "" } - return *r.GitTagsURL + return *s.Location } -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetGitURL() string { - if r == nil || r.GitURL == nil { +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (s *SCIMMeta) GetResourceType() string { + if s == nil || s.ResourceType == nil { return "" } - return *r.GitURL + return *s.ResourceType } -// GetHasDiscussions returns the HasDiscussions field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasDiscussions() bool { - if r == nil || r.HasDiscussions == nil { - return false +// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. +func (s *SCIMProvisionedIdentities) GetItemsPerPage() int { + if s == nil || s.ItemsPerPage == nil { + return 0 } - return *r.HasDiscussions + return *s.ItemsPerPage } -// GetHasDownloads returns the HasDownloads field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasDownloads() bool { - if r == nil || r.HasDownloads == nil { - return false +// GetResources returns the Resources slice if it's non-nil, nil otherwise. +func (s *SCIMProvisionedIdentities) GetResources() []*SCIMUserAttributes { + if s == nil || s.Resources == nil { + return nil } - return *r.HasDownloads + return s.Resources } -// GetHasIssues returns the HasIssues field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasIssues() bool { - if r == nil || r.HasIssues == nil { - return false +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMProvisionedIdentities) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.HasIssues + return s.Schemas } -// GetHasPages returns the HasPages field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasPages() bool { - if r == nil || r.HasPages == nil { - return false +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (s *SCIMProvisionedIdentities) GetStartIndex() int { + if s == nil || s.StartIndex == nil { + return 0 } - return *r.HasPages + return *s.StartIndex } -// GetHasProjects returns the HasProjects field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasProjects() bool { - if r == nil || r.HasProjects == nil { - return false +// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. +func (s *SCIMProvisionedIdentities) GetTotalResults() int { + if s == nil || s.TotalResults == nil { + return 0 } - return *r.HasProjects + return *s.TotalResults } -// GetHasWiki returns the HasWiki field if it's non-nil, zero value otherwise. -func (r *Repository) GetHasWiki() bool { - if r == nil || r.HasWiki == nil { +// GetActive returns the Active field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetActive() bool { + if s == nil || s.Active == nil { return false } - return *r.HasWiki + return *s.Active } -// GetHomepage returns the Homepage field if it's non-nil, zero value otherwise. -func (r *Repository) GetHomepage() string { - if r == nil || r.Homepage == nil { +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetDisplayName() string { + if s == nil || s.DisplayName == nil { return "" } - return *r.Homepage + return *s.DisplayName } -// GetHooksURL returns the HooksURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetHooksURL() string { - if r == nil || r.HooksURL == nil { - return "" +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetEmails() []*SCIMUserEmail { + if s == nil || s.Emails == nil { + return nil } - return *r.HooksURL + return s.Emails } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetExternalID() string { + if s == nil || s.ExternalID == nil { return "" } - return *r.HTMLURL + return *s.ExternalID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Repository) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetGroups() []string { + if s == nil || s.Groups == nil { + return nil } - return *r.ID + return s.Groups } -// GetIssueCommentURL returns the IssueCommentURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssueCommentURL() string { - if r == nil || r.IssueCommentURL == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SCIMUserAttributes) GetID() string { + if s == nil || s.ID == nil { return "" } - return *r.IssueCommentURL + return *s.ID } -// GetIssueEventsURL returns the IssueEventsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssueEventsURL() string { - if r == nil || r.IssueEventsURL == nil { - return "" +// GetMeta returns the Meta field. +func (s *SCIMUserAttributes) GetMeta() *SCIMMeta { + if s == nil { + return nil } - return *r.IssueEventsURL + return s.Meta } -// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetIssuesURL() string { - if r == nil || r.IssuesURL == nil { - return "" +// GetName returns the Name field. +func (s *SCIMUserAttributes) GetName() SCIMUserName { + if s == nil { + return SCIMUserName{} } - return *r.IssuesURL + return s.Name } -// GetIsTemplate returns the IsTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetIsTemplate() bool { - if r == nil || r.IsTemplate == nil { - return false +// GetRoles returns the Roles slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetRoles() []*SCIMUserRole { + if s == nil || s.Roles == nil { + return nil } - return *r.IsTemplate + return s.Roles } -// GetKeysURL returns the KeysURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetKeysURL() string { - if r == nil || r.KeysURL == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (s *SCIMUserAttributes) GetSchemas() []string { + if s == nil || s.Schemas == nil { + return nil } - return *r.KeysURL + return s.Schemas } -// GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetLabelsURL() string { - if r == nil || r.LabelsURL == nil { +// GetUserName returns the UserName field. +func (s *SCIMUserAttributes) GetUserName() string { + if s == nil { return "" } - return *r.LabelsURL + return s.UserName } -// GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (r *Repository) GetLanguage() string { - if r == nil || r.Language == nil { - return "" +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMUserEmail) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false } - return *r.Language + return *s.Primary } -// GetLanguagesURL returns the LanguagesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetLanguagesURL() string { - if r == nil || r.LanguagesURL == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMUserEmail) GetType() string { + if s == nil || s.Type == nil { return "" } - return *r.LanguagesURL + return *s.Type } -// GetLicense returns the License field. -func (r *Repository) GetLicense() *License { - if r == nil { - return nil +// GetValue returns the Value field. +func (s *SCIMUserEmail) GetValue() string { + if s == nil { + return "" } - return r.License + return s.Value } -// GetLicenseTemplate returns the LicenseTemplate field if it's non-nil, zero value otherwise. -func (r *Repository) GetLicenseTemplate() string { - if r == nil || r.LicenseTemplate == nil { +// GetFamilyName returns the FamilyName field. +func (s *SCIMUserName) GetFamilyName() string { + if s == nil { return "" } - return *r.LicenseTemplate + return s.FamilyName } -// GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise. -func (r *Repository) GetMasterBranch() string { - if r == nil || r.MasterBranch == nil { +// GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. +func (s *SCIMUserName) GetFormatted() string { + if s == nil || s.Formatted == nil { return "" } - return *r.MasterBranch + return *s.Formatted } -// GetMergeCommitMessage returns the MergeCommitMessage field if it's non-nil, zero value otherwise. -func (r *Repository) GetMergeCommitMessage() string { - if r == nil || r.MergeCommitMessage == nil { +// GetGivenName returns the GivenName field. +func (s *SCIMUserName) GetGivenName() string { + if s == nil { return "" } - return *r.MergeCommitMessage + return s.GivenName } -// GetMergeCommitTitle returns the MergeCommitTitle field if it's non-nil, zero value otherwise. -func (r *Repository) GetMergeCommitTitle() string { - if r == nil || r.MergeCommitTitle == nil { +// 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 *r.MergeCommitTitle + return *s.Display } -// GetMergesURL returns the MergesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMergesURL() string { - if r == nil || r.MergesURL == nil { - return "" +// 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 *r.MergesURL + return *s.Primary } -// GetMilestonesURL returns the MilestonesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMilestonesURL() string { - if r == nil || r.MilestonesURL == nil { +// 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 *r.MilestonesURL + return *s.Type } -// GetMirrorURL returns the MirrorURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetMirrorURL() string { - if r == nil || r.MirrorURL == nil { +// GetValue returns the Value field. +func (s *SCIMUserRole) GetValue() string { + if s == nil { return "" } - return *r.MirrorURL + return s.Value } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *Repository) GetName() string { - if r == nil || r.Name == nil { - return "" +// 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 *r.Name + return *s.AdvancedSearch } -// GetNetworkCount returns the NetworkCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetNetworkCount() int { - if r == nil || r.NetworkCount == nil { - return 0 +// GetOrder returns the Order field. +func (s *SearchOptions) GetOrder() string { + if s == nil { + return "" } - return *r.NetworkCount + return s.Order } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Repository) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetSearchType returns the SearchType field. +func (s *SearchOptions) GetSearchType() string { + if s == nil { return "" } - return *r.NodeID + return s.SearchType } -// GetNotificationsURL returns the NotificationsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetNotificationsURL() string { - if r == nil || r.NotificationsURL == nil { +// GetSort returns the Sort field. +func (s *SearchOptions) GetSort() string { + if s == nil { return "" } - return *r.NotificationsURL + return s.Sort } -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (r *Repository) GetOpenIssues() int { - if r == nil || r.OpenIssues == nil { +// GetTextMatch returns the TextMatch field. +func (s *SearchOptions) GetTextMatch() bool { + if s == nil { + return false + } + return s.TextMatch +} + +// GetSeatsCreated returns the SeatsCreated field. +func (s *SeatAssignments) GetSeatsCreated() int { + if s == nil { return 0 } - return *r.OpenIssues + return s.SeatsCreated } -// GetOpenIssuesCount returns the OpenIssuesCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetOpenIssuesCount() int { - if r == nil || r.OpenIssuesCount == nil { +// GetSeatsCancelled returns the SeatsCancelled field. +func (s *SeatCancellations) GetSeatsCancelled() int { + if s == nil { return 0 } - return *r.OpenIssuesCount + return s.SeatsCancelled } -// GetOrganization returns the Organization field. -func (r *Repository) GetOrganization() *Organization { - if r == nil { - return nil +// GetCreatedAt returns the CreatedAt field. +func (s *Secret) GetCreatedAt() Timestamp { + if s == nil { + return Timestamp{} } - return r.Organization + return s.CreatedAt } -// GetOwner returns the Owner field. -func (r *Repository) GetOwner() *User { - if r == nil { - return nil +// GetName returns the Name field. +func (s *Secret) GetName() string { + if s == nil { + return "" } - return r.Owner + return s.Name } -// GetParent returns the Parent field. -func (r *Repository) GetParent() *Repository { - if r == nil { - return nil +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field. +func (s *Secret) GetSelectedRepositoriesURL() string { + if s == nil { + return "" } - return r.Parent + return s.SelectedRepositoriesURL } -// 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{} +// GetUpdatedAt returns the UpdatedAt field. +func (s *Secret) GetUpdatedAt() Timestamp { + if s == nil { + return Timestamp{} } - return r.Permissions + return s.UpdatedAt } -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (r *Repository) GetPrivate() bool { - if r == nil || r.Private == nil { - return false +// GetVisibility returns the Visibility field. +func (s *Secret) GetVisibility() string { + if s == nil { + return "" } - return *r.Private + return s.Visibility } -// GetPullsURL returns the PullsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetPullsURL() string { - if r == nil || r.PullsURL == nil { +// GetEncryptedValue returns the EncryptedValue field. +func (s *SecretOrgRequest) GetEncryptedValue() string { + if s == nil { return "" } - return *r.PullsURL + return s.EncryptedValue } -// GetPushedAt returns the PushedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetPushedAt() Timestamp { - if r == nil || r.PushedAt == nil { - return Timestamp{} +// GetKeyID returns the KeyID field. +func (s *SecretOrgRequest) GetKeyID() string { + if s == nil { + return "" } - return *r.PushedAt + return s.KeyID } -// GetReleasesURL returns the ReleasesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetReleasesURL() string { - if r == nil || r.ReleasesURL == nil { +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (s *SecretOrgRequest) GetSelectedRepositoryIDs() []int64 { + if s == nil || s.SelectedRepositoryIDs == nil { + return nil + } + return s.SelectedRepositoryIDs +} + +// GetVisibility returns the Visibility field. +func (s *SecretOrgRequest) GetVisibility() string { + if s == nil { return "" } - return *r.ReleasesURL + return s.Visibility } -// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. -func (r *Repository) GetRoleName() string { - if r == nil || r.RoleName == nil { +// GetEncryptedValue returns the EncryptedValue field. +func (s *SecretRequest) GetEncryptedValue() string { + if s == nil { return "" } - return *r.RoleName + return s.EncryptedValue } -// GetSecurityAndAnalysis returns the SecurityAndAnalysis field. -func (r *Repository) GetSecurityAndAnalysis() *SecurityAndAnalysis { - if r == nil { +// GetKeyID returns the KeyID field. +func (s *SecretRequest) GetKeyID() string { + if s == nil { + return "" + } + return s.KeyID +} + +// GetSecrets returns the Secrets slice if it's non-nil, nil otherwise. +func (s *Secrets) GetSecrets() []*Secret { + if s == nil || s.Secrets == nil { return nil } - return r.SecurityAndAnalysis + return s.Secrets } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *Repository) GetSize() int { - if r == nil || r.Size == nil { +// GetTotalCount returns the TotalCount field. +func (s *Secrets) GetTotalCount() int { + if s == nil { return 0 } - return *r.Size + return s.TotalCount } -// GetSource returns the Source field. -func (r *Repository) GetSource() *Repository { - if r == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SecretScanning) GetStatus() string { + if s == nil || s.Status == nil { + return "" + } + return *s.Status +} + +// GetAssignedTo returns the AssignedTo field. +func (s *SecretScanningAlert) GetAssignedTo() *User { + if s == nil { return nil } - return r.Source + return s.AssignedTo } -// GetSquashMergeCommitMessage returns the SquashMergeCommitMessage field if it's non-nil, zero value otherwise. -func (r *Repository) GetSquashMergeCommitMessage() string { - if r == nil || r.SquashMergeCommitMessage == nil { +// GetClosureRequestComment returns the ClosureRequestComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetClosureRequestComment() string { + if s == nil || s.ClosureRequestComment == nil { return "" } - return *r.SquashMergeCommitMessage + return *s.ClosureRequestComment } -// GetSquashMergeCommitTitle returns the SquashMergeCommitTitle field if it's non-nil, zero value otherwise. -func (r *Repository) GetSquashMergeCommitTitle() string { - if r == nil || r.SquashMergeCommitTitle == nil { - return "" +// GetClosureRequestReviewer returns the ClosureRequestReviewer field. +func (s *SecretScanningAlert) GetClosureRequestReviewer() *User { + if s == nil { + return nil } - return *r.SquashMergeCommitTitle + return s.ClosureRequestReviewer } -// GetSSHURL returns the SSHURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSSHURL() string { - if r == nil || r.SSHURL == nil { +// GetClosureRequestReviewerComment returns the ClosureRequestReviewerComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetClosureRequestReviewerComment() string { + if s == nil || s.ClosureRequestReviewerComment == nil { return "" } - return *r.SSHURL + return *s.ClosureRequestReviewerComment } -// GetStargazersCount returns the StargazersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetStargazersCount() int { - if r == nil || r.StargazersCount == nil { - return 0 +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} } - return *r.StargazersCount + return *s.CreatedAt } -// GetStargazersURL returns the StargazersURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetStargazersURL() string { - if r == nil || r.StargazersURL == nil { - return "" +// GetFirstLocationDetected returns the FirstLocationDetected field. +func (s *SecretScanningAlert) GetFirstLocationDetected() *SecretScanningAlertLocationDetails { + if s == nil { + return nil } - return *r.StargazersURL + return s.FirstLocationDetected } -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetStatusesURL() string { - if r == nil || r.StatusesURL == nil { - return "" +// GetHasMoreLocations returns the HasMoreLocations field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetHasMoreLocations() bool { + if s == nil || s.HasMoreLocations == nil { + return false } - return *r.StatusesURL + return *s.HasMoreLocations } -// GetSubscribersCount returns the SubscribersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscribersCount() int { - if r == nil || r.SubscribersCount == nil { - return 0 +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetHTMLURL() string { + if s == nil || s.HTMLURL == nil { + return "" } - return *r.SubscribersCount + return *s.HTMLURL } -// GetSubscribersURL returns the SubscribersURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscribersURL() string { - if r == nil || r.SubscribersURL == nil { - return "" +// GetIsBase64Encoded returns the IsBase64Encoded field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetIsBase64Encoded() bool { + if s == nil || s.IsBase64Encoded == nil { + return false } - return *r.SubscribersURL + return *s.IsBase64Encoded } -// GetSubscriptionURL returns the SubscriptionURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSubscriptionURL() string { - if r == nil || r.SubscriptionURL == nil { +// GetLocationsURL returns the LocationsURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetLocationsURL() string { + if s == nil || s.LocationsURL == nil { return "" } - return *r.SubscriptionURL + return *s.LocationsURL } -// GetSVNURL returns the SVNURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetSVNURL() string { - if r == nil || r.SVNURL == nil { - return "" +// GetMetadata returns the Metadata slice if it's non-nil, nil otherwise. +func (s *SecretScanningAlert) GetMetadata() []*SecretScanningAlertMetadata { + if s == nil || s.Metadata == nil { + return nil } - return *r.SVNURL + return s.Metadata } -// GetTagsURL returns the TagsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTagsURL() string { - if r == nil || r.TagsURL == nil { - return "" +// GetMultiRepo returns the MultiRepo field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetMultiRepo() bool { + if s == nil || s.MultiRepo == nil { + return false } - return *r.TagsURL + return *s.MultiRepo } -// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. -func (r *Repository) GetTeamID() int64 { - if r == nil || r.TeamID == nil { +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetNumber() int { + if s == nil || s.Number == nil { return 0 } - return *r.TeamID + return *s.Number } -// GetTeamsURL returns the TeamsURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTeamsURL() string { - if r == nil || r.TeamsURL == nil { +// GetProvider returns the Provider field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetProvider() string { + if s == nil || s.Provider == nil { return "" } - return *r.TeamsURL + return *s.Provider } -// GetTemplateRepository returns the TemplateRepository field. -func (r *Repository) GetTemplateRepository() *Repository { - if r == nil { - return nil +// GetProviderSlug returns the ProviderSlug field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetProviderSlug() string { + if s == nil || s.ProviderSlug == nil { + return "" } - return r.TemplateRepository + return *s.ProviderSlug } -// GetTreesURL returns the TreesURL field if it's non-nil, zero value otherwise. -func (r *Repository) GetTreesURL() string { - if r == nil || r.TreesURL == nil { - return "" +// GetPubliclyLeaked returns the PubliclyLeaked field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPubliclyLeaked() bool { + if s == nil || s.PubliclyLeaked == nil { + return false } - return *r.TreesURL + return *s.PubliclyLeaked } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *Repository) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { +// GetPushProtectionBypassed returns the PushProtectionBypassed field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassed() bool { + if s == nil || s.PushProtectionBypassed == nil { + return false + } + return *s.PushProtectionBypassed +} + +// GetPushProtectionBypassedAt returns the PushProtectionBypassedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassedAt() Timestamp { + if s == nil || s.PushProtectionBypassedAt == nil { return Timestamp{} } - return *r.UpdatedAt + return *s.PushProtectionBypassedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *Repository) GetURL() string { - if r == nil || r.URL == nil { - return "" +// GetPushProtectionBypassedBy returns the PushProtectionBypassedBy field. +func (s *SecretScanningAlert) GetPushProtectionBypassedBy() *User { + if s == nil { + return nil } - return *r.URL + return s.PushProtectionBypassedBy } -// GetUseSquashPRTitleAsDefault returns the UseSquashPRTitleAsDefault field if it's non-nil, zero value otherwise. -func (r *Repository) GetUseSquashPRTitleAsDefault() bool { - if r == nil || r.UseSquashPRTitleAsDefault == nil { - return false +// GetPushProtectionBypassRequestComment returns the PushProtectionBypassRequestComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassRequestComment() string { + if s == nil || s.PushProtectionBypassRequestComment == nil { + return "" } - return *r.UseSquashPRTitleAsDefault + return *s.PushProtectionBypassRequestComment } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (r *Repository) GetVisibility() string { - if r == nil || r.Visibility == nil { +// GetPushProtectionBypassRequestHTMLURL returns the PushProtectionBypassRequestHTMLURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassRequestHTMLURL() string { + if s == nil || s.PushProtectionBypassRequestHTMLURL == nil { return "" } - return *r.Visibility + return *s.PushProtectionBypassRequestHTMLURL } -// GetWatchers returns the Watchers field if it's non-nil, zero value otherwise. -func (r *Repository) GetWatchers() int { - if r == nil || r.Watchers == nil { - return 0 +// GetPushProtectionBypassRequestReviewer returns the PushProtectionBypassRequestReviewer field. +func (s *SecretScanningAlert) GetPushProtectionBypassRequestReviewer() *User { + if s == nil { + return nil } - return *r.Watchers + return s.PushProtectionBypassRequestReviewer } -// GetWatchersCount returns the WatchersCount field if it's non-nil, zero value otherwise. -func (r *Repository) GetWatchersCount() int { - if r == nil || r.WatchersCount == nil { - return 0 +// GetPushProtectionBypassRequestReviewerComment returns the PushProtectionBypassRequestReviewerComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassRequestReviewerComment() string { + if s == nil || s.PushProtectionBypassRequestReviewerComment == nil { + return "" } - return *r.WatchersCount + return *s.PushProtectionBypassRequestReviewerComment } -// GetWebCommitSignoffRequired returns the WebCommitSignoffRequired field if it's non-nil, zero value otherwise. -func (r *Repository) GetWebCommitSignoffRequired() bool { - if r == nil || r.WebCommitSignoffRequired == nil { - return false +// GetRepository returns the Repository field. +func (s *SecretScanningAlert) GetRepository() *Repository { + if s == nil { + return nil } - return *r.WebCommitSignoffRequired + return s.Repository } -// GetAccessLevel returns the AccessLevel field if it's non-nil, zero value otherwise. -func (r *RepositoryActionsAccessLevel) GetAccessLevel() string { - if r == nil || r.AccessLevel == nil { +// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetResolution() string { + if s == nil || s.Resolution == nil { return "" } - return *r.AccessLevel + return *s.Resolution } -// 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 +// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetResolutionComment() string { + if s == nil || s.ResolutionComment == nil { + return "" } - return *r.AdvancedSecurityCommitters + return *s.ResolutionComment } -// 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 "" +// GetResolvedAt returns the ResolvedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetResolvedAt() Timestamp { + if s == nil || s.ResolvedAt == nil { + return Timestamp{} } - return *r.Name + return *s.ResolvedAt } -// GetConfiguration returns the Configuration field. -func (r *RepositoryCodeSecurityConfiguration) GetConfiguration() *CodeSecurityConfiguration { - if r == nil { +// GetResolvedBy returns the ResolvedBy field. +func (s *SecretScanningAlert) GetResolvedBy() *User { + if s == nil { return nil } - return r.Configuration + return s.ResolvedBy } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *RepositoryCodeSecurityConfiguration) GetState() string { - if r == nil || r.State == nil { +// GetSecret returns the Secret field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetSecret() string { + if s == nil || s.Secret == nil { return "" } - return *r.State + return *s.Secret } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetBody() string { - if r == nil || r.Body == nil { +// GetSecretType returns the SecretType field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetSecretType() string { + if s == nil || s.SecretType == nil { return "" } - return *r.Body + return *s.SecretType } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetCommitID() string { - if r == nil || r.CommitID == nil { +// GetSecretTypeDisplayName returns the SecretTypeDisplayName field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetSecretTypeDisplayName() string { + if s == nil || s.SecretTypeDisplayName == nil { return "" } - return *r.CommitID + return *s.SecretTypeDisplayName } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetState returns the State field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetState() string { + if s == nil || s.State == nil { + return "" } - return *r.CreatedAt + return *s.State } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { + return Timestamp{} } - return *r.HTMLURL + return *s.UpdatedAt } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetURL() string { + if s == nil || s.URL == nil { + return "" } - return *r.ID + return *s.URL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetValidity returns the Validity field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetValidity() string { + if s == nil || s.Validity == nil { return "" } - return *r.NodeID + return *s.Validity } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetPath() string { - if r == nil || r.Path == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertEvent) GetAction() string { + if s == nil || s.Action == nil { return "" } - return *r.Path + return *s.Action } -// GetPosition returns the Position field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetPosition() int { - if r == nil || r.Position == nil { - return 0 +// GetAlert returns the Alert field. +func (s *SecretScanningAlertEvent) GetAlert() *SecretScanningAlert { + if s == nil { + return nil } - return *r.Position + return s.Alert } -// GetReactions returns the Reactions field. -func (r *RepositoryComment) GetReactions() *Reactions { - if r == nil { +// GetEnterprise returns the Enterprise field. +func (s *SecretScanningAlertEvent) GetEnterprise() *Enterprise { + if s == nil { return nil } - return r.Reactions + return s.Enterprise } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} +// GetInstallation returns the Installation field. +func (s *SecretScanningAlertEvent) GetInstallation() *Installation { + if s == nil { + return nil } - return *r.UpdatedAt + return s.Installation } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryComment) GetURL() string { - if r == nil || r.URL == nil { - return "" +// GetOrganization returns the Organization field. +func (s *SecretScanningAlertEvent) GetOrganization() *Organization { + if s == nil { + return nil } - return *r.URL + return s.Organization } -// GetUser returns the User field. -func (r *RepositoryComment) GetUser() *User { - if r == nil { +// GetRepo returns the Repo field. +func (s *SecretScanningAlertEvent) GetRepo() *Repository { + if s == nil { return nil } - return r.User + return s.Repo } -// GetAuthor returns the Author field. -func (r *RepositoryCommit) GetAuthor() *User { - if r == nil { +// GetSender returns the Sender field. +func (s *SecretScanningAlertEvent) GetSender() *User { + if s == nil { return nil } - return r.Author + return s.Sender } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetCommentsURL() string { - if r == nil || r.CommentsURL == nil { +// GetDirection returns the Direction field. +func (s *SecretScanningAlertListOptions) GetDirection() string { + if s == nil { return "" } - return *r.CommentsURL + return s.Direction } -// GetCommit returns the Commit field. -func (r *RepositoryCommit) GetCommit() *Commit { - if r == nil { - return nil +// GetIsMultiRepo returns the IsMultiRepo field. +func (s *SecretScanningAlertListOptions) GetIsMultiRepo() bool { + if s == nil { + return false } - return r.Commit + return s.IsMultiRepo } -// GetCommitter returns the Committer field. -func (r *RepositoryCommit) GetCommitter() *User { - if r == nil { - return nil +// GetIsPubliclyLeaked returns the IsPubliclyLeaked field. +func (s *SecretScanningAlertListOptions) GetIsPubliclyLeaked() bool { + if s == nil { + return false } - return r.Committer + return s.IsPubliclyLeaked } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetResolution returns the Resolution field. +func (s *SecretScanningAlertListOptions) GetResolution() string { + if s == nil { return "" } - return *r.HTMLURL + return s.Resolution } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetSecretType returns the SecretType field. +func (s *SecretScanningAlertListOptions) GetSecretType() string { + if s == nil { return "" } - return *r.NodeID + return s.SecretType } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetSHA() string { - if r == nil || r.SHA == nil { +// GetSort returns the Sort field. +func (s *SecretScanningAlertListOptions) GetSort() string { + if s == nil { return "" } - return *r.SHA + return s.Sort } -// GetStats returns the Stats field. -func (r *RepositoryCommit) GetStats() *CommitStats { - if r == nil { - return nil +// GetState returns the State field. +func (s *SecretScanningAlertListOptions) GetState() string { + if s == nil { + return "" } - return r.Stats + return s.State } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryCommit) GetURL() string { - if r == nil || r.URL == nil { +// GetValidity returns the Validity field. +func (s *SecretScanningAlertListOptions) GetValidity() string { + if s == nil { return "" } - return *r.URL + return s.Validity } -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetDownloadURL() string { - if r == nil || r.DownloadURL == nil { - return "" +// GetDetails returns the Details field. +func (s *SecretScanningAlertLocation) GetDetails() *SecretScanningAlertLocationDetails { + if s == nil { + return nil } - return *r.DownloadURL + return s.Details } -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetEncoding() string { - if r == nil || r.Encoding == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocation) GetType() string { + if s == nil || s.Type == nil { return "" } - return *r.Encoding + return *s.Type } -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetGitURL() string { - if r == nil || r.GitURL == nil { +// GetBlobSHA returns the BlobSHA field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetBlobSHA() string { + if s == nil || s.BlobSHA == nil { return "" } - return *r.GitURL + return *s.BlobSHA } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetBlobURL() string { + if s == nil || s.BlobURL == nil { return "" } - return *r.HTMLURL + return *s.BlobURL } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetName() string { - if r == nil || r.Name == nil { +// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetCommitSHA() string { + if s == nil || s.CommitSHA == nil { return "" } - return *r.Name + return *s.CommitSHA } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetPath() string { - if r == nil || r.Path == nil { +// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetCommitURL() string { + if s == nil || s.CommitURL == nil { return "" } - return *r.Path + return *s.CommitURL } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetSHA() string { - if r == nil || r.SHA == nil { - return "" +// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetEndColumn() int { + if s == nil || s.EndColumn == nil { + return 0 } - return *r.SHA + return *s.EndColumn } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetSize() int { - if r == nil || r.Size == nil { +// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetEndLine() int { + if s == nil || s.EndLine == nil { return 0 } - return *r.Size + return *s.EndLine } -// GetSubmoduleGitURL returns the SubmoduleGitURL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetSubmoduleGitURL() string { - if r == nil || r.SubmoduleGitURL == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetPath() string { + if s == nil || s.Path == nil { return "" } - return *r.SubmoduleGitURL + return *s.Path } -// GetTarget returns the Target field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetTarget() string { - if r == nil || r.Target == nil { +// GetPullRequestCommentURL returns the PullRequestCommentURL field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetPullRequestCommentURL() string { + if s == nil || s.PullRequestCommentURL == nil { return "" } - return *r.Target + return *s.PullRequestCommentURL } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetType() string { - if r == nil || r.Type == nil { - return "" +// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetStartColumn() int { + if s == nil || s.StartColumn == nil { + return 0 } - return *r.Type + return *s.StartColumn } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryContent) GetURL() string { - if r == nil || r.URL == nil { +// GetStartline returns the Startline field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationDetails) GetStartline() int { + if s == nil || s.Startline == nil { + return 0 + } + return *s.Startline +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertLocationEvent) GetAction() string { + if s == nil || s.Action == nil { return "" } - return *r.URL + return *s.Action } -// GetAuthor returns the Author field. -func (r *RepositoryContentFileOptions) GetAuthor() *CommitAuthor { - if r == nil { +// GetAlert returns the Alert field. +func (s *SecretScanningAlertLocationEvent) GetAlert() *SecretScanningAlert { + if s == nil { return nil } - return r.Author + return s.Alert } -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetBranch() string { - if r == nil || r.Branch == nil { - return "" +// GetInstallation returns the Installation field. +func (s *SecretScanningAlertLocationEvent) GetInstallation() *Installation { + if s == nil { + return nil } - return *r.Branch + return s.Installation } -// GetCommitter returns the Committer field. -func (r *RepositoryContentFileOptions) GetCommitter() *CommitAuthor { - if r == nil { +// GetLocation returns the Location field. +func (s *SecretScanningAlertLocationEvent) GetLocation() *SecretScanningAlertLocation { + if s == nil { return nil } - return r.Committer + return s.Location } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetMessage() string { - if r == nil || r.Message == nil { - return "" +// GetOrganization returns the Organization field. +func (s *SecretScanningAlertLocationEvent) GetOrganization() *Organization { + if s == nil { + return nil } - return *r.Message + return s.Organization } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryContentFileOptions) GetSHA() string { - if r == nil || r.SHA == nil { - return "" +// GetRepo returns the Repo field. +func (s *SecretScanningAlertLocationEvent) GetRepo() *Repository { + if s == nil { + return nil } - return *r.SHA + return s.Repo } -// GetContent returns the Content field. -func (r *RepositoryContentResponse) GetContent() *RepositoryContent { - if r == nil { +// GetSender returns the Sender field. +func (s *SecretScanningAlertLocationEvent) GetSender() *User { + if s == nil { return nil } - return r.Content + return s.Sender } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryDispatchEvent) GetAction() string { - if r == nil || r.Action == nil { +// GetKey returns the Key field. +func (s *SecretScanningAlertMetadata) GetKey() string { + if s == nil { return "" } - return *r.Action + return s.Key } -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (r *RepositoryDispatchEvent) GetBranch() string { - if r == nil || r.Branch == nil { +// GetValue returns the Value field. +func (s *SecretScanningAlertMetadata) GetValue() string { + if s == nil { return "" } - return *r.Branch + return s.Value } -// GetInstallation returns the Installation field. -func (r *RepositoryDispatchEvent) GetInstallation() *Installation { - if r == nil { +// GetPatterns returns the Patterns slice if it's non-nil, nil otherwise. +func (s *SecretScanningCreateCustomPatternsRequest) GetPatterns() []*SecretScanningCustomPatternRequest { + if s == nil || s.Patterns == nil { return nil } - return r.Installation + return s.Patterns } -// GetOrg returns the Org field. -func (r *RepositoryDispatchEvent) GetOrg() *Organization { - if r == nil { +// GetCreatedPatterns returns the CreatedPatterns slice if it's non-nil, nil otherwise. +func (s *SecretScanningCreateCustomPatternsResponse) GetCreatedPatterns() []*SecretScanningCustomPattern { + if s == nil || s.CreatedPatterns == nil { return nil } - return r.Org + return s.CreatedPatterns } -// GetRepo returns the Repo field. -func (r *RepositoryDispatchEvent) GetRepo() *Repository { - if r == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPattern) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} } - return r.Repo + return *s.CreatedAt } -// GetSender returns the Sender field. -func (r *RepositoryDispatchEvent) GetSender() *User { - if r == nil { - return nil +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPattern) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { + return "" } - return r.Sender + return *s.CustomPatternVersion } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryEvent) GetAction() string { - if r == nil || r.Action == nil { +// GetEndDelimiter returns the EndDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPattern) GetEndDelimiter() string { + if s == nil || s.EndDelimiter == nil { return "" } - return *r.Action + return *s.EndDelimiter } -// GetChanges returns the Changes field. -func (r *RepositoryEvent) GetChanges() *EditChange { - if r == nil { - return nil +// GetID returns the ID field. +func (s *SecretScanningCustomPattern) GetID() int64 { + if s == nil { + return 0 } - return r.Changes + return s.ID } -// GetInstallation returns the Installation field. -func (r *RepositoryEvent) GetInstallation() *Installation { - if r == nil { +// GetMustMatch returns the MustMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningCustomPattern) GetMustMatch() []string { + if s == nil || s.MustMatch == nil { return nil } - return r.Installation + return s.MustMatch } -// GetOrg returns the Org field. -func (r *RepositoryEvent) GetOrg() *Organization { - if r == nil { +// GetMustNotMatch returns the MustNotMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningCustomPattern) GetMustNotMatch() []string { + if s == nil || s.MustNotMatch == nil { return nil } - return r.Org + return s.MustNotMatch } -// GetRepo returns the Repo field. -func (r *RepositoryEvent) GetRepo() *Repository { - if r == nil { - return nil +// GetName returns the Name field. +func (s *SecretScanningCustomPattern) GetName() string { + if s == nil { + return "" } - return r.Repo + return s.Name } -// GetSender returns the Sender field. -func (r *RepositoryEvent) GetSender() *User { - if r == nil { - return nil +// GetPattern returns the Pattern field. +func (s *SecretScanningCustomPattern) GetPattern() string { + if s == nil { + return "" } - return r.Sender + return s.Pattern } -// GetOrg returns the Org field. -func (r *RepositoryImportEvent) GetOrg() *Organization { - if r == nil { - return nil +// GetPushProtectionEnabled returns the PushProtectionEnabled field. +func (s *SecretScanningCustomPattern) GetPushProtectionEnabled() bool { + if s == nil { + return false } - return r.Org + return s.PushProtectionEnabled } -// GetRepo returns the Repo field. -func (r *RepositoryImportEvent) GetRepo() *Repository { - if r == nil { - return nil +// GetSlug returns the Slug field. +func (s *SecretScanningCustomPattern) GetSlug() string { + if s == nil { + return "" } - return r.Repo + return s.Slug } -// GetSender returns the Sender field. -func (r *RepositoryImportEvent) GetSender() *User { - if r == nil { - return nil +// GetStartDelimiter returns the StartDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPattern) GetStartDelimiter() string { + if s == nil || s.StartDelimiter == nil { + return "" } - return r.Sender + return *s.StartDelimiter } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (r *RepositoryImportEvent) GetStatus() string { - if r == nil || r.Status == nil { +// GetState returns the State field. +func (s *SecretScanningCustomPattern) GetState() string { + if s == nil { return "" } - return *r.Status + return s.State } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPattern) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { return Timestamp{} } - return *r.CreatedAt + return *s.UpdatedAt } -// GetExpired returns the Expired field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetExpired() bool { - if r == nil || r.Expired == nil { - return false +// GetDirection returns the Direction field. +func (s *SecretScanningCustomPatternListOptions) GetDirection() string { + if s == nil { + return "" } - return *r.Expired + return s.Direction } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetPushProtection returns the PushProtection field. +func (s *SecretScanningCustomPatternListOptions) GetPushProtection() string { + if s == nil { return "" } - return *r.HTMLURL + return s.PushProtection } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetSort returns the Sort field. +func (s *SecretScanningCustomPatternListOptions) GetSort() string { + if s == nil { + return "" } - return *r.ID + return s.Sort } -// GetInvitee returns the Invitee field. -func (r *RepositoryInvitation) GetInvitee() *User { - if r == nil { +// GetState returns the State field. +func (s *SecretScanningCustomPatternListOptions) GetState() string { + if s == nil { + return "" + } + return s.State +} + +// GetEndDelimiter returns the EndDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPatternRequest) GetEndDelimiter() string { + if s == nil || s.EndDelimiter == nil { + return "" + } + return *s.EndDelimiter +} + +// GetMustMatch returns the MustMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningCustomPatternRequest) GetMustMatch() []string { + if s == nil || s.MustMatch == nil { return nil } - return r.Invitee + return s.MustMatch } -// GetInviter returns the Inviter field. -func (r *RepositoryInvitation) GetInviter() *User { - if r == nil { +// GetMustNotMatch returns the MustNotMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningCustomPatternRequest) GetMustNotMatch() []string { + if s == nil || s.MustNotMatch == nil { return nil } - return r.Inviter + return s.MustNotMatch } -// GetPermissions returns the Permissions field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetPermissions() string { - if r == nil || r.Permissions == nil { +// GetName returns the Name field. +func (s *SecretScanningCustomPatternRequest) GetName() string { + if s == nil { return "" } - return *r.Permissions + return s.Name } -// GetRepo returns the Repo field. -func (r *RepositoryInvitation) GetRepo() *Repository { - if r == nil { - return nil +// GetPattern returns the Pattern field. +func (s *SecretScanningCustomPatternRequest) GetPattern() string { + if s == nil { + return "" } - return r.Repo + return s.Pattern } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryInvitation) GetURL() string { - if r == nil || r.URL == nil { +// GetStartDelimiter returns the StartDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPatternRequest) GetStartDelimiter() string { + if s == nil || s.StartDelimiter == nil { return "" } - return *r.URL + return *s.StartDelimiter } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetContent() string { - if r == nil || r.Content == nil { +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPatternSetting) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { return "" } - return *r.Content + return *s.CustomPatternVersion } -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetDownloadURL() string { - if r == nil || r.DownloadURL == nil { +// GetPushProtectionSetting returns the PushProtectionSetting field. +func (s *SecretScanningCustomPatternSetting) GetPushProtectionSetting() string { + if s == nil { + return "" + } + return s.PushProtectionSetting +} + +// GetTokenType returns the TokenType field. +func (s *SecretScanningCustomPatternSetting) GetTokenType() string { + if s == nil { + return "" + } + return s.TokenType +} + +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningCustomPatternToDelete) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { return "" } - return *r.DownloadURL + return *s.CustomPatternVersion +} + +// GetPatternID returns the PatternID field. +func (s *SecretScanningCustomPatternToDelete) GetPatternID() int64 { + if s == nil { + return 0 + } + return s.PatternID +} + +// GetReviewers returns the Reviewers slice if it's non-nil, nil otherwise. +func (s *SecretScanningDelegatedBypassOptions) GetReviewers() []*BypassReviewer { + if s == nil || s.Reviewers == nil { + return nil + } + return s.Reviewers } -// GetEncoding returns the Encoding field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetEncoding() string { - if r == nil || r.Encoding == nil { - return "" +// GetPatterns returns the Patterns slice if it's non-nil, nil otherwise. +func (s *SecretScanningDeleteCustomPatternsRequest) GetPatterns() []*SecretScanningCustomPatternToDelete { + if s == nil || s.Patterns == nil { + return nil } - return *r.Encoding + return s.Patterns } -// GetGitURL returns the GitURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetGitURL() string { - if r == nil || r.GitURL == nil { +// GetPostDeleteAction returns the PostDeleteAction field if it's non-nil, zero value otherwise. +func (s *SecretScanningDeleteCustomPatternsRequest) GetPostDeleteAction() string { + if s == nil || s.PostDeleteAction == nil { return "" } - return *r.GitURL + return *s.PostDeleteAction } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetCustomPatternOverrides returns the CustomPatternOverrides slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigs) GetCustomPatternOverrides() []*SecretScanningPatternOverride { + if s == nil || s.CustomPatternOverrides == nil { + return nil + } + return s.CustomPatternOverrides +} + +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigs) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { return "" } - return *r.HTMLURL + return *s.PatternConfigVersion } -// GetLicense returns the License field. -func (r *RepositoryLicense) GetLicense() *License { - if r == nil { +// GetProviderPatternOverrides returns the ProviderPatternOverrides slice if it's non-nil, nil otherwise. +func (s *SecretScanningPatternConfigs) GetProviderPatternOverrides() []*SecretScanningPatternOverride { + if s == nil || s.ProviderPatternOverrides == nil { return nil } - return r.License + return s.ProviderPatternOverrides } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetName() string { - if r == nil || r.Name == nil { +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigsUpdate) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { return "" } - return *r.Name + return *s.PatternConfigVersion } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetPath() string { - if r == nil || r.Path == nil { - return "" +// GetAlertTotal returns the AlertTotal field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetAlertTotal() int { + if s == nil || s.AlertTotal == nil { + return 0 } - return *r.Path + return *s.AlertTotal } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetSHA() string { - if r == nil || r.SHA == nil { - return "" +// GetAlertTotalPercentage returns the AlertTotalPercentage field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetAlertTotalPercentage() int { + if s == nil || s.AlertTotalPercentage == nil { + return 0 } - return *r.SHA + return *s.AlertTotalPercentage } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetSize() int { - if r == nil || r.Size == nil { +// GetBypassrate returns the Bypassrate field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetBypassrate() int { + if s == nil || s.Bypassrate == nil { return 0 } - return *r.Size + return *s.Bypassrate } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetType() string { - if r == nil || r.Type == nil { +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { return "" } - return *r.Type + return *s.CustomPatternVersion } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryLicense) GetURL() string { - if r == nil || r.URL == nil { +// GetDefaultSetting returns the DefaultSetting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetDefaultSetting() string { + if s == nil || s.DefaultSetting == nil { return "" } - return *r.URL + return *s.DefaultSetting } -// GetBase returns the Base field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetBase() string { - if r == nil || r.Base == nil { +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetDisplayName() string { + if s == nil || s.DisplayName == nil { return "" } - return *r.Base + return *s.DisplayName } -// GetCommitMessage returns the CommitMessage field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetCommitMessage() string { - if r == nil || r.CommitMessage == nil { +// GetEnterpriseSetting returns the EnterpriseSetting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetEnterpriseSetting() string { + if s == nil || s.EnterpriseSetting == nil { return "" } - return *r.CommitMessage + return *s.EnterpriseSetting } -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (r *RepositoryMergeRequest) GetHead() string { - if r == nil || r.Head == nil { - return "" +// GetFalsePositiveRate returns the FalsePositiveRate field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetFalsePositiveRate() int { + if s == nil || s.FalsePositiveRate == nil { + return 0 } - return *r.Head + return *s.FalsePositiveRate } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (r *RepositoryPermissionLevel) GetPermission() string { - if r == nil || r.Permission == nil { +// GetFalsePositives returns the FalsePositives field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetFalsePositives() int { + if s == nil || s.FalsePositives == nil { + return 0 + } + return *s.FalsePositives +} + +// GetSetting returns the Setting field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetSetting() string { + if s == nil || s.Setting == nil { return "" } - return *r.Permission + return *s.Setting } -// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. -func (r *RepositoryPermissionLevel) GetRoleName() string { - if r == nil || r.RoleName == nil { +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetSlug() string { + if s == nil || s.Slug == nil { return "" } - return *r.RoleName + return *s.Slug } -// GetUser returns the User field. -func (r *RepositoryPermissionLevel) GetUser() *User { - if r == nil { - return nil +// GetTokenType returns the TokenType field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternOverride) GetTokenType() string { + if s == nil || s.TokenType == nil { + return "" } - return r.User + return *s.TokenType } -// GetAssetsURL returns the AssetsURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetAssetsURL() string { - if r == nil || r.AssetsURL == nil { +// GetPushProtectionSetting returns the PushProtectionSetting field. +func (s *SecretScanningProviderPatternSetting) GetPushProtectionSetting() string { + if s == nil { return "" } - return *r.AssetsURL + return s.PushProtectionSetting } -// GetAuthor returns the Author field. -func (r *RepositoryRelease) GetAuthor() *User { - if r == nil { - return nil +// GetTokenType returns the TokenType field. +func (s *SecretScanningProviderPatternSetting) GetTokenType() string { + if s == nil { + return "" } - return r.Author + return s.TokenType } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetBody() string { - if r == nil || r.Body == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SecretScanningPushProtection) GetStatus() string { + if s == nil || s.Status == nil { return "" } - return *r.Body + return *s.Status } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetBackfillScans returns the BackfillScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetBackfillScans() []*SecretsScan { + if s == nil || s.BackfillScans == nil { + return nil } - return *r.CreatedAt + return s.BackfillScans } -// GetDiscussionCategoryName returns the DiscussionCategoryName field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetDiscussionCategoryName() string { - if r == nil || r.DiscussionCategoryName == nil { - return "" +// GetCustomPatternBackfillScans returns the CustomPatternBackfillScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetCustomPatternBackfillScans() []*CustomPatternBackfillScan { + if s == nil || s.CustomPatternBackfillScans == nil { + return nil } - return *r.DiscussionCategoryName + return s.CustomPatternBackfillScans } -// GetDraft returns the Draft field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetDraft() bool { - if r == nil || r.Draft == nil { - return false +// GetIncrementalScans returns the IncrementalScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetIncrementalScans() []*SecretsScan { + if s == nil || s.IncrementalScans == nil { + return nil } - return *r.Draft + return s.IncrementalScans } -// GetGenerateReleaseNotes returns the GenerateReleaseNotes field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetGenerateReleaseNotes() bool { - if r == nil || r.GenerateReleaseNotes == nil { - return false +// GetPatternUpdateScans returns the PatternUpdateScans slice if it's non-nil, nil otherwise. +func (s *SecretScanningScanHistory) GetPatternUpdateScans() []*SecretsScan { + if s == nil || s.PatternUpdateScans == nil { + return nil } - return *r.GenerateReleaseNotes + return s.PatternUpdateScans } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetHTMLURL() string { - if r == nil || r.HTMLURL == nil { +// GetCustomPatternVersion returns the CustomPatternVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetCustomPatternVersion() string { + if s == nil || s.CustomPatternVersion == nil { return "" } - return *r.HTMLURL + return *s.CustomPatternVersion } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetEndDelimiter returns the EndDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetEndDelimiter() string { + if s == nil || s.EndDelimiter == nil { + return "" } - return *r.ID + return *s.EndDelimiter } -// GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetMakeLatest() string { - if r == nil || r.MakeLatest == nil { - return "" +// GetMustMatch returns the MustMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetMustMatch() []string { + if s == nil || s.MustMatch == nil { + return nil } - return *r.MakeLatest + return s.MustMatch } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetName() string { - if r == nil || r.Name == nil { +// GetMustNotMatch returns the MustNotMatch slice if it's non-nil, nil otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetMustNotMatch() []string { + if s == nil || s.MustNotMatch == nil { + return nil + } + return s.MustNotMatch +} + +// GetPattern returns the Pattern field if it's non-nil, zero value otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetPattern() string { + if s == nil || s.Pattern == nil { return "" } - return *r.Name + return *s.Pattern } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetStartDelimiter returns the StartDelimiter field if it's non-nil, zero value otherwise. +func (s *SecretScanningUpdateCustomPatternRequest) GetStartDelimiter() string { + if s == nil || s.StartDelimiter == nil { return "" } - return *r.NodeID + return *s.StartDelimiter } -// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetPrerelease() bool { - if r == nil || r.Prerelease == nil { - return false +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SecretScanningValidityChecks) GetStatus() string { + if s == nil || s.Status == nil { + return "" } - return *r.Prerelease + return *s.Status } -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetPublishedAt() Timestamp { - if r == nil || r.PublishedAt == nil { +// 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 *r.PublishedAt + return *s.CompletedAt } -// GetTagName returns the TagName field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTagName() string { - if r == nil || r.TagName == nil { - return "" +// 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 *r.TagName + return *s.StartedAt } -// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTarballURL() string { - if r == nil || r.TarballURL == nil { +// GetStatus returns the Status field. +func (s *SecretsScan) GetStatus() string { + if s == nil { return "" } - return *r.TarballURL + return s.Status } -// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetTargetCommitish() string { - if r == nil || r.TargetCommitish == nil { +// GetType returns the Type field. +func (s *SecretsScan) GetType() string { + if s == nil { return "" } - return *r.TargetCommitish + return s.Type } -// GetUploadURL returns the UploadURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetUploadURL() string { - if r == nil || r.UploadURL == nil { - return "" +// GetAuthor returns the Author field. +func (s *SecurityAdvisory) GetAuthor() *User { + if s == nil { + return nil } - return *r.UploadURL + return s.Author } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetURL() string { - if r == nil || r.URL == nil { - return "" +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetClosedAt() Timestamp { + if s == nil || s.ClosedAt == nil { + return Timestamp{} } - return *r.URL + return *s.ClosedAt } -// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryRelease) GetZipballURL() string { - if r == nil || r.ZipballURL == nil { - return "" +// GetCollaboratingTeams returns the CollaboratingTeams slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCollaboratingTeams() []*Team { + if s == nil || s.CollaboratingTeams == nil { + return nil } - return *r.ZipballURL + return s.CollaboratingTeams } -// GetConditions returns the Conditions field. -func (r *RepositoryRuleset) GetConditions() *RepositoryRulesetConditions { - if r == nil { +// GetCollaboratingUsers returns the CollaboratingUsers slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCollaboratingUsers() []*User { + if s == nil || s.CollaboratingUsers == nil { return nil } - return r.Conditions + return s.CollaboratingUsers } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { +func (s *SecurityAdvisory) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { return Timestamp{} } - return *r.CreatedAt + return *s.CreatedAt } -// GetCurrentUserCanBypass returns the CurrentUserCanBypass field. -func (r *RepositoryRuleset) GetCurrentUserCanBypass() *BypassMode { - if r == nil { +// GetCredits returns the Credits slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCredits() []*RepoAdvisoryCredit { + if s == nil || s.Credits == nil { return nil } - return r.CurrentUserCanBypass + return s.Credits } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetCreditsDetailed returns the CreditsDetailed slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCreditsDetailed() []*RepoAdvisoryCreditDetailed { + if s == nil || s.CreditsDetailed == nil { + return nil } - return *r.ID + return s.CreditsDetailed } -// GetLinks returns the Links field. -func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLinks { - if r == nil { - return nil +// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetCVEID() string { + if s == nil || s.CVEID == nil { + return "" } - return r.Links + return *s.CVEID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" +// GetCVSS returns the CVSS field. +func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { + if s == nil { + return nil } - return *r.NodeID + return s.CVSS } -// GetRules returns the Rules field. -func (r *RepositoryRuleset) GetRules() *RepositoryRulesetRules { - if r == nil { +// GetCVSSSeverities returns the CVSSSeverities field. +func (s *SecurityAdvisory) GetCVSSSeverities() *AdvisoryCVSSSeverities { + if s == nil { return nil } - return r.Rules + return s.CVSSSeverities } -// GetSourceType returns the SourceType field. -func (r *RepositoryRuleset) GetSourceType() *RulesetSourceType { - if r == nil { +// GetCWEIDs returns the CWEIDs slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCWEIDs() []string { + if s == nil || s.CWEIDs == nil { return nil } - return r.SourceType + return s.CWEIDs } -// GetTarget returns the Target field. -func (r *RepositoryRuleset) GetTarget() *RulesetTarget { - if r == nil { +// GetCWEs returns the CWEs slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetCWEs() []*AdvisoryCWEs { + if s == nil || s.CWEs == nil { return nil } - return r.Target + return s.CWEs } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetDescription() string { + if s == nil || s.Description == nil { + return "" } - return *r.UpdatedAt + return *s.Description } -// GetConfiguration returns the Configuration field. -func (r *RepositoryRulesetChangedRule) GetConfiguration() *RepositoryRulesetChangeSource { - if r == nil { - return nil +// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetGHSAID() string { + if s == nil || s.GHSAID == nil { + return "" } - return r.Configuration + return *s.GHSAID } -// GetPattern returns the Pattern field. -func (r *RepositoryRulesetChangedRule) GetPattern() *RepositoryRulesetChangeSource { - if r == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetHTMLURL() string { + if s == nil || s.HTMLURL == nil { + return "" } - return r.Pattern + return *s.HTMLURL } -// GetRuleType returns the RuleType field. -func (r *RepositoryRulesetChangedRule) GetRuleType() *RepositoryRulesetChangeSource { - if r == nil { +// GetIdentifiers returns the Identifiers slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetIdentifiers() []*AdvisoryIdentifier { + if s == nil || s.Identifiers == nil { return nil } - return r.RuleType + return s.Identifiers } -// GetConditions returns the Conditions field. -func (r *RepositoryRulesetChanges) GetConditions() *RepositoryRulesetChangedConditions { - if r == nil { +// GetPrivateFork returns the PrivateFork field. +func (s *SecurityAdvisory) GetPrivateFork() *Repository { + if s == nil { return nil } - return r.Conditions + return s.PrivateFork } -// GetEnforcement returns the Enforcement field. -func (r *RepositoryRulesetChanges) GetEnforcement() *RepositoryRulesetChangeSource { - if r == nil { - return nil +// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetPublishedAt() Timestamp { + if s == nil || s.PublishedAt == nil { + return Timestamp{} } - return r.Enforcement + return *s.PublishedAt } -// GetName returns the Name field. -func (r *RepositoryRulesetChanges) GetName() *RepositoryRulesetChangeSource { - if r == nil { +// GetPublisher returns the Publisher field. +func (s *SecurityAdvisory) GetPublisher() *User { + if s == nil { return nil } - return r.Name + return s.Publisher } -// GetRules returns the Rules field. -func (r *RepositoryRulesetChanges) GetRules() *RepositoryRulesetChangedRules { - if r == nil { +// GetReferences returns the References slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetReferences() []*AdvisoryReference { + if s == nil || s.References == nil { return nil } - return r.Rules + return s.References } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetChangeSource) GetFrom() string { - if r == nil || r.From == nil { +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetSeverity() string { + if s == nil || s.Severity == nil { return "" } - return *r.From + return *s.Severity } -// GetOrganizationID returns the OrganizationID field. -func (r *RepositoryRulesetConditions) GetOrganizationID() *RepositoryRulesetOrganizationIDsConditionParameters { - if r == nil { - return nil +// GetState returns the State field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetState() string { + if s == nil || s.State == nil { + return "" } - return r.OrganizationID + return *s.State } -// GetOrganizationName returns the OrganizationName field. -func (r *RepositoryRulesetConditions) GetOrganizationName() *RepositoryRulesetOrganizationNamesConditionParameters { - if r == nil { +// GetSubmission returns the Submission field. +func (s *SecurityAdvisory) GetSubmission() *SecurityAdvisorySubmission { + if s == nil { return nil } - return r.OrganizationName + return s.Submission } -// GetRefName returns the RefName field. -func (r *RepositoryRulesetConditions) GetRefName() *RepositoryRulesetRefConditionParameters { - if r == nil { - return nil +// GetSummary returns the Summary field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetSummary() string { + if s == nil || s.Summary == nil { + return "" } - return r.RefName + return *s.Summary } -// GetRepositoryID returns the RepositoryID field. -func (r *RepositoryRulesetConditions) GetRepositoryID() *RepositoryRulesetRepositoryIDsConditionParameters { - if r == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { + return Timestamp{} } - return r.RepositoryID + return *s.UpdatedAt } -// GetRepositoryName returns the RepositoryName field. -func (r *RepositoryRulesetConditions) GetRepositoryName() *RepositoryRulesetRepositoryNamesConditionParameters { - if r == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetURL() string { + if s == nil || s.URL == nil { + return "" } - return r.RepositoryName + return *s.URL } -// GetRepositoryProperty returns the RepositoryProperty field. -func (r *RepositoryRulesetConditions) GetRepositoryProperty() *RepositoryRulesetRepositoryPropertyConditionParameters { - if r == nil { +// GetVulnerabilities returns the Vulnerabilities slice if it's non-nil, nil otherwise. +func (s *SecurityAdvisory) GetVulnerabilities() []*AdvisoryVulnerability { + if s == nil || s.Vulnerabilities == nil { return nil } - return r.RepositoryProperty + return s.Vulnerabilities } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetEvent) GetAction() string { - if r == nil || r.Action == nil { - return "" +// GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetWithdrawnAt() Timestamp { + if s == nil || s.WithdrawnAt == nil { + return Timestamp{} } - return *r.Action + return *s.WithdrawnAt } -// GetChanges returns the Changes field. -func (r *RepositoryRulesetEvent) GetChanges() *RepositoryRulesetChanges { - if r == nil { - return nil +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisoryEvent) GetAction() string { + if s == nil || s.Action == nil { + return "" } - return r.Changes + return *s.Action } // GetEnterprise returns the Enterprise field. -func (r *RepositoryRulesetEvent) GetEnterprise() *Enterprise { - if r == nil { +func (s *SecurityAdvisoryEvent) GetEnterprise() *Enterprise { + if s == nil { return nil } - return r.Enterprise + return s.Enterprise } // GetInstallation returns the Installation field. -func (r *RepositoryRulesetEvent) GetInstallation() *Installation { - if r == nil { +func (s *SecurityAdvisoryEvent) GetInstallation() *Installation { + if s == nil { return nil } - return r.Installation + return s.Installation } // GetOrganization returns the Organization field. -func (r *RepositoryRulesetEvent) GetOrganization() *Organization { - if r == nil { +func (s *SecurityAdvisoryEvent) GetOrganization() *Organization { + if s == nil { return nil } - return r.Organization + return s.Organization } // GetRepository returns the Repository field. -func (r *RepositoryRulesetEvent) GetRepository() *Repository { - if r == nil { +func (s *SecurityAdvisoryEvent) GetRepository() *Repository { + if s == nil { return nil } - return r.Repository + return s.Repository } -// GetRepositoryRuleset returns the RepositoryRuleset field. -func (r *RepositoryRulesetEvent) GetRepositoryRuleset() *RepositoryRuleset { - if r == nil { +// GetSecurityAdvisory returns the SecurityAdvisory field. +func (s *SecurityAdvisoryEvent) GetSecurityAdvisory() *SecurityAdvisory { + if s == nil { return nil } - return r.RepositoryRuleset + return s.SecurityAdvisory } // GetSender returns the Sender field. -func (r *RepositoryRulesetEvent) GetSender() *User { - if r == nil { +func (s *SecurityAdvisoryEvent) GetSender() *User { + if s == nil { return nil } - return r.Sender + return s.Sender } -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetLink) GetHRef() string { - if r == nil || r.HRef == nil { - return "" +// GetAccepted returns the Accepted field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisorySubmission) GetAccepted() bool { + if s == nil || s.Accepted == nil { + return false } - return *r.HRef + return *s.Accepted } -// GetHTML returns the HTML field. -func (r *RepositoryRulesetLinks) GetHTML() *RepositoryRulesetLink { - if r == nil { +// GetAdvancedSecurity returns the AdvancedSecurity field. +func (s *SecurityAndAnalysis) GetAdvancedSecurity() *AdvancedSecurity { + if s == nil { return nil } - return r.HTML + return s.AdvancedSecurity } -// GetSelf returns the Self field. -func (r *RepositoryRulesetLinks) GetSelf() *RepositoryRulesetLink { - if r == nil { +// GetCodeSecurity returns the CodeSecurity field. +func (s *SecurityAndAnalysis) GetCodeSecurity() *CodeSecurity { + if s == nil { return nil } - return r.Self + return s.CodeSecurity } -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetRepositoryNamesConditionParameters) GetProtected() bool { - if r == nil || r.Protected == nil { - return false +// GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field. +func (s *SecurityAndAnalysis) GetDependabotSecurityUpdates() *DependabotSecurityUpdates { + if s == nil { + return nil } - return *r.Protected + return s.DependabotSecurityUpdates } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetRepositoryPropertyTargetParameters) GetSource() string { - if r == nil || r.Source == nil { - return "" +// GetSecretScanning returns the SecretScanning field. +func (s *SecurityAndAnalysis) GetSecretScanning() *SecretScanning { + if s == nil { + return nil } - return *r.Source + return s.SecretScanning } -// GetBranchNamePattern returns the BranchNamePattern field. -func (r *RepositoryRulesetRules) GetBranchNamePattern() *PatternRuleParameters { - if r == nil { +// GetSecretScanningPushProtection returns the SecretScanningPushProtection field. +func (s *SecurityAndAnalysis) GetSecretScanningPushProtection() *SecretScanningPushProtection { + if s == nil { return nil } - return r.BranchNamePattern + return s.SecretScanningPushProtection } -// GetCodeScanning returns the CodeScanning field. -func (r *RepositoryRulesetRules) GetCodeScanning() *CodeScanningRuleParameters { - if r == nil { +// GetSecretScanningValidityChecks returns the SecretScanningValidityChecks field. +func (s *SecurityAndAnalysis) GetSecretScanningValidityChecks() *SecretScanningValidityChecks { + if s == nil { return nil } - return r.CodeScanning + return s.SecretScanningValidityChecks } -// GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern field. -func (r *RepositoryRulesetRules) GetCommitAuthorEmailPattern() *PatternRuleParameters { - if r == nil { +// GetFrom returns the From field. +func (s *SecurityAndAnalysisChange) GetFrom() *SecurityAndAnalysisChangeFrom { + if s == nil { return nil } - return r.CommitAuthorEmailPattern + return s.From } -// GetCommitMessagePattern returns the CommitMessagePattern field. -func (r *RepositoryRulesetRules) GetCommitMessagePattern() *PatternRuleParameters { - if r == nil { +// GetSecurityAndAnalysis returns the SecurityAndAnalysis field. +func (s *SecurityAndAnalysisChangeFrom) GetSecurityAndAnalysis() *SecurityAndAnalysis { + if s == nil { return nil } - return r.CommitMessagePattern + return s.SecurityAndAnalysis +} + +// GetChanges returns the Changes field. +func (s *SecurityAndAnalysisEvent) GetChanges() *SecurityAndAnalysisChange { + if s == nil { + return nil + } + return s.Changes } -// GetCommitterEmailPattern returns the CommitterEmailPattern field. -func (r *RepositoryRulesetRules) GetCommitterEmailPattern() *PatternRuleParameters { - if r == nil { +// GetEnterprise returns the Enterprise field. +func (s *SecurityAndAnalysisEvent) GetEnterprise() *Enterprise { + if s == nil { return nil } - return r.CommitterEmailPattern + return s.Enterprise } -// GetCreation returns the Creation field. -func (r *RepositoryRulesetRules) GetCreation() *EmptyRuleParameters { - if r == nil { +// GetInstallation returns the Installation field. +func (s *SecurityAndAnalysisEvent) GetInstallation() *Installation { + if s == nil { return nil } - return r.Creation + return s.Installation } -// GetDeletion returns the Deletion field. -func (r *RepositoryRulesetRules) GetDeletion() *EmptyRuleParameters { - if r == nil { +// GetOrganization returns the Organization field. +func (s *SecurityAndAnalysisEvent) GetOrganization() *Organization { + if s == nil { return nil } - return r.Deletion + return s.Organization } -// GetFileExtensionRestriction returns the FileExtensionRestriction field. -func (r *RepositoryRulesetRules) GetFileExtensionRestriction() *FileExtensionRestrictionRuleParameters { - if r == nil { +// GetRepository returns the Repository field. +func (s *SecurityAndAnalysisEvent) GetRepository() *Repository { + if s == nil { return nil } - return r.FileExtensionRestriction + return s.Repository } -// GetFilePathRestriction returns the FilePathRestriction field. -func (r *RepositoryRulesetRules) GetFilePathRestriction() *FilePathRestrictionRuleParameters { - if r == nil { +// GetSender returns the Sender field. +func (s *SecurityAndAnalysisEvent) GetSender() *User { + if s == nil { return nil } - return r.FilePathRestriction + return s.Sender } -// GetMaxFilePathLength returns the MaxFilePathLength field. -func (r *RepositoryRulesetRules) GetMaxFilePathLength() *MaxFilePathLengthRuleParameters { - if r == nil { +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (s *SelectedReposList) GetRepositories() []*Repository { + if s == nil || s.Repositories == nil { return nil } - return r.MaxFilePathLength + return s.Repositories } -// GetMaxFileSize returns the MaxFileSize field. -func (r *RepositoryRulesetRules) GetMaxFileSize() *MaxFileSizeRuleParameters { - if r == nil { - return nil +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (s *SelectedReposList) GetTotalCount() int { + if s == nil || s.TotalCount == nil { + return 0 } - return r.MaxFileSize + return *s.TotalCount } -// GetMergeQueue returns the MergeQueue field. -func (r *RepositoryRulesetRules) GetMergeQueue() *MergeQueueRuleParameters { - if r == nil { +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (s *SelfHostedRunnersAllowedRepos) GetRepositories() []*Repository { + if s == nil || s.Repositories == nil { return nil } - return r.MergeQueue + return s.Repositories } -// GetNonFastForward returns the NonFastForward field. -func (r *RepositoryRulesetRules) GetNonFastForward() *EmptyRuleParameters { - if r == nil { - return nil +// GetTotalCount returns the TotalCount field. +func (s *SelfHostedRunnersAllowedRepos) GetTotalCount() int { + if s == nil { + return 0 } - return r.NonFastForward + return s.TotalCount } -// GetPullRequest returns the PullRequest field. -func (r *RepositoryRulesetRules) GetPullRequest() *PullRequestRuleParameters { - if r == nil { - return nil +// GetEnabledRepositories returns the EnabledRepositories field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganization) GetEnabledRepositories() string { + if s == nil || s.EnabledRepositories == nil { + return "" } - return r.PullRequest + return *s.EnabledRepositories } -// GetRequiredDeployments returns the RequiredDeployments field. -func (r *RepositoryRulesetRules) GetRequiredDeployments() *RequiredDeploymentsRuleParameters { - if r == nil { - return nil +// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganization) GetSelectedRepositoriesURL() string { + if s == nil || s.SelectedRepositoriesURL == nil { + return "" } - return r.RequiredDeployments + return *s.SelectedRepositoriesURL } -// GetRequiredLinearHistory returns the RequiredLinearHistory field. -func (r *RepositoryRulesetRules) GetRequiredLinearHistory() *EmptyRuleParameters { - if r == nil { - return nil +// GetEnabledRepositories returns the EnabledRepositories field. +func (s *SelfHostedRunnersSettingsOrganizationOpt) GetEnabledRepositories() string { + if s == nil { + return "" } - return r.RequiredLinearHistory + return s.EnabledRepositories } -// GetRequiredSignatures returns the RequiredSignatures field. -func (r *RepositoryRulesetRules) GetRequiredSignatures() *EmptyRuleParameters { - if r == nil { - return nil +// GetDisableSelfHostedRunnersForAllOrgs returns the DisableSelfHostedRunnersForAllOrgs field. +func (s *SelfHostRunnerPermissionsEnterprise) GetDisableSelfHostedRunnersForAllOrgs() bool { + if s == nil { + return false } - return r.RequiredSignatures + return s.DisableSelfHostedRunnersForAllOrgs } -// GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (r *RepositoryRulesetRules) GetRequiredStatusChecks() *RequiredStatusChecksRuleParameters { - if r == nil { +// GetServerInstances returns the ServerInstances field. +func (s *ServerInstanceProperties) GetServerInstances() *ServerInstances { + if s == nil { return nil } - return r.RequiredStatusChecks + return s.ServerInstances } -// GetTagNamePattern returns the TagNamePattern field. -func (r *RepositoryRulesetRules) GetTagNamePattern() *PatternRuleParameters { - if r == nil { +// GetItems returns the Items field. +func (s *ServerInstances) GetItems() *ServiceInstanceItems { + if s == nil { return nil } - return r.TagNamePattern + return s.Items } -// GetUpdate returns the Update field. -func (r *RepositoryRulesetRules) GetUpdate() *UpdateRuleParameters { - if r == nil { - return nil +// GetType returns the Type field. +func (s *ServerInstances) GetType() string { + if s == nil { + return "" } - return r.Update + return s.Type } -// GetWorkflows returns the Workflows field. -func (r *RepositoryRulesetRules) GetWorkflows() *WorkflowsRuleParameters { - if r == nil { - return nil +// GetHostname returns the Hostname field. +func (s *ServerItemProperties) GetHostname() string { + if s == nil { + return "" } - return r.Workflows + return s.Hostname } -// GetConditionType returns the ConditionType field. -func (r *RepositoryRulesetUpdatedCondition) GetConditionType() *RepositoryRulesetChangeSource { - if r == nil { +// GetLastSync returns the LastSync field. +func (s *ServerItemProperties) GetLastSync() *LastLicenseSync { + if s == nil { return nil } - return r.ConditionType + return s.LastSync } -// GetExclude returns the Exclude field. -func (r *RepositoryRulesetUpdatedCondition) GetExclude() *RepositoryRulesetChangeSources { - if r == nil { - return nil +// GetServerID returns the ServerID field. +func (s *ServerItemProperties) GetServerID() string { + if s == nil { + return "" } - return r.Exclude + return s.ServerID } -// GetInclude returns the Include field. -func (r *RepositoryRulesetUpdatedCondition) GetInclude() *RepositoryRulesetChangeSources { - if r == nil { +// GetProperties returns the Properties field. +func (s *ServiceInstanceItems) GetProperties() *ServerItemProperties { + if s == nil { return nil } - return r.Include + return s.Properties } -// GetTarget returns the Target field. -func (r *RepositoryRulesetUpdatedCondition) GetTarget() *RepositoryRulesetChangeSource { - if r == nil { - return nil +// GetType returns the Type field. +func (s *ServiceInstanceItems) GetType() string { + if s == nil { + return "" } - return r.Target + return s.Type } -// GetChanges returns the Changes field. -func (r *RepositoryRulesetUpdatedConditions) GetChanges() *RepositoryRulesetUpdatedCondition { - if r == nil { +// GetSelectedOrganizationIDs returns the SelectedOrganizationIDs slice if it's non-nil, nil otherwise. +func (s *SetOrgAccessRunnerGroupRequest) GetSelectedOrganizationIDs() []int64 { + if s == nil || s.SelectedOrganizationIDs == nil { return nil } - return r.Changes + return s.SelectedOrganizationIDs } -// GetCondition returns the Condition field. -func (r *RepositoryRulesetUpdatedConditions) GetCondition() *RepositoryRulesetConditions { - if r == nil { +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (s *SetRepoAccessRunnerGroupRequest) GetSelectedRepositoryIDs() []int64 { + if s == nil || s.SelectedRepositoryIDs == nil { return nil } - return r.Condition + return s.SelectedRepositoryIDs } -// GetChanges returns the Changes field. -func (r *RepositoryRulesetUpdatedRules) GetChanges() *RepositoryRulesetChangedRule { - if r == nil { +// GetRunners returns the Runners slice if it's non-nil, nil otherwise. +func (s *SetRunnerGroupRunnersRequest) GetRunners() []int64 { + if s == nil || s.Runners == nil { return nil } - return r.Changes + return s.Runners } -// GetRule returns the Rule field. -func (r *RepositoryRulesetUpdatedRules) GetRule() *RepositoryRule { - if r == nil { - return nil +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { + if s == nil || s.From == nil { + return "" } - return r.Rule + return *s.From } -// GetCommit returns the Commit field. -func (r *RepositoryTag) GetCommit() *Commit { - if r == nil { - return nil +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (s *SignaturesProtectedBranch) GetEnabled() bool { + if s == nil || s.Enabled == nil { + return false } - return r.Commit + return *s.Enabled } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetName() string { - if r == nil || r.Name == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SignaturesProtectedBranch) GetURL() string { + if s == nil || s.URL == nil { return "" } - return *r.Name + return *s.URL } -// GetTarballURL returns the TarballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetTarballURL() string { - if r == nil || r.TarballURL == nil { +// GetPayload returns the Payload field if it's non-nil, zero value otherwise. +func (s *SignatureVerification) GetPayload() string { + if s == nil || s.Payload == nil { return "" } - return *r.TarballURL + return *s.Payload } -// GetZipballURL returns the ZipballURL field if it's non-nil, zero value otherwise. -func (r *RepositoryTag) GetZipballURL() string { - if r == nil || r.ZipballURL == nil { +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (s *SignatureVerification) GetReason() string { + if s == nil || s.Reason == nil { return "" } - return *r.ZipballURL + return *s.Reason } -// GetAffectedPackageName returns the AffectedPackageName field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetAffectedPackageName() string { - if r == nil || r.AffectedPackageName == nil { +// GetSignature returns the Signature field if it's non-nil, zero value otherwise. +func (s *SignatureVerification) GetSignature() string { + if s == nil || s.Signature == nil { return "" } - return *r.AffectedPackageName + return *s.Signature } -// GetAffectedRange returns the AffectedRange field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetAffectedRange() string { - if r == nil || r.AffectedRange == nil { +// GetVerified returns the Verified field if it's non-nil, zero value otherwise. +func (s *SignatureVerification) GetVerified() bool { + if s == nil || s.Verified == nil { + return false + } + return *s.Verified +} + +// GetNegate returns the Negate field. +func (s *SimplePatternRuleParameters) GetNegate() bool { + if s == nil { + return false + } + return s.Negate +} + +// GetPattern returns the Pattern field. +func (s *SimplePatternRuleParameters) GetPattern() string { + if s == nil { return "" } - return *r.AffectedRange + return s.Pattern } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetProvider returns the Provider field if it's non-nil, zero value otherwise. +func (s *SocialAccount) GetProvider() string { + if s == nil || s.Provider == nil { + return "" } - return *r.CreatedAt + return *s.Provider } -// GetDismissedAt returns the DismissedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetDismissedAt() Timestamp { - if r == nil || r.DismissedAt == nil { - return Timestamp{} +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SocialAccount) GetURL() string { + if s == nil || s.URL == nil { + return "" } - return *r.DismissedAt + return *s.URL } -// GetDismisser returns the Dismisser field. -func (r *RepositoryVulnerabilityAlert) GetDismisser() *User { - if r == nil { +// GetActor returns the Actor field. +func (s *Source) GetActor() *User { + if s == nil { return nil } - return r.Dismisser + return s.Actor } -// GetDismissReason returns the DismissReason field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetDismissReason() string { - if r == nil || r.DismissReason == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *Source) GetID() int64 { + if s == nil || s.ID == nil { + return 0 } - return *r.DismissReason + return *s.ID } -// GetExternalIdentifier returns the ExternalIdentifier field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetExternalIdentifier() string { - if r == nil || r.ExternalIdentifier == nil { - return "" +// GetIssue returns the Issue field. +func (s *Source) GetIssue() *Issue { + if s == nil { + return nil } - return *r.ExternalIdentifier + return s.Issue } -// GetExternalReference returns the ExternalReference field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetExternalReference() string { - if r == nil || r.ExternalReference == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *Source) GetType() string { + if s == nil || s.Type == nil { return "" } - return *r.ExternalReference + return *s.Type } -// GetFixedIn returns the FixedIn field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetFixedIn() string { - if r == nil || r.FixedIn == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *Source) GetURL() string { + if s == nil || s.URL == nil { return "" } - return *r.FixedIn + return *s.URL } -// GetGitHubSecurityAdvisoryID returns the GitHubSecurityAdvisoryID field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetGitHubSecurityAdvisoryID() string { - if r == nil || r.GitHubSecurityAdvisoryID == nil { +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetEmail() string { + if s == nil || s.Email == nil { return "" } - return *r.GitHubSecurityAdvisoryID + return *s.Email } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetID() int64 { - if r == nil || r.ID == nil { +func (s *SourceImportAuthor) GetID() int64 { + if s == nil || s.ID == nil { return 0 } - return *r.ID + return *s.ID } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlert) GetSeverity() string { - if r == nil || r.Severity == nil { +// GetImportURL returns the ImportURL field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetImportURL() string { + if s == nil || s.ImportURL == nil { return "" } - return *r.Severity + return *s.ImportURL } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryVulnerabilityAlertEvent) GetAction() string { - if r == nil || r.Action == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetName() string { + if s == nil || s.Name == nil { return "" } - return *r.Action + return *s.Name } -// GetAlert returns the Alert field. -func (r *RepositoryVulnerabilityAlertEvent) GetAlert() *RepositoryVulnerabilityAlert { - if r == nil { - return nil +// GetRemoteID returns the RemoteID field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetRemoteID() string { + if s == nil || s.RemoteID == nil { + return "" } - return r.Alert + return *s.RemoteID } -// GetInstallation returns the Installation field. -func (r *RepositoryVulnerabilityAlertEvent) GetInstallation() *Installation { - if r == nil { - return nil +// GetRemoteName returns the RemoteName field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetRemoteName() string { + if s == nil || s.RemoteName == nil { + return "" } - return r.Installation + return *s.RemoteName } -// GetOrg returns the Org field. -func (r *RepositoryVulnerabilityAlertEvent) GetOrg() *Organization { - if r == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SourceImportAuthor) GetURL() string { + if s == nil || s.URL == nil { + return "" } - return r.Org + return *s.URL } -// GetRepository returns the Repository field. -func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository { - if r == nil { - return nil +// GetDomain returns the Domain field. +func (s *SplunkConfig) GetDomain() string { + if s == nil { + return "" } - return r.Repository + return s.Domain } -// GetSender returns the Sender field. -func (r *RepositoryVulnerabilityAlertEvent) GetSender() *User { - if r == nil { - return nil +// GetEncryptedToken returns the EncryptedToken field. +func (s *SplunkConfig) GetEncryptedToken() string { + if s == nil { + return "" } - return r.Sender + return s.EncryptedToken } -// GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetForkRepos() int { - if r == nil || r.ForkRepos == nil { - return 0 +// GetKeyID returns the KeyID field. +func (s *SplunkConfig) GetKeyID() string { + if s == nil { + return "" } - return *r.ForkRepos + return s.KeyID } -// GetOrgRepos returns the OrgRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetOrgRepos() int { - if r == nil || r.OrgRepos == nil { +// GetPort returns the Port field. +func (s *SplunkConfig) GetPort() uint16 { + if s == nil { return 0 } - return *r.OrgRepos + return s.Port } -// GetRootRepos returns the RootRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetRootRepos() int { - if r == nil || r.RootRepos == nil { - return 0 +// GetSSLVerify returns the SSLVerify field. +func (s *SplunkConfig) GetSSLVerify() bool { + if s == nil { + return false } - return *r.RootRepos + return s.SSLVerify } -// GetTotalPushes returns the TotalPushes field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalPushes() int { - if r == nil || r.TotalPushes == nil { - return 0 +// GetPrivacyLevel returns the PrivacyLevel field if it's non-nil, zero value otherwise. +func (s *SponsorshipChanges) GetPrivacyLevel() string { + if s == nil || s.PrivacyLevel == nil { + return "" } - return *r.TotalPushes + return *s.PrivacyLevel } -// GetTotalRepos returns the TotalRepos field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalRepos() int { - if r == nil || r.TotalRepos == nil { - return 0 +// GetTier returns the Tier field. +func (s *SponsorshipChanges) GetTier() *SponsorshipTier { + if s == nil { + return nil } - return *r.TotalRepos + return s.Tier } -// GetTotalWikis returns the TotalWikis field if it's non-nil, zero value otherwise. -func (r *RepoStats) GetTotalWikis() int { - if r == nil || r.TotalWikis == nil { - return 0 +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (s *SponsorshipEvent) GetAction() string { + if s == nil || s.Action == nil { + return "" } - return *r.TotalWikis + return *s.Action } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetAvatarURL() string { - if r == nil || r.AvatarURL == nil { - return "" +// GetChanges returns the Changes field. +func (s *SponsorshipEvent) GetChanges() *SponsorshipChanges { + if s == nil { + return nil } - return *r.AvatarURL + return s.Changes } -// GetContext returns the Context field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetContext() string { - if r == nil || r.Context == nil { +// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. +func (s *SponsorshipEvent) GetEffectiveDate() string { + if s == nil || s.EffectiveDate == nil { return "" } - return *r.Context + return *s.EffectiveDate } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} +// GetInstallation returns the Installation field. +func (s *SponsorshipEvent) GetInstallation() *Installation { + if s == nil { + return nil } - return *r.CreatedAt + return s.Installation } -// GetCreator returns the Creator field. -func (r *RepoStatus) GetCreator() *User { - if r == nil { +// GetOrganization returns the Organization field. +func (s *SponsorshipEvent) GetOrganization() *Organization { + if s == nil { return nil } - return r.Creator + return s.Organization } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetDescription() string { - if r == nil || r.Description == nil { - return "" +// GetRepository returns the Repository field. +func (s *SponsorshipEvent) GetRepository() *Repository { + if s == nil { + return nil } - return *r.Description + return s.Repository } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetSender returns the Sender field. +func (s *SponsorshipEvent) GetSender() *User { + if s == nil { + return nil } - return *r.ID + return s.Sender } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetNodeID() string { - if r == nil || r.NodeID == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (s *SponsorshipTier) GetFrom() string { + if s == nil || s.From == nil { return "" } - return *r.NodeID + return *s.From } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetState() string { - if r == nil || r.State == nil { +// GetKey returns the Key field. +func (s *SSHKeyOptions) GetKey() string { + if s == nil { return "" } - return *r.State + return s.Key } -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetTargetURL() string { - if r == nil || r.TargetURL == nil { +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (s *SSHKeyStatus) GetHostname() string { + if s == nil || s.Hostname == nil { return "" } - return *r.TargetURL + return *s.Hostname } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (s *SSHKeyStatus) GetMessage() string { + if s == nil || s.Message == nil { + return "" } - return *r.UpdatedAt + return *s.Message } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RepoStatus) GetURL() string { - if r == nil || r.URL == nil { +// GetModified returns the Modified field if it's non-nil, zero value otherwise. +func (s *SSHKeyStatus) GetModified() bool { + if s == nil || s.Modified == nil { + return false + } + return *s.Modified +} + +// GetUUID returns the UUID field if it's non-nil, zero value otherwise. +func (s *SSHKeyStatus) GetUUID() string { + if s == nil || s.UUID == nil { return "" } - return *r.URL + return *s.UUID +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *SSHSigningKey) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} + } + return *s.CreatedAt } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RequireCodeOwnerReviewChanges) GetFrom() bool { - if r == nil || r.From == nil { - return false +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SSHSigningKey) GetID() int64 { + if s == nil || s.ID == nil { + return 0 } - return *r.From + return *s.ID } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RequiredConversationResolutionLevelChanges) GetFrom() string { - if r == nil || r.From == nil { +// GetKey returns the Key field if it's non-nil, zero value otherwise. +func (s *SSHSigningKey) GetKey() string { + if s == nil || s.Key == nil { return "" } - return *r.From + return *s.Key } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RequiredDeploymentsEnforcementLevelChanges) GetFrom() string { - if r == nil || r.From == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (s *SSHSigningKey) GetTitle() string { + if s == nil || s.Title == nil { return "" } - return *r.From + return *s.Title } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RequiredReviewer) GetType() string { - if r == nil || r.Type == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (s *StarEvent) GetAction() string { + if s == nil || s.Action == nil { return "" } - return *r.Type + return *s.Action } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (r *RequiredStatusCheck) GetAppID() int64 { - if r == nil || r.AppID == nil { - return 0 +// GetInstallation returns the Installation field. +func (s *StarEvent) GetInstallation() *Installation { + if s == nil { + return nil } - return *r.AppID + return s.Installation } -// GetChecks returns the Checks field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecks) GetChecks() []*RequiredStatusCheck { - if r == nil || r.Checks == nil { +// GetOrg returns the Org field. +func (s *StarEvent) GetOrg() *Organization { + if s == nil { return nil } - return *r.Checks + return s.Org } -// GetContexts returns the Contexts field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecks) GetContexts() []string { - if r == nil || r.Contexts == nil { +// GetRepo returns the Repo field. +func (s *StarEvent) GetRepo() *Repository { + if s == nil { return nil } - return *r.Contexts + return s.Repo } -// GetContextsURL returns the ContextsURL field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecks) GetContextsURL() string { - if r == nil || r.ContextsURL == nil { - return "" +// GetSender returns the Sender field. +func (s *StarEvent) GetSender() *User { + if s == nil { + return nil } - return *r.ContextsURL + return s.Sender } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecks) GetURL() string { - if r == nil || r.URL == nil { - return "" +// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. +func (s *StarEvent) GetStarredAt() Timestamp { + if s == nil || s.StarredAt == nil { + return Timestamp{} } - return *r.URL + return *s.StarredAt } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecksEnforcementLevelChanges) GetFrom() string { - if r == nil || r.From == nil { - return "" +// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. +func (s *Stargazer) GetStarredAt() Timestamp { + if s == nil || s.StarredAt == nil { + return Timestamp{} } - return *r.From + return *s.StarredAt } -// GetStrict returns the Strict field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecksRequest) GetStrict() bool { - if r == nil || r.Strict == nil { - return false +// GetUser returns the User field. +func (s *Stargazer) GetUser() *User { + if s == nil { + return nil } - return *r.Strict + return s.User } -// GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. -func (r *RequiredStatusChecksRuleParameters) GetDoNotEnforceOnCreate() bool { - if r == nil || r.DoNotEnforceOnCreate == nil { - return false +// GetCount returns the Count field. +func (s *StargazerCount) GetCount() int { + if s == nil { + return 0 } - return *r.DoNotEnforceOnCreate + return s.Count } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (r *RequiredWorkflowSelectedRepos) GetTotalCount() int { - if r == nil || r.TotalCount == nil { - return 0 +// GetDays returns the Days slice if it's non-nil, nil otherwise. +func (s *StargazerHistory) GetDays() []int { + if s == nil || s.Days == nil { + return nil } - return *r.TotalCount + return s.Days } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *ReviewersRequest) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" +// GetTotal returns the Total field. +func (s *StargazerHistory) GetTotal() int { + if s == nil { + return 0 } - return *r.NodeID + return s.Total } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (r *ReviewPersonalAccessTokenRequestOptions) GetReason() string { - if r == nil || r.Reason == nil { - return "" +// GetWeek returns the Week field. +func (s *StargazerHistory) GetWeek() Timestamp { + if s == nil { + return Timestamp{} } - return *r.Reason + return s.Week } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (r *Rule) GetDescription() string { - if r == nil || r.Description == nil { - return "" +// GetRepository returns the Repository field. +func (s *StarredRepository) GetRepository() *Repository { + if s == nil { + return nil } - return *r.Description + return s.Repository } -// GetFullDescription returns the FullDescription field if it's non-nil, zero value otherwise. -func (r *Rule) GetFullDescription() string { - if r == nil || r.FullDescription == nil { - return "" +// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. +func (s *StarredRepository) GetStarredAt() Timestamp { + if s == nil || s.StarredAt == nil { + return Timestamp{} } - return *r.FullDescription + return *s.StarredAt } -// GetHelp returns the Help field if it's non-nil, zero value otherwise. -func (r *Rule) GetHelp() string { - if r == nil || r.Help == nil { - return "" +// GetBranches returns the Branches slice if it's non-nil, nil otherwise. +func (s *StatusEvent) GetBranches() []*Branch { + if s == nil || s.Branches == nil { + return nil } - return *r.Help + return s.Branches } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Rule) GetID() string { - if r == nil || r.ID == nil { - return "" +// GetCommit returns the Commit field. +func (s *StatusEvent) GetCommit() *RepositoryCommit { + if s == nil { + return nil } - return *r.ID + return s.Commit } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *Rule) GetName() string { - if r == nil || r.Name == nil { +// GetContext returns the Context field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetContext() string { + if s == nil || s.Context == nil { return "" } - return *r.Name + return *s.Context } -// GetSecuritySeverityLevel returns the SecuritySeverityLevel field if it's non-nil, zero value otherwise. -func (r *Rule) GetSecuritySeverityLevel() string { - if r == nil || r.SecuritySeverityLevel == nil { - return "" +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} } - return *r.SecuritySeverityLevel + return *s.CreatedAt } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (r *Rule) GetSeverity() string { - if r == nil || r.Severity == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetDescription() string { + if s == nil || s.Description == nil { return "" } - return *r.Severity + return *s.Description } -// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. -func (r *RuleStatusCheck) GetIntegrationID() int64 { - if r == nil || r.IntegrationID == nil { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetID() int64 { + if s == nil || s.ID == nil { return 0 } - return *r.IntegrationID + return *s.ID } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (r *RuleWorkflow) GetRef() string { - if r == nil || r.Ref == nil { - return "" +// GetInstallation returns the Installation field. +func (s *StatusEvent) GetInstallation() *Installation { + if s == nil { + return nil } - return *r.Ref + return s.Installation } -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (r *RuleWorkflow) GetRepositoryID() int64 { - if r == nil || r.RepositoryID == nil { - return 0 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetName() string { + if s == nil || s.Name == nil { + return "" } - return *r.RepositoryID + return *s.Name } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (r *RuleWorkflow) GetSHA() string { - if r == nil || r.SHA == nil { - return "" +// GetOrg returns the Org field. +func (s *StatusEvent) GetOrg() *Organization { + if s == nil { + return nil } - return *r.SHA + return s.Org } -// GetBusy returns the Busy field if it's non-nil, zero value otherwise. -func (r *Runner) GetBusy() bool { - if r == nil || r.Busy == nil { - return false +// GetRepo returns the Repo field. +func (s *StatusEvent) GetRepo() *Repository { + if s == nil { + return nil } - return *r.Busy + return s.Repo } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Runner) GetID() int64 { - if r == nil || r.ID == nil { - return 0 +// GetSender returns the Sender field. +func (s *StatusEvent) GetSender() *User { + if s == nil { + return nil } - return *r.ID + return s.Sender } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *Runner) GetName() string { - if r == nil || r.Name == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetSHA() string { + if s == nil || s.SHA == nil { return "" } - return *r.Name + return *s.SHA } -// GetOS returns the OS field if it's non-nil, zero value otherwise. -func (r *Runner) GetOS() string { - if r == nil || r.OS == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetState() string { + if s == nil || s.State == nil { return "" } - return *r.OS + return *s.State } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (r *Runner) GetStatus() string { - if r == nil || r.Status == nil { +// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetTargetURL() string { + if s == nil || s.TargetURL == nil { return "" } - return *r.Status + return *s.TargetURL } -// GetArchitecture returns the Architecture field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetArchitecture() string { - if r == nil || r.Architecture == nil { - return "" +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *StatusEvent) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { + return Timestamp{} } - return *r.Architecture + return *s.UpdatedAt } -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetDownloadURL() string { - if r == nil || r.DownloadURL == nil { - return "" +// GetDaysLeftInBillingCycle returns the DaysLeftInBillingCycle field. +func (s *StorageBilling) GetDaysLeftInBillingCycle() int { + if s == nil { + return 0 } - return *r.DownloadURL + return s.DaysLeftInBillingCycle } -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetFilename() string { - if r == nil || r.Filename == nil { - return "" +// GetEstimatedPaidStorageForMonth returns the EstimatedPaidStorageForMonth field. +func (s *StorageBilling) GetEstimatedPaidStorageForMonth() int { + if s == nil { + return 0 } - return *r.Filename + return s.EstimatedPaidStorageForMonth } -// GetOS returns the OS field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetOS() string { - if r == nil || r.OS == nil { - return "" +// GetEstimatedStorageForMonth returns the EstimatedStorageForMonth field. +func (s *StorageBilling) GetEstimatedStorageForMonth() int { + if s == nil { + return 0 } - return *r.OS + return s.EstimatedStorageForMonth } -// GetSHA256Checksum returns the SHA256Checksum field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetSHA256Checksum() string { - if r == nil || r.SHA256Checksum == nil { - return "" +// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. +func (s *SubIssueRequest) GetAfterID() int64 { + if s == nil || s.AfterID == nil { + return 0 } - return *r.SHA256Checksum + return *s.AfterID } -// GetTempDownloadToken returns the TempDownloadToken field if it's non-nil, zero value otherwise. -func (r *RunnerApplicationDownload) GetTempDownloadToken() string { - if r == nil || r.TempDownloadToken == nil { - return "" +// GetBeforeID returns the BeforeID field if it's non-nil, zero value otherwise. +func (s *SubIssueRequest) GetBeforeID() int64 { + if s == nil || s.BeforeID == nil { + return 0 } - return *r.TempDownloadToken + return *s.BeforeID } -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetAllowsPublicRepositories() bool { - if r == nil || r.AllowsPublicRepositories == nil { +// GetReplaceParent returns the ReplaceParent field if it's non-nil, zero value otherwise. +func (s *SubIssueRequest) GetReplaceParent() bool { + if s == nil || s.ReplaceParent == nil { return false } - return *r.AllowsPublicRepositories + return *s.ReplaceParent } -// GetDefault returns the Default field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetDefault() bool { - if r == nil || r.Default == nil { - return false +// GetSubIssueID returns the SubIssueID field. +func (s *SubIssueRequest) GetSubIssueID() int64 { + if s == nil { + return 0 } - return *r.Default + return s.SubIssueID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetID() int64 { - if r == nil || r.ID == nil { +// GetCompleted returns the Completed field if it's non-nil, zero value otherwise. +func (s *SubIssuesSummary) GetCompleted() int { + if s == nil || s.Completed == nil { return 0 } - return *r.ID + return *s.Completed } -// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetInherited() bool { - if r == nil || r.Inherited == nil { - return false +// GetPercentCompleted returns the PercentCompleted field if it's non-nil, zero value otherwise. +func (s *SubIssuesSummary) GetPercentCompleted() int { + if s == nil || s.PercentCompleted == nil { + return 0 } - return *r.Inherited + return *s.PercentCompleted } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetName() string { - if r == nil || r.Name == nil { - return "" +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (s *SubIssuesSummary) GetTotal() int { + if s == nil || s.Total == nil { + return 0 } - return *r.Name + return *s.Total } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetRestrictedToWorkflows() bool { - if r == nil || r.RestrictedToWorkflows == nil { - return false +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *Subscription) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} } - return *r.RestrictedToWorkflows + return *s.CreatedAt } -// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetRunnersURL() string { - if r == nil || r.RunnersURL == nil { - return "" +// GetIgnored returns the Ignored field if it's non-nil, zero value otherwise. +func (s *Subscription) GetIgnored() bool { + if s == nil || s.Ignored == nil { + return false } - return *r.RunnersURL + return *s.Ignored } -// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetSelectedRepositoriesURL() string { - if r == nil || r.SelectedRepositoriesURL == nil { +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (s *Subscription) GetReason() string { + if s == nil || s.Reason == nil { return "" } - return *r.SelectedRepositoriesURL + return *s.Reason } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetVisibility() string { - if r == nil || r.Visibility == nil { +// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. +func (s *Subscription) GetRepositoryURL() string { + if s == nil || s.RepositoryURL == nil { return "" } - return *r.Visibility + return *s.RepositoryURL } -// GetWorkflowRestrictionsReadOnly returns the WorkflowRestrictionsReadOnly field if it's non-nil, zero value otherwise. -func (r *RunnerGroup) GetWorkflowRestrictionsReadOnly() bool { - if r == nil || r.WorkflowRestrictionsReadOnly == nil { +// GetSubscribed returns the Subscribed field if it's non-nil, zero value otherwise. +func (s *Subscription) GetSubscribed() bool { + if s == nil || s.Subscribed == nil { return false } - return *r.WorkflowRestrictionsReadOnly -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *RunnerLabels) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID + return *s.Subscribed } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RunnerLabels) GetName() string { - if r == nil || r.Name == nil { +// GetThreadURL returns the ThreadURL field if it's non-nil, zero value otherwise. +func (s *Subscription) GetThreadURL() string { + if s == nil || s.ThreadURL == nil { return "" } - return *r.Name + return *s.ThreadURL } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (r *RunnerLabels) GetType() string { - if r == nil || r.Type == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *Subscription) GetURL() string { + if s == nil || s.URL == nil { return "" } - return *r.Type + return *s.URL } -// GetCheckoutURI returns the CheckoutURI field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetCheckoutURI() string { - if s == nil || s.CheckoutURI == nil { +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (s *SuspendUserRequest) GetReason() string { + if s == nil || s.Reason == nil { return "" } - return *s.CheckoutURI + return *s.Reason } -// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetCommitSHA() string { - if s == nil || s.CommitSHA == nil { - return "" +// GetNodes returns the Nodes slice if it's non-nil, nil otherwise. +func (s *SystemRequirements) GetNodes() []*SystemRequirementsNode { + if s == nil || s.Nodes == nil { + return nil } - return *s.CommitSHA + return s.Nodes } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetRef() string { - if s == nil || s.Ref == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SystemRequirements) GetStatus() string { + if s == nil || s.Status == nil { return "" } - return *s.Ref + return *s.Status } -// GetSarif returns the Sarif field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetSarif() string { - if s == nil || s.Sarif == nil { +// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. +func (s *SystemRequirementsNode) GetHostname() string { + if s == nil || s.Hostname == nil { return "" } - return *s.Sarif + return *s.Hostname } -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetStartedAt() Timestamp { - if s == nil || s.StartedAt == nil { - return Timestamp{} +// GetRolesStatus returns the RolesStatus slice if it's non-nil, nil otherwise. +func (s *SystemRequirementsNode) GetRolesStatus() []*SystemRequirementsNodeRoleStatus { + if s == nil || s.RolesStatus == nil { + return nil } - return *s.StartedAt + return s.RolesStatus } -// GetToolName returns the ToolName field if it's non-nil, zero value otherwise. -func (s *SarifAnalysis) GetToolName() string { - if s == nil || s.ToolName == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SystemRequirementsNode) GetStatus() string { + if s == nil || s.Status == nil { return "" } - return *s.ToolName + return *s.Status } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SarifID) GetID() string { - if s == nil || s.ID == nil { +// GetRole returns the Role field if it's non-nil, zero value otherwise. +func (s *SystemRequirementsNodeRoleStatus) GetRole() string { + if s == nil || s.Role == nil { return "" } - return *s.ID + return *s.Role } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SarifID) GetURL() string { - if s == nil || s.URL == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SystemRequirementsNodeRoleStatus) GetStatus() string { + if s == nil || s.Status == nil { return "" } - return *s.URL + return *s.Status } -// GetAnalysesURL returns the AnalysesURL field if it's non-nil, zero value otherwise. -func (s *SARIFUpload) GetAnalysesURL() string { - if s == nil || s.AnalysesURL == nil { +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (t *Tag) GetMessage() string { + if t == nil || t.Message == nil { return "" } - return *s.AnalysesURL + return *t.Message } -// GetProcessingStatus returns the ProcessingStatus field if it's non-nil, zero value otherwise. -func (s *SARIFUpload) GetProcessingStatus() string { - if s == nil || s.ProcessingStatus == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (t *Tag) GetNodeID() string { + if t == nil || t.NodeID == nil { return "" } - return *s.ProcessingStatus -} - -// GetSBOM returns the SBOM field. -func (s *SBOM) GetSBOM() *SBOMInfo { - if s == nil { - return nil - } - return s.SBOM -} - -// GetCreationInfo returns the CreationInfo field. -func (s *SBOMInfo) GetCreationInfo() *CreationInfo { - if s == nil { - return nil - } - return s.CreationInfo + return *t.NodeID } -// GetDataLicense returns the DataLicense field if it's non-nil, zero value otherwise. -func (s *SBOMInfo) GetDataLicense() string { - if s == nil || s.DataLicense == nil { - return "" +// GetObject returns the Object field. +func (t *Tag) GetObject() *GitObject { + if t == nil { + return nil } - return *s.DataLicense + return t.Object } -// GetDocumentNamespace returns the DocumentNamespace field if it's non-nil, zero value otherwise. -func (s *SBOMInfo) GetDocumentNamespace() string { - if s == nil || s.DocumentNamespace == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (t *Tag) GetSHA() string { + if t == nil || t.SHA == nil { return "" } - return *s.DocumentNamespace + return *t.SHA } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *SBOMInfo) GetName() string { - if s == nil || s.Name == nil { +// GetTag returns the Tag field if it's non-nil, zero value otherwise. +func (t *Tag) GetTag() string { + if t == nil || t.Tag == nil { return "" } - return *s.Name + return *t.Tag } -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (s *SBOMInfo) GetSPDXID() string { - if s == nil || s.SPDXID == nil { - return "" +// GetTagger returns the Tagger field. +func (t *Tag) GetTagger() *CommitAuthor { + if t == nil { + return nil } - return *s.SPDXID + return t.Tagger } -// GetSPDXVersion returns the SPDXVersion field if it's non-nil, zero value otherwise. -func (s *SBOMInfo) GetSPDXVersion() string { - if s == nil || s.SPDXVersion == nil { +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (t *Tag) GetURL() string { + if t == nil || t.URL == nil { return "" } - return *s.SPDXVersion + return *t.URL } -// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetAnalysisKey() string { - if s == nil || s.AnalysisKey == nil { - return "" +// GetVerification returns the Verification field. +func (t *Tag) GetVerification() *SignatureVerification { + if t == nil { + return nil } - return *s.AnalysisKey + return t.Verification } -// GetCategory returns the Category field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetCategory() string { - if s == nil || s.Category == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (t *TagProtection) GetID() int64 { + if t == nil || t.ID == nil { + return 0 } - return *s.Category + return *t.ID } -// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetCommitSHA() string { - if s == nil || s.CommitSHA == nil { +// GetPattern returns the Pattern field if it's non-nil, zero value otherwise. +func (t *TagProtection) GetPattern() string { + if t == nil || t.Pattern == nil { return "" } - return *s.CommitSHA + return *t.Pattern } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetCompletedAt() Timestamp { + if t == nil || t.CompletedAt == nil { return Timestamp{} } - return *s.CreatedAt + return *t.CompletedAt } -// GetDeletable returns the Deletable field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetDeletable() bool { - if s == nil || s.Deletable == nil { - return false +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetConclusion() string { + if t == nil || t.Conclusion == nil { + return "" } - return *s.Deletable + return *t.Conclusion } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetEnvironment() string { - if s == nil || s.Environment == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetName() string { + if t == nil || t.Name == nil { return "" } - return *s.Environment + return *t.Name } -// GetError returns the Error field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetError() string { - if s == nil || s.Error == nil { - return "" +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetNumber() int64 { + if t == nil || t.Number == nil { + return 0 } - return *s.Error + return *t.Number } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetID() int64 { - if s == nil || s.ID == nil { - return 0 +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetStartedAt() Timestamp { + if t == nil || t.StartedAt == nil { + return Timestamp{} } - return *s.ID + return *t.StartedAt } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetRef() string { - if s == nil || s.Ref == nil { +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (t *TaskStep) GetStatus() string { + if t == nil || t.Status == nil { return "" } - return *s.Ref + return *t.Status } -// GetResultsCount returns the ResultsCount field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetResultsCount() int { - if s == nil || s.ResultsCount == nil { - return 0 +// GetAccessSource returns the AccessSource field if it's non-nil, zero value otherwise. +func (t *Team) GetAccessSource() string { + if t == nil || t.AccessSource == nil { + return "" } - return *s.ResultsCount + return *t.AccessSource } -// GetRulesCount returns the RulesCount field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetRulesCount() int { - if s == nil || s.RulesCount == nil { - return 0 +// GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. +func (t *Team) GetAssignment() string { + if t == nil || t.Assignment == nil { + return "" } - return *s.RulesCount + return *t.Assignment } -// GetSarifID returns the SarifID field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetSarifID() string { - if s == nil || s.SarifID == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (t *Team) GetDescription() string { + if t == nil || t.Description == nil { return "" } - return *s.SarifID + return *t.Description } -// GetTool returns the Tool field. -func (s *ScanningAnalysis) GetTool() *Tool { - if s == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (t *Team) GetHTMLURL() string { + if t == nil || t.HTMLURL == nil { + return "" } - return s.Tool + return *t.HTMLURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetURL() string { - if s == nil || s.URL == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (t *Team) GetID() int64 { + if t == nil || t.ID == nil { + return 0 } - return *s.URL + return *t.ID } -// GetWarning returns the Warning field if it's non-nil, zero value otherwise. -func (s *ScanningAnalysis) GetWarning() string { - if s == nil || s.Warning == nil { +// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. +func (t *Team) GetLDAPDN() string { + if t == nil || t.LDAPDN == nil { return "" } - return *s.Warning + return *t.LDAPDN } -// GetDisplay returns the Display field if it's non-nil, zero value otherwise. -func (s *SCIMDisplayReference) GetDisplay() string { - if s == nil || s.Display == nil { +// GetMembersCount returns the MembersCount field if it's non-nil, zero value otherwise. +func (t *Team) GetMembersCount() int { + if t == nil || t.MembersCount == nil { + return 0 + } + return *t.MembersCount +} + +// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. +func (t *Team) GetMembersURL() string { + if t == nil || t.MembersURL == nil { return "" } - return *s.Display + return *t.MembersURL } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetDisplayName() string { - if s == nil || s.DisplayName == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (t *Team) GetName() string { + if t == nil || t.Name == nil { return "" } - return *s.DisplayName + return *t.Name } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetExternalID() string { - if s == nil || s.ExternalID == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (t *Team) GetNodeID() string { + if t == nil || t.NodeID == nil { return "" } - return *s.ExternalID + return *t.NodeID } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SCIMGroupAttributes) GetID() string { - if s == nil || s.ID == nil { +// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. +func (t *Team) GetNotificationSetting() string { + if t == nil || t.NotificationSetting == nil { return "" } - return *s.ID + return *t.NotificationSetting } -// GetMeta returns the Meta field. -func (s *SCIMGroupAttributes) GetMeta() *SCIMMeta { - if s == nil { +// GetOrganization returns the Organization field. +func (t *Team) GetOrganization() *Organization { + if t == nil { return nil } - return s.Meta + return t.Organization } -// GetCreated returns the Created field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetCreated() Timestamp { - if s == nil || s.Created == nil { - return Timestamp{} +// GetParent returns the Parent field. +func (t *Team) GetParent() *Team { + if t == nil { + return nil } - return *s.Created + return t.Parent } -// GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetLastModified() Timestamp { - if s == nil || s.LastModified == nil { - return Timestamp{} +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (t *Team) GetPermission() string { + if t == nil || t.Permission == nil { + return "" } - return *s.LastModified + return *t.Permission } -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetLocation() string { - if s == nil || s.Location == nil { - return "" +// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. +func (t *Team) GetPermissions() map[string]bool { + if t == nil || t.Permissions == nil { + return map[string]bool{} } - return *s.Location + return t.Permissions } -// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. -func (s *SCIMMeta) GetResourceType() string { - if s == nil || s.ResourceType == nil { +// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. +func (t *Team) GetPrivacy() string { + if t == nil || t.Privacy == nil { return "" } - return *s.ResourceType + return *t.Privacy } -// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedGroups) GetItemsPerPage() int { - if s == nil || s.ItemsPerPage == nil { +// GetReposCount returns the ReposCount field if it's non-nil, zero value otherwise. +func (t *Team) GetReposCount() int { + if t == nil || t.ReposCount == nil { return 0 } - return *s.ItemsPerPage + return *t.ReposCount } -// 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 +// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. +func (t *Team) GetRepositoriesURL() string { + if t == nil || t.RepositoriesURL == nil { + return "" } - return *s.StartIndex + return *t.RepositoriesURL } -// 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 +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (t *Team) GetSlug() string { + if t == nil || t.Slug == nil { + return "" } - return *s.TotalResults + return *t.Slug } -// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedIdentities) GetItemsPerPage() int { - if s == nil || s.ItemsPerPage == nil { - return 0 +// 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 *s.ItemsPerPage + return *t.Type } -// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedIdentities) GetStartIndex() int { - if s == nil || s.StartIndex == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (t *Team) GetURL() string { + if t == nil || t.URL == nil { + return "" } - return *s.StartIndex + return *t.URL } -// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. -func (s *SCIMProvisionedIdentities) GetTotalResults() int { - if s == nil || s.TotalResults == nil { - return 0 +// GetInstallation returns the Installation field. +func (t *TeamAddEvent) GetInstallation() *Installation { + if t == nil { + return nil } - return *s.TotalResults + return t.Installation } -// GetActive returns the Active field if it's non-nil, zero value otherwise. -func (s *SCIMUserAttributes) GetActive() bool { - if s == nil || s.Active == nil { - return false +// GetOrg returns the Org field. +func (t *TeamAddEvent) GetOrg() *Organization { + if t == nil { + return nil } - return *s.Active + return t.Org } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (s *SCIMUserAttributes) GetDisplayName() string { - if s == nil || s.DisplayName == nil { - return "" +// GetRepo returns the Repo field. +func (t *TeamAddEvent) GetRepo() *Repository { + if t == nil { + return nil } - return *s.DisplayName + return t.Repo } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (s *SCIMUserAttributes) GetExternalID() string { - if s == nil || s.ExternalID == nil { - return "" +// GetSender returns the Sender field. +func (t *TeamAddEvent) GetSender() *User { + if t == nil { + return nil } - return *s.ExternalID + return t.Sender } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SCIMUserAttributes) GetID() string { - if s == nil || s.ID == nil { - return "" +// GetTeam returns the Team field. +func (t *TeamAddEvent) GetTeam() *Team { + if t == nil { + return nil } - return *s.ID + return t.Team } -// GetMeta returns the Meta field. -func (s *SCIMUserAttributes) GetMeta() *SCIMMeta { - if s == nil { +// GetDescription returns the Description field. +func (t *TeamChange) GetDescription() *TeamDescription { + if t == nil { return nil } - return s.Meta + return t.Description } -// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. -func (s *SCIMUserEmail) GetPrimary() bool { - if s == nil || s.Primary == nil { - return false +// GetName returns the Name field. +func (t *TeamChange) GetName() *TeamName { + if t == nil { + return nil } - return *s.Primary + return t.Name } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (s *SCIMUserEmail) GetType() string { - if s == nil || s.Type == nil { - return "" +// GetPrivacy returns the Privacy field. +func (t *TeamChange) GetPrivacy() *TeamPrivacy { + if t == nil { + return nil } - return *s.Type + return t.Privacy } -// GetFormatted returns the Formatted field if it's non-nil, zero value otherwise. -func (s *SCIMUserName) GetFormatted() string { - if s == nil || s.Formatted == nil { - return "" +// GetRepository returns the Repository field. +func (t *TeamChange) GetRepository() *TeamRepository { + if t == nil { + return nil } - return *s.Formatted + return t.Repository } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SecretScanning) GetStatus() string { - if s == nil || s.Status == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (t *TeamDescription) GetFrom() string { + if t == nil || t.From == nil { return "" } - return *s.Status + return *t.From } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} +// GetAuthor returns the Author field. +func (t *TeamDiscussion) GetAuthor() *User { + if t == nil { + return nil } - return *s.CreatedAt + return t.Author } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetHTMLURL() string { - if s == nil || s.HTMLURL == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetBody() string { + if t == nil || t.Body == nil { return "" } - return *s.HTMLURL + return *t.Body } -// GetLocationsURL returns the LocationsURL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetLocationsURL() string { - if s == nil || s.LocationsURL == nil { +// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetBodyHTML() string { + if t == nil || t.BodyHTML == nil { return "" } - return *s.LocationsURL + return *t.BodyHTML } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetNumber() int { - if s == nil || s.Number == nil { - return 0 +// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetBodyVersion() string { + if t == nil || t.BodyVersion == nil { + return "" } - return *s.Number + return *t.BodyVersion } -// GetPushProtectionBypassed returns the PushProtectionBypassed field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetPushProtectionBypassed() bool { - if s == nil || s.PushProtectionBypassed == nil { - return false +// GetCommentsCount returns the CommentsCount field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetCommentsCount() int { + if t == nil || t.CommentsCount == nil { + return 0 } - return *s.PushProtectionBypassed + return *t.CommentsCount } -// GetPushProtectionBypassedAt returns the PushProtectionBypassedAt field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetPushProtectionBypassedAt() Timestamp { - if s == nil || s.PushProtectionBypassedAt == nil { - return Timestamp{} +// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetCommentsURL() string { + if t == nil || t.CommentsURL == nil { + return "" } - return *s.PushProtectionBypassedAt + return *t.CommentsURL } -// GetPushProtectionBypassedBy returns the PushProtectionBypassedBy field. -func (s *SecretScanningAlert) GetPushProtectionBypassedBy() *User { - if s == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetCreatedAt() Timestamp { + if t == nil || t.CreatedAt == nil { + return Timestamp{} } - return s.PushProtectionBypassedBy + return *t.CreatedAt } -// GetRepository returns the Repository field. -func (s *SecretScanningAlert) GetRepository() *Repository { - if s == nil { - return nil +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetHTMLURL() string { + if t == nil || t.HTMLURL == nil { + return "" } - return s.Repository + return *t.HTMLURL } -// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetResolution() string { - if s == nil || s.Resolution == nil { - return "" +// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetLastEditedAt() Timestamp { + if t == nil || t.LastEditedAt == nil { + return Timestamp{} } - return *s.Resolution + return *t.LastEditedAt } -// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetResolutionComment() string { - if s == nil || s.ResolutionComment == nil { +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetNodeID() string { + if t == nil || t.NodeID == nil { return "" } - return *s.ResolutionComment + return *t.NodeID } -// GetResolvedAt returns the ResolvedAt field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetResolvedAt() Timestamp { - if s == nil || s.ResolvedAt == nil { - return Timestamp{} +// GetNumber returns the Number field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetNumber() int { + if t == nil || t.Number == nil { + return 0 } - return *s.ResolvedAt + return *t.Number } -// GetResolvedBy returns the ResolvedBy field. -func (s *SecretScanningAlert) GetResolvedBy() *User { - if s == nil { - return nil +// GetPinned returns the Pinned field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetPinned() bool { + if t == nil || t.Pinned == nil { + return false } - return s.ResolvedBy + return *t.Pinned } -// GetSecret returns the Secret field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetSecret() string { - if s == nil || s.Secret == nil { - return "" +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetPrivate() bool { + if t == nil || t.Private == nil { + return false } - return *s.Secret + return *t.Private } -// GetSecretType returns the SecretType field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetSecretType() string { - if s == nil || s.SecretType == nil { - return "" +// GetReactions returns the Reactions field. +func (t *TeamDiscussion) GetReactions() *Reactions { + if t == nil { + return nil } - return *s.SecretType + return t.Reactions } -// GetSecretTypeDisplayName returns the SecretTypeDisplayName field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetSecretTypeDisplayName() string { - if s == nil || s.SecretTypeDisplayName == nil { +// GetTeamURL returns the TeamURL field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetTeamURL() string { + if t == nil || t.TeamURL == nil { return "" } - return *s.SecretTypeDisplayName + return *t.TeamURL } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetState() string { - if s == nil || s.State == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (t *TeamDiscussion) GetTitle() string { + if t == nil || t.Title == nil { return "" } - return *s.State + return *t.Title } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetUpdatedAt() Timestamp { - if s == nil || s.UpdatedAt == nil { +func (t *TeamDiscussion) GetUpdatedAt() Timestamp { + if t == nil || t.UpdatedAt == nil { return Timestamp{} } - return *s.UpdatedAt + return *t.UpdatedAt } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlert) GetURL() string { - if s == nil || s.URL == nil { +func (t *TeamDiscussion) GetURL() string { + if t == nil || t.URL == nil { return "" } - return *s.URL + return *t.URL } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertEvent) GetAction() string { - if s == nil || s.Action == nil { +func (t *TeamEvent) GetAction() string { + if t == nil || t.Action == nil { return "" } - return *s.Action -} - -// GetAlert returns the Alert field. -func (s *SecretScanningAlertEvent) GetAlert() *SecretScanningAlert { - if s == nil { - return nil - } - return s.Alert + return *t.Action } -// GetEnterprise returns the Enterprise field. -func (s *SecretScanningAlertEvent) GetEnterprise() *Enterprise { - if s == nil { +// GetChanges returns the Changes field. +func (t *TeamEvent) GetChanges() *TeamChange { + if t == nil { return nil } - return s.Enterprise + return t.Changes } // GetInstallation returns the Installation field. -func (s *SecretScanningAlertEvent) GetInstallation() *Installation { - if s == nil { +func (t *TeamEvent) GetInstallation() *Installation { + if t == nil { return nil } - return s.Installation + return t.Installation } -// GetOrganization returns the Organization field. -func (s *SecretScanningAlertEvent) GetOrganization() *Organization { - if s == nil { +// GetOrg returns the Org field. +func (t *TeamEvent) GetOrg() *Organization { + if t == nil { return nil } - return s.Organization + return t.Org } // GetRepo returns the Repo field. -func (s *SecretScanningAlertEvent) GetRepo() *Repository { - if s == nil { +func (t *TeamEvent) GetRepo() *Repository { + if t == nil { return nil } - return s.Repo + return t.Repo } // GetSender returns the Sender field. -func (s *SecretScanningAlertEvent) GetSender() *User { - if s == nil { +func (t *TeamEvent) GetSender() *User { + if t == nil { return nil } - return s.Sender + return t.Sender } -// GetDetails returns the Details field. -func (s *SecretScanningAlertLocation) GetDetails() *SecretScanningAlertLocationDetails { - if s == nil { +// GetTeam returns the Team field. +func (t *TeamEvent) GetTeam() *Team { + if t == nil { return nil } - return s.Details + return t.Team } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocation) GetType() string { - if s == nil || s.Type == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetDescription() string { + if t == nil || t.Description == nil { return "" } - return *s.Type + return *t.Description } -// GetBlobSHA returns the BlobSHA field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetBlobSHA() string { - if s == nil || s.BlobSHA == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetID() int64 { + if t == nil || t.ID == nil { + return 0 } - return *s.BlobSHA + return *t.ID } -// GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetBlobURL() string { - if s == nil || s.BlobURL == nil { +// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetLDAPDN() string { + if t == nil || t.LDAPDN == nil { return "" } - return *s.BlobURL + return *t.LDAPDN } -// GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetCommitSHA() string { - if s == nil || s.CommitSHA == nil { +// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetMembersURL() string { + if t == nil || t.MembersURL == nil { return "" } - return *s.CommitSHA + return *t.MembersURL } -// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetCommitURL() string { - if s == nil || s.CommitURL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetName() string { + if t == nil || t.Name == nil { return "" } - return *s.CommitURL + return *t.Name } -// GetEndColumn returns the EndColumn field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetEndColumn() int { - if s == nil || s.EndColumn == nil { - return 0 +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetPermission() string { + if t == nil || t.Permission == nil { + return "" } - return *s.EndColumn + return *t.Permission } -// GetEndLine returns the EndLine field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetEndLine() int { - if s == nil || s.EndLine == nil { - return 0 +// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetPrivacy() string { + if t == nil || t.Privacy == nil { + return "" } - return *s.EndLine + return *t.Privacy } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetPath() string { - if s == nil || s.Path == nil { +// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetRepositoriesURL() string { + if t == nil || t.RepositoriesURL == nil { return "" } - return *s.Path + return *t.RepositoriesURL } -// GetPullRequestCommentURL returns the PullRequestCommentURL field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetPullRequestCommentURL() string { - if s == nil || s.PullRequestCommentURL == nil { +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetSlug() string { + if t == nil || t.Slug == nil { return "" } - return *s.PullRequestCommentURL + return *t.Slug } -// GetStartColumn returns the StartColumn field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetStartColumn() int { - if s == nil || s.StartColumn == nil { - return 0 +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (t *TeamLDAPMapping) GetURL() string { + if t == nil || t.URL == nil { + return "" } - return *s.StartColumn + return *t.URL } -// GetStartline returns the Startline field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationDetails) GetStartline() int { - if s == nil || s.Startline == nil { - return 0 +// GetRole returns the Role field. +func (t *TeamListTeamMembersOptions) GetRole() string { + if t == nil { + return "" } - return *s.Startline + return t.Role } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertLocationEvent) GetAction() string { - if s == nil || s.Action == nil { +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (t *TeamName) GetFrom() string { + if t == nil || t.From == nil { return "" } - return *s.Action + return *t.From } -// GetAlert returns the Alert field. -func (s *SecretScanningAlertLocationEvent) GetAlert() *SecretScanningAlert { - if s == nil { +// GetFrom returns the From field. +func (t *TeamPermissions) GetFrom() *TeamPermissionsFrom { + if t == nil { return nil } - return s.Alert + return t.From } -// GetInstallation returns the Installation field. -func (s *SecretScanningAlertLocationEvent) GetInstallation() *Installation { - if s == nil { - return nil +// GetAdmin returns the Admin field if it's non-nil, zero value otherwise. +func (t *TeamPermissionsFrom) GetAdmin() bool { + if t == nil || t.Admin == nil { + return false } - return s.Installation + return *t.Admin } -// GetLocation returns the Location field. -func (s *SecretScanningAlertLocationEvent) GetLocation() *SecretScanningAlertLocation { - if s == nil { - return nil +// GetPull returns the Pull field if it's non-nil, zero value otherwise. +func (t *TeamPermissionsFrom) GetPull() bool { + if t == nil || t.Pull == nil { + return false } - return s.Location + return *t.Pull } -// GetOrganization returns the Organization field. -func (s *SecretScanningAlertLocationEvent) GetOrganization() *Organization { - if s == nil { - return nil +// GetPush returns the Push field if it's non-nil, zero value otherwise. +func (t *TeamPermissionsFrom) GetPush() bool { + if t == nil || t.Push == nil { + return false } - return s.Organization + return *t.Push } -// GetRepo returns the Repo field. -func (s *SecretScanningAlertLocationEvent) GetRepo() *Repository { - if s == nil { - return nil +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (t *TeamPrivacy) GetFrom() string { + if t == nil || t.From == nil { + return "" } - return s.Repo + return *t.From } -// GetSender returns the Sender field. -func (s *SecretScanningAlertLocationEvent) GetSender() *User { - if s == nil { +// GetPermissions returns the Permissions field. +func (t *TeamRepository) GetPermissions() *TeamPermissions { + if t == nil { return nil } - return s.Sender + return t.Permissions } -// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertUpdateOptions) GetResolution() string { - if s == nil || s.Resolution == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (t *TemplateRepoRequest) GetDescription() string { + if t == nil || t.Description == nil { return "" } - return *s.Resolution + return *t.Description } -// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertUpdateOptions) GetResolutionComment() string { - if s == nil || s.ResolutionComment == nil { - return "" +// GetIncludeAllBranches returns the IncludeAllBranches field if it's non-nil, zero value otherwise. +func (t *TemplateRepoRequest) GetIncludeAllBranches() bool { + if t == nil || t.IncludeAllBranches == nil { + return false } - return *s.ResolutionComment + return *t.IncludeAllBranches } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SecretScanningPushProtection) GetStatus() string { - if s == nil || s.Status == nil { +// GetName returns the Name field. +func (t *TemplateRepoRequest) GetName() string { + if t == nil { return "" } - return *s.Status + return t.Name } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SecretScanningValidityChecks) GetStatus() string { - if s == nil || s.Status == nil { +// GetOwner returns the Owner field if it's non-nil, zero value otherwise. +func (t *TemplateRepoRequest) GetOwner() string { + if t == nil || t.Owner == nil { return "" } - return *s.Status + return *t.Owner } -// GetAuthor returns the Author field. -func (s *SecurityAdvisory) GetAuthor() *User { - if s == nil { - return nil +// GetPrivate returns the Private field if it's non-nil, zero value otherwise. +func (t *TemplateRepoRequest) GetPrivate() bool { + if t == nil || t.Private == nil { + return false } - return s.Author + return *t.Private } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetClosedAt() Timestamp { - if s == nil || s.ClosedAt == nil { - return Timestamp{} +// GetFragment returns the Fragment field if it's non-nil, zero value otherwise. +func (t *TextMatch) GetFragment() string { + if t == nil || t.Fragment == nil { + return "" } - return *s.ClosedAt + return *t.Fragment } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} +// GetMatches returns the Matches slice if it's non-nil, nil otherwise. +func (t *TextMatch) GetMatches() []*Match { + if t == nil || t.Matches == nil { + return nil } - return *s.CreatedAt + return t.Matches } -// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetCVEID() string { - if s == nil || s.CVEID == nil { +// GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise. +func (t *TextMatch) GetObjectType() string { + if t == nil || t.ObjectType == nil { return "" } - return *s.CVEID -} - -// GetCVSS returns the CVSS field. -func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { - if s == nil { - return nil - } - return s.CVSS + return *t.ObjectType } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetDescription() string { - if s == nil || s.Description == nil { +// GetObjectURL returns the ObjectURL field if it's non-nil, zero value otherwise. +func (t *TextMatch) GetObjectURL() string { + if t == nil || t.ObjectURL == nil { return "" } - return *s.Description + return *t.ObjectURL } -// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetGHSAID() string { - if s == nil || s.GHSAID == nil { +// GetProperty returns the Property field if it's non-nil, zero value otherwise. +func (t *TextMatch) GetProperty() string { + if t == nil || t.Property == nil { return "" } - return *s.GHSAID + return *t.Property } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetHTMLURL() string { - if s == nil || s.HTMLURL == nil { - return "" +// GetActor returns the Actor field. +func (t *Timeline) GetActor() *User { + if t == nil { + return nil } - return *s.HTMLURL + return t.Actor } -// GetPrivateFork returns the PrivateFork field. -func (s *SecurityAdvisory) GetPrivateFork() *Repository { - if s == nil { +// GetAssignee returns the Assignee field. +func (t *Timeline) GetAssignee() *User { + if t == nil { return nil } - return s.PrivateFork + return t.Assignee } -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetPublishedAt() Timestamp { - if s == nil || s.PublishedAt == nil { - return Timestamp{} +// GetAssigner returns the Assigner field. +func (t *Timeline) GetAssigner() *User { + if t == nil { + return nil } - return *s.PublishedAt + return t.Assigner } -// GetPublisher returns the Publisher field. -func (s *SecurityAdvisory) GetPublisher() *User { - if s == nil { +// GetAuthor returns the Author field. +func (t *Timeline) GetAuthor() *CommitAuthor { + if t == nil { return nil } - return s.Publisher + return t.Author } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetSeverity() string { - if s == nil || s.Severity == nil { +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (t *Timeline) GetBody() string { + if t == nil || t.Body == nil { return "" } - return *s.Severity + return *t.Body } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetState() string { - if s == nil || s.State == nil { +// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. +func (t *Timeline) GetCommitID() string { + if t == nil || t.CommitID == nil { return "" } - return *s.State + return *t.CommitID } -// GetSubmission returns the Submission field. -func (s *SecurityAdvisory) GetSubmission() *SecurityAdvisorySubmission { - if s == nil { +// GetCommitter returns the Committer field. +func (t *Timeline) GetCommitter() *CommitAuthor { + if t == nil { return nil } - return s.Submission + return t.Committer } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetSummary() string { - if s == nil || s.Summary == nil { +// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. +func (t *Timeline) GetCommitURL() string { + if t == nil || t.CommitURL == nil { return "" } - return *s.Summary + return *t.CommitURL } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetUpdatedAt() Timestamp { - if s == nil || s.UpdatedAt == nil { +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (t *Timeline) GetCreatedAt() Timestamp { + if t == nil || t.CreatedAt == nil { return Timestamp{} } - return *s.UpdatedAt + return *t.CreatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetURL() string { - if s == nil || s.URL == nil { +// GetEvent returns the Event field if it's non-nil, zero value otherwise. +func (t *Timeline) GetEvent() string { + if t == nil || t.Event == nil { return "" } - return *s.URL + return *t.Event } -// GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisory) GetWithdrawnAt() Timestamp { - if s == nil || s.WithdrawnAt == nil { - return Timestamp{} +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (t *Timeline) GetID() int64 { + if t == nil || t.ID == nil { + return 0 } - return *s.WithdrawnAt + return *t.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisoryEvent) GetAction() string { - if s == nil || s.Action == nil { - return "" +// GetLabel returns the Label field. +func (t *Timeline) GetLabel() *Label { + if t == nil { + return nil } - return *s.Action + return t.Label } -// GetEnterprise returns the Enterprise field. -func (s *SecurityAdvisoryEvent) GetEnterprise() *Enterprise { - if s == nil { - return nil +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (t *Timeline) GetMessage() string { + if t == nil || t.Message == nil { + return "" } - return s.Enterprise + return *t.Message } -// GetInstallation returns the Installation field. -func (s *SecurityAdvisoryEvent) GetInstallation() *Installation { - if s == nil { +// GetMilestone returns the Milestone field. +func (t *Timeline) GetMilestone() *Milestone { + if t == nil { return nil } - return s.Installation + return t.Milestone } -// GetOrganization returns the Organization field. -func (s *SecurityAdvisoryEvent) GetOrganization() *Organization { - if s == nil { +// GetParents returns the Parents slice if it's non-nil, nil otherwise. +func (t *Timeline) GetParents() []*Commit { + if t == nil || t.Parents == nil { return nil } - return s.Organization + return t.Parents } -// GetRepository returns the Repository field. -func (s *SecurityAdvisoryEvent) GetRepository() *Repository { - if s == nil { +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (t *Timeline) GetPerformedViaGithubApp() *App { + if t == nil { return nil } - return s.Repository + return t.PerformedViaGithubApp } -// GetSecurityAdvisory returns the SecurityAdvisory field. -func (s *SecurityAdvisoryEvent) GetSecurityAdvisory() *SecurityAdvisory { - if s == nil { +// GetRename returns the Rename field. +func (t *Timeline) GetRename() *Rename { + if t == nil { return nil } - return s.SecurityAdvisory + return t.Rename } -// GetSender returns the Sender field. -func (s *SecurityAdvisoryEvent) GetSender() *User { - if s == nil { +// GetRequestedTeam returns the RequestedTeam field. +func (t *Timeline) GetRequestedTeam() *Team { + if t == nil { return nil } - return s.Sender + return t.RequestedTeam } -// GetAccepted returns the Accepted field if it's non-nil, zero value otherwise. -func (s *SecurityAdvisorySubmission) GetAccepted() bool { - if s == nil || s.Accepted == nil { - return false +// GetRequester returns the Requester field. +func (t *Timeline) GetRequester() *User { + if t == nil { + return nil } - return *s.Accepted + return t.Requester } -// GetAdvancedSecurity returns the AdvancedSecurity field. -func (s *SecurityAndAnalysis) GetAdvancedSecurity() *AdvancedSecurity { - if s == nil { +// GetReviewer returns the Reviewer field. +func (t *Timeline) GetReviewer() *User { + if t == nil { return nil } - return s.AdvancedSecurity + return t.Reviewer } -// GetDependabotSecurityUpdates returns the DependabotSecurityUpdates field. -func (s *SecurityAndAnalysis) GetDependabotSecurityUpdates() *DependabotSecurityUpdates { - if s == nil { - return nil +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (t *Timeline) GetSHA() string { + if t == nil || t.SHA == nil { + return "" } - return s.DependabotSecurityUpdates + return *t.SHA } -// GetSecretScanning returns the SecretScanning field. -func (s *SecurityAndAnalysis) GetSecretScanning() *SecretScanning { - if s == nil { +// GetSource returns the Source field. +func (t *Timeline) GetSource() *Source { + if t == nil { return nil } - return s.SecretScanning + return t.Source } -// GetSecretScanningPushProtection returns the SecretScanningPushProtection field. -func (s *SecurityAndAnalysis) GetSecretScanningPushProtection() *SecretScanningPushProtection { - if s == nil { - return nil +// GetState returns the State field if it's non-nil, zero value otherwise. +func (t *Timeline) GetState() string { + if t == nil || t.State == nil { + return "" } - return s.SecretScanningPushProtection + return *t.State } -// GetSecretScanningValidityChecks returns the SecretScanningValidityChecks field. -func (s *SecurityAndAnalysis) GetSecretScanningValidityChecks() *SecretScanningValidityChecks { - if s == nil { - return nil +// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. +func (t *Timeline) GetSubmittedAt() Timestamp { + if t == nil || t.SubmittedAt == nil { + return Timestamp{} } - return s.SecretScanningValidityChecks + return *t.SubmittedAt } -// GetFrom returns the From field. -func (s *SecurityAndAnalysisChange) GetFrom() *SecurityAndAnalysisChangeFrom { - if s == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (t *Timeline) GetURL() string { + if t == nil || t.URL == nil { + return "" } - return s.From + return *t.URL } -// GetSecurityAndAnalysis returns the SecurityAndAnalysis field. -func (s *SecurityAndAnalysisChangeFrom) GetSecurityAndAnalysis() *SecurityAndAnalysis { - if s == nil { +// GetUser returns the User field. +func (t *Timeline) GetUser() *User { + if t == nil { return nil } - return s.SecurityAndAnalysis + return t.User } -// GetChanges returns the Changes field. -func (s *SecurityAndAnalysisEvent) GetChanges() *SecurityAndAnalysisChange { - if s == nil { - return nil +// GetGUID returns the GUID field if it's non-nil, zero value otherwise. +func (t *Tool) GetGUID() string { + if t == nil || t.GUID == nil { + return "" } - return s.Changes + return *t.GUID } -// GetEnterprise returns the Enterprise field. -func (s *SecurityAndAnalysisEvent) GetEnterprise() *Enterprise { - if s == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (t *Tool) GetName() string { + if t == nil || t.Name == nil { + return "" } - return s.Enterprise + return *t.Name } -// GetInstallation returns the Installation field. -func (s *SecurityAndAnalysisEvent) GetInstallation() *Installation { - if s == nil { - return nil +// GetVersion returns the Version field if it's non-nil, zero value otherwise. +func (t *Tool) GetVersion() string { + if t == nil || t.Version == nil { + return "" } - return s.Installation + return *t.Version } -// GetOrganization returns the Organization field. -func (s *SecurityAndAnalysisEvent) GetOrganization() *Organization { - if s == nil { - return nil +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetCreatedAt() Timestamp { + if t == nil || t.CreatedAt == nil { + return Timestamp{} } - return s.Organization + return *t.CreatedAt } -// GetRepository returns the Repository field. -func (s *SecurityAndAnalysisEvent) GetRepository() *Repository { - if s == nil { - return nil +// GetCreatedBy returns the CreatedBy field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetCreatedBy() string { + if t == nil || t.CreatedBy == nil { + return "" } - return s.Repository + return *t.CreatedBy } -// GetSender returns the Sender field. -func (s *SecurityAndAnalysisEvent) GetSender() *User { - if s == nil { - return nil +// GetCurated returns the Curated field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetCurated() bool { + if t == nil || t.Curated == nil { + return false } - return s.Sender + return *t.Curated } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (s *SelectedReposList) GetTotalCount() int { - if s == nil || s.TotalCount == nil { - return 0 +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetDescription() string { + if t == nil || t.Description == nil { + return "" } - return *s.TotalCount + return *t.Description } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { - if s == nil || s.From == nil { +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetDisplayName() string { + if t == nil || t.DisplayName == nil { return "" } - return *s.From + return *t.DisplayName } -// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. -func (s *SignaturesProtectedBranch) GetEnabled() bool { - if s == nil || s.Enabled == nil { +// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetFeatured() bool { + if t == nil || t.Featured == nil { return false } - return *s.Enabled + return *t.Featured } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SignaturesProtectedBranch) GetURL() string { - if s == nil || s.URL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetName() string { + if t == nil || t.Name == nil { return "" } - return *s.URL + return *t.Name } -// GetPayload returns the Payload field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetPayload() string { - if s == nil || s.Payload == nil { - return "" +// GetScore returns the Score field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetScore() float64 { + if t == nil || t.Score == nil { + return 0 } - return *s.Payload + return *t.Score } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetReason() string { - if s == nil || s.Reason == nil { +// GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetShortDescription() string { + if t == nil || t.ShortDescription == nil { return "" } - return *s.Reason + return *t.ShortDescription } -// GetSignature returns the Signature field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetSignature() string { - if s == nil || s.Signature == nil { +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (t *TopicResult) GetUpdatedAt() string { + if t == nil || t.UpdatedAt == nil { return "" } - return *s.Signature + return *t.UpdatedAt } -// GetVerified returns the Verified field if it's non-nil, zero value otherwise. -func (s *SignatureVerification) GetVerified() bool { - if s == nil || s.Verified == nil { +// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. +func (t *TopicsSearchResult) GetIncompleteResults() bool { + if t == nil || t.IncompleteResults == nil { return false } - return *s.Verified + return *t.IncompleteResults } -// GetActor returns the Actor field. -func (s *Source) GetActor() *User { - if s == nil { +// GetTopics returns the Topics slice if it's non-nil, nil otherwise. +func (t *TopicsSearchResult) GetTopics() []*TopicResult { + if t == nil || t.Topics == nil { return nil } - return s.Actor + return t.Topics } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *Source) GetID() int64 { - if s == nil || s.ID == nil { +// GetTotal returns the Total field if it's non-nil, zero value otherwise. +func (t *TopicsSearchResult) GetTotal() int { + if t == nil || t.Total == nil { return 0 } - return *s.ID + return *t.Total } -// GetIssue returns the Issue field. -func (s *Source) GetIssue() *Issue { - if s == nil { - return nil +// GetTotalActiveCachesCount returns the TotalActiveCachesCount field. +func (t *TotalCacheUsage) GetTotalActiveCachesCount() int { + if t == nil { + return 0 } - return s.Issue + return t.TotalActiveCachesCount } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (s *Source) GetType() string { - if s == nil || s.Type == nil { - return "" +// GetTotalActiveCachesUsageSizeInBytes returns the TotalActiveCachesUsageSizeInBytes field. +func (t *TotalCacheUsage) GetTotalActiveCachesUsageSizeInBytes() int64 { + if t == nil { + return 0 } - return *s.Type + return t.TotalActiveCachesUsageSizeInBytes } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *Source) GetURL() string { - if s == nil || s.URL == nil { +// GetPer returns the Per field. +func (t *TrafficBreakdownOptions) GetPer() string { + if t == nil { return "" } - return *s.URL + return t.Per } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetEmail() string { - if s == nil || s.Email == nil { - return "" +// GetClones returns the Clones slice if it's non-nil, nil otherwise. +func (t *TrafficClones) GetClones() []*TrafficData { + if t == nil || t.Clones == nil { + return nil } - return *s.Email + return t.Clones } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetID() int64 { - if s == nil || s.ID == nil { +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (t *TrafficClones) GetCount() int { + if t == nil || t.Count == nil { return 0 } - return *s.ID + return *t.Count } -// GetImportURL returns the ImportURL field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetImportURL() string { - if s == nil || s.ImportURL == nil { - return "" +// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. +func (t *TrafficClones) GetUniques() int { + if t == nil || t.Uniques == nil { + return 0 } - return *s.ImportURL + return *t.Uniques } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetName() string { - if s == nil || s.Name == nil { - return "" +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (t *TrafficData) GetCount() int { + if t == nil || t.Count == nil { + return 0 } - return *s.Name + return *t.Count } -// GetRemoteID returns the RemoteID field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetRemoteID() string { - if s == nil || s.RemoteID == nil { - return "" +// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. +func (t *TrafficData) GetTimestamp() Timestamp { + if t == nil || t.Timestamp == nil { + return Timestamp{} } - return *s.RemoteID + return *t.Timestamp } -// GetRemoteName returns the RemoteName field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetRemoteName() string { - if s == nil || s.RemoteName == nil { - return "" +// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. +func (t *TrafficData) GetUniques() int { + if t == nil || t.Uniques == nil { + return 0 } - return *s.RemoteName + return *t.Uniques } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *SourceImportAuthor) GetURL() string { - if s == nil || s.URL == nil { - return "" +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (t *TrafficPath) GetCount() int { + if t == nil || t.Count == nil { + return 0 } - return *s.URL + return *t.Count } -// GetPrivacyLevel returns the PrivacyLevel field if it's non-nil, zero value otherwise. -func (s *SponsorshipChanges) GetPrivacyLevel() string { - if s == nil || s.PrivacyLevel == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (t *TrafficPath) GetPath() string { + if t == nil || t.Path == nil { return "" } - return *s.PrivacyLevel + return *t.Path } -// GetTier returns the Tier field. -func (s *SponsorshipChanges) GetTier() *SponsorshipTier { - if s == nil { - return nil +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (t *TrafficPath) GetTitle() string { + if t == nil || t.Title == nil { + return "" } - return s.Tier + return *t.Title } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *SponsorshipEvent) GetAction() string { - if s == nil || s.Action == nil { - return "" +// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. +func (t *TrafficPath) GetUniques() int { + if t == nil || t.Uniques == nil { + return 0 } - return *s.Action + return *t.Uniques } -// GetChanges returns the Changes field. -func (s *SponsorshipEvent) GetChanges() *SponsorshipChanges { - if s == nil { - return nil +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (t *TrafficReferrer) GetCount() int { + if t == nil || t.Count == nil { + return 0 } - return s.Changes + return *t.Count } -// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise. -func (s *SponsorshipEvent) GetEffectiveDate() string { - if s == nil || s.EffectiveDate == nil { +// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. +func (t *TrafficReferrer) GetReferrer() string { + if t == nil || t.Referrer == nil { return "" } - return *s.EffectiveDate + return *t.Referrer } -// GetInstallation returns the Installation field. -func (s *SponsorshipEvent) GetInstallation() *Installation { - if s == nil { - return nil +// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. +func (t *TrafficReferrer) GetUniques() int { + if t == nil || t.Uniques == nil { + return 0 } - return s.Installation + return *t.Uniques } -// GetOrganization returns the Organization field. -func (s *SponsorshipEvent) GetOrganization() *Organization { - if s == nil { - return nil +// GetCount returns the Count field if it's non-nil, zero value otherwise. +func (t *TrafficViews) GetCount() int { + if t == nil || t.Count == nil { + return 0 } - return s.Organization + return *t.Count } -// GetRepository returns the Repository field. -func (s *SponsorshipEvent) GetRepository() *Repository { - if s == nil { - return nil +// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. +func (t *TrafficViews) GetUniques() int { + if t == nil || t.Uniques == nil { + return 0 } - return s.Repository + return *t.Uniques } -// GetSender returns the Sender field. -func (s *SponsorshipEvent) GetSender() *User { - if s == nil { +// GetViews returns the Views slice if it's non-nil, nil otherwise. +func (t *TrafficViews) GetViews() []*TrafficData { + if t == nil || t.Views == nil { return nil } - return s.Sender + return t.Views } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (s *SponsorshipTier) GetFrom() string { - if s == nil || s.From == nil { +// GetNewName returns the NewName field if it's non-nil, zero value otherwise. +func (t *TransferRequest) GetNewName() string { + if t == nil || t.NewName == nil { return "" } - return *s.From + return *t.NewName } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (s *SSHKeyStatus) GetHostname() string { - if s == nil || s.Hostname == nil { +// GetNewOwner returns the NewOwner field. +func (t *TransferRequest) GetNewOwner() string { + if t == nil { return "" } - return *s.Hostname + return t.NewOwner } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (s *SSHKeyStatus) GetMessage() string { - if s == nil || s.Message == nil { - return "" +// GetTeamID returns the TeamID slice if it's non-nil, nil otherwise. +func (t *TransferRequest) GetTeamID() []int64 { + if t == nil || t.TeamID == nil { + return nil } - return *s.Message + return t.TeamID } -// GetModified returns the Modified field if it's non-nil, zero value otherwise. -func (s *SSHKeyStatus) GetModified() bool { - if s == nil || s.Modified == nil { - return false +// GetEntries returns the Entries slice if it's non-nil, nil otherwise. +func (t *Tree) GetEntries() []*TreeEntry { + if t == nil || t.Entries == nil { + return nil } - return *s.Modified + return t.Entries } -// GetUUID returns the UUID field if it's non-nil, zero value otherwise. -func (s *SSHKeyStatus) GetUUID() string { - if s == nil || s.UUID == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (t *Tree) GetSHA() string { + if t == nil || t.SHA == nil { return "" } - return *s.UUID + return *t.SHA } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *SSHSigningKey) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} +// GetTruncated returns the Truncated field if it's non-nil, zero value otherwise. +func (t *Tree) GetTruncated() bool { + if t == nil || t.Truncated == nil { + return false } - return *s.CreatedAt + return *t.Truncated } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *SSHSigningKey) GetID() int64 { - if s == nil || s.ID == nil { - return 0 +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetContent() string { + if t == nil || t.Content == nil { + return "" } - return *s.ID + return *t.Content } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (s *SSHSigningKey) GetKey() string { - if s == nil || s.Key == nil { +// GetMode returns the Mode field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetMode() string { + if t == nil || t.Mode == nil { return "" } - return *s.Key + return *t.Mode } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (s *SSHSigningKey) GetTitle() string { - if s == nil || s.Title == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetPath() string { + if t == nil || t.Path == nil { return "" } - return *s.Title + return *t.Path } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (s *StarEvent) GetAction() string { - if s == nil || s.Action == nil { +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetSHA() string { + if t == nil || t.SHA == nil { return "" } - return *s.Action + return *t.SHA } -// GetInstallation returns the Installation field. -func (s *StarEvent) GetInstallation() *Installation { - if s == nil { - return nil +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetSize() int { + if t == nil || t.Size == nil { + return 0 } - return s.Installation + return *t.Size } -// GetOrg returns the Org field. -func (s *StarEvent) GetOrg() *Organization { - if s == nil { - return nil +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetType() string { + if t == nil || t.Type == nil { + return "" } - return s.Org + return *t.Type } -// GetRepo returns the Repo field. -func (s *StarEvent) GetRepo() *Repository { - if s == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (t *TreeEntry) GetURL() string { + if t == nil || t.URL == nil { + return "" } - return s.Repo + return *t.URL } -// GetSender returns the Sender field. -func (s *StarEvent) GetSender() *User { - if s == nil { - return nil +// GetClientID returns the ClientID field. +func (u *UnauthenticatedRateLimitedTransport) GetClientID() string { + if u == nil { + return "" } - return s.Sender + return u.ClientID } -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *StarEvent) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} +// GetClientSecret returns the ClientSecret field. +func (u *UnauthenticatedRateLimitedTransport) GetClientSecret() string { + if u == nil { + return "" } - return *s.StarredAt + return u.ClientSecret } -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *Stargazer) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (u *UnsuspendUserRequest) GetReason() string { + if u == nil || u.Reason == nil { + return "" } - return *s.StarredAt + return *u.Reason } -// GetUser returns the User field. -func (s *Stargazer) GetUser() *User { - if s == nil { +// GetConditions returns the Conditions field. +func (u *UpdateActionsPolicyRequest) GetConditions() *ActionsPolicyConditions { + if u == nil { return nil } - return s.User + return u.Conditions } -// GetRepository returns the Repository field. -func (s *StarredRepository) GetRepository() *Repository { - if s == nil { +// GetEnforcement returns the Enforcement field. +func (u *UpdateActionsPolicyRequest) GetEnforcement() *RulesetEnforcement { + if u == nil { return nil } - return s.Repository + return u.Enforcement } -// GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise. -func (s *StarredRepository) GetStarredAt() Timestamp { - if s == nil || s.StarredAt == nil { - return Timestamp{} +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateActionsPolicyRequest) GetName() string { + if u == nil || u.Name == nil { + return "" + } + return *u.Name +} + +// GetRules returns the Rules slice if it's non-nil, nil otherwise. +func (u *UpdateActionsPolicyRequest) GetRules() []*ActionsPolicyRule { + if u == nil || u.Rules == nil { + return nil } - return *s.StarredAt + return u.Rules } -// GetCommit returns the Commit field. -func (s *StatusEvent) GetCommit() *RepositoryCommit { - if s == nil { +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (u *UpdateAppInstallationRepositoriesRequest) GetRepositories() []string { + if u == nil || u.Repositories == nil { return nil } - return s.Commit + return u.Repositories } -// GetContext returns the Context field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetContext() string { - if s == nil || s.Context == nil { +// GetRepositorySelection returns the RepositorySelection field. +func (u *UpdateAppInstallationRepositoriesRequest) GetRepositorySelection() string { + if u == nil { return "" } - return *s.Context + return u.RepositorySelection } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} +// GetOp returns the Op field. +func (u *UpdateAttributeForSCIMUserOperations) GetOp() string { + if u == nil { + return "" } - return *s.CreatedAt + return u.Op } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetDescription() string { - if s == nil || s.Description == nil { +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { + if u == nil || u.Path == nil { return "" } - return *s.Description + return *u.Path } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetID() int64 { - if s == nil || s.ID == nil { - return 0 +// GetValue returns the Value field. +func (u *UpdateAttributeForSCIMUserOperations) GetValue() json.RawMessage { + if u == nil { + return json.RawMessage{} } - return *s.ID + return u.Value } -// GetInstallation returns the Installation field. -func (s *StatusEvent) GetInstallation() *Installation { - if s == nil { +// GetOperations returns the Operations slice if it's non-nil, nil otherwise. +func (u *UpdateAttributeForSCIMUserRequest) GetOperations() []*UpdateAttributeForSCIMUserOperations { + if u == nil || u.Operations == nil { return nil } - return s.Installation + return u.Operations } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetName() string { - if s == nil || s.Name == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (u *UpdateAttributeForSCIMUserRequest) GetSchemas() []string { + if u == nil || u.Schemas == nil { + return nil } - return *s.Name + return u.Schemas } -// GetOrg returns the Org field. -func (s *StatusEvent) GetOrg() *Organization { - if s == nil { - return nil +// GetParameters returns the Parameters field. +func (u *UpdateBranchRule) GetParameters() UpdateRuleParameters { + if u == nil { + return UpdateRuleParameters{} } - return s.Org + return u.Parameters } -// GetRepo returns the Repo field. -func (s *StatusEvent) GetRepo() *Repository { - if s == nil { +// GetActions returns the Actions slice if it's non-nil, nil otherwise. +func (u *UpdateCheckRunOptions) GetActions() []*CheckRunAction { + if u == nil || u.Actions == nil { return nil } - return s.Repo + return u.Actions } -// GetSender returns the Sender field. -func (s *StatusEvent) GetSender() *User { - if s == nil { - return nil +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { + if u == nil || u.CompletedAt == nil { + return Timestamp{} } - return s.Sender + return *u.CompletedAt } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetSHA() string { - if s == nil || s.SHA == nil { +// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetConclusion() string { + if u == nil || u.Conclusion == nil { return "" } - return *s.SHA + return *u.Conclusion } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetState() string { - if s == nil || s.State == nil { +// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetDetailsURL() string { + if u == nil || u.DetailsURL == nil { return "" } - return *s.State + return *u.DetailsURL } -// GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetTargetURL() string { - if s == nil || s.TargetURL == nil { +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetExternalID() string { + if u == nil || u.ExternalID == nil { return "" } - return *s.TargetURL + return *u.ExternalID } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (s *StatusEvent) GetUpdatedAt() Timestamp { - if s == nil || s.UpdatedAt == nil { - return Timestamp{} +// GetName returns the Name field. +func (u *UpdateCheckRunOptions) GetName() string { + if u == nil { + return "" } - return *s.UpdatedAt + return u.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (s *Subscription) GetCreatedAt() Timestamp { - if s == nil || s.CreatedAt == nil { - return Timestamp{} +// GetOutput returns the Output field. +func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput { + if u == nil { + return nil } - return *s.CreatedAt + return u.Output } -// GetIgnored returns the Ignored field if it's non-nil, zero value otherwise. -func (s *Subscription) GetIgnored() bool { - if s == nil || s.Ignored == nil { - return false +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (u *UpdateCheckRunOptions) GetStatus() string { + if u == nil || u.Status == nil { + return "" } - return *s.Ignored + return *u.Status } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (s *Subscription) GetReason() string { - if s == nil || s.Reason == nil { +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (u *UpdateCodespaceRequest) GetDisplayName() string { + if u == nil || u.DisplayName == nil { return "" } - return *s.Reason + return *u.DisplayName } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetRepositoryURL() string { - if s == nil || s.RepositoryURL == nil { +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (u *UpdateCodespaceRequest) GetMachine() string { + if u == nil || u.Machine == nil { return "" } - return *s.RepositoryURL + return *u.Machine } -// GetSubscribed returns the Subscribed field if it's non-nil, zero value otherwise. -func (s *Subscription) GetSubscribed() bool { - if s == nil || s.Subscribed == nil { - return false +// GetRecentFolders returns the RecentFolders slice if it's non-nil, nil otherwise. +func (u *UpdateCodespaceRequest) GetRecentFolders() []string { + if u == nil || u.RecentFolders == nil { + return nil } - return *s.Subscribed + return u.RecentFolders } -// GetThreadURL returns the ThreadURL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetThreadURL() string { - if s == nil || s.ThreadURL == nil { +// GetBody returns the Body field. +func (u *UpdateCommitCommentRequest) GetBody() string { + if u == nil { return "" } - return *s.ThreadURL + return u.Body } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (s *Subscription) GetURL() string { - if s == nil || s.URL == nil { - return "" +// GetGroupID returns the GroupID field. +func (u *UpdateConnectedExternalGroupRequest) GetGroupID() int64 { + if u == nil { + return 0 } - return *s.URL + return u.GroupID } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SystemRequirements) GetStatus() string { - if s == nil || s.Status == nil { - return "" +// GetDestroy returns the Destroy field if it's non-nil, zero value otherwise. +func (u *UpdateCopilotSpaceResourceAttributes) GetDestroy() bool { + if u == nil || u.Destroy == nil { + return false } - return *s.Status + return *u.Destroy } -// GetHostname returns the Hostname field if it's non-nil, zero value otherwise. -func (s *SystemRequirementsNode) GetHostname() string { - if s == nil || s.Hostname == nil { - return "" +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (u *UpdateCopilotSpaceResourceAttributes) GetID() int64 { + if u == nil || u.ID == nil { + return 0 } - return *s.Hostname + return *u.ID } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SystemRequirementsNode) GetStatus() string { - if s == nil || s.Status == nil { - return "" +// GetMetadata returns the Metadata field. +func (u *UpdateCopilotSpaceResourceAttributes) GetMetadata() *CopilotSpaceMetadata { + if u == nil { + return nil } - return *s.Status + return u.Metadata } -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (s *SystemRequirementsNodeRoleStatus) GetRole() string { - if s == nil || s.Role == nil { +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (u *UpdateCopilotSpaceResourceAttributes) GetResourceType() string { + if u == nil || u.ResourceType == nil { return "" } - return *s.Role + return *u.ResourceType } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (s *SystemRequirementsNodeRoleStatus) GetStatus() string { - if s == nil || s.Status == nil { +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetBaseRole() string { + if u == nil || u.BaseRole == nil { return "" } - return *s.Status + return *u.BaseRole } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (t *Tag) GetMessage() string { - if t == nil || t.Message == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.Message + return *u.Description } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *Tag) GetNodeID() string { - if t == nil || t.NodeID == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateCustomOrgRoleRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.NodeID + return *u.Name } -// GetObject returns the Object field. -func (t *Tag) GetObject() *GitObject { - if t == nil { +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (u *UpdateCustomOrgRoleRequest) GetPermissions() []string { + if u == nil || u.Permissions == nil { return nil } - return t.Object + return u.Permissions } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *Tag) GetSHA() string { - if t == nil || t.SHA == nil { +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (u *UpdateCustomRepoRoleRequest) GetBaseRole() string { + if u == nil || u.BaseRole == nil { return "" } - return *t.SHA + return *u.BaseRole } -// GetTag returns the Tag field if it's non-nil, zero value otherwise. -func (t *Tag) GetTag() string { - if t == nil || t.Tag == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateCustomRepoRoleRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.Tag -} - -// GetTagger returns the Tagger field. -func (t *Tag) GetTagger() *CommitAuthor { - if t == nil { - return nil - } - return t.Tagger + return *u.Description } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Tag) GetURL() string { - if t == nil || t.URL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateCustomRepoRoleRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.URL + return *u.Name } -// GetVerification returns the Verification field. -func (t *Tag) GetVerification() *SignatureVerification { - if t == nil { +// GetPermissions returns the Permissions slice if it's non-nil, nil otherwise. +func (u *UpdateCustomRepoRoleRequest) GetPermissions() []string { + if u == nil || u.Permissions == nil { return nil } - return t.Verification + return u.Permissions } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *TagProtection) GetID() int64 { - if t == nil || t.ID == nil { - return 0 +// GetLanguages returns the Languages slice if it's non-nil, nil otherwise. +func (u *UpdateDefaultSetupConfigurationOptions) GetLanguages() []string { + if u == nil || u.Languages == nil { + return nil } - return *t.ID + return u.Languages } -// GetPattern returns the Pattern field if it's non-nil, zero value otherwise. -func (t *TagProtection) GetPattern() string { - if t == nil || t.Pattern == nil { +// GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. +func (u *UpdateDefaultSetupConfigurationOptions) GetQuerySuite() string { + if u == nil || u.QuerySuite == nil { return "" } - return *t.Pattern + return *u.QuerySuite } -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetCompletedAt() Timestamp { - if t == nil || t.CompletedAt == nil { - return Timestamp{} +// GetState returns the State field. +func (u *UpdateDefaultSetupConfigurationOptions) GetState() string { + if u == nil { + return "" } - return *t.CompletedAt + return u.State } -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetConclusion() string { - if t == nil || t.Conclusion == nil { - return "" +// GetRunID returns the RunID field if it's non-nil, zero value otherwise. +func (u *UpdateDefaultSetupConfigurationResponse) GetRunID() int64 { + if u == nil || u.RunID == nil { + return 0 } - return *t.Conclusion + return *u.RunID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetName() string { - if t == nil || t.Name == nil { +// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. +func (u *UpdateDefaultSetupConfigurationResponse) GetRunURL() string { + if u == nil || u.RunURL == nil { return "" } - return *t.Name + return *u.RunURL } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetNumber() int64 { - if t == nil || t.Number == nil { - return 0 +// GetName returns the Name field. +func (u *UpdateDeploymentBranchPolicyRequest) GetName() string { + if u == nil { + return "" } - return *t.Number + return u.Name } -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetStartedAt() Timestamp { - if t == nil || t.StartedAt == nil { - return Timestamp{} +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if u == nil || u.AllowsPublicRepositories == nil { + return false } - return *t.StartedAt + return *u.AllowsPublicRepositories } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (t *TaskStep) GetStatus() string { - if t == nil || t.Status == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.Status + return *u.Name } -// GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. -func (t *Team) GetAssignment() string { - if t == nil || t.Assignment == nil { +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { return "" } - return *t.Assignment + return *u.NetworkConfigurationID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *Team) GetDescription() string { - if t == nil || t.Description == nil { - return "" +// GetRemoveNetworkConfiguration returns the RemoveNetworkConfiguration field. +func (u *UpdateEnterpriseRunnerGroupRequest) GetRemoveNetworkConfiguration() bool { + if u == nil { + return false } - return *t.Description + return u.RemoveNetworkConfiguration } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (t *Team) GetHTMLURL() string { - if t == nil || t.HTMLURL == nil { - return "" +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { + if u == nil || u.RestrictedToWorkflows == nil { + return false } - return *t.HTMLURL + return *u.RestrictedToWorkflows } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Team) GetID() int64 { - if t == nil || t.ID == nil { - return 0 +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetSelectedWorkflows() []string { + if u == nil || u.SelectedWorkflows == nil { + return nil } - return *t.ID + return u.SelectedWorkflows } -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (t *Team) GetLDAPDN() string { - if t == nil || t.LDAPDN == nil { +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { + if u == nil || u.Visibility == nil { return "" } - return *t.LDAPDN + return *u.Visibility } -// GetMembersCount returns the MembersCount field if it's non-nil, zero value otherwise. -func (t *Team) GetMembersCount() int { - if t == nil || t.MembersCount == nil { - return 0 +// GetBody returns the Body field. +func (u *UpdateGistCommentRequest) GetBody() string { + if u == nil { + return "" } - return *t.MembersCount + return u.Body } -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (t *Team) GetMembersURL() string { - if t == nil || t.MembersURL == nil { +// GetContent returns the Content field if it's non-nil, zero value otherwise. +func (u *UpdateGistFile) GetContent() string { + if u == nil || u.Content == nil { return "" } - return *t.MembersURL + return *u.Content } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *Team) GetName() string { - if t == nil || t.Name == nil { +// GetFilename returns the Filename field if it's non-nil, zero value otherwise. +func (u *UpdateGistFile) GetFilename() string { + if u == nil || u.Filename == nil { return "" } - return *t.Name + return *u.Filename } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *Team) GetNodeID() string { - if t == nil || t.NodeID == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateGistRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.NodeID + return *u.Description } -// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. -func (t *Team) GetNotificationSetting() string { - if t == nil || t.NotificationSetting == nil { - return "" +// 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 *t.NotificationSetting + return *u.EnableStaticIP } -// GetOrganization returns the Organization field. -func (t *Team) GetOrganization() *Organization { - if t == nil { - return nil +// GetImageGen returns the ImageGen field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetImageGen() bool { + if u == nil || u.ImageGen == nil { + return false } - return t.Organization + return *u.ImageGen } -// GetParent returns the Parent field. -func (t *Team) GetParent() *Team { - if t == nil { - return nil +// 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 t.Parent + return *u.ImageID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *Team) GetPermission() string { - if t == nil || t.Permission == nil { +// 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 *t.Permission + return *u.ImageVersion } -// GetPermissions returns the Permissions map if it's non-nil, an empty map otherwise. -func (t *Team) GetPermissions() map[string]bool { - if t == nil || t.Permissions == nil { - return map[string]bool{} +// 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 t.Permissions + return *u.MaximumRunners } -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (t *Team) GetPrivacy() string { - if t == nil || t.Privacy == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateHostedRunnerRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.Privacy + return *u.Name } -// GetReposCount returns the ReposCount field if it's non-nil, zero value otherwise. -func (t *Team) GetReposCount() int { - if t == nil || t.ReposCount == nil { +// 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 *t.ReposCount + return *u.RunnerGroupID } -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (t *Team) GetRepositoriesURL() string { - if t == nil || t.RepositoriesURL == 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 *t.RepositoriesURL + return *u.Size } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (t *Team) GetSlug() string { - if t == nil || t.Slug == nil { +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (u *UpdateIssueLabelRequest) GetColor() string { + if u == nil || u.Color == nil { return "" } - return *t.Slug + return *u.Color } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Team) GetURL() string { - if t == nil || t.URL == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateIssueLabelRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.URL -} - -// GetInstallation returns the Installation field. -func (t *TeamAddEvent) GetInstallation() *Installation { - if t == nil { - return nil - } - return t.Installation + return *u.Description } -// GetOrg returns the Org field. -func (t *TeamAddEvent) GetOrg() *Organization { - if t == nil { - return nil +// GetNewName returns the NewName field if it's non-nil, zero value otherwise. +func (u *UpdateIssueLabelRequest) GetNewName() string { + if u == nil || u.NewName == nil { + return "" } - return t.Org + return *u.NewName } -// GetRepo returns the Repo field. -func (t *TeamAddEvent) GetRepo() *Repository { - if t == nil { - return nil +// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetAssignee() string { + if u == nil || u.Assignee == nil { + return "" } - return t.Repo + return *u.Assignee } -// GetSender returns the Sender field. -func (t *TeamAddEvent) GetSender() *User { - if t == nil { +// GetAssignees returns the Assignees slice if it's non-nil, nil otherwise. +func (u *UpdateIssueRequest) GetAssignees() []string { + if u == nil || u.Assignees == nil { return nil } - return t.Sender + return u.Assignees } -// GetTeam returns the Team field. -func (t *TeamAddEvent) GetTeam() *Team { - if t == nil { - return nil +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetBody() string { + if u == nil || u.Body == nil { + return "" } - return t.Team + return *u.Body } -// GetDescription returns the Description field. -func (t *TeamChange) GetDescription() *TeamDescription { - if t == nil { - return nil +// GetDuplicateIssueID returns the DuplicateIssueID field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetDuplicateIssueID() int { + if u == nil || u.DuplicateIssueID == nil { + return 0 } - return t.Description + return *u.DuplicateIssueID } -// GetName returns the Name field. -func (t *TeamChange) GetName() *TeamName { - if t == nil { +// GetIssueFieldValues returns the IssueFieldValues slice if it's non-nil, nil otherwise. +func (u *UpdateIssueRequest) GetIssueFieldValues() []*IssueRequestFieldValue { + if u == nil || u.IssueFieldValues == nil { return nil } - return t.Name + return u.IssueFieldValues } -// GetPrivacy returns the Privacy field. -func (t *TeamChange) GetPrivacy() *TeamPrivacy { - if t == nil { +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (u *UpdateIssueRequest) GetLabels() []string { + if u == nil || u.Labels == nil { return nil } - return t.Privacy + return u.Labels } -// GetRepository returns the Repository field. -func (t *TeamChange) GetRepository() *TeamRepository { - if t == nil { - return nil +// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetMilestone() int { + if u == nil || u.Milestone == nil { + return 0 } - return t.Repository + return *u.Milestone } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (t *TeamDescription) GetFrom() string { - if t == nil || t.From == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetState() string { + if u == nil || u.State == nil { return "" } - return *t.From -} - -// GetAuthor returns the Author field. -func (t *TeamDiscussion) GetAuthor() *User { - if t == nil { - return nil - } - return t.Author + return *u.State } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBody() string { - if t == nil || t.Body == nil { +// GetStateReason returns the StateReason field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetStateReason() string { + if u == nil || u.StateReason == nil { return "" } - return *t.Body + return *u.StateReason } -// GetBodyHTML returns the BodyHTML field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBodyHTML() string { - if t == nil || t.BodyHTML == nil { +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetTitle() string { + if u == nil || u.Title == nil { return "" } - return *t.BodyHTML + return *u.Title } -// GetBodyVersion returns the BodyVersion field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetBodyVersion() string { - if t == nil || t.BodyVersion == nil { +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (u *UpdateIssueRequest) GetType() string { + if u == nil || u.Type == nil { return "" } - return *t.BodyVersion -} - -// GetCommentsCount returns the CommentsCount field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCommentsCount() int { - if t == nil || t.CommentsCount == nil { - return 0 - } - return *t.CommentsCount + return *u.Type } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCommentsURL() string { - if t == nil || t.CommentsURL == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateMilestoneRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.CommentsURL + return *u.Description } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetCreatedAt() Timestamp { - if t == nil || t.CreatedAt == nil { +// GetDueOn returns the DueOn field if it's non-nil, zero value otherwise. +func (u *UpdateMilestoneRequest) GetDueOn() Timestamp { + if u == nil || u.DueOn == nil { return Timestamp{} } - return *t.CreatedAt + return *u.DueOn } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetHTMLURL() string { - if t == nil || t.HTMLURL == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateMilestoneRequest) GetState() string { + if u == nil || u.State == nil { return "" } - return *t.HTMLURL + return *u.State } -// GetLastEditedAt returns the LastEditedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetLastEditedAt() Timestamp { - if t == nil || t.LastEditedAt == nil { - return Timestamp{} +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (u *UpdateMilestoneRequest) GetTitle() string { + if u == nil || u.Title == nil { + return "" } - return *t.LastEditedAt + return *u.Title } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetNodeID() string { - if t == nil || t.NodeID == nil { +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationCopilotSpaceRequest) GetBaseRole() string { + if u == nil || u.BaseRole == nil { return "" } - return *t.NodeID + return *u.BaseRole } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetNumber() int { - if t == nil || t.Number == nil { - return 0 +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationCopilotSpaceRequest) GetDescription() string { + if u == nil || u.Description == nil { + return "" } - return *t.Number + return *u.Description } -// GetPinned returns the Pinned field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetPinned() bool { - if t == nil || t.Pinned == nil { - return false +// GetGeneralInstructions returns the GeneralInstructions field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationCopilotSpaceRequest) GetGeneralInstructions() string { + if u == nil || u.GeneralInstructions == nil { + return "" } - return *t.Pinned + return *u.GeneralInstructions } -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetPrivate() bool { - if t == nil || t.Private == nil { - return false +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationCopilotSpaceRequest) GetName() string { + if u == nil || u.Name == nil { + return "" } - return *t.Private + return *u.Name } -// GetReactions returns the Reactions field. -func (t *TeamDiscussion) GetReactions() *Reactions { - if t == nil { +// GetResourcesAttributes returns the ResourcesAttributes slice if it's non-nil, nil otherwise. +func (u *UpdateOrganizationCopilotSpaceRequest) GetResourcesAttributes() []*UpdateCopilotSpaceResourceAttributes { + if u == nil || u.ResourcesAttributes == nil { return nil } - return t.Reactions + return u.ResourcesAttributes } -// GetTeamURL returns the TeamURL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetTeamURL() string { - if t == nil || t.TeamURL == nil { +// GetAccountID returns the AccountID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAccountID() string { + if u == nil || u.AccountID == nil { return "" } - return *t.TeamURL + return *u.AccountID } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetTitle() string { - if t == nil || t.Title == nil { +// GetAudience returns the Audience field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAudience() string { + if u == nil || u.Audience == nil { return "" } - return *t.Title + return *u.Audience } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetUpdatedAt() Timestamp { - if t == nil || t.UpdatedAt == nil { - return Timestamp{} +// GetAuthType returns the AuthType field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAuthType() string { + if u == nil || u.AuthType == nil { + return "" } - return *t.UpdatedAt + return *u.AuthType } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TeamDiscussion) GetURL() string { - if t == nil || t.URL == nil { +// GetAWSRegion returns the AWSRegion field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetAWSRegion() string { + if u == nil || u.AWSRegion == nil { return "" } - return *t.URL + return *u.AWSRegion } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (t *TeamEvent) GetAction() string { - if t == nil || t.Action == nil { +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetClientID() string { + if u == nil || u.ClientID == nil { return "" } - return *t.Action + return *u.ClientID } -// GetChanges returns the Changes field. -func (t *TeamEvent) GetChanges() *TeamChange { - if t == nil { - return nil +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomain() string { + if u == nil || u.Domain == nil { + return "" } - return t.Changes + return *u.Domain } -// GetInstallation returns the Installation field. -func (t *TeamEvent) GetInstallation() *Installation { - if t == nil { - return nil +// GetDomainOwner returns the DomainOwner field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetDomainOwner() string { + if u == nil || u.DomainOwner == nil { + return "" } - return t.Installation + return *u.DomainOwner } -// GetOrg returns the Org field. -func (t *TeamEvent) GetOrg() *Organization { - if t == nil { - return 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 t.Org + return *u.EncryptedValue } -// GetRepo returns the Repo field. -func (t *TeamEvent) GetRepo() *Repository { - if t == nil { - return nil +// GetIdentityMappingName returns the IdentityMappingName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetIdentityMappingName() string { + if u == nil || u.IdentityMappingName == nil { + return "" } - return t.Repo + return *u.IdentityMappingName } -// GetSender returns the Sender field. -func (t *TeamEvent) GetSender() *User { - if t == nil { - return nil +// GetJFrogOIDCProviderName returns the JFrogOIDCProviderName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetJFrogOIDCProviderName() string { + if u == nil || u.JFrogOIDCProviderName == nil { + return "" } - return t.Sender + return *u.JFrogOIDCProviderName } -// GetTeam returns the Team field. -func (t *TeamEvent) GetTeam() *Team { - if t == 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 t.Team + return *u.KeyID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetDescription() string { - if t == nil || t.Description == nil { - return "" +// GetRegistryType returns the RegistryType field. +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() *PrivateRegistryType { + if u == nil { + return nil } - return *t.Description + return u.RegistryType } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetID() int64 { - if t == nil || t.ID == nil { - return 0 +// GetReplacesBase returns the ReplacesBase field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetReplacesBase() bool { + if u == nil || u.ReplacesBase == nil { + return false } - return *t.ID + return *u.ReplacesBase } -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetLDAPDN() string { - if t == nil || t.LDAPDN == nil { +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetRoleName() string { + if u == nil || u.RoleName == nil { return "" } - return *t.LDAPDN + return *u.RoleName } -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetMembersURL() string { - if t == nil || t.MembersURL == nil { - return "" +// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs slice if it's non-nil, nil otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetSelectedRepositoryIDs() []int64 { + if u == nil || u.SelectedRepositoryIDs == nil { + return nil } - return *t.MembersURL + return u.SelectedRepositoryIDs } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetName() string { - if t == nil || t.Name == nil { +// GetTenantID returns the TenantID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetTenantID() string { + if u == nil || u.TenantID == nil { return "" } - return *t.Name + return *u.TenantID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetPermission() string { - if t == nil || t.Permission == 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 *t.Permission + return *u.URL } -// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetPrivacy() string { - if t == nil || t.Privacy == 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 *t.Privacy + return *u.Username } -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetRepositoriesURL() string { - if t == nil || t.RepositoriesURL == nil { - return "" +// GetVisibility returns the Visibility field. +func (u *UpdateOrganizationPrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if u == nil { + return nil } - return *t.RepositoriesURL + return u.Visibility } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetSlug() string { - if t == nil || t.Slug == nil { +// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. +func (u *UpdatePreReceiveHookRequest) GetEnforcement() string { + if u == nil || u.Enforcement == nil { return "" } - return *t.Slug + return *u.Enforcement } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TeamLDAPMapping) GetURL() string { - if t == nil || t.URL == nil { - return "" +// GetFields returns the Fields slice if it's non-nil, nil otherwise. +func (u *UpdateProjectItemRequest) GetFields() []*UpdateProjectV2Field { + if u == nil || u.Fields == nil { + return nil } - return *t.URL + return u.Fields } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (t *TeamName) GetFrom() string { - if t == nil || t.From == nil { - return "" +// GetID returns the ID field. +func (u *UpdateProjectV2Field) GetID() int64 { + if u == nil { + return 0 } - return *t.From + return u.ID } -// GetFrom returns the From field. -func (t *TeamPermissions) GetFrom() *TeamPermissionsFrom { - if t == nil { +// GetValue returns the Value field. +func (u *UpdateProjectV2Field) GetValue() any { + if u == nil { return nil } - return t.From + return u.Value } -// GetAdmin returns the Admin field if it's non-nil, zero value otherwise. -func (t *TeamPermissionsFrom) GetAdmin() bool { - if t == nil || t.Admin == nil { +// GetActive returns the Active field if it's non-nil, zero value otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetActive() bool { + if u == nil || u.Active == nil { return false } - return *t.Admin + return *u.Active } -// GetPull returns the Pull field if it's non-nil, zero value otherwise. -func (t *TeamPermissionsFrom) GetPull() bool { - if t == nil || t.Pull == nil { - return false +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetDisplayName() string { + if u == nil || u.DisplayName == nil { + return "" } - return *t.Pull + return *u.DisplayName } -// GetPush returns the Push field if it's non-nil, zero value otherwise. -func (t *TeamPermissionsFrom) GetPush() bool { - if t == nil || t.Push == nil { - return false +// GetEmails returns the Emails slice if it's non-nil, nil otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetEmails() []*SCIMUserEmail { + if u == nil || u.Emails == nil { + return nil } - return *t.Push + return u.Emails } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (t *TeamPrivacy) GetFrom() string { - if t == nil || t.From == nil { +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetExternalID() string { + if u == nil || u.ExternalID == nil { return "" } - return *t.From + return *u.ExternalID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (t *TeamProjectOptions) GetPermission() string { - if t == nil || t.Permission == nil { - return "" +// GetGroups returns the Groups slice if it's non-nil, nil otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetGroups() []string { + if u == nil || u.Groups == nil { + return nil } - return *t.Permission + return u.Groups } -// GetPermissions returns the Permissions field. -func (t *TeamRepository) GetPermissions() *TeamPermissions { - if t == nil { - return nil +// GetName returns the Name field. +func (u *UpdateProvisionedOrgMembershipRequest) GetName() SCIMUserName { + if u == nil { + return SCIMUserName{} } - return t.Permissions + return u.Name } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetDescription() string { - if t == nil || t.Description == nil { - return "" +// GetSchemas returns the Schemas slice if it's non-nil, nil otherwise. +func (u *UpdateProvisionedOrgMembershipRequest) GetSchemas() []string { + if u == nil || u.Schemas == nil { + return nil } - return *t.Description + return u.Schemas } -// GetIncludeAllBranches returns the IncludeAllBranches field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetIncludeAllBranches() bool { - if t == nil || t.IncludeAllBranches == nil { - return false +// GetUserName returns the UserName field. +func (u *UpdateProvisionedOrgMembershipRequest) GetUserName() string { + if u == nil { + return "" } - return *t.IncludeAllBranches + return u.UserName } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetName() string { - if t == nil || t.Name == nil { +// GetExpectedHeadSHA returns the ExpectedHeadSHA field if it's non-nil, zero value otherwise. +func (u *UpdatePullRequestBranchRequest) GetExpectedHeadSHA() string { + if u == nil || u.ExpectedHeadSHA == nil { return "" } - return *t.Name + return *u.ExpectedHeadSHA } -// GetOwner returns the Owner field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetOwner() string { - if t == nil || t.Owner == nil { +// GetBody returns the Body field. +func (u *UpdatePullRequestCommentRequest) GetBody() string { + if u == nil { return "" } - return *t.Owner + return u.Body } -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (t *TemplateRepoRequest) GetPrivate() bool { - if t == nil || t.Private == nil { +// 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 *t.Private + return *u.Force } -// GetFragment returns the Fragment field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetFragment() string { - if t == nil || t.Fragment == nil { +// GetSHA returns the SHA field. +func (u *UpdateRef) GetSHA() string { + if u == nil { return "" } - return *t.Fragment + return u.SHA } -// GetObjectType returns the ObjectType field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetObjectType() string { - if t == nil || t.ObjectType == nil { +// GetLabel returns the Label field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseAssetRequest) GetLabel() string { + if u == nil || u.Label == nil { return "" } - return *t.ObjectType + return *u.Label } -// GetObjectURL returns the ObjectURL field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetObjectURL() string { - if t == nil || t.ObjectURL == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseAssetRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.ObjectURL + return *u.Name } -// GetProperty returns the Property field if it's non-nil, zero value otherwise. -func (t *TextMatch) GetProperty() string { - if t == nil || t.Property == nil { +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseAssetRequest) GetState() string { + if u == nil || u.State == nil { return "" } - return *t.Property -} - -// GetActor returns the Actor field. -func (t *Timeline) GetActor() *User { - if t == nil { - return nil - } - return t.Actor + return *u.State } -// GetAssignee returns the Assignee field. -func (t *Timeline) GetAssignee() *User { - if t == nil { - return nil +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetBody() string { + if u == nil || u.Body == nil { + return "" } - return t.Assignee + return *u.Body } -// GetAssigner returns the Assigner field. -func (t *Timeline) GetAssigner() *User { - if t == nil { - return nil +// GetDiscussionCategoryName returns the DiscussionCategoryName field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetDiscussionCategoryName() string { + if u == nil || u.DiscussionCategoryName == nil { + return "" } - return t.Assigner + return *u.DiscussionCategoryName } -// GetAuthor returns the Author field. -func (t *Timeline) GetAuthor() *CommitAuthor { - if t == nil { - return nil +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetDraft() bool { + if u == nil || u.Draft == nil { + return false } - return t.Author + return *u.Draft } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (t *Timeline) GetBody() string { - if t == nil || t.Body == nil { +// GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetMakeLatest() string { + if u == nil || u.MakeLatest == nil { return "" } - return *t.Body + return *u.MakeLatest } -// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCommitID() string { - if t == nil || t.CommitID == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.CommitID + return *u.Name } -// GetCommitter returns the Committer field. -func (t *Timeline) GetCommitter() *CommitAuthor { - if t == nil { - return nil +// GetPrerelease returns the Prerelease field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetPrerelease() bool { + if u == nil || u.Prerelease == nil { + return false } - return t.Committer + return *u.Prerelease } -// GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCommitURL() string { - if t == nil || t.CommitURL == nil { +// GetTagName returns the TagName field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetTagName() string { + if u == nil || u.TagName == nil { return "" } - return *t.CommitURL + return *u.TagName } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (t *Timeline) GetCreatedAt() Timestamp { - if t == nil || t.CreatedAt == nil { - return Timestamp{} +// GetTargetCommitish returns the TargetCommitish field if it's non-nil, zero value otherwise. +func (u *UpdateReleaseRequest) GetTargetCommitish() string { + if u == nil || u.TargetCommitish == nil { + return "" } - return *t.CreatedAt + return *u.TargetCommitish } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (t *Timeline) GetEvent() string { - if t == nil || t.Event == nil { - return "" +// GetUpdateAllowsFetchAndMerge returns the UpdateAllowsFetchAndMerge field. +func (u *UpdateRuleParameters) GetUpdateAllowsFetchAndMerge() bool { + if u == nil { + return false } - return *t.Event + return u.UpdateAllowsFetchAndMerge } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (t *Timeline) GetID() int64 { - if t == nil || t.ID == nil { - return 0 +// 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 *t.ID + return *u.AllowsPublicRepositories } -// GetLabel returns the Label field. -func (t *Timeline) GetLabel() *Label { - if t == nil { - return nil +// GetName returns the Name field. +func (u *UpdateRunnerGroupRequest) GetName() string { + if u == nil { + return "" } - return t.Label + return u.Name } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (t *Timeline) GetMessage() string { - if t == nil || t.Message == 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 *t.Message + return *u.NetworkConfigurationID } -// GetMilestone returns the Milestone field. -func (t *Timeline) GetMilestone() *Milestone { - if t == nil { - return nil +// GetRemoveNetworkConfiguration returns the RemoveNetworkConfiguration field. +func (u *UpdateRunnerGroupRequest) GetRemoveNetworkConfiguration() bool { + if u == nil { + return false } - return t.Milestone + return u.RemoveNetworkConfiguration } -// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. -func (t *Timeline) GetPerformedViaGithubApp() *App { - if t == nil { - return 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 t.PerformedViaGithubApp + return *u.RestrictedToWorkflows } -// GetRename returns the Rename field. -func (t *Timeline) GetRename() *Rename { - if t == nil { +// GetSelectedWorkflows returns the SelectedWorkflows slice if it's non-nil, nil otherwise. +func (u *UpdateRunnerGroupRequest) GetSelectedWorkflows() []string { + if u == nil || u.SelectedWorkflows == nil { return nil } - return t.Rename + return u.SelectedWorkflows } -// GetRequestedTeam returns the RequestedTeam field. -func (t *Timeline) GetRequestedTeam() *Team { - if t == nil { - return nil +// 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 t.RequestedTeam + return *u.Visibility } -// GetRequester returns the Requester field. -func (t *Timeline) GetRequester() *User { - if t == nil { - return nil +// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningAlertRequest) GetAssignee() string { + if u == nil || u.Assignee == nil { + return "" } - return t.Requester + return *u.Assignee } -// GetReviewer returns the Reviewer field. -func (t *Timeline) GetReviewer() *User { - if t == nil { - return nil +// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningAlertRequest) GetResolution() string { + if u == nil || u.Resolution == nil { + return "" } - return t.Reviewer + return *u.Resolution } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *Timeline) GetSHA() string { - if t == nil || t.SHA == nil { +// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningAlertRequest) GetResolutionComment() string { + if u == nil || u.ResolutionComment == nil { return "" } - return *t.SHA + return *u.ResolutionComment } -// GetSource returns the Source field. -func (t *Timeline) GetSource() *Source { - if t == nil { - return nil +// GetState returns the State field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningAlertRequest) GetState() string { + if u == nil || u.State == nil { + return "" } - return t.Source + return *u.State } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (t *Timeline) GetState() string { - if t == nil || t.State == nil { +// GetValidity returns the Validity field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningAlertRequest) GetValidity() string { + if u == nil || u.Validity == nil { return "" } - return *t.State + return *u.Validity } -// GetSubmittedAt returns the SubmittedAt field if it's non-nil, zero value otherwise. -func (t *Timeline) GetSubmittedAt() Timestamp { - if t == nil || t.SubmittedAt == nil { - return Timestamp{} +// GetCustomPatternSettings returns the CustomPatternSettings slice if it's non-nil, nil otherwise. +func (u *UpdateSecretScanningPatternConfigsRequest) GetCustomPatternSettings() []*SecretScanningCustomPatternSetting { + if u == nil || u.CustomPatternSettings == nil { + return nil } - return *t.SubmittedAt + return u.CustomPatternSettings } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *Timeline) GetURL() string { - if t == nil || t.URL == nil { +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (u *UpdateSecretScanningPatternConfigsRequest) GetPatternConfigVersion() string { + if u == nil || u.PatternConfigVersion == nil { return "" } - return *t.URL + return *u.PatternConfigVersion } -// GetUser returns the User field. -func (t *Timeline) GetUser() *User { - if t == nil { +// GetProviderPatternSettings returns the ProviderPatternSettings slice if it's non-nil, nil otherwise. +func (u *UpdateSecretScanningPatternConfigsRequest) GetProviderPatternSettings() []*SecretScanningProviderPatternSetting { + if u == nil || u.ProviderPatternSettings == nil { return nil } - return t.User + return u.ProviderPatternSettings } -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (t *Tool) GetGUID() string { - if t == nil || t.GUID == nil { +// GetLDAPDN returns the LDAPDN field. +func (u *UpdateTeamLDAPMappingRequest) GetLDAPDN() string { + if u == nil { return "" } - return *t.GUID + return u.LDAPDN } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *Tool) GetName() string { - if t == nil || t.Name == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetDescription() string { + if u == nil || u.Description == nil { return "" } - return *t.Name + return *u.Description } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (t *Tool) GetVersion() string { - if t == nil || t.Version == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetName() string { + if u == nil || u.Name == nil { return "" } - return *t.Version + return *u.Name } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetCreatedAt() Timestamp { - if t == nil || t.CreatedAt == nil { - return Timestamp{} +// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetNotificationSetting() string { + if u == nil || u.NotificationSetting == nil { + return "" } - return *t.CreatedAt + return *u.NotificationSetting } -// GetCreatedBy returns the CreatedBy field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetCreatedBy() string { - if t == nil || t.CreatedBy == nil { - return "" +// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetParentTeamID() int64 { + if u == nil || u.ParentTeamID == nil { + return 0 } - return *t.CreatedBy + return *u.ParentTeamID } -// GetCurated returns the Curated field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetCurated() bool { - if t == nil || t.Curated == nil { - return false +// GetParentTeamSlug returns the ParentTeamSlug field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetParentTeamSlug() string { + if u == nil || u.ParentTeamSlug == nil { + return "" } - return *t.Curated + return *u.ParentTeamSlug } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetDescription() string { - if t == nil || t.Description == nil { +// GetPermission returns the Permission field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetPermission() string { + if u == nil || u.Permission == nil { return "" } - return *t.Description + return *u.Permission } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetDisplayName() string { - if t == nil || t.DisplayName == nil { +// GetPrivacy returns the Privacy field if it's non-nil, zero value otherwise. +func (u *UpdateTeamRequest) GetPrivacy() string { + if u == nil || u.Privacy == nil { return "" } - return *t.DisplayName + return *u.Privacy } -// GetFeatured returns the Featured field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetFeatured() bool { - if t == nil || t.Featured == nil { +// GetRemoveParentTeam returns the RemoveParentTeam field. +func (u *UpdateTeamRequest) GetRemoveParentTeam() bool { + if u == nil { return false } - return *t.Featured + return u.RemoveParentTeam } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetName() string { - if t == nil || t.Name == nil { +// GetLDAPDN returns the LDAPDN field. +func (u *UpdateUserLDAPMappingRequest) GetLDAPDN() string { + if u == nil { return "" } - return *t.Name + return u.LDAPDN } -// GetScore returns the Score field. -func (t *TopicResult) GetScore() *float64 { - if t == nil { - return nil +// GetLicense returns the License field. +func (u *UploadLicenseOptions) GetLicense() string { + if u == nil { + return "" } - return t.Score + return u.License } -// GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetShortDescription() string { - if t == nil || t.ShortDescription == nil { +// GetLabel returns the Label field. +func (u *UploadOptions) GetLabel() string { + if u == nil { return "" } - return *t.ShortDescription + return u.Label } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (t *TopicResult) GetUpdatedAt() string { - if t == nil || t.UpdatedAt == nil { +// GetMediaType returns the MediaType field. +func (u *UploadOptions) GetMediaType() string { + if u == nil { + return "" + } + return u.MediaType +} + +// GetName returns the Name field. +func (u *UploadOptions) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +// GetDate returns the Date field. +func (u *UsageItem) GetDate() string { + if u == nil { return "" } - return *t.UpdatedAt + return u.Date } -// GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. -func (t *TopicsSearchResult) GetIncompleteResults() bool { - if t == nil || t.IncompleteResults == nil { - return false +// GetDiscountAmount returns the DiscountAmount field. +func (u *UsageItem) GetDiscountAmount() float64 { + if u == nil { + return 0 } - return *t.IncompleteResults + return u.DiscountAmount } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (t *TopicsSearchResult) GetTotal() int { - if t == nil || t.Total == nil { +// GetGrossAmount returns the GrossAmount field. +func (u *UsageItem) GetGrossAmount() float64 { + if u == nil { return 0 } - return *t.Total + return u.GrossAmount } -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficClones) GetCount() int { - if t == nil || t.Count == nil { +// GetNetAmount returns the NetAmount field. +func (u *UsageItem) GetNetAmount() float64 { + if u == nil { return 0 } - return *t.Count + return u.NetAmount } -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficClones) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 +// 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 *t.Uniques + return *u.OrganizationName } -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetCount() int { - if t == nil || t.Count == nil { +// GetPricePerUnit returns the PricePerUnit field. +func (u *UsageItem) GetPricePerUnit() float64 { + if u == nil { return 0 } - return *t.Count + return u.PricePerUnit } -// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetTimestamp() Timestamp { - if t == nil || t.Timestamp == nil { - return Timestamp{} +// GetProduct returns the Product field. +func (u *UsageItem) GetProduct() string { + if u == nil { + return "" } - return *t.Timestamp + return u.Product } -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficData) GetUniques() int { - if t == nil || t.Uniques == nil { +// GetQuantity returns the Quantity field. +func (u *UsageItem) GetQuantity() float64 { + if u == nil { return 0 } - return *t.Uniques + return u.Quantity } -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetCount() int { - if t == nil || t.Count == nil { - return 0 +// 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 *t.Count + return *u.RepositoryName } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetPath() string { - if t == nil || t.Path == nil { +// GetSKU returns the SKU field. +func (u *UsageItem) GetSKU() string { + if u == nil { return "" } - return *t.Path + return u.SKU } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetTitle() string { - if t == nil || t.Title == nil { +// GetUnitType returns the UnitType field. +func (u *UsageItem) GetUnitType() string { + if u == nil { return "" } - return *t.Title + return u.UnitType } -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficPath) GetUniques() int { - if t == nil || t.Uniques == nil { - return 0 +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (u *UsageReport) GetUsageItems() []*UsageItem { + if u == nil || u.UsageItems == nil { + return nil } - return *t.Uniques + return u.UsageItems } -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetCount() int { - if t == nil || t.Count == nil { +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetDay() int { + if u == nil || u.Day == nil { return 0 } - return *t.Count + return *u.Day } -// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetReferrer() string { - if t == nil || t.Referrer == nil { - return "" +// GetHour returns the Hour field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetHour() int { + if u == nil || u.Hour == nil { + return 0 } - return *t.Referrer + return *u.Hour } -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficReferrer) GetUniques() int { - if t == nil || t.Uniques == nil { +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetMonth() int { + if u == nil || u.Month == nil { return 0 } - return *t.Uniques + return *u.Month } -// GetCount returns the Count field if it's non-nil, zero value otherwise. -func (t *TrafficViews) GetCount() int { - if t == nil || t.Count == nil { +// GetYear returns the Year field if it's non-nil, zero value otherwise. +func (u *UsageReportOptions) GetYear() int { + if u == nil || u.Year == nil { return 0 } - return *t.Count + return *u.Year } -// GetUniques returns the Uniques field if it's non-nil, zero value otherwise. -func (t *TrafficViews) GetUniques() int { - if t == nil || t.Uniques == nil { +// GetDiscountAmount returns the DiscountAmount field. +func (u *UsageSummaryItem) GetDiscountAmount() float64 { + if u == nil { return 0 } - return *t.Uniques + return u.DiscountAmount } -// GetNewName returns the NewName field if it's non-nil, zero value otherwise. -func (t *TransferRequest) GetNewName() string { - if t == nil || t.NewName == nil { - return "" +// GetDiscountQuantity returns the DiscountQuantity field. +func (u *UsageSummaryItem) GetDiscountQuantity() float64 { + if u == nil { + return 0 } - return *t.NewName + return u.DiscountQuantity } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *Tree) GetSHA() string { - if t == nil || t.SHA == nil { - return "" +// GetGrossAmount returns the GrossAmount field. +func (u *UsageSummaryItem) GetGrossAmount() float64 { + if u == nil { + return 0 } - return *t.SHA + return u.GrossAmount } -// GetTruncated returns the Truncated field if it's non-nil, zero value otherwise. -func (t *Tree) GetTruncated() bool { - if t == nil || t.Truncated == nil { - return false +// GetGrossQuantity returns the GrossQuantity field. +func (u *UsageSummaryItem) GetGrossQuantity() float64 { + if u == nil { + return 0 } - return *t.Truncated + return u.GrossQuantity } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetContent() string { - if t == nil || t.Content == nil { - return "" +// GetNetAmount returns the NetAmount field. +func (u *UsageSummaryItem) GetNetAmount() float64 { + if u == nil { + return 0 } - return *t.Content + return u.NetAmount } -// GetMode returns the Mode field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetMode() string { - if t == nil || t.Mode == nil { - return "" +// GetNetQuantity returns the NetQuantity field. +func (u *UsageSummaryItem) GetNetQuantity() float64 { + if u == nil { + return 0 } - return *t.Mode + return u.NetQuantity } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetPath() string { - if t == nil || t.Path == nil { - return "" +// GetPricePerUnit returns the PricePerUnit field. +func (u *UsageSummaryItem) GetPricePerUnit() float64 { + if u == nil { + return 0 } - return *t.Path + return u.PricePerUnit } -// GetSHA returns the SHA field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetSHA() string { - if t == nil || t.SHA == nil { +// GetProduct returns the Product field. +func (u *UsageSummaryItem) GetProduct() string { + if u == nil { return "" } - return *t.SHA -} - -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetSize() int { - if t == nil || t.Size == nil { - return 0 - } - return *t.Size + return u.Product } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetType() string { - if t == nil || t.Type == nil { +// GetSKU returns the SKU field. +func (u *UsageSummaryItem) GetSKU() string { + if u == nil { return "" } - return *t.Type + return u.SKU } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (t *TreeEntry) GetURL() string { - if t == nil || t.URL == nil { +// GetUnitType returns the UnitType field. +func (u *UsageSummaryItem) GetUnitType() string { + if u == nil { return "" } - return *t.URL + return u.UnitType } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (u *UpdateAttributeForSCIMUserOperations) GetPath() string { - if u == nil || u.Path == nil { - return "" +// GetDay returns the Day field. +func (u *UsageSummaryOptions) GetDay() int { + if u == nil { + return 0 } - return *u.Path + return u.Day } -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetCompletedAt() Timestamp { - if u == nil || u.CompletedAt == nil { - return Timestamp{} +// GetMonth returns the Month field. +func (u *UsageSummaryOptions) GetMonth() int { + if u == nil { + return 0 } - return *u.CompletedAt + return u.Month } -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetConclusion() string { - if u == nil || u.Conclusion == nil { +// GetProduct returns the Product field. +func (u *UsageSummaryOptions) GetProduct() string { + if u == nil { return "" } - return *u.Conclusion + return u.Product } -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetDetailsURL() string { - if u == nil || u.DetailsURL == nil { +// GetRepository returns the Repository field. +func (u *UsageSummaryOptions) GetRepository() string { + if u == nil { return "" } - return *u.DetailsURL + return u.Repository } -// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetExternalID() string { - if u == nil || u.ExternalID == nil { +// GetSKU returns the SKU field. +func (u *UsageSummaryOptions) GetSKU() string { + if u == nil { return "" } - return *u.ExternalID + return u.SKU } -// GetOutput returns the Output field. -func (u *UpdateCheckRunOptions) GetOutput() *CheckRunOutput { +// GetYear returns the Year field. +func (u *UsageSummaryOptions) GetYear() int { if u == nil { - return nil + return 0 } - return u.Output + return u.Year } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (u *UpdateCheckRunOptions) GetStatus() string { - if u == nil || u.Status == nil { +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (u *UsageSummaryReport) GetOrganization() string { + if u == nil || u.Organization == nil { return "" } - return *u.Status + return *u.Organization } -// GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. -func (u *UpdateDefaultSetupConfigurationOptions) GetQuerySuite() string { - if u == nil || u.QuerySuite == nil { +// GetProduct returns the Product field if it's non-nil, zero value otherwise. +func (u *UsageSummaryReport) GetProduct() string { + if u == nil || u.Product == nil { return "" } - return *u.QuerySuite -} - -// GetRunID returns the RunID field if it's non-nil, zero value otherwise. -func (u *UpdateDefaultSetupConfigurationResponse) GetRunID() int64 { - if u == nil || u.RunID == nil { - return 0 - } - return *u.RunID + return *u.Product } -// GetRunURL returns the RunURL field if it's non-nil, zero value otherwise. -func (u *UpdateDefaultSetupConfigurationResponse) GetRunURL() string { - if u == nil || u.RunURL == nil { +// GetRepository returns the Repository field if it's non-nil, zero value otherwise. +func (u *UsageSummaryReport) GetRepository() string { + if u == nil || u.Repository == nil { return "" } - return *u.RunURL -} - -// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. -func (u *UpdateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { - if u == nil || u.AllowsPublicRepositories == nil { - return false - } - return *u.AllowsPublicRepositories + return *u.Repository } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (u *UpdateEnterpriseRunnerGroupRequest) GetName() string { - if u == nil || u.Name == nil { +// GetSKU returns the SKU field if it's non-nil, zero value otherwise. +func (u *UsageSummaryReport) GetSKU() string { + if u == nil || u.SKU == nil { return "" } - return *u.Name + return *u.SKU } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (u *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { - if u == nil || u.RestrictedToWorkflows == nil { - return false +// GetTimePeriod returns the TimePeriod field. +func (u *UsageSummaryReport) GetTimePeriod() UsageSummaryTimePeriod { + if u == nil { + return UsageSummaryTimePeriod{} } - return *u.RestrictedToWorkflows + return u.TimePeriod } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { - if u == nil || u.Visibility == nil { - return "" +// GetUsageItems returns the UsageItems slice if it's non-nil, nil otherwise. +func (u *UsageSummaryReport) GetUsageItems() []*UsageSummaryItem { + if u == nil || u.UsageItems == nil { + return nil } - return *u.Visibility + return u.UsageItems } -// 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 +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (u *UsageSummaryReport) GetUser() string { + if u == nil || u.User == nil { + return "" } - return *u.AllowsPublicRepositories + return *u.User } -// 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 "" +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (u *UsageSummaryTimePeriod) GetDay() int { + if u == nil || u.Day == nil { + return 0 } - return *u.Name + return *u.Day } -// 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 +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (u *UsageSummaryTimePeriod) GetMonth() int { + if u == nil || u.Month == nil { + return 0 } - return *u.RestrictedToWorkflows + return *u.Month } -// 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 "" +// GetYear returns the Year field. +func (u *UsageSummaryTimePeriod) GetYear() int { + if u == nil { + return 0 } - return *u.Visibility + return u.Year } // GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. @@ -26838,6 +47614,14 @@ func (u *User) GetBlog() string { return *u.Blog } +// GetBusinessPlus returns the BusinessPlus field if it's non-nil, zero value otherwise. +func (u *User) GetBusinessPlus() bool { + if u == nil || u.BusinessPlus == nil { + return false + } + return *u.BusinessPlus +} + // GetCollaborators returns the Collaborators field if it's non-nil, zero value otherwise. func (u *User) GetCollaborators() int { if u == nil || u.Collaborators == nil { @@ -26958,6 +47742,22 @@ func (u *User) GetID() int64 { return *u.ID } +// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. +func (u *User) GetInherited() bool { + if u == nil || u.Inherited == nil { + return false + } + return *u.Inherited +} + +// GetInheritedFrom returns the InheritedFrom slice if it's non-nil, nil otherwise. +func (u *User) GetInheritedFrom() []*Team { + if u == nil || u.InheritedFrom == nil { + return nil + } + return u.InheritedFrom +} + // GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. func (u *User) GetLdapDn() string { if u == nil || u.LdapDn == nil { @@ -26998,6 +47798,14 @@ func (u *User) GetNodeID() string { return *u.NodeID } +// GetNotificationEmail returns the NotificationEmail field if it's non-nil, zero value otherwise. +func (u *User) GetNotificationEmail() string { + if u == nil || u.NotificationEmail == nil { + return "" + } + return *u.NotificationEmail +} + // GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. func (u *User) GetOrganizationsURL() string { if u == nil || u.OrganizationsURL == nil { @@ -27014,10 +47822,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 } @@ -27070,6 +47878,14 @@ func (u *User) GetReposURL() string { return *u.ReposURL } +// GetRole returns the Role field if it's non-nil, zero value otherwise. +func (u *User) GetRole() string { + if u == nil || u.Role == nil { + return "" + } + return *u.Role +} + // GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. func (u *User) GetRoleName() string { if u == nil || u.RoleName == nil { @@ -27110,6 +47926,14 @@ func (u *User) GetSuspendedAt() Timestamp { return *u.SuspendedAt } +// GetTextMatches returns the TextMatches slice if it's non-nil, nil otherwise. +func (u *User) GetTextMatches() []*TextMatch { + if u == nil || u.TextMatches == nil { + return nil + } + return u.TextMatches +} + // GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. func (u *User) GetTotalPrivateRepos() int64 { if u == nil || u.TotalPrivateRepos == nil { @@ -27158,6 +47982,14 @@ func (u *User) GetURL() string { return *u.URL } +// GetUserViewType returns the UserViewType field if it's non-nil, zero value otherwise. +func (u *User) GetUserViewType() string { + if u == nil || u.UserViewType == nil { + return "" + } + return *u.UserViewType +} + // GetApp returns the App field. func (u *UserAuthorization) GetApp() *OAuthAPP { if u == nil { @@ -27214,6 +48046,14 @@ func (u *UserAuthorization) GetNoteURL() string { return *u.NoteURL } +// GetScopes returns the Scopes slice if it's non-nil, nil otherwise. +func (u *UserAuthorization) GetScopes() []string { + if u == nil || u.Scopes == nil { + return nil + } + return u.Scopes +} + // GetToken returns the Token field if it's non-nil, zero value otherwise. func (u *UserAuthorization) GetToken() string { if u == nil || u.Token == nil { @@ -27470,6 +48310,22 @@ func (u *UserLDAPMapping) GetURL() string { return *u.URL } +// GetPerPage returns the PerPage field. +func (u *UserListOptions) GetPerPage() int { + if u == nil { + return 0 + } + return u.PerPage +} + +// GetSince returns the Since field. +func (u *UserListOptions) GetSince() int64 { + if u == nil { + return 0 + } + return u.Since +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (u *UserMigration) GetCreatedAt() string { if u == nil || u.CreatedAt == nil { @@ -27510,6 +48366,14 @@ func (u *UserMigration) GetLockRepositories() bool { return *u.LockRepositories } +// GetRepositories returns the Repositories slice if it's non-nil, nil otherwise. +func (u *UserMigration) GetRepositories() []*Repository { + if u == nil || u.Repositories == nil { + return nil + } + return u.Repositories +} + // GetState returns the State field if it's non-nil, zero value otherwise. func (u *UserMigration) GetState() string { if u == nil || u.State == nil { @@ -27534,6 +48398,22 @@ func (u *UserMigration) GetURL() string { return *u.URL } +// GetExcludeAttachments returns the ExcludeAttachments field. +func (u *UserMigrationOptions) GetExcludeAttachments() bool { + if u == nil { + return false + } + return u.ExcludeAttachments +} + +// GetLockRepositories returns the LockRepositories field. +func (u *UserMigrationOptions) GetLockRepositories() bool { + if u == nil { + return false + } + return u.LockRepositories +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (u *UsersSearchResult) GetIncompleteResults() bool { if u == nil || u.IncompleteResults == nil { @@ -27550,6 +48430,14 @@ func (u *UsersSearchResult) GetTotal() int { return *u.Total } +// GetUsers returns the Users slice if it's non-nil, nil otherwise. +func (u *UsersSearchResult) GetUsers() []*User { + if u == nil || u.Users == nil { + return nil + } + return u.Users +} + // GetAdminUsers returns the AdminUsers field if it's non-nil, zero value otherwise. func (u *UserStats) GetAdminUsers() int { if u == nil || u.AdminUsers == nil { @@ -27574,12 +48462,124 @@ func (u *UserStats) GetTotalUsers() int { return *u.TotalUsers } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (u *UserSuspendOptions) GetReason() string { - if u == nil || u.Reason == nil { +// GetBio returns the Bio field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetBio() string { + if u == nil || u.Bio == nil { return "" } - return *u.Reason + return *u.Bio +} + +// GetBlog returns the Blog field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetBlog() string { + if u == nil || u.Blog == nil { + return "" + } + return *u.Blog +} + +// GetCompany returns the Company field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetCompany() string { + if u == nil || u.Company == nil { + return "" + } + return *u.Company +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetEmail() string { + if u == nil || u.Email == nil { + return "" + } + return *u.Email +} + +// GetHireable returns the Hireable field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetHireable() bool { + if u == nil || u.Hireable == nil { + return false + } + return *u.Hireable +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetLocation() string { + if u == nil || u.Location == nil { + return "" + } + return *u.Location +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetName() string { + if u == nil || u.Name == nil { + return "" + } + return *u.Name +} + +// GetTwitterUsername returns the TwitterUsername field if it's non-nil, zero value otherwise. +func (u *UserUpdateRequest) GetTwitterUsername() string { + if u == nil || u.TwitterUsername == nil { + return "" + } + return *u.TwitterUsername +} + +// GetManualMatch returns the ManualMatch field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptionAssignment) GetManualMatch() bool { + if v == nil || v.ManualMatch == nil { + return false + } + return *v.ManualMatch +} + +// GetSubscriptionID returns the SubscriptionID field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptionAssignment) GetSubscriptionID() string { + if v == nil || v.SubscriptionID == nil { + return "" + } + return *v.SubscriptionID +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptionAssignment) GetUsername() string { + if v == nil || v.Username == nil { + return "" + } + return *v.Username +} + +// GetVisualStudioSubscriptionEmail returns the VisualStudioSubscriptionEmail field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptionAssignment) GetVisualStudioSubscriptionEmail() string { + if v == nil || v.VisualStudioSubscriptionEmail == nil { + return "" + } + return *v.VisualStudioSubscriptionEmail +} + +// GetUserIdentifier returns the UserIdentifier field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptionAssignmentRequest) GetUserIdentifier() string { + if v == nil || v.UserIdentifier == nil { + return "" + } + return *v.UserIdentifier +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (v *VisualStudioSubscriptions) GetTotalCount() int { + if v == nil || v.TotalCount == nil { + return 0 + } + return *v.TotalCount +} + +// GetVisualStudioSubscriptions returns the VisualStudioSubscriptions slice if it's non-nil, nil otherwise. +func (v *VisualStudioSubscriptions) GetVisualStudioSubscriptions() []*VisualStudioSubscriptionAssignment { + if v == nil || v.VisualStudioSubscriptions == nil { + return nil + } + return v.VisualStudioSubscriptions } // GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. @@ -27638,6 +48638,14 @@ func (w *WatchEvent) GetSender() *User { return w.Sender } +// GetDays returns the Days slice if it's non-nil, nil otherwise. +func (w *WeeklyCommitActivity) GetDays() []int { + if w == nil || w.Days == nil { + return nil + } + return w.Days +} + // GetTotal returns the Total field if it's non-nil, zero value otherwise. func (w *WeeklyCommitActivity) GetTotal() int { if w == nil || w.Total == nil { @@ -27774,6 +48782,14 @@ func (w *WorkflowBill) GetTotalMS() int64 { return *w.TotalMS } +// GetInputs returns the Inputs field. +func (w *WorkflowDispatchEvent) GetInputs() json.RawMessage { + if w == nil { + return json.RawMessage{} + } + return w.Inputs +} + // GetInstallation returns the Installation field. func (w *WorkflowDispatchEvent) GetInstallation() *Installation { if w == nil { @@ -27822,6 +48838,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 { @@ -27886,6 +48926,14 @@ func (w *WorkflowJob) GetID() int64 { return *w.ID } +// GetLabels returns the Labels slice if it's non-nil, nil otherwise. +func (w *WorkflowJob) GetLabels() []string { + if w == nil || w.Labels == nil { + return nil + } + return w.Labels +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetName() string { if w == nil || w.Name == nil { @@ -27974,6 +49022,14 @@ func (w *WorkflowJob) GetStatus() string { return *w.Status } +// GetSteps returns the Steps slice if it's non-nil, nil otherwise. +func (w *WorkflowJob) GetSteps() []*TaskStep { + if w == nil || w.Steps == nil { + return nil + } + return w.Steps +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (w *WorkflowJob) GetURL() string { if w == nil || w.URL == nil { @@ -28286,6 +49342,22 @@ func (w *WorkflowRun) GetPreviousAttemptURL() string { return *w.PreviousAttemptURL } +// GetPullRequests returns the PullRequests slice if it's non-nil, nil otherwise. +func (w *WorkflowRun) GetPullRequests() []*PullRequest { + if w == nil || w.PullRequests == nil { + return nil + } + return w.PullRequests +} + +// GetReferencedWorkflows returns the ReferencedWorkflows slice if it's non-nil, nil otherwise. +func (w *WorkflowRun) GetReferencedWorkflows() []*ReferencedWorkflow { + if w == nil || w.ReferencedWorkflows == nil { + return nil + } + return w.ReferencedWorkflows +} + // GetRepository returns the Repository field. func (w *WorkflowRun) GetRepository() *Repository { if w == nil { @@ -28382,6 +49454,14 @@ func (w *WorkflowRunAttemptOptions) GetExcludePullRequests() bool { return *w.ExcludePullRequests } +// GetJobRuns returns the JobRuns slice if it's non-nil, nil otherwise. +func (w *WorkflowRunBill) GetJobRuns() []*WorkflowRunJobRun { + if w == nil || w.JobRuns == nil { + return nil + } + return w.JobRuns +} + // GetJobs returns the Jobs field if it's non-nil, zero value otherwise. func (w *WorkflowRunBill) GetJobs() int { if w == nil || w.Jobs == nil { @@ -28478,6 +49558,14 @@ func (w *WorkflowRuns) GetTotalCount() int { return *w.TotalCount } +// GetWorkflowRuns returns the WorkflowRuns slice if it's non-nil, nil otherwise. +func (w *WorkflowRuns) GetWorkflowRuns() []*WorkflowRun { + if w == nil || w.WorkflowRuns == nil { + return nil + } + return w.WorkflowRuns +} + // GetBillable returns the Billable field. func (w *WorkflowRunUsage) GetBillable() *WorkflowRunBillMap { if w == nil { @@ -28502,6 +49590,86 @@ func (w *Workflows) GetTotalCount() int { return *w.TotalCount } +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (w *Workflows) GetWorkflows() []*Workflow { + if w == nil || w.Workflows == nil { + return nil + } + return w.Workflows +} + +// GetParameters returns the Parameters field. +func (w *WorkflowsBranchRule) GetParameters() WorkflowsRuleParameters { + if w == nil { + return WorkflowsRuleParameters{} + } + return w.Parameters +} + +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPRWorkflows +} + +// GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetRunWorkflowsFromForkPullRequests() bool { + if w == nil || w.RunWorkflowsFromForkPullRequests == nil { + return false + } + return *w.RunWorkflowsFromForkPullRequests +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissions) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + +// GetRequireApprovalForForkPRWorkflows returns the RequireApprovalForForkPRWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetRequireApprovalForForkPRWorkflows() bool { + if w == nil || w.RequireApprovalForForkPRWorkflows == nil { + return false + } + return *w.RequireApprovalForForkPRWorkflows +} + +// GetRunWorkflowsFromForkPullRequests returns the RunWorkflowsFromForkPullRequests field. +func (w *WorkflowsPermissionsOpt) GetRunWorkflowsFromForkPullRequests() bool { + if w == nil { + return false + } + return w.RunWorkflowsFromForkPullRequests +} + +// GetSendSecretsAndVariables returns the SendSecretsAndVariables field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendSecretsAndVariables() bool { + if w == nil || w.SendSecretsAndVariables == nil { + return false + } + return *w.SendSecretsAndVariables +} + +// GetSendWriteTokensToWorkflows returns the SendWriteTokensToWorkflows field if it's non-nil, zero value otherwise. +func (w *WorkflowsPermissionsOpt) GetSendWriteTokensToWorkflows() bool { + if w == nil || w.SendWriteTokensToWorkflows == nil { + return false + } + return *w.SendWriteTokensToWorkflows +} + // GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { if w == nil || w.DoNotEnforceOnCreate == nil { @@ -28510,6 +49678,14 @@ func (w *WorkflowsRuleParameters) GetDoNotEnforceOnCreate() bool { return *w.DoNotEnforceOnCreate } +// GetWorkflows returns the Workflows slice if it's non-nil, nil otherwise. +func (w *WorkflowsRuleParameters) GetWorkflows() []*RuleWorkflow { + if w == nil || w.Workflows == nil { + return nil + } + return w.Workflows +} + // GetBillable returns the Billable field. func (w *WorkflowUsage) GetBillable() *WorkflowBillMap { if w == nil { diff --git a/vendor/github.com/google/go-github/v93/github/github-iterators.go b/vendor/github.com/google/go-github/v93/github/github-iterators.go new file mode 100644 index 000000000..3413ef22f --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/github-iterators.go @@ -0,0 +1,8532 @@ +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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, owner string, repo string, 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 = new(*opts) + } + + for { + results, resp, err := s.ListEnvSecrets(ctx, owner, repo, 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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListOrganizationPoliciesIter returns an iterator that paginates through all results of ListOrganizationPolicies. +func (s *ActionsService) ListOrganizationPoliciesIter(ctx context.Context, org string, opts *ActionsPolicyListOptions) iter.Seq2[*ActionsPolicy, error] { + return func(yield func(*ActionsPolicy, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActionsPolicyListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListOrganizationPolicies(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsPolicy + if results != nil { + iterItems = results.Policies + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListRepositoryPoliciesIter returns an iterator that paginates through all results of ListRepositoryPolicies. +func (s *ActionsService) ListRepositoryPoliciesIter(ctx context.Context, owner string, repo string, opts *ActionsPolicyListOptions) iter.Seq2[*ActionsPolicy, error] { + return func(yield func(*ActionsPolicy, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ActionsPolicyListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListRepositoryPolicies(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*ActionsPolicy + if results != nil { + iterItems = results.Policies + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.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 = new(*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 + } + } +} + +// ListRunnerGroupHostedRunnersIter returns an iterator that paginates through all results of ListRunnerGroupHostedRunners. +func (s *ActionsService) ListRunnerGroupHostedRunnersIter(ctx context.Context, org string, groupID int64, 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 = new(*opts) + } + + for { + results, resp, err := s.ListRunnerGroupHostedRunners(ctx, org, groupID, 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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListStargazerHistoryIter returns an iterator that paginates through all results of ListStargazerHistory. +func (s *ActivityService) ListStargazerHistoryIter(ctx context.Context, owner string, repo string, opts *ListOptions) iter.Seq2[*StargazerHistory, error] { + return func(yield func(*StargazerHistory, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListStargazerHistory(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListIter returns an iterator that paginates through all results of List. +func (s *AgentTasksService) ListIter(ctx context.Context, opts *AgentTaskListOptions) iter.Seq2[*AgentTask, error] { + return func(yield func(*AgentTask, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AgentTaskListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.List(ctx, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*AgentTask + if results != nil { + iterItems = results.Tasks + } + for _, item := range iterItems { + 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 *AgentTasksService) ListByRepoIter(ctx context.Context, owner string, repo string, opts *AgentTaskListByRepoOptions) iter.Seq2[*AgentTask, error] { + return func(yield func(*AgentTask, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &AgentTaskListByRepoOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListByRepo(ctx, owner, repo, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*AgentTask + if results != nil { + iterItems = results.Tasks + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.Page = resp.NextPage + } + } +} + +// ListOrgSecretsIter returns an iterator that paginates through all results of ListOrgSecrets. +func (s *AgentsService) 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 = new(*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 *AgentsService) 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 = new(*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 + } + } +} + +// ListRepoOrgSecretsIter returns an iterator that paginates through all results of ListRepoOrgSecrets. +func (s *AgentsService) 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 = new(*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 *AgentsService) 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 = new(*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 *AgentsService) 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 = new(*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 *AgentsService) 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 = new(*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 + } + } +} + +// ListSelectedReposForOrgSecretIter returns an iterator that paginates through all results of ListSelectedReposForOrgSecret. +func (s *AgentsService) 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 = new(*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 *AgentsService) 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 = new(*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 + } + } +} + +// 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 = new(*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.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListFindingsIter returns an iterator that paginates through all results of ListFindings. +func (s *CodeQualityService) ListFindingsIter(ctx context.Context, owner string, repo string, opts *ListCodeQualityFindingsOptions) iter.Seq2[*CodeQualityFinding, error] { + return func(yield func(*CodeQualityFinding, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCodeQualityFindingsOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListFindings(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListOrganizationCodingAgentRepositoriesIter returns an iterator that paginates through all results of ListOrganizationCodingAgentRepositories. +func (s *CopilotService) ListOrganizationCodingAgentRepositoriesIter(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 = new(*opts) + } + + for { + results, resp, err := s.ListOrganizationCodingAgentRepositories(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 + } + } +} + +// ListOrganizationCopilotSpacesIter returns an iterator that paginates through all results of ListOrganizationCopilotSpaces. +func (s *CopilotService) ListOrganizationCopilotSpacesIter(ctx context.Context, org string, opts *ListCursorOptions) iter.Seq2[*CopilotSpace, error] { + return func(yield func(*CopilotSpace, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListCursorOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListOrganizationCopilotSpaces(ctx, org, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CopilotSpace + if results != nil { + iterItems = results.Spaces + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.After == "" { + break + } + opts.After = resp.After + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListUserStatesForBudgetIter returns an iterator that paginates through all results of GetUserStatesForBudget. +func (s *EnterpriseService) ListUserStatesForBudgetIter(ctx context.Context, enterprise string, budgetID string, opts *EnterpriseGetUserStatesOptions) iter.Seq2[*EnterpriseBudgetUserState, error] { + return func(yield func(*EnterpriseBudgetUserState, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &EnterpriseGetUserStatesOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.GetUserStatesForBudget(ctx, enterprise, budgetID, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseBudgetUserState + if results != nil { + iterItems = results.UserStates + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListBudgetsIter returns an iterator that paginates through all results of ListBudgets. +func (s *EnterpriseService) ListBudgetsIter(ctx context.Context, enterprise string, opts *EnterpriseListBudgetsOptions) iter.Seq2[*EnterpriseBudget, error] { + return func(yield func(*EnterpriseBudget, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &EnterpriseListBudgetsOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListBudgets(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseBudget + if results != nil { + iterItems = results.Budgets + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.ListOptions.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 = new(*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 = new(*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 + } + } +} + +// ListConsumedLicensesIter returns an iterator that paginates through all results of ListConsumedLicenses. +func (s *EnterpriseService) ListConsumedLicensesIter(ctx context.Context, enterprise string, opts *ListOptions) iter.Seq2[*EnterpriseLicensedUsers, error] { + return func(yield func(*EnterpriseLicensedUsers, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListConsumedLicenses(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*EnterpriseLicensedUsers + if results != nil { + iterItems = results.Users + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListVisualStudioSubscriptionsIter returns an iterator that paginates through all results of ListVisualStudioSubscriptions. +func (s *EnterpriseService) ListVisualStudioSubscriptionsIter(ctx context.Context, enterprise string, opts *ListVisualStudioSubscriptionsOptions) iter.Seq2[*VisualStudioSubscriptionAssignment, error] { + return func(yield func(*VisualStudioSubscriptionAssignment, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListVisualStudioSubscriptionsOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListVisualStudioSubscriptions(ctx, enterprise, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*VisualStudioSubscriptionAssignment + if results != nil { + iterItems = results.VisualStudioSubscriptions + } + for _, item := range iterItems { + 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 *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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListBlockedByIter returns an iterator that paginates through all results of ListBlockedBy. +func (s *IssuesService) ListBlockedByIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) 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 = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListBlockedBy(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 + } + } +} + +// ListBlockingIter returns an iterator that paginates through all results of ListBlocking. +func (s *IssuesService) ListBlockingIter(ctx context.Context, owner string, repo string, issueNumber int64, opts *ListOptions) 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 = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListBlocking(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListAllRepositoryRulesetsIter returns an iterator that paginates through all results of ListAllRepositoryRulesets. +func (s *OrganizationsService) ListAllRepositoryRulesetsIter(ctx context.Context, org string, opts *ListOptions) iter.Seq2[*RepositoryRuleset, error] { + return func(yield func(*RepositoryRuleset, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListAllRepositoryRulesets(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListOrganizationProjectViewItemsIter returns an iterator that paginates through all results of ListOrganizationProjectViewItems. +func (s *ProjectsService) ListOrganizationProjectViewItemsIter(ctx context.Context, org string, projectNumber int, viewNumber 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 = new(*opts) + } + + for { + results, resp, err := s.ListOrganizationProjectViewItems(ctx, org, projectNumber, viewNumber, 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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListUserProjectViewItemsIter returns an iterator that paginates through all results of ListUserProjectViewItems. +func (s *ProjectsService) ListUserProjectViewItemsIter(ctx context.Context, username string, projectNumber int, viewNumber 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 = new(*opts) + } + + for { + results, resp, err := s.ListUserProjectViewItems(ctx, username, projectNumber, viewNumber, 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListStacksIter returns an iterator that paginates through all results of ListStacks. +func (s *PullRequestsService) ListStacksIter(ctx context.Context, owner string, repo string, opts *PullRequestListStacksOptions) iter.Seq2[*PullRequestStackMinimal, error] { + return func(yield func(*PullRequestStackMinimal, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &PullRequestListStacksOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListStacks(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListCommitComparisonFilesIter returns an iterator that paginates through all results of CompareCommits. +func (s *RepositoriesService) ListCommitComparisonFilesIter(ctx context.Context, owner string, repo string, base string, head string, 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 = new(*opts) + } + + for { + results, resp, err := s.CompareCommits(ctx, owner, repo, base, head, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CommitFile + if results != nil { + iterItems = results.Files + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCombinedStatusIter returns an iterator that paginates through all results of GetCombinedStatus. +func (s *RepositoriesService) ListCombinedStatusIter(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 = new(*opts) + } + + for { + results, resp, err := s.GetCombinedStatus(ctx, owner, repo, ref, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*RepoStatus + if results != nil { + iterItems = results.Statuses + } + for _, item := range iterItems { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// ListCommitFilesIter returns an iterator that paginates through all results of GetCommit. +func (s *RepositoriesService) ListCommitFilesIter(ctx context.Context, owner string, repo string, sha string, 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 = new(*opts) + } + + for { + results, resp, err := s.GetCommit(ctx, owner, repo, sha, opts) + if err != nil { + yield(nil, err) + return + } + + var iterItems []*CommitFile + if results != nil { + iterItems = results.Files + } + for _, item := range iterItems { + 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 *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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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.Cursor == "" { + break + } + opts.Cursor = resp.Cursor + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListCustomPatternsForEnterpriseIter returns an iterator that paginates through all results of ListCustomPatternsForEnterprise. +func (s *SecretScanningService) ListCustomPatternsForEnterpriseIter(ctx context.Context, enterprise string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] { + return func(yield func(*SecretScanningCustomPattern, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningCustomPatternListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListCustomPatternsForEnterprise(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.ListOptions.Page = resp.NextPage + } + } +} + +// ListCustomPatternsForOrgIter returns an iterator that paginates through all results of ListCustomPatternsForOrg. +func (s *SecretScanningService) ListCustomPatternsForOrgIter(ctx context.Context, org string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] { + return func(yield func(*SecretScanningCustomPattern, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningCustomPatternListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListCustomPatternsForOrg(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 + } + } +} + +// ListCustomPatternsForRepoIter returns an iterator that paginates through all results of ListCustomPatternsForRepo. +func (s *SecretScanningService) ListCustomPatternsForRepoIter(ctx context.Context, owner string, repo string, opts *SecretScanningCustomPatternListOptions) iter.Seq2[*SecretScanningCustomPattern, error] { + return func(yield func(*SecretScanningCustomPattern, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &SecretScanningCustomPatternListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListCustomPatternsForRepo(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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, opts *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 opts == nil { + opts = &DiscussionCommentListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListCommentsByID(ctx, orgID, 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 + } + } +} + +// ListCommentsBySlugIter returns an iterator that paginates through all results of ListCommentsBySlug. +func (s *TeamsService) ListCommentsBySlugIter(ctx context.Context, org string, slug string, discussionNumber int, opts *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 opts == nil { + opts = &DiscussionCommentListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListCommentsBySlug(ctx, org, slug, 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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 = new(*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 + } + } +} + +// ListPublicEmailsIter returns an iterator that paginates through all results of ListPublicEmails. +func (s *UsersService) ListPublicEmailsIter(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 = new(*opts) + } + + for { + results, resp, err := s.ListPublicEmails(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 + } + } +} + +// 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 = new(*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 = new(*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 = new(*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/v69/github/github.go b/vendor/github.com/google/go-github/v93/github/github.go similarity index 54% rename from vendor/github.com/google/go-github/v69/github/github.go rename to vendor/github.com/google/go-github/v93/github/github.go index d163b32d2..a13d0a12e 100644 --- a/vendor/github.com/google/go-github/v69/github/github.go +++ b/vendor/github.com/google/go-github/v93/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,8 +19,8 @@ import ( "io" "net/http" "net/url" - "reflect" "regexp" + "slices" "strconv" "strings" "sync" @@ -29,21 +30,26 @@ import ( ) const ( - Version = "v69.2.0" - - 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" + Version = "v93.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" + + // https://docs.github.com/en/rest/about-the-rest-api/api-versions#about-api-versioning + api20221128 = "2022-11-28" + api20260310 = "2026-03-10" + + defaultBaseURL = "https://api.github.com/" + defaultUserAgent = "go-github" + "/" + Version + uploadBaseURL = "https://uploads.github.com/" + + headerAPIVersion = "X-Github-Api-Version" + headerOTP = "X-Github-Otp" + headerRetryAfter = "Retry-After" headerTokenExpiration = "Github-Authentication-Token-Expiration" @@ -54,8 +60,10 @@ const ( mediaTypeV3Patch = "application/vnd.github.v3.patch" 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). @@ -70,10 +78,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. - - // https://developer.github.com/changes/2014-12-09-new-attributes-for-stars-api/ - mediaTypeStarringPreview = "application/vnd.github.v3.star+json" + // 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" @@ -154,24 +159,46 @@ const ( mediaTypeContentAttachmentsPreview = "application/vnd.github.corsair-preview+json" ) -var errNonNilContext = errors.New("context must be non-nil") +// ErrPathForbidden is returned when a URL path contains ".." as a path +// segment, which could allow path traversal attacks. +var ErrPathForbidden = errors.New("path must not contain '..' due to auth vulnerability issue") // A Client manages communication with the GitHub API. type Client struct { - clientMu sync.Mutex // clientMu protects the client during calls that modify the CheckRedirect func. client *http.Client // HTTP client used to communicate with the API. clientIgnoreRedirects *http.Client // HTTP client used to communicate with the API on endpoints where we don't want to follow redirects. + // authToken is the token configured by [WithAuthToken], retained so that + // [Client.Clone] can install it against the clone's own origins. + authToken *string + + // baseTransport is the transport the credential wrapper was installed on + // top of, so that [Client.Clone] can rebase onto it rather than layering a + // second wrapper over the first. + baseTransport http.RoundTripper + // Base URL for API requests. Defaults to the public GitHub API, but can be - // set to a domain endpoint to use with GitHub Enterprise. BaseURL should + // set to a domain endpoint to use with GitHub Enterprise. baseURL should // always be specified with a trailing slash. - BaseURL *url.URL + baseURL *url.URL // Base URL for uploading files. - UploadURL *url.URL + uploadURL *url.URL + + // Default API version to set in the X-Github-Api-Version header. + apiVersionDefault string + // Minimum API version that the client can use. + apiVersionMin string + // Maximum API version that the client can use. + apiVersionMax string // User agent used when communicating with the GitHub API. - UserAgent string + userAgent string + + // disableRateLimitCheck stops the client checking for rate limits or tracking + // them. This is different to setting BypassRateLimitCheck in the context, + // as that still tracks the rate limits. + disableRateLimitCheck bool rateMu sync.Mutex rateLimits [Categories]Rate // Rate limits for the client as determined by the most recent API calls. @@ -179,10 +206,10 @@ type Client struct { // If specified, Client will block requests for at most this duration in case of reaching a secondary // rate limit - MaxSecondaryRateLimitRetryAfterDuration time.Duration + maxSecondaryRateLimitRetryAfterDuration time.Duration // Whether to respect rate limit headers on endpoints that return 302 redirections to artifacts - RateLimitRedirectionalEndpoints bool + rateLimitRedirectionalEndpoints bool common service // Reuse a single struct instead of allocating one for each service on the heap. @@ -190,14 +217,19 @@ type Client struct { Actions *ActionsService Activity *ActivityService Admin *AdminService + AgentTasks *AgentTasksService + Agents *AgentsService Apps *AppsService Authorizations *AuthorizationsService Billing *BillingService Checks *ChecksService + Classroom *ClassroomService + CodeQuality *CodeQualityService CodeScanning *CodeScanningService CodesOfConduct *CodesOfConductService Codespaces *CodespacesService Copilot *CopilotService + Credentials *CredentialsService Dependabot *DependabotService DependencyGraph *DependencyGraphService Emojis *EmojisService @@ -214,6 +246,8 @@ type Client struct { Meta *MetaService Migrations *MigrationService Organizations *OrganizationsService + PrivateRegistries *PrivateRegistriesService + Projects *ProjectsService PullRequests *PullRequestsService RateLimit *RateLimitService Reactions *ReactionsService @@ -222,6 +256,7 @@ type Client struct { Search *SearchService SecretScanning *SecretScanningService SecurityAdvisories *SecurityAdvisoriesService + SubIssue *SubIssueService Teams *TeamsService Users *UsersService } @@ -231,11 +266,10 @@ type service struct { } // Client returns the http.Client used by this GitHub client. -// This should only be used for requests to the GitHub API because -// request headers will contain an authorization token. +// The token configured by [WithAuthToken] is attached only to requests to this +// client's configured API and upload origins, so the returned client may also +// be used for requests to other hosts without leaking the token. func (c *Client) Client() *http.Client { - c.clientMu.Lock() - defer c.clientMu.Unlock() clientCopy := *c.client return &clientCopy } @@ -300,11 +334,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 interface{}) (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 } @@ -322,118 +357,348 @@ func addOptions(s string, opts interface{}) (string, error) { return u.String(), nil } -// NewClient returns a new GitHub API client. If a nil httpClient is -// provided, a new http.Client will be used. To use API methods which require -// 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). -func NewClient(httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = &http.Client{} - } - httpClient2 := *httpClient - c := &Client{client: &httpClient2} - c.initialize() - return c -} - -// WithAuthToken returns a copy of the client configured to use the provided token for the Authorization header. -func (c *Client) WithAuthToken(token string) *Client { - c2 := c.copy() - defer c2.initialize() - transport := c2.client.Transport - if transport == nil { - transport = http.DefaultTransport - } - 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)) - return transport.RoundTrip(req) - }, - ) - return c2 +// errUninitialized is returned when an uninitialized Client is used. +var errUninitialized = errors.New("client is not initialized") + +// clientOptions holds the configuration options for a Client. +type clientOptions struct { + httpClient *http.Client + transport http.RoundTripper + timeout *time.Duration + apiVersionMin *string + apiVersionMax *string + userAgent *string + envProxy bool + token *string + baseURL *url.URL + uploadURL *url.URL + disableRateLimitCheck bool + rateLimitRedirectionalEndpoints bool + maxSecondaryRateLimitRetryAfterDuration *time.Duration + marketplaceStubbed bool +} + +// ClientOptionsFunc is a functional option for providing configuration options +// to a Client. +type ClientOptionsFunc func(*clientOptions) error + +// WithHTTPClient returns a ClientOptionsFunc that sets the http.Client +// for a Client. If not set, a default http.Client will be used. +func WithHTTPClient(httpClient *http.Client) ClientOptionsFunc { + return func(o *clientOptions) error { + if httpClient == nil { + return errors.New("http client must not be nil") + } + + httpClient := *httpClient + o.httpClient = &httpClient + return nil + } } -// WithEnterpriseURLs returns a copy of the client configured to use the provided base and -// upload URLs. If the base URL does not have the suffix "/api/v3/", it will be added -// automatically. If the upload URL does not have the suffix "/api/uploads", it will be -// added automatically. -// -// Note that WithEnterpriseURLs is a convenience helper only; -// its behavior is equivalent to setting the BaseURL and UploadURL fields. -// -// Another important thing is that by default, the GitHub Enterprise URL format -// should be http(s)://[hostname]/api/v3/ or you will always receive the 406 status code. -// The upload URL format should be http(s)://[hostname]/api/uploads/. -func (c *Client) WithEnterpriseURLs(baseURL, uploadURL string) (*Client, error) { - c2 := c.copy() - defer c2.initialize() - var err error - c2.BaseURL, err = url.Parse(baseURL) - if err != nil { - return nil, err +// WithTransport returns a ClientOptionsFunc that sets the http.RoundTripper +// for a Client. This overrides the transport set by [WithHTTPClient]. If not +// set and no HTTP client is provided, the default http.RoundTripper will be used. +func WithTransport(transport http.RoundTripper) ClientOptionsFunc { + return func(o *clientOptions) error { + if transport == nil { + return errors.New("transport must not be nil") + } + + o.transport = transport + return nil } +} - if !strings.HasSuffix(c2.BaseURL.Path, "/") { - c2.BaseURL.Path += "/" +// WithTimeout returns a ClientOptionsFunc that sets the timeout for a Client. +// This overrides the timeout set by [WithHTTPClient]. If not set and no HTTP +// client is provided, the default http.Client with no timeout will be used. +// It is recommended to provide a timeout for production environments. +func WithTimeout(timeout time.Duration) ClientOptionsFunc { + return func(o *clientOptions) error { + if timeout < 0 { + return errors.New("timeout must not be negative") + } + + o.timeout = &timeout + return nil } - if !strings.HasSuffix(c2.BaseURL.Path, "/api/v3/") && - !strings.HasPrefix(c2.BaseURL.Host, "api.") && - !strings.Contains(c2.BaseURL.Host, ".api.") { - c2.BaseURL.Path += "api/v3/" +} + +// WithUserAgent returns a ClientOptionsFunc that sets the User-Agent header +// for a Client. If not set, a default User-Agent will be used. +func WithUserAgent(userAgent string) ClientOptionsFunc { + return func(o *clientOptions) error { + o.userAgent = &userAgent + return nil } +} - c2.UploadURL, err = url.Parse(uploadURL) - if err != nil { - return nil, err +// WithEnvProxy returns a ClientOptionsFunc that configures the Client to use +// the HTTP proxy settings from the environment variables +// (e.g., HTTP_PROXY, HTTPS_PROXY, NO_PROXY). +// If not set, the client will not use environment proxy settings. +func WithEnvProxy() ClientOptionsFunc { + return func(o *clientOptions) error { + o.envProxy = true + return nil } +} + +// WithAuthToken returns a ClientOptionsFunc that sets the authentication token +// for a Client. The token is attached only to requests to the Client's +// configured API and upload origins; a request to any other origin is sent +// without it. If not set, the client will make unauthenticated requests. +func WithAuthToken(token string) ClientOptionsFunc { + return func(o *clientOptions) error { + if token == "" { + return errors.New("token must not be empty") + } - if !strings.HasSuffix(c2.UploadURL.Path, "/") { - c2.UploadURL.Path += "/" + o.token = &token + return nil } - if !strings.HasSuffix(c2.UploadURL.Path, "/api/uploads/") && - !strings.HasPrefix(c2.UploadURL.Host, "api.") && - !strings.Contains(c2.UploadURL.Host, ".api.") { - c2.UploadURL.Path += "api/uploads/" +} + +// WithURLs returns a ClientOptionsFunc that sets the base and upload URLs +// while only validating the URL format. Nil values will be ignored and default +// URLs will be used. +func WithURLs(baseURL, uploadURL *string) ClientOptionsFunc { + return func(o *clientOptions) error { + if baseURL != nil { + b, err := parseURL(*baseURL) + if err != nil { + return fmt.Errorf("invalid base url: %w", err) + } + + o.baseURL = b + } + + if uploadURL != nil { + u, err := parseURL(*uploadURL) + if err != nil { + return fmt.Errorf("invalid upload url: %w", err) + } + + o.uploadURL = u + } + + return nil } - return c2, nil } -// initialize sets default values and initializes services. -func (c *Client) initialize() { - if c.client == nil { +// WithEnterpriseURLs returns a ClientOptionsFunc that sets the base and upload +// URLs for a Client. +func WithEnterpriseURLs(baseURL, uploadURL string) ClientOptionsFunc { + return func(o *clientOptions) error { + b, err := parseURL(baseURL) + if err != nil { + return fmt.Errorf("invalid base url: %w", err) + } + + if !strings.HasSuffix(b.Path, "/api/v3/") && + !strings.HasPrefix(b.Host, "api.") && + !strings.Contains(b.Host, ".api.") { + b.Path += "api/v3/" + } + + o.baseURL = b + + u, err := parseURL(uploadURL) + if err != nil { + return fmt.Errorf("invalid upload url: %w", err) + } + + if !strings.HasSuffix(u.Path, "/api/uploads/") && + !strings.HasPrefix(u.Host, "api.") && + !strings.Contains(u.Host, ".api.") && + !strings.HasPrefix(u.Host, "uploads.") { + u.Path += "api/uploads/" + } + + o.uploadURL = u + + return nil + } +} + +// WithDisableRateLimitCheck returns a ClientOptionsFunc that disables rate +// limit checking for a Client. If not set, the client will check for rate +// limits and track them. +func WithDisableRateLimitCheck() ClientOptionsFunc { + return func(o *clientOptions) error { + o.disableRateLimitCheck = true + return nil + } +} + +// WithRateLimitRedirectionalEndpoints returns a ClientOptionsFunc that +// configures the Client to respect rate limit headers on endpoints that +// return 302 redirection to artifacts. If not set, the client will not +// respect rate limit headers on these endpoints. +func WithRateLimitRedirectionalEndpoints() ClientOptionsFunc { + return func(o *clientOptions) error { + o.rateLimitRedirectionalEndpoints = true + return nil + } +} + +// WithMaxSecondaryRateLimitRetryAfterDuration returns a ClientOptionsFunc +// that configures the Client secondary rate limit max retry after duration. +func WithMaxSecondaryRateLimitRetryAfterDuration(duration time.Duration) ClientOptionsFunc { + return func(o *clientOptions) error { + o.maxSecondaryRateLimitRetryAfterDuration = &duration + return nil + } +} + +// NewClient returns a new GitHub API client configured with the provided +// options. The default configuration is suitable for making unauthenticated +// requests to the public GitHub API. +// +// For GitHub Enterprise, use [WithEnterpriseURLs] to set the base and upload +// URLs. +// +// To make authenticated requests, use [WithAuthToken] or [WithHTTPClient] to +// pass in a [http.Client] that performs authentication +// (e.g., using golang.org/x/oauth2). +// +// For production usage it is recommended to provide a timeout using +// [WithTimeout] or by providing a custom [http.Client] with an appropriate +// timeout using [WithHTTPClient]. +func NewClient(opts ...ClientOptionsFunc) (*Client, error) { + o := clientOptions{} + for _, opt := range opts { + if err := opt(&o); err != nil { + return nil, err + } + } + + return newClient(o) +} + +// newClient creates a new Client with the provided options. This is an internal +// helper function that is called by [NewClient] and [Client.Clone]. +func newClient(opts clientOptions) (*Client, error) { + c := &Client{ + apiVersionDefault: api20221128, + apiVersionMin: api20221128, + apiVersionMax: api20260310, + } + + if opts.httpClient != nil { + c.client = opts.httpClient + } else { c.client = &http.Client{} } - // Copy the main http client into the IgnoreRedirects one, overriding the `CheckRedirect` func - c.clientIgnoreRedirects = &http.Client{} - c.clientIgnoreRedirects.Transport = c.client.Transport - c.clientIgnoreRedirects.Timeout = c.client.Timeout - c.clientIgnoreRedirects.Jar = c.client.Jar - c.clientIgnoreRedirects.CheckRedirect = func(req *http.Request, via []*http.Request) error { - return http.ErrUseLastResponse + + if opts.transport != nil { + c.client.Transport = opts.transport + } + + if opts.timeout != nil { + c.client.Timeout = *opts.timeout + } + + if opts.envProxy { + transport := c.client.Transport + if transport == nil { + transport = http.DefaultTransport + } + + t, ok := transport.(*http.Transport) + if !ok { + return nil, errors.New("cannot set environment proxy on non-http transport") + } + + t2 := t.Clone() + t2.Proxy = http.ProxyFromEnvironment + c.client.Transport = t2 + } + + if opts.apiVersionMin != nil { + c.apiVersionMin = *opts.apiVersionMin + } + + if opts.apiVersionMax != nil { + c.apiVersionMax = *opts.apiVersionMax + } + + if opts.userAgent != nil { + c.userAgent = *opts.userAgent + } else { + c.userAgent = defaultUserAgent + } + + if opts.baseURL != nil { + c.baseURL = opts.baseURL + } else { + c.baseURL, _ = url.Parse(defaultBaseURL) + } + + if opts.uploadURL != nil { + c.uploadURL = opts.uploadURL + } else { + c.uploadURL, _ = url.Parse(uploadBaseURL) } - if c.BaseURL == nil { - c.BaseURL, _ = url.Parse(defaultBaseURL) + + // Install the credential wrapper only after the API and upload origins are + // known: the wrapper consults them for every request, so that a request to + // any other origin goes out unauthenticated instead of carrying the token. + c.baseTransport = c.client.Transport + if opts.token != nil { + token := "Bearer " + *opts.token + c.authToken = opts.token + + transport := c.baseTransport + if transport == nil { + transport = http.DefaultTransport + } + + c.client.Transport = roundTripperFunc(func(req *http.Request) (*http.Response, error) { + if c.shouldAuthorizeRequest(req.URL) { + req = req.Clone(req.Context()) + req.Header.Set("Authorization", token) + } + + return transport.RoundTrip(req) + }) } - if c.UploadURL == nil { - c.UploadURL, _ = url.Parse(uploadBaseURL) + + c.clientIgnoreRedirects = &http.Client{ + Transport: c.client.Transport, + Timeout: c.client.Timeout, + Jar: c.client.Jar, + CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, } - if c.UserAgent == "" { - c.UserAgent = defaultUserAgent + + c.disableRateLimitCheck = opts.disableRateLimitCheck + + if !c.disableRateLimitCheck { + c.rateLimitRedirectionalEndpoints = opts.rateLimitRedirectionalEndpoints + + if opts.maxSecondaryRateLimitRetryAfterDuration != nil { + c.maxSecondaryRateLimitRetryAfterDuration = *opts.maxSecondaryRateLimitRetryAfterDuration + } } + c.common.client = c c.Actions = (*ActionsService)(&c.common) c.Activity = (*ActivityService)(&c.common) c.Admin = (*AdminService)(&c.common) + c.AgentTasks = (*AgentTasksService)(&c.common) + c.Agents = (*AgentsService)(&c.common) c.Apps = (*AppsService)(&c.common) c.Authorizations = (*AuthorizationsService)(&c.common) c.Billing = (*BillingService)(&c.common) c.Checks = (*ChecksService)(&c.common) + c.Classroom = (*ClassroomService)(&c.common) + c.CodeQuality = (*CodeQualityService)(&c.common) c.CodeScanning = (*CodeScanningService)(&c.common) 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) @@ -446,10 +711,12 @@ func (c *Client) initialize() { c.Issues = (*IssuesService)(&c.common) c.Licenses = (*LicensesService)(&c.common) c.Markdown = (*MarkdownService)(&c.common) - c.Marketplace = &MarketplaceService{client: c} + c.Marketplace = &MarketplaceService{client: c, Stubbed: opts.marketplaceStubbed} 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) @@ -458,53 +725,228 @@ func (c *Client) initialize() { c.Search = (*SearchService)(&c.common) c.SecretScanning = (*SecretScanningService)(&c.common) c.SecurityAdvisories = (*SecurityAdvisoriesService)(&c.common) + c.SubIssue = (*SubIssueService)(&c.common) c.Teams = (*TeamsService)(&c.common) c.Users = (*UsersService)(&c.common) + + return c, nil } -// copy returns a copy of the current client. It must be initialized before use. -func (c *Client) copy() *Client { - c.clientMu.Lock() - // can't use *c here because that would copy mutexes by value. - clone := Client{ - client: &http.Client{}, - UserAgent: c.UserAgent, - BaseURL: c.BaseURL, - UploadURL: c.UploadURL, - RateLimitRedirectionalEndpoints: c.RateLimitRedirectionalEndpoints, - secondaryRateLimitReset: c.secondaryRateLimitReset, - } - c.clientMu.Unlock() - if c.client != nil { - clone.client.Transport = c.client.Transport - clone.client.CheckRedirect = c.client.CheckRedirect - clone.client.Jar = c.client.Jar - clone.client.Timeout = c.client.Timeout +// A request's destination is governed by two rules, and they deliberately differ +// because a credential and a payload fail in opposite ways. +// +// Credentials — the token configured by [WithAuthToken], and the credentials on +// [BasicAuthTransport] and [UnauthenticatedRateLimitedTransport] — are sent +// only to origins the caller has configured. Any other destination, including +// a redirect hop, goes out with no credentials attached. Such a request is +// never rejected and the credentials are never forwarded: it is simply sent +// unauthenticated, so that a caller cannot leak a token by handing the client a +// URL whose host it does not control. Withholding a credential is safe to do +// silently because the request can still succeed without it — a pre-signed +// download URL handed back by the API is the ordinary case. +// +// A payload cannot be withheld that way, because a request whose body is dropped +// cannot succeed at all, and the caller would be told a request succeeded when +// nothing was stored. The rule for a body is therefore absolute: the two +// constructors that build one — [Client.NewUploadRequest] and +// [Client.NewFormRequest] — refuse to aim it at an origin this client was not +// configured for, so the caller's bytes are never sent to a host the caller did +// not choose. See [ErrUntrustedDestination]. +// +// Within a Client both rules read the same two configured origins, BaseURL and +// UploadURL, which is where [WithEnterpriseURLs] and [WithURLs] put them; a +// GitHub Enterprise or proxy deployment whose upload host differs from its API +// host must therefore configure both. The exported transports are not attached +// to a Client and take their own [BasicAuthTransport.AllowedOrigins] list +// instead. sameOrigin is the one predicate behind both rules. Every place that +// decides whether a destination may receive credentials — the WithAuthToken +// wrapper, both exported auth transports, and the redirect guards — must use it, +// so the answer cannot differ depending on which code path a request happens to +// take. + +// ErrUntrustedDestination is returned by [Client.NewUploadRequest] and +// [Client.NewFormRequest] when a request they build would send its body to an +// origin this client was not configured for. +// +// The URL for such a request is routinely read out of an API response — a +// release's UploadURL is the usual case — so the host in one is chosen by +// whoever answered the request rather than by the caller. A response naming a +// foreign host must not be able to take the caller's bytes, and an error is the +// only safe answer: sending the payload unauthenticated, the way a credential is +// withheld, would report success for a request that never reached GitHub. +// +// Configure the destination with [WithURLs] or [WithEnterpriseURLs] if a request +// legitimately belongs on a host other than BaseURL or UploadURL. +var ErrUntrustedDestination = errors.New("refusing to send a request body to a destination the client is not configured for") + +// defaultAuthOrigins are the origins credentials may be sent to when no +// allowlist is configured: GitHub.com's API and upload hosts. An empty +// allowlist must never be read as "any origin". +var defaultAuthOrigins = []*url.URL{ + {Scheme: "https", Host: "api.github.com"}, + {Scheme: "https", Host: "uploads.github.com"}, +} + +// sameOrigin reports whether u and base share an origin: the same scheme, the +// same hostname, and the same port once the scheme's default port is implied. A +// nil argument never matches. +func sameOrigin(u, base *url.URL) bool { + if u == nil || base == nil { + return false } - c.rateMu.Lock() - copy(clone.rateLimits[:], c.rateLimits[:]) - c.rateMu.Unlock() - return &clone + + return strings.EqualFold(u.Scheme, base.Scheme) && + strings.EqualFold(u.Hostname(), base.Hostname()) && + normalizedPort(u) == normalizedPort(base) } -// NewClientWithEnvProxy enhances NewClient with the HttpProxy env. -func NewClientWithEnvProxy() *Client { - return NewClient(&http.Client{Transport: &http.Transport{Proxy: http.ProxyFromEnvironment}}) +// normalizedPort returns u's explicit port, or the default port for u's scheme +// so that "https://ghe.example.com" and "https://ghe.example.com:443" compare +// equal. It returns "" for a scheme with no default port. +func normalizedPort(u *url.URL) string { + if port := u.Port(); port != "" { + return port + } + + switch strings.ToLower(u.Scheme) { + case "http": + return "80" + case "https": + return "443" + default: + return "" + } } -// 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. - return NewClient(nil).WithAuthToken(token) +// isAllowedOrigin reports whether u matches one of origins. An empty origins +// list means [defaultAuthOrigins], not "allow every origin". +func isAllowedOrigin(u *url.URL, origins []*url.URL) bool { + if len(origins) == 0 { + origins = defaultAuthOrigins + } + + for _, origin := range origins { + if sameOrigin(u, origin) { + return true + } + } + + return false } -// NewEnterpriseClient returns a new GitHub API client with provided -// base URL and upload URL (often is your GitHub Enterprise hostname). +// shouldAuthorizeRequest reports whether the credentials configured on c may be +// sent to u. The client's own origins are read here, at request time, rather +// than captured when the wrapper was installed: GitHub Enterprise installs and +// test setups assign baseURL/uploadURL directly, and the rest of the request +// plumbing (NewRequest, BaseURL) reads them the same way. +func (c *Client) shouldAuthorizeRequest(u *url.URL) bool { + return sameOrigin(u, c.baseURL) || sameOrigin(u, c.uploadURL) +} + +// checkBodyDestination returns [ErrUntrustedDestination] when u is not an origin +// this client may send a request body to. // -// Deprecated: Use NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) instead. -func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) { - return NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) +// Such a request carries the caller's payload to a URL that a response usually +// chose, and unlike a credential a body cannot be withheld and then have the +// request still mean anything. So the destination is refused outright rather +// than quietly sent unauthenticated, and the refusal happens where the request +// is built, before any byte of the body is written. +func (c *Client) checkBodyDestination(u *url.URL) error { + if c.shouldAuthorizeRequest(u) { + return nil + } + + return fmt.Errorf("%w: %v", ErrUntrustedDestination, u.Redacted()) +} + +// UserAgent returns the User-Agent header value for the client. +func (c *Client) UserAgent() string { + return c.userAgent +} + +// BaseURL returns the base URL for API requests. +func (c *Client) BaseURL() string { + if c.baseURL == nil { + return "" + } + return c.baseURL.String() +} + +// UploadURL returns the base URL for upload API requests. +func (c *Client) UploadURL() string { + if c.uploadURL == nil { + return "" + } + return c.uploadURL.String() +} + +// Clone returns a copy of the client with the same configuration and services. +// The returned client has its own http.Client but shares the client +// configuration such as transport and timeout. The returned client starts with +// the same rate limit information as the original client, but it is not +// updated when the original client's rate limit information is updated. +// The returned client is independent of the original client and can be +// modified without affecting the original client. Any token configured by +// [WithAuthToken] carries over to the clone, and is re-scoped to the clone's +// own API and upload origins. +func (c *Client) Clone(opts ...ClientOptionsFunc) (*Client, error) { + if c.client == nil { + return nil, errUninitialized + } + + o := clientOptions{ + apiVersionMin: &c.apiVersionMin, + apiVersionMax: &c.apiVersionMax, + userAgent: &c.userAgent, + baseURL: new(*c.baseURL), + uploadURL: new(*c.uploadURL), + token: c.authToken, + disableRateLimitCheck: c.disableRateLimitCheck, + rateLimitRedirectionalEndpoints: c.rateLimitRedirectionalEndpoints, + maxSecondaryRateLimitRetryAfterDuration: &c.maxSecondaryRateLimitRetryAfterDuration, + } + + if c.Marketplace != nil { + o.marketplaceStubbed = c.Marketplace.Stubbed + } + + for _, opt := range opts { + if err := opt(&o); err != nil { + return nil, err + } + } + + if o.httpClient == nil { + // A clone that carries a token installs the credential against its own + // origins, so it starts from the unwrapped transport: reusing the + // wrapped one would stack a second check that still enforces the + // original client's origins. + transport := c.client.Transport + if c.authToken != nil { + transport = c.baseTransport + } + + o.httpClient = &http.Client{ + Transport: transport, + CheckRedirect: c.client.CheckRedirect, + Jar: c.client.Jar, + Timeout: c.client.Timeout, + } + } + + clone, err := newClient(o) + if err != nil { + return nil, err + } + + if !clone.disableRateLimitCheck { + c.rateMu.Lock() + clone.rateLimits = c.rateLimits + clone.secondaryRateLimitReset = c.secondaryRateLimitReset + c.rateMu.Unlock() + } + + return clone, nil } // RequestOption represents an option that can modify an http.Request. @@ -519,17 +961,45 @@ func WithVersion(version string) RequestOption { } } +// requestBufferPool pools response read buffers so that Client.Do can decode +// JSON payloads without allocating a growing buffer per call. +var requestBufferPool = sync.Pool{ + New: func() any { + return new(bytes.Buffer) + }, +} + +// maxPooledBufferCap is the largest buffer capacity that putRequestBuffer +// returns to requestBufferPool. Buffers that grew beyond it while reading an +// unusually large response are dropped so they do not pin memory in the pool. +const maxPooledBufferCap = 1 << 20 + +// putRequestBuffer resets buf and returns it to requestBufferPool, dropping +// oversized buffers. It reports whether buf was pooled. +func putRequestBuffer(buf *bytes.Buffer) bool { + if buf.Cap() > maxPooledBufferCap { + return false + } + buf.Reset() + requestBufferPool.Put(buf) + return true +} + // NewRequest creates an API request. A relative URL can be provided in urlStr, // in which case it is resolved relative to the BaseURL of the Client. // Relative URLs should always be specified without a preceding slash. If // specified, the value pointed to by body is JSON encoded and included as the // request body. -func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") { - return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) +func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body any, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.baseURL.Path, "/") { + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.baseURL) } - u, err := c.BaseURL.Parse(urlStr) + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err + } + + u, err := c.baseURL.Parse(urlStr) if err != nil { return nil, err } @@ -545,7 +1015,7 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...Req } } - req, err := http.NewRequest(method, u.String(), buf) + req, err := http.NewRequestWithContext(ctx, method, u.String(), buf) if err != nil { return nil, err } @@ -554,10 +1024,10 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...Req req.Header.Set("Content-Type", "application/json") } req.Header.Set("Accept", mediaTypeV3) - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) + if c.userAgent != "" { + req.Header.Set("User-Agent", c.userAgent) } - req.Header.Set(headerAPIVersion, defaultAPIVersion) + req.Header.Set(headerAPIVersion, c.apiVersionDefault) for _, opt := range opts { opt(req) @@ -570,27 +1040,44 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...Req // in which case it is resolved relative to the BaseURL of the Client. // Relative URLs should always be specified without a preceding slash. // Body is sent with Content-Type: application/x-www-form-urlencoded. -func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.BaseURL.Path, "/") { - return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) +// +// An absolute urlStr replaces the BaseURL, so the request is refused with +// [ErrUntrustedDestination] unless it targets an origin this Client was +// configured for. This constructor carries a body, and a body cannot be withheld +// the way a credential can: see the destination rules on [ErrUntrustedDestination]. +func (c *Client) NewFormRequest(ctx context.Context, urlStr string, body io.Reader, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.baseURL.Path, "/") { + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.baseURL) } - u, err := c.BaseURL.Parse(urlStr) + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err + } + + u, err := c.baseURL.Parse(urlStr) if err != nil { return nil, err } - req, err := http.NewRequest(http.MethodPost, u.String(), body) + // The same gate as NewUploadRequest, for the same reason: this builds a + // request that carries the caller's bytes, and an absolute urlStr is a + // destination a response could have supplied. Today's only caller passes a + // relative path, so this is a guard against the next one rather than a fix. + if err := c.checkBodyDestination(u); err != nil { + return nil, err + } + + req, err := http.NewRequestWithContext(ctx, "POST", u.String(), body) if err != nil { return nil, err } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Accept", mediaTypeV3) - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) + if c.userAgent != "" { + req.Header.Set("User-Agent", c.userAgent) } - req.Header.Set(headerAPIVersion, defaultAPIVersion) + req.Header.Set(headerAPIVersion, c.apiVersionDefault) for _, opt := range opts { opt(req) @@ -599,32 +1086,104 @@ func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOp return req, nil } +// checkURLPathTraversal returns ErrPathForbidden if urlStr contains ".." as a +// path segment (e.g. "a/../b"), preventing path traversal attacks. Percent- +// encoded equivalents such as "%2e%2e" are also rejected because url.Parse +// decodes them to ".." before the check runs. It does not match ".." embedded +// within a segment (e.g. "file..txt"). The check is performed only on the path +// portion of the URL, ignoring any query string or fragment. +func checkURLPathTraversal(urlStr string) error { + u, err := url.Parse(urlStr) + if err != nil { + return err + } + if slices.Contains(strings.Split(u.Path, "/"), "..") { + return ErrPathForbidden + } + return nil +} + // NewUploadRequest creates an upload request. A relative URL can be provided in // urlStr, in which case it is resolved relative to the UploadURL of the Client. // Relative URLs should always be specified without a preceding slash. -func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string, opts ...RequestOption) (*http.Request, error) { - if !strings.HasSuffix(c.UploadURL.Path, "/") { - return nil, fmt.Errorf("uploadURL must have a trailing slash, but %q does not", c.UploadURL) +// +// An absolute urlStr replaces the Client's UploadURL, and the host in one of +// those is usually chosen by an API response rather than by the caller — a +// release's UploadURL is the usual case. The request is therefore refused with +// [ErrUntrustedDestination] unless it targets an origin this Client was +// configured for, so that a response cannot redirect the caller's bytes to a +// host the caller did not choose. +func (c *Client) NewUploadRequest(ctx context.Context, urlStr string, reader io.Reader, size int64, mediaType string, opts ...RequestOption) (*http.Request, error) { + if !strings.HasSuffix(c.uploadURL.Path, "/") { + return nil, fmt.Errorf("uploadURL must have a trailing slash, but %q does not", c.uploadURL) + } + + if err := checkURLPathTraversal(urlStr); err != nil { + return nil, err } - u, err := c.UploadURL.Parse(urlStr) + + u, err := c.uploadURL.Parse(urlStr) if err != nil { return nil, err } - req, err := http.NewRequest("POST", u.String(), reader) + // The same gate as NewFormRequest, for the same reason: this builds a + // request that carries the caller's bytes, and an absolute urlStr is a + // destination a response could have supplied. + if err := c.checkBodyDestination(u); err != nil { + return nil, err + } + + requestBody := reader + if reader != nil { + // Wrap the provided reader so transport code does not observe concrete body types + // (for example *os.File) and switch to platform-specific sendfile fast paths. + // + // Why this exists: + // race-enabled test runs on Windows have surfaced data races in the sendfile path + // while request read/write loops run concurrently. Hiding concrete type information + // keeps uploads on the generic io.Reader copy path, which is race-stable and preserves + // request semantics (same bytes, same headers, same content length). + requestBody = uploadRequestBodyReader{Reader: reader} + } + + req, err := http.NewRequestWithContext(ctx, "POST", u.String(), requestBody) if err != nil { return nil, err } req.ContentLength = size + // Set GetBody so HTTP/2 transports can retry the request when a stream is + // refused (REFUSED_STREAM / GOAWAY) after the body has been written. Without + // GetBody, net/http2 fails with "cannot retry ... after Request.Body was + // written". See https://github.com/google/go-github/issues/2113. + // + // http.Request.GetBody must return an independent copy of the body, so we + // require io.ReaderAt (to read without moving the original body's position) + // in addition to io.Seeker (to record the body's starting offset). This is + // satisfied by *os.File, *bytes.Reader and *strings.Reader. Readers that + // cannot provide an independent, rewindable view are left without GetBody so + // that large uploads are never buffered in memory. + seeker, isSeeker := reader.(io.Seeker) + readerAt, isReaderAt := reader.(io.ReaderAt) + if isSeeker && isReaderAt { + offset, err := seeker.Seek(0, io.SeekCurrent) + if err != nil { + return nil, err + } + req.GetBody = func() (io.ReadCloser, error) { + return io.NopCloser(uploadRequestBodyReader{Reader: io.NewSectionReader(readerAt, offset, size)}), nil + } + } + if mediaType == "" { mediaType = defaultMediaType } req.Header.Set("Content-Type", mediaType) req.Header.Set("Accept", mediaTypeV3) - req.Header.Set("User-Agent", c.UserAgent) - req.Header.Set(headerAPIVersion, defaultAPIVersion) + req.Header.Set("User-Agent", c.userAgent) + req.Header.Set(headerAPIVersion, c.apiVersionDefault) for _, opt := range opts { opt(req) @@ -633,6 +1192,12 @@ func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, m return req, nil } +// uploadRequestBodyReader intentionally wraps an io.Reader to hide concrete reader types. +// See NewUploadRequest for why this prevents race-prone transport optimizations. +type uploadRequestBodyReader struct { + io.Reader +} + // Response is a GitHub API response. This wraps the standard http.Response // returned from GitHub and provides convenient access to things like // pagination links. @@ -696,7 +1261,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 @@ -719,8 +1284,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 } } @@ -764,21 +1328,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 @@ -799,7 +1363,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 @@ -835,36 +1399,65 @@ const ( SleepUntilPrimaryRateLimitResetWhenRateLimited ) +// maxErrorBodySize is the maximum number of bytes read from an HTTP error +// response body. Limits memory allocation when a server returns an +// unexpectedly large error body. +const maxErrorBodySize = 1 * 1024 * 1024 // 1 MiB + +// ErrUnsupportedAPIVersion is returned when the API version specified in the +// request is not supported by the client. +var ErrUnsupportedAPIVersion = errors.New("unsupported api version") + +// checkRequestAPIVersionBeforeDo checks if the API version specified in the +// request is supported by the client before making the API call. If the +// version is not supported, it returns [ErrUnsupportedAPIVersion]. If the +// version is empty it returns nil. +func (c *Client) checkRequestAPIVersionBeforeDo(req *http.Request) error { + reqAPIVersion := req.Header.Get(headerAPIVersion) + + if reqAPIVersion == "" { + return nil + } + + if reqAPIVersion < c.apiVersionMin || reqAPIVersion > c.apiVersionMax { + return ErrUnsupportedAPIVersion + } + + return nil +} + // 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. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Request) (*Response, error) { - if ctx == nil { - return nil, errNonNilContext +func (c *Client) bareDo(caller *http.Client, req *http.Request) (*Response, error) { + ctx := req.Context() + + if err := c.checkRequestAPIVersionBeforeDo(req); err != nil { + return nil, err } - req = withContext(ctx, req) + rateLimitCategory := CoreCategory - rateLimitCategory := GetRateLimitCategory(req.Method, req.URL.Path) + if !c.disableRateLimitCheck { + rateLimitCategory = GetRateLimitCategory(req.Method, req.URL.Path) - if bypass := ctx.Value(BypassRateLimitCheck); bypass == nil { - // If we've hit rate limit, don't make further requests before Reset time. - if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil { - return &Response{ - Response: err.Response, - Rate: err.Rate, - }, err - } - // If we've hit a secondary rate limit, don't make further requests before Retry After. - if err := c.checkSecondaryRateLimitBeforeDo(req); err != nil { - return &Response{ - Response: err.Response, - }, err + if bypass := ctx.Value(BypassRateLimitCheck); bypass == nil { + // If we've hit rate limit, don't make further requests before Reset time. + if err := c.checkRateLimitBeforeDo(req, rateLimitCategory); err != nil { + return &Response{ + Response: err.Response, + Rate: err.Rate, + }, err + } + + // If we've hit a secondary rate limit, don't make further requests before Retry After. + if err := c.checkSecondaryRateLimitBeforeDo(req); err != nil { + return &Response{ + Response: err.Response, + }, err + } } } @@ -884,7 +1477,7 @@ 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 { + if e, ok := errors.AsType[*url.Error](err); ok { if url, err := url.Parse(e.URL); err == nil { e.URL = sanitizeURL(url).String() return response, e @@ -894,25 +1487,29 @@ func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Requ return response, err } - // Don't update the rate limits if this was a cached response. - // X-From-Cache is set by https://github.com/gregjones/httpcache - if response.Header.Get("X-From-Cache") == "" { + // Don't update the rate limits if the client has rate limits disabled or if + // this was a cached response. The X-From-Cache is set by + // https://github.com/bartventer/httpcache if it's enabled. + if !c.disableRateLimitCheck && response.Header.Get("X-From-Cache") == "" { c.rateMu.Lock() c.rateLimits[rateLimitCategory] = response.Rate c.rateMu.Unlock() } + // CheckResponse substitutes r.Body with a re-readable copy on error + // responses, so capture the network body first: it is the one that must + // be closed. + origBody := resp.Body err = CheckResponse(resp) if err != nil { - defer resp.Body.Close() + defer origBody.Close() // Special case for AcceptedErrors. If an AcceptedError // has been encountered, the response's payload will be // added to the AcceptedError and returned. // // Issue #1022 - aerr, ok := err.(*AcceptedError) - if ok { - b, readErr := io.ReadAll(resp.Body) + if aerr, ok := errors.AsType[*AcceptedError](err); ok { + b, readErr := io.ReadAll(io.LimitReader(resp.Body, maxErrorBodySize)) if readErr != nil { return response, readErr } @@ -921,21 +1518,23 @@ 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 { - if err := sleepUntilResetWithBuffer(req.Context(), rateLimitError.Rate.Reset.Time); err != nil { + var rateLimitError *RateLimitError + if errors.As(err, &rateLimitError) && + ctx.Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + if err := sleepUntilResetWithBuffer(ctx, rateLimitError.Rate.Reset.Time); err != nil { return response, err } - // retry the request once when the rate limit has reset - return c.bareDo(context.WithValue(req.Context(), SleepUntilPrimaryRateLimitResetWhenRateLimited, nil), caller, req) + // retry the request now the rate limit should have been reset + newReq := req.Clone(context.WithValue(ctx, SleepUntilPrimaryRateLimitResetWhenRateLimited, nil)) + return c.bareDo(caller, newReq) } // 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 + if c.maxSecondaryRateLimitRetryAfterDuration > 0 && rerr.GetRetryAfter() > c.maxSecondaryRateLimitRetryAfterDuration { + rerr.RetryAfter = &c.maxSecondaryRateLimitRetryAfterDuration } c.rateMu.Lock() c.secondaryRateLimitReset = time.Now().Add(*rerr.RetryAfter) @@ -946,25 +1545,19 @@ 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. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error) { - return c.bareDo(ctx, c.client, req) +func (c *Client) BareDo(req *http.Request) (*Response, error) { + return c.bareDo(c.client, req) } // bareDoIgnoreRedirects has the exact same behavior as BareDo but stops at the first // redirection code returned by the API. If a redirection is returned by the api, bareDoIgnoreRedirects // returns a *RedirectionError. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDoIgnoreRedirects(ctx context.Context, req *http.Request) (*Response, error) { - return c.bareDo(ctx, c.clientIgnoreRedirects, req) +func (c *Client) bareDoIgnoreRedirects(req *http.Request) (*Response, error) { + return c.bareDo(c.clientIgnoreRedirects, req) } var errInvalidLocation = errors.New("invalid or empty Location header in redirection response") @@ -973,20 +1566,16 @@ var errInvalidLocation = errors.New("invalid or empty Location header in redirec // a 302, it will parse the Location header into a *url.URL and return that. // This is useful for endpoints that return a 302 in successful cases but still might return 301s for // permanent redirections. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it is -// canceled or times out, ctx.Err() will be returned. -func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRedirects int) (*url.URL, *Response, error) { - response, err := c.bareDoIgnoreRedirects(ctx, req) +func (c *Client) bareDoUntilFound(req *http.Request, maxRedirects int) (*url.URL, *Response, error) { + response, err := c.bareDoIgnoreRedirects(req) if err != nil { - rerr, ok := err.(*RedirectionError) - if ok { + if rerr, ok := errors.AsType[*RedirectionError](err); ok { // If we receive a 302, transform potential relative locations into absolute and return it. if rerr.StatusCode == http.StatusFound { if rerr.Location == nil { return nil, nil, errInvalidLocation } - newURL := c.BaseURL.ResolveReference(rerr.Location) + newURL := c.baseURL.ResolveReference(rerr.Location) return newURL, response, nil } // If permanent redirect response is returned, follow it @@ -994,10 +1583,18 @@ func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRed if rerr.Location == nil { return nil, nil, errInvalidLocation } - newURL := c.BaseURL.ResolveReference(rerr.Location) - newRequest := req.Clone(ctx) + newURL := c.baseURL.ResolveReference(rerr.Location) + // Refuse to follow a permanent redirect outside the origins + // this client may send credentials to: the auth transport + // attaches them on every hop, so a cross-host target would + // leak them. This uses the same predicate as the transport so + // that the two cannot disagree about which origin is allowed. + if !c.shouldAuthorizeRequest(newURL) { + return nil, response, fmt.Errorf("refusing to follow cross-host redirect from %q to %q", c.baseURL.Host, newURL.Host) + } + newRequest := req.Clone(req.Context()) newRequest.URL = newURL - return c.bareDoUntilFound(ctx, newRequest, maxRedirects-1) + return c.bareDoUntilFound(newRequest, maxRedirects-1) } // If we reached the maximum amount of redirections, return an error if maxRedirects <= 0 && rerr.StatusCode == http.StatusMovedPermanently { @@ -1018,11 +1615,8 @@ func (c *Client) bareDoUntilFound(ctx context.Context, req *http.Request, maxRed // decode it. If v is nil, and no error happens, the response is returned as is. // If rate limit is exceeded and reset time is in the future, Do returns // *RateLimitError immediately without making a network API call. -// -// The provided ctx must be non-nil, if it is nil an error is returned. If it -// is canceled or times out, ctx.Err() will be returned. -func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) { - resp, err := c.BareDo(ctx, req) +func (c *Client) Do(req *http.Request, v any) (*Response, error) { + resp, err := c.BareDo(req) if err != nil { return resp, err } @@ -1033,12 +1627,21 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res case io.Writer: _, err = io.Copy(v, resp.Body) default: - decErr := json.NewDecoder(resp.Body).Decode(v) - if decErr == io.EOF { - decErr = nil // ignore EOF errors caused by empty response body - } - if decErr != nil { - err = decErr + respBuf := requestBufferPool.Get().(*bytes.Buffer) + defer putRequestBuffer(respBuf) + + _, readErr := respBuf.ReadFrom(resp.Body) + if readErr != nil { + err = readErr + } else if respBuf.Len() > 0 { + b := respBuf.Bytes() + decErr := json.Unmarshal(b, v) + if decErr != nil && len(bytes.TrimSpace(b)) == 0 { + decErr = nil // ignore errors caused by whitespace-only response body + } + if decErr != nil { + err = decErr + } } } return resp, err @@ -1049,6 +1652,8 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res // from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily. // Otherwise it returns nil, and Client.Do should proceed normally. func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory RateLimitCategory) *RateLimitError { + ctx := req.Context() + c.rateMu.Lock() rate := c.rateLimits[rateLimitCategory] c.rateMu.Unlock() @@ -1062,8 +1667,8 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory Rat Body: io.NopCloser(strings.NewReader("")), } - if req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { - if err := sleepUntilResetWithBuffer(req.Context(), rate.Reset.Time); err == nil { + if ctx.Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + if err := sleepUntilResetWithBuffer(ctx, rate.Reset.Time); err == nil { return nil } return &RateLimitError{ @@ -1129,7 +1734,7 @@ func compareHTTPResponse(r1, r2 *http.Response) bool { /* An ErrorResponse reports one or more errors caused by an API request. -GitHub API docs: https://docs.github.com/rest/#client-errors +GitHub API docs: https://docs.github.com/rest?apiVersion=2022-11-28#client-errors */ type ErrorResponse struct { Response *http.Response `json:"-"` // HTTP response that caused this error @@ -1140,7 +1745,7 @@ type ErrorResponse struct { Block *ErrorBlock `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing // to some content that might help you resolve the error, see - // https://docs.github.com/rest/#client-errors + // https://docs.github.com/rest?apiVersion=2022-11-28#client-errors DocumentationURL string `json:"documentation_url,omitempty"` } @@ -1154,13 +1759,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) @@ -1168,8 +1773,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 } @@ -1201,7 +1806,7 @@ func (r *ErrorResponse) Is(target error) bool { return false } if r.Block.CreatedAt != nil && v.Block.CreatedAt != nil { - if *(r.Block.CreatedAt) != *(v.Block.CreatedAt) { + if *r.Block.CreatedAt != *v.Block.CreatedAt { return false } } @@ -1226,15 +1831,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 } @@ -1260,15 +1865,15 @@ 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) } // AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits". +// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits". type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message @@ -1280,23 +1885,34 @@ type AbuseRateLimitError struct { } func (r *AbuseRateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v", + retryInfo := "" + if r.RetryAfter != nil && *r.RetryAfter > 0 { + retryInfo = fmt.Sprintf(" [retry after %v]", r.RetryAfter.Round(time.Second)) + } + return fmt.Sprintf("%v %v: %v %v%v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message) + r.Response.StatusCode, r.Message, retryInfo) } // 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 } return r.Message == v.Message && - r.RetryAfter == v.RetryAfter && + equalDurationPtr(r.RetryAfter, v.RetryAfter) && compareHTTPResponse(r.Response, v.Response) } +func equalDurationPtr(a, b *time.Duration) bool { + if a == nil || b == nil { + return a == b + } + return *a == *b +} + // RedirectionError represents a response that returned a redirect status code: // // 301 (Moved Permanently) @@ -1314,15 +1930,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 } @@ -1331,15 +1947,23 @@ func (r *RedirectionError) Is(target error) bool { r.Location != nil && v.Location != nil && r.Location.String() == v.Location.String()) // or they are both not nil and marshaled identically } -// sanitizeURL redacts the client_secret parameter from the URL which may be +var sensitiveParams = []string{"client_secret", "access_token", "token"} + +// sanitizeURL redacts sensitive parameters from the URL which may be // exposed to the user. func sanitizeURL(uri *url.URL) *url.URL { if uri == nil { return nil } params := uri.Query() - if len(params.Get("client_secret")) > 0 { - params.Set("client_secret", "REDACTED") + var redacted bool + for _, p := range sensitiveParams { + if len(params.Get(p)) > 0 { + params.Set(p, "REDACTED") + redacted = true + } + } + if redacted { uri.RawQuery = params.Encode() } return uri @@ -1365,7 +1989,7 @@ GitHub error responses structure are often undocumented and inconsistent. Sometimes error is just a simple string (Issue #540). In such cases, Message represents an error message as a workaround. -GitHub API docs: https://docs.github.com/rest/#client-errors +GitHub API docs: https://docs.github.com/rest?apiVersion=2022-11-28#client-errors */ type Error struct { Resource string `json:"resource"` // resource on which the error occurred @@ -1379,6 +2003,7 @@ func (e *Error) Error() string { e.Code, e.Field, e.Resource) } +// UnmarshalJSON implements the json.Unmarshaler interface. func (e *Error) UnmarshalJSON(data []byte) error { type aliasError Error // avoid infinite recursion by using type alias. if err := json.Unmarshal(data, (*aliasError)(e)); err != nil { @@ -1391,12 +2016,18 @@ func (e *Error) UnmarshalJSON(data []byte) error { // present. A response is considered an error if it has a status code outside // the 200 range or equal to 202 Accepted. // API error responses are expected to have response -// body, and a JSON response body that maps to ErrorResponse. +// body, and a JSON response body that maps to [ErrorResponse]. +// +// On error responses other than 202 Accepted, CheckResponse consumes r.Body +// and replaces it with an in-memory copy so that the error body can be +// re-read. Closing r.Body after CheckResponse returns therefore closes only +// the copy: to release the original body and its underlying connection, +// capture r.Body before the call and close the captured body instead. // -// The error type will be *RateLimitError for rate limit exceeded errors, -// *AcceptedError for 202 Accepted status codes, -// *TwoFactorAuthError for two-factor authentication errors, -// and *RedirectionError for redirect status codes (only happens when ignoring redirections). +// The error type will be *[RateLimitError] for rate limit exceeded errors, +// *[AcceptedError] for 202 Accepted status codes, +// *[TwoFactorAuthError] for two-factor authentication errors, +// and *[RedirectionError] for redirect status codes (only happens when ignoring redirections). func CheckResponse(r *http.Response) error { if r.StatusCode == http.StatusAccepted { return &AcceptedError{} @@ -1406,7 +2037,7 @@ func CheckResponse(r *http.Response) error { } errorResponse := &ErrorResponse{Response: r} - data, err := io.ReadAll(r.Body) + data, err := io.ReadAll(io.LimitReader(r.Body, maxErrorBodySize)) if err == nil && data != nil { err = json.Unmarshal(data, errorResponse) if err != nil { @@ -1421,13 +2052,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/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28 + 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/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#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{ @@ -1472,7 +2108,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 } @@ -1481,6 +2118,7 @@ func parseBoolResponse(err error) (bool, error) { return false, err } +// RateLimitCategory represents the enumeration of rate limit categories. type RateLimitCategory uint8 const ( @@ -1495,6 +2133,7 @@ const ( DependencySnapshotsCategory CodeSearchCategory AuditLogCategory + DependencySBOMCategory Categories // An array of this length will be able to contain all rate limit categories. ) @@ -1502,15 +2141,15 @@ const ( // GetRateLimitCategory returns the rate limit RateLimitCategory of the endpoint, determined by HTTP method and Request.URL.Path. func GetRateLimitCategory(method, path string) RateLimitCategory { switch { - // https://docs.github.com/rest/rate-limit#about-rate-limits + // https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28#about-rate-limits default: // NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too, // because no API found for this category. return CoreCategory - // https://docs.github.com/en/rest/search/search#search-code + // https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-code case strings.HasPrefix(path, "/search/code") && - method == http.MethodGet: + method == "GET": return CodeSearchCategory case strings.HasPrefix(path, "/search/"): @@ -1519,32 +2158,38 @@ 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 + // https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#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 + // https://docs.github.com/rest/code-scanning?apiVersion=2022-11-28#upload-an-analysis-as-sarif-data case strings.HasSuffix(path, "/code-scanning/sarifs"): return CodeScanningUploadCategory - // https://docs.github.com/enterprise-cloud@latest/rest/scim + // https://docs.github.com/enterprise-cloud@latest/rest/scim?apiVersion=2022-11-28 case strings.HasPrefix(path, "/scim/"): return ScimCategory - // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository + // https://docs.github.com/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28#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 + // https://docs.github.com/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/rest/dependency-graph/sboms?apiVersion=2022-11-28 + case strings.HasPrefix(path, "/repos/") && + (strings.HasSuffix(path, "/dependency-graph/sbom") || + strings.HasSuffix(path, "/dependency-graph/sbom/generate-report")): + return DependencySBOMCategory } } @@ -1562,15 +2207,14 @@ func setCredentialsAsHeaders(req *http.Request, id, secret string) *http.Request // // Since we are going to modify only req.Header here, we only need a deep copy // of req.Header. - convertedRequest := new(http.Request) - *convertedRequest = *req + convertedRequest := *req convertedRequest.Header = make(http.Header, len(req.Header)) for k, s := range req.Header { convertedRequest.Header[k] = append([]string(nil), s...) } convertedRequest.SetBasicAuth(id, secret) - return convertedRequest + return &convertedRequest } /* @@ -1586,8 +2230,8 @@ that need to use a higher rate limit associated with your OAuth application. This will add the client id and secret as a base64-encoded string in the format ClientID:ClientSecret and apply it as an "Authorization": "Basic" header. -See https://docs.github.com/rest/#unauthenticated-rate-limited-requests for -more information. +See https://docs.github.com/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#primary-rate-limit-for-oauth-apps +for more information. */ type UnauthenticatedRateLimitedTransport struct { // ClientID is the GitHub OAuth client ID of the current application, which @@ -1599,6 +2243,16 @@ type UnauthenticatedRateLimitedTransport struct { // application. ClientSecret string + // AllowedOrigins limits the origins ClientID and ClientSecret are sent to. + // The credentials are attached only to requests whose origin matches one of + // these; every other request, including a redirect hop, is sent without + // them. + // + // If empty, the GitHub.com API and upload origins are used. An empty + // AllowedOrigins does not mean "any origin": set it explicitly when talking + // to GitHub Enterprise. + AllowedOrigins []*url.URL + // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper @@ -1613,9 +2267,12 @@ func (t *UnauthenticatedRateLimitedTransport) RoundTrip(req *http.Request) (*htt return nil, errors.New("t.ClientSecret is empty") } - req2 := setCredentialsAsHeaders(req, t.ClientID, t.ClientSecret) + if isAllowedOrigin(req.URL, t.AllowedOrigins) { + req = setCredentialsAsHeaders(req, t.ClientID, t.ClientSecret) + } + // Make the HTTP request. - return t.transport().RoundTrip(req2) + return t.transport().RoundTrip(req) } // Client returns an *http.Client that makes requests which are subject to the @@ -1640,6 +2297,15 @@ type BasicAuthTransport struct { Password string // GitHub password OTP string // one-time password for users with two-factor auth enabled + // AllowedOrigins limits the origins the credentials above are sent to. They + // are attached only to requests whose origin matches one of these; every + // other request, including a redirect hop, is sent without them. + // + // If empty, the GitHub.com API and upload origins are used. An empty + // AllowedOrigins does not mean "any origin": set it explicitly when talking + // to GitHub Enterprise. + AllowedOrigins []*url.URL + // Transport is the underlying HTTP transport to use when making requests. // It will default to http.DefaultTransport if nil. Transport http.RoundTripper @@ -1647,11 +2313,14 @@ type BasicAuthTransport struct { // RoundTrip implements the RoundTripper interface. func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error) { - req2 := setCredentialsAsHeaders(req, t.Username, t.Password) - if t.OTP != "" { - req2.Header.Set(headerOTP, t.OTP) + if isAllowedOrigin(req.URL, t.AllowedOrigins) { + req = setCredentialsAsHeaders(req, t.Username, t.Password) + if t.OTP != "" { + req.Header.Set(headerOTP, t.OTP) + } } - return t.transport().RoundTrip(req2) + + return t.transport().RoundTrip(req) } // Client returns an *http.Client that makes requests that are authenticated @@ -1681,9 +2350,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 { @@ -1709,14 +2378,13 @@ func sleepUntilResetWithBuffer(ctx context.Context, reset time.Time) error { // When using roundTripWithOptionalFollowRedirect, note that it // is the responsibility of the caller to close the response body. func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u string, maxRedirects int, opts ...RequestOption) (*http.Response, error) { - req, err := c.NewRequest("GET", u, nil, opts...) + req, err := c.NewRequest(ctx, "GET", u, nil, opts...) if err != nil { return nil, err } var resp *http.Response // Use http.DefaultTransport if no custom Transport is configured - req = withContext(ctx, req) if c.client.Transport == nil { resp, err = http.DefaultTransport.RoundTrip(req) } else { @@ -1730,40 +2398,76 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri if maxRedirects > 0 && resp.StatusCode == http.StatusMovedPermanently { _ = resp.Body.Close() u = resp.Header.Get("Location") + if err := c.checkRedirectHost(u); err != nil { + return nil, err + } resp, err = c.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects-1, opts...) } return resp, err } +// checkRedirectHost returns an error if the redirect target is outside the +// origins this client may send credentials to. The auth transport attaches +// credentials on every hop, so a cross-origin Location header would otherwise +// carry them to a host the caller never configured, when a compromised or +// malicious API response supplies one. An empty Location is also rejected. +func (c *Client) checkRedirectHost(location string) error { + if location == "" { + return errInvalidLocation + } + target, err := url.Parse(location) + if err != nil { + return fmt.Errorf("invalid redirect location %q: %w", location, err) + } + // Resolve relative locations against BaseURL so relative paths are allowed. + target = c.baseURL.ResolveReference(target) + if !c.shouldAuthorizeRequest(target) { + return fmt.Errorf("refusing to follow cross-host redirect from %q to %q", c.baseURL.Host, target.Host) + } + return nil +} + // Ptr is a helper routine that allocates a new T value // to store v and returns a pointer to it. +// +// Deprecated: use the new builtin instead. +// +//go:fix inline func Ptr[T any](v T) *T { - return &v + return new(v) } // Bool is a helper routine that allocates a new bool value // 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 new(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 new(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 new(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 new(v) } // roundTripperFunc creates a RoundTripper (transport). type roundTripperFunc func(*http.Request) (*http.Response, error) @@ -1772,7 +2476,7 @@ func (fn roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { return fn(r) } -var runIDFromURLRE = regexp.MustCompile(`^repos/.*/actions/runs/(\d+)/deployment_protection_rule$`) +var runIDFromURLRE = regexp.MustCompile(`repos/.*/actions/runs/(\d+)/deployment_protection_rule$`) // GetRunID is a Helper Function used to extract the workflow RunID from the *DeploymentProtectionRuleEvent.DeploymentCallBackURL. func (e *DeploymentProtectionRuleEvent) GetRunID() (int64, error) { diff --git a/vendor/github.com/google/go-github/v69/github/gitignore.go b/vendor/github.com/google/go-github/v93/github/gitignore.go similarity index 76% rename from vendor/github.com/google/go-github/v69/github/gitignore.go rename to vendor/github.com/google/go-github/v93/github/gitignore.go index 34cf285e1..9a2c8b2d1 100644 --- a/vendor/github.com/google/go-github/v69/github/gitignore.go +++ b/vendor/github.com/google/go-github/v93/github/gitignore.go @@ -13,7 +13,7 @@ import ( // GitignoresService provides access to the gitignore related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/gitignore/ +// GitHub API docs: https://docs.github.com/rest/gitignore?apiVersion=2022-11-28 type GitignoresService service // Gitignore represents a .gitignore file as returned by the GitHub API. @@ -28,17 +28,17 @@ func (g Gitignore) String() string { // List all available Gitignore templates. // -// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore?apiVersion=2022-11-28#get-all-gitignore-templates // //meta:operation GET /gitignore/templates func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) { - req, err := s.client.NewRequest("GET", "gitignore/templates", nil) + req, err := s.client.NewRequest(ctx, "GET", "gitignore/templates", nil) if err != nil { return nil, nil, err } var availableTemplates []string - resp, err := s.client.Do(ctx, req, &availableTemplates) + resp, err := s.client.Do(req, &availableTemplates) if err != nil { return nil, resp, err } @@ -48,18 +48,18 @@ func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, erro // Get a Gitignore by name. // -// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore?apiVersion=2022-11-28#get-a-gitignore-template // //meta:operation GET /gitignore/templates/{name} func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) { u := fmt.Sprintf("gitignore/templates/%v", name) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - gitignore := new(Gitignore) - resp, err := s.client.Do(ctx, req, gitignore) + var gitignore *Gitignore + resp, err := s.client.Do(req, &gitignore) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/interactions.go b/vendor/github.com/google/go-github/v93/github/interactions.go similarity index 92% rename from vendor/github.com/google/go-github/v69/github/interactions.go rename to vendor/github.com/google/go-github/v93/github/interactions.go index 2268273dd..92bd24b4d 100644 --- a/vendor/github.com/google/go-github/v69/github/interactions.go +++ b/vendor/github.com/google/go-github/v93/github/interactions.go @@ -8,7 +8,7 @@ package github // InteractionsService handles communication with the repository and organization related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/interactions/ +// GitHub API docs: https://docs.github.com/rest/interactions?apiVersion=2022-11-28 type InteractionsService service // InteractionRestriction represents the interaction restrictions for repository and organization. diff --git a/vendor/github.com/google/go-github/v69/github/interactions_orgs.go b/vendor/github.com/google/go-github/v93/github/interactions_orgs.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/interactions_orgs.go rename to vendor/github.com/google/go-github/v93/github/interactions_orgs.go index 47998c4ee..8ec5e8936 100644 --- a/vendor/github.com/google/go-github/v69/github/interactions_orgs.go +++ b/vendor/github.com/google/go-github/v93/github/interactions_orgs.go @@ -12,22 +12,20 @@ import ( // GetRestrictionsForOrg fetches the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#get-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#get-interaction-restrictions-for-an-organization // //meta:operation GET /orgs/{org}/interaction-limits func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) + var organizationInteractions *InteractionRestriction + resp, err := s.client.Do(req, &organizationInteractions) if err != nil { return nil, resp, err } @@ -41,25 +39,23 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz // in public repositories for the given organization. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#set-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#set-interaction-restrictions-for-an-organization // //meta:operation PUT /orgs/{org}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - interaction := &InteractionRestriction{Limit: Ptr(limit)} + interaction := &InteractionRestriction{Limit: &limit} - req, err := s.client.NewRequest("PUT", u, interaction) + req, err := s.client.NewRequest(ctx, "PUT", u, interaction) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - organizationInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, organizationInteractions) + var organizationInteractions *InteractionRestriction + resp, err := s.client.Do(req, &organizationInteractions) if err != nil { return nil, resp, err } @@ -69,18 +65,17 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga // RemoveRestrictionsFromOrg removes the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs?apiVersion=2022-11-28#remove-interaction-restrictions-for-an-organization // //meta:operation DELETE /orgs/{org}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/interactions_repos.go b/vendor/github.com/google/go-github/v93/github/interactions_repos.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/interactions_repos.go rename to vendor/github.com/google/go-github/v93/github/interactions_repos.go index 58fd4f04f..8de75e73c 100644 --- a/vendor/github.com/google/go-github/v69/github/interactions_repos.go +++ b/vendor/github.com/google/go-github/v93/github/interactions_repos.go @@ -12,22 +12,20 @@ import ( // GetRestrictionsForRepo fetches the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#get-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#get-interaction-restrictions-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) + var repositoryInteractions *InteractionRestriction + resp, err := s.client.Do(req, &repositoryInteractions) if err != nil { return nil, resp, err } @@ -41,25 +39,23 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, // for the given repository. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#set-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#set-interaction-restrictions-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - interaction := &InteractionRestriction{Limit: Ptr(limit)} + interaction := &InteractionRestriction{Limit: &limit} - req, err := s.client.NewRequest("PUT", u, interaction) + req, err := s.client.NewRequest(ctx, "PUT", u, interaction) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) - repositoryInteractions := new(InteractionRestriction) - - resp, err := s.client.Do(ctx, req, repositoryInteractions) + var repositoryInteractions *InteractionRestriction + resp, err := s.client.Do(req, &repositoryInteractions) if err != nil { return nil, resp, err } @@ -69,18 +65,17 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own // RemoveRestrictionsFromRepo removes the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos?apiVersion=2022-11-28#remove-interaction-restrictions-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/issue_import.go b/vendor/github.com/google/go-github/v93/github/issue_import.go similarity index 86% rename from vendor/github.com/google/go-github/v69/github/issue_import.go rename to vendor/github.com/google/go-github/v93/github/issue_import.go index 4f0637108..95e61d03d 100644 --- a/vendor/github.com/google/go-github/v69/github/issue_import.go +++ b/vendor/github.com/google/go-github/v93/github/issue_import.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" ) @@ -73,22 +74,20 @@ type IssueImportError struct { // GitHub API docs: https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import // //meta:operation POST /repos/{owner}/{repo}/import/issues -func (s *IssueImportService) Create(ctx context.Context, owner, repo string, issue *IssueImportRequest) (*IssueImportResponse, *Response, error) { +func (s *IssueImportService) Create(ctx context.Context, owner, repo string, body *IssueImportRequest) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues", owner, repo) - req, err := s.client.NewRequest("POST", u, issue) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { 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) + var i *IssueImportResponse + resp, err := s.client.Do(req, &i) if err != nil { - aerr, ok := err.(*AcceptedError) - if ok { - if err := json.Unmarshal(aerr.Raw, i); err != nil { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { + if err := json.Unmarshal(aerr.Raw, &i); err != nil { return i, resp, err } return i, resp, err @@ -106,16 +105,15 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss //meta:operation GET /repos/{owner}/{repo}/import/issues/{issue_number} func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string, issueID int64) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues/%v", owner, repo, issueID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + var i *IssueImportResponse + resp, err := s.client.Do(req, &i) if err != nil { return nil, resp, err } @@ -130,16 +128,15 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string //meta:operation GET /repos/{owner}/{repo}/import/issues func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo string, since Timestamp) ([]*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues?since=%v", owner, repo, since.Format("2006-01-02")) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) var b bytes.Buffer - resp, err := s.client.Do(ctx, req, &b) + resp, err := s.client.Do(req, &b) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/issues.go b/vendor/github.com/google/go-github/v93/github/issues.go new file mode 100644 index 000000000..07526ee3c --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/issues.go @@ -0,0 +1,582 @@ +// Copyright 2013 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" + "time" +) + +// IssuesService handles communication with the issue related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/issues?apiVersion=2022-11-28 +type IssuesService service + +// IssueDependenciesSummary represents a summary of issue dependency counts. +type IssueDependenciesSummary struct { + BlockedBy *int `json:"blocked_by,omitempty"` + Blocking *int `json:"blocking,omitempty"` + TotalBlockedBy *int `json:"total_blocked_by,omitempty"` + TotalBlocking *int `json:"total_blocking,omitempty"` +} + +// SubIssuesSummary represents a summary of sub-issue progress. +type SubIssuesSummary struct { + Total *int `json:"total,omitempty"` + Completed *int `json:"completed,omitempty"` + PercentCompleted *int `json:"percent_completed,omitempty"` +} + +// Issue represents a GitHub issue on a repository. +// +// Note: As far as the GitHub API is concerned, every pull request is an issue, +// but not every issue is a pull request. Some endpoints, events, and webhooks +// may also return pull requests via this struct. If PullRequestLinks is nil, +// this is an issue, and if PullRequestLinks is not nil, this is a pull request. +// The IsPullRequest helper method can be used to check that. +type Issue struct { + ID *int64 `json:"id,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + // StateReason can be one of: "completed", "not_planned", "reopened". + StateReason *string `json:"state_reason,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + // AuthorAssociation is the issue author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issues REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue + AuthorAssociation *string `json:"author_association,omitempty"` + User *User `json:"user,omitempty"` + Labels []*Label `json:"labels,omitempty"` + // Deprecated: GitHub REST API version 2026-03-10 removed the singular assignee field. + // Use Assignees instead. + Assignee *User `json:"assignee,omitempty"` + Comments *int `json:"comments,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ClosedBy *User `json:"closed_by,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` + 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"` + Reactions *Reactions `json:"reactions,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Draft *bool `json:"draft,omitempty"` + Type *IssueType `json:"type,omitempty"` + PinnedComment *IssueComment `json:"pinned_comment,omitempty"` + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` + IssueDependenciesSummary *IssueDependenciesSummary `json:"issue_dependencies_summary,omitempty"` + SubIssuesSummary *SubIssuesSummary `json:"sub_issues_summary,omitempty"` + IssueFieldValues []*IssueFieldValue `json:"issue_field_values,omitempty"` + + // TextMatches is only populated from search results that request text matches + // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + TextMatches []*TextMatch `json:"text_matches,omitempty"` + + // ActiveLockReason is populated only when LockReason is provided while locking the issue. + // Possible values are: "off-topic", "too heated", "resolved", and "spam". + ActiveLockReason *string `json:"active_lock_reason,omitempty"` +} + +func (i Issue) String() string { + return Stringify(i) +} + +// IsPullRequest reports whether the issue is also a pull request. It uses the +// method recommended by GitHub's API documentation, which is to check whether +// PullRequestLinks is non-nil. +func (i Issue) IsPullRequest() bool { + return i.PullRequestLinks != nil +} + +// CreateIssueRequest represents a request to create an issue. +// It is separate from Issue above because otherwise Labels +// and Assignee fail to serialize to the correct JSON. +type CreateIssueRequest struct { + Title string `json:"title"` + Body *string `json:"body,omitempty"` + Labels []string `json:"labels,omitempty"` + Assignee *string `json:"assignee,omitempty"` + Milestone *int `json:"milestone,omitempty"` + Assignees []string `json:"assignees,omitempty"` + Type *string `json:"type,omitempty"` + IssueFieldValues []*IssueRequestFieldValue `json:"issue_field_values,omitempty"` +} + +// UpdateIssueRequest represents a request to edit an issue. +// It is separate from Issue above because otherwise Labels +// and Assignee fail to serialize to the correct JSON. +type UpdateIssueRequest struct { + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + // Labels: nil leaves existing labels unchanged; a non-nil slice replaces + // them, so []string{} clears all labels. + Labels []string `json:"labels,omitzero"` + Assignee *string `json:"assignee,omitempty"` + State *string `json:"state,omitempty"` + // StateReason can be `completed`, `not_planned`, `duplicate` or `reopened`. + StateReason *string `json:"state_reason,omitempty"` + // DuplicateIssueID is required when state_reason is `duplicate`. + DuplicateIssueID *int `json:"duplicate_issue_id,omitempty"` + Milestone *int `json:"milestone,omitempty"` + // Assignees: nil leaves existing assignees unchanged; a non-nil slice + // replaces them, so []string{} clears all assignees. + Assignees []string `json:"assignees,omitzero"` + Type *string `json:"type,omitempty"` + IssueFieldValues []*IssueRequestFieldValue `json:"issue_field_values,omitempty"` +} + +// 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"` + IsEnabled *bool `json:"is_enabled,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// IssueFieldValueSingleSelectOption represents a single-select option for an issue field value. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +type IssueFieldValueSingleSelectOption struct { + ID int64 `json:"id"` + Name string `json:"name"` + Color string `json:"color"` +} + +// IssueRequestFieldValue represents a custom field value to set on an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +type IssueRequestFieldValue struct { + FieldID int64 `json:"field_id"` + Value any `json:"value"` +} + +// IssueFieldValue represents a custom field value attached to an issue. +// The Value field contains a string for text, single_select, and date fields, +// or a number for numeric fields. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +type IssueFieldValue struct { + IssueFieldID int64 `json:"issue_field_id"` + NodeID string `json:"node_id"` + DataType string `json:"data_type"` + Value any `json:"value"` + SingleSelectOption *IssueFieldValueSingleSelectOption `json:"single_select_option,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, 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"` + + Collab bool `url:"collab,omitempty"` + Orgs bool `url:"orgs,omitempty"` + Owned bool `url:"owned,omitempty"` + Pulls bool `url:"pulls,omitempty"` + + ListOptions +} + +// 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// 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 +} + +// ListUserIssues gets issues across owned and member repositories assigned to the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-user-account-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + 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 +// authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-organization-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /orgs/{org}/issues +func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListByOrgOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("orgs/%v/issues", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// IssueListByRepoOptions specifies the optional parameters to the +// IssuesService.ListByRepo method. +type IssueListByRepoOptions struct { + // Milestone limits issues for the specified milestone. Possible values are + // a milestone number, "none" for issues with no milestone, "*" for issues + // with any milestone. + Milestone string `url:"milestone,omitempty"` + + // State filters issues based on their state. Possible values are: open, + // closed, all. Default is "open". + State string `url:"state,omitempty"` + + // Assignee filters issues based on their assignee. Possible values are a + // user name, "none" for issues that are not assigned, "*" for issues with + // 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"` + + // Mentioned filters issues to those mentioned a specific user. + Mentioned string `url:"mentioned,omitempty"` + + // Labels filters issues based on their label. + Labels []string `url:"labels,omitempty,comma"` + + // 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"` + + // ListCursorOptions specifies the optional parameters for cursor pagination. + ListCursorOptions + + // Add ListOptions so offset pagination with integer type "page" query parameter is accepted + // since ListCursorOptions accepts "page" as string only. + ListOptions +} + +// ListByRepo lists the issues for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues +// +//meta:operation GET /repos/{owner}/{repo}/issues +func (s *IssuesService) ListByRepo(ctx context.Context, owner, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// Get a single issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#get-an-issue +// +//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/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var issue *Issue + resp, err := s.client.Do(req, &issue) + if err != nil { + return nil, resp, err + } + + return issue, resp, nil +} + +// Create a new issue on the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#create-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues +func (s *IssuesService) Create(ctx context.Context, owner, repo string, body CreateIssueRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// Update an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} +func (s *IssuesService) Update(ctx context.Context, owner, repo string, number int, body UpdateIssueRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// RemoveMilestone removes a milestone from an issue. +// +// This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} +func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) + req, err := s.client.NewRequest(ctx, "PATCH", u, &struct { + Milestone *Milestone `json:"milestone"` + }{}) + if err != nil { + return nil, nil, err + } + + var i *Issue + resp, err := s.client.Do(req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + +// LockIssueRequest represents a request to lock an issue. +type LockIssueRequest struct { + // LockReason specifies the reason to lock this issue. + // Providing a lock reason can help make it clearer to contributors why an issue + // was locked. Possible values are: "off-topic", "too heated", "resolved", and "spam". + LockReason *string `json:"lock_reason,omitempty"` +} + +// Lock an issue's conversation. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#lock-an-issue +// +//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock +func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, body LockIssueRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// Unlock an issue's conversation. +// +// GitHub API docs: https://docs.github.com/rest/issues/issues?apiVersion=2022-11-28#unlock-an-issue +// +//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/%v/lock", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/issues_assignees.go b/vendor/github.com/google/go-github/v93/github/issues_assignees.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/issues_assignees.go rename to vendor/github.com/google/go-github/v93/github/issues_assignees.go index fd065771e..3b2dd4d3a 100644 --- a/vendor/github.com/google/go-github/v69/github/issues_assignees.go +++ b/vendor/github.com/google/go-github/v93/github/issues_assignees.go @@ -13,7 +13,7 @@ import ( // ListAssignees fetches all available assignees (owners and collaborators) to // which issues may be assigned. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#list-assignees +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#list-assignees // //meta:operation GET /repos/{owner}/{repo}/assignees func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { @@ -23,13 +23,13 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var assignees []*User - resp, err := s.client.Do(ctx, req, &assignees) + resp, err := s.client.Do(req, &assignees) if err != nil { return nil, resp, err } @@ -39,24 +39,24 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o // IsAssignee checks if a user is an assignee for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#check-if-a-user-can-be-assigned // //meta:operation GET /repos/{owner}/{repo}/assignees/{assignee} func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) assignee, err := parseBoolResponse(err) return assignee, resp, err } // AddAssignees adds the provided GitHub users as assignees to the issue. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { @@ -64,13 +64,13 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu Assignees []string `json:"assignees,omitempty"` }{Assignees: assignees} u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("POST", u, users) + req, err := s.client.NewRequest(ctx, "POST", u, users) if err != nil { return nil, nil, err } - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) + var issue *Issue + resp, err := s.client.Do(req, &issue) if err != nil { return nil, resp, err } @@ -80,7 +80,7 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu // RemoveAssignees removes the provided GitHub users as assignees from the issue. // -// GitHub API docs: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees?apiVersion=2022-11-28#remove-assignees-from-an-issue // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { @@ -88,13 +88,13 @@ func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, Assignees []string `json:"assignees,omitempty"` }{Assignees: assignees} u := fmt.Sprintf("repos/%v/%v/issues/%v/assignees", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, users) + req, err := s.client.NewRequest(ctx, "DELETE", u, users) if err != nil { return nil, nil, err } - issue := &Issue{} - resp, err := s.client.Do(ctx, req, issue) + var issue *Issue + resp, err := s.client.Do(req, &issue) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/issues_comments.go b/vendor/github.com/google/go-github/v93/github/issues_comments.go similarity index 53% rename from vendor/github.com/google/go-github/v69/github/issues_comments.go rename to vendor/github.com/google/go-github/v93/github/issues_comments.go index 74a4e60f7..23bf0e1c7 100644 --- a/vendor/github.com/google/go-github/v69/github/issues_comments.go +++ b/vendor/github.com/google/go-github/v93/github/issues_comments.go @@ -22,16 +22,39 @@ type IssueComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the issue's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". - AuthorAssociation *string `json:"author_association,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Issue Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#get-an-issue-comment + AuthorAssociation *string `json:"author_association,omitempty"` + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` + Pin *PinnedIssueComment `json:"pin,omitempty"` + Minimized *MinimizedIssueComment `json:"minimized,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + IssueURL *string `json:"issue_url,omitempty"` +} + +// PinnedIssueComment represents the pin details of a pinned issue comment. +type PinnedIssueComment struct { + PinnedAt *Timestamp `json:"pinned_at,omitempty"` + PinnedBy *User `json:"pinned_by,omitempty"` +} + +// MinimizedIssueComment represents the minimized details of a minimized issue comment. +type MinimizedIssueComment struct { + Reason *string `json:"reason,omitempty"` } func (i IssueComment) String() string { return Stringify(i) } +// IssueCommentRequest represents a request to create or update an issue comment. +type IssueCommentRequest struct { + Body string `json:"body"` +} + // IssueListCommentsOptions specifies the optional parameters to the // IssuesService.ListComments method. type IssueListCommentsOptions struct { @@ -50,33 +73,33 @@ type IssueListCommentsOptions struct { // ListComments lists all comments on the specified issue. Specifying an issue // 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 +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments +// +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#list-issue-comments-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/comments //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/comments -func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { +func (s *IssuesService) ListComments(ctx context.Context, owner, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { var u string 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 { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) var comments []*IssueComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -86,22 +109,21 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str // GetComment fetches the specified issue comment. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#get-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#get-an-issue-comment // //meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) +func (s *IssuesService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) - resp, err := s.client.Do(ctx, req, comment) + var comment *IssueComment + resp, err := s.client.Do(req, &comment) if err != nil { return nil, resp, err } @@ -111,17 +133,17 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin // CreateComment creates a new comment on the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#create-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/comments -func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) +func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, body IssueCommentRequest) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) + var c *IssueComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -129,20 +151,19 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st return c, resp, nil } -// EditComment updates an issue comment. -// A non-nil comment.Body must be provided. Other comment fields should be left nil. +// UpdateComment updates an issue comment. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#update-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#update-an-issue-comment // //meta:operation PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) +func (s *IssuesService) UpdateComment(ctx context.Context, owner, repo string, commentID int64, body IssueCommentRequest) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(IssueComment) - resp, err := s.client.Do(ctx, req, c) + var c *IssueComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -152,14 +173,14 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri // DeleteComment deletes an issue comment. // -// GitHub API docs: https://docs.github.com/rest/issues/comments#delete-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments?apiVersion=2022-11-28#delete-an-issue-comment // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} -func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/issues_dependencies.go b/vendor/github.com/google/go-github/v93/github/issues_dependencies.go new file mode 100644 index 000000000..1a944aaa5 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/issues_dependencies.go @@ -0,0 +1,110 @@ +// 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" +) + +// IssueDependencyRequest represents a request to add a dependency to an issue. +type IssueDependencyRequest struct { + IssueID int64 `json:"issue_id"` +} + +// ListBlockedBy lists the dependencies that block the specified issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies?apiVersion=2022-11-28#list-dependencies-an-issue-is-blocked-by +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by +func (s *IssuesService) ListBlockedBy(ctx context.Context, owner, repo string, issueNumber int64, opts *ListOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by", owner, repo, issueNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} + +// AddBlockedBy adds a "blocked by" dependency to the specified issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies?apiVersion=2022-11-28#add-a-dependency-an-issue-is-blocked-by +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by +func (s *IssuesService) AddBlockedBy(ctx context.Context, owner, repo string, issueNumber int64, body IssueDependencyRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by", owner, repo, issueNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var issue *Issue + resp, err := s.client.Do(req, &issue) + if err != nil { + return nil, resp, err + } + + return issue, resp, nil +} + +// RemoveBlockedBy removes a "blocked by" dependency from the specified issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies?apiVersion=2022-11-28#remove-dependency-an-issue-is-blocked-by +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id} +func (s *IssuesService) RemoveBlockedBy(ctx context.Context, owner, repo string, issueNumber, blockingIssueID int64) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocked_by/%v", owner, repo, issueNumber, blockingIssueID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + var issue *Issue + resp, err := s.client.Do(req, &issue) + if err != nil { + return nil, resp, err + } + + return issue, resp, nil +} + +// ListBlocking lists the issues that the specified issue is blocking. +// +// GitHub API docs: https://docs.github.com/rest/issues/issue-dependencies?apiVersion=2022-11-28#list-dependencies-an-issue-is-blocking +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking +func (s *IssuesService) ListBlocking(ctx context.Context, owner, repo string, issueNumber int64, opts *ListOptions) ([]*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/dependencies/blocking", owner, repo, issueNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var issues []*Issue + resp, err := s.client.Do(req, &issues) + if err != nil { + return nil, resp, err + } + + return issues, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/issues_events.go b/vendor/github.com/google/go-github/v93/github/issues_events.go similarity index 90% rename from vendor/github.com/google/go-github/v69/github/issues_events.go rename to vendor/github.com/google/go-github/v93/github/issues_events.go index 8e234d7e0..82aa38f9a 100644 --- a/vendor/github.com/google/go-github/v69/github/issues_events.go +++ b/vendor/github.com/google/go-github/v93/github/issues_events.go @@ -104,7 +104,7 @@ type DismissedReview struct { // ListIssueEvents lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/events func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -114,7 +114,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -122,7 +122,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, req.Header.Set("Accept", mediaTypeProjectCardDetailsPreview) var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -132,7 +132,7 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, // ListRepositoryEvents lists events for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#list-issue-events-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/issues/events func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { @@ -142,13 +142,13 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var events []*IssueEvent - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } @@ -158,19 +158,19 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st // GetEvent returns the specified issue event. // -// GitHub API docs: https://docs.github.com/rest/issues/events#get-an-issue-event +// GitHub API docs: https://docs.github.com/rest/issues/events?apiVersion=2022-11-28#get-an-issue-event // //meta:operation GET /repos/{owner}/{repo}/issues/events/{event_id} func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - event := new(IssueEvent) - resp, err := s.client.Do(ctx, req, event) + var event *IssueEvent + resp, err := s.client.Do(req, &event) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/issues_labels.go b/vendor/github.com/google/go-github/v93/github/issues_labels.go new file mode 100644 index 000000000..b7798854f --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/issues_labels.go @@ -0,0 +1,267 @@ +// Copyright 2013 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" +) + +// Label represents a GitHub label on an Issue. +type Label struct { + ID int64 `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Color string `json:"color"` + Description *string `json:"description"` + Default bool `json:"default"` + NodeID string `json:"node_id"` +} + +func (l Label) String() string { + return Stringify(l) +} + +// CreateIssueLabelRequest represents a request to create a label. +type CreateIssueLabelRequest struct { + Name string `json:"name"` + Color *string `json:"color,omitempty"` + Description *string `json:"description,omitempty"` +} + +// UpdateIssueLabelRequest represents a request to update a label. +type UpdateIssueLabelRequest struct { + NewName *string `json:"new_name,omitempty"` + Color *string `json:"color,omitempty"` + Description *string `json:"description,omitempty"` +} + +// ListLabels lists all labels for a repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/labels +func (s *IssuesService) ListLabels(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var labels []*Label + resp, err := s.client.Do(req, &labels) + if err != nil { + return nil, resp, err + } + + return labels, resp, nil +} + +// GetLabel gets a single label. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#get-a-label +// +//meta:operation GET /repos/{owner}/{repo}/labels/{name} +func (s *IssuesService) GetLabel(ctx context.Context, owner, repo, name string) (*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var label *Label + resp, err := s.client.Do(req, &label) + if err != nil { + return nil, resp, err + } + + return label, resp, nil +} + +// CreateLabel creates a new label on the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#create-a-label +// +//meta:operation POST /repos/{owner}/{repo}/labels +func (s *IssuesService) CreateLabel(ctx context.Context, owner, repo string, body CreateIssueLabelRequest) (*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var l *Label + resp, err := s.client.Do(req, &l) + if err != nil { + return nil, resp, err + } + + return l, resp, nil +} + +// UpdateLabel updates a label. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#update-a-label +// +//meta:operation PATCH /repos/{owner}/{repo}/labels/{name} +func (s *IssuesService) UpdateLabel(ctx context.Context, owner, repo, name string, body UpdateIssueLabelRequest) (*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var l *Label + resp, err := s.client.Do(req, &l) + if err != nil { + return nil, resp, err + } + + return l, resp, nil +} + +// DeleteLabel deletes a label. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#delete-a-label +// +//meta:operation DELETE /repos/{owner}/{repo}/labels/{name} +func (s *IssuesService) DeleteLabel(ctx context.Context, owner, repo, name string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + +// ListLabelsByIssue lists all labels for an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-an-issue +// +//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/%v/labels", owner, repo, number) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var labels []*Label + resp, err := s.client.Do(req, &labels) + if err != nil { + return nil, resp, err + } + + return labels, resp, nil +} + +// AddLabelsToIssue adds labels to an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#add-labels-to-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels +func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string, number int, body []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var l []*Label + resp, err := s.client.Do(req, &l) + if err != nil { + return nil, resp, err + } + + return l, resp, nil +} + +// RemoveLabelForIssue removes a label for an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#remove-a-label-from-an-issue +// +//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/%v/labels/%v", owner, repo, number, label) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ReplaceLabelsForIssue replaces all labels for an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#set-labels-for-an-issue +// +//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels +func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo string, number int, body []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var l []*Label + resp, err := s.client.Do(req, &l) + if err != nil { + return nil, resp, err + } + + return l, resp, nil +} + +// RemoveLabelsForIssue removes all labels for an issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#remove-all-labels-from-an-issue +// +//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/%v/labels", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListLabelsForMilestone lists labels for every issue in a milestone. +// +// GitHub API docs: https://docs.github.com/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-issues-in-a-milestone +// +//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/%v/labels", owner, repo, number) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var labels []*Label + resp, err := s.client.Do(req, &labels) + if err != nil { + return nil, resp, err + } + + return labels, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/issues_milestones.go b/vendor/github.com/google/go-github/v93/github/issues_milestones.go similarity index 63% rename from vendor/github.com/google/go-github/v69/github/issues_milestones.go rename to vendor/github.com/google/go-github/v93/github/issues_milestones.go index 6c31bcd05..d863f5c6a 100644 --- a/vendor/github.com/google/go-github/v69/github/issues_milestones.go +++ b/vendor/github.com/google/go-github/v93/github/issues_milestones.go @@ -34,6 +34,22 @@ func (m Milestone) String() string { return Stringify(m) } +// CreateMilestoneRequest represents a request to create a milestone. +type CreateMilestoneRequest struct { + Title string `json:"title"` + State *string `json:"state,omitempty"` + Description *string `json:"description,omitempty"` + DueOn *Timestamp `json:"due_on,omitempty"` +} + +// UpdateMilestoneRequest represents a request to update a milestone. +type UpdateMilestoneRequest struct { + Title *string `json:"title,omitempty"` + State *string `json:"state,omitempty"` + Description *string `json:"description,omitempty"` + DueOn *Timestamp `json:"due_on,omitempty"` +} + // MilestoneListOptions specifies the optional parameters to the // IssuesService.ListMilestones method. type MilestoneListOptions struct { @@ -54,23 +70,23 @@ type MilestoneListOptions struct { // ListMilestones lists all milestones for a repository. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#list-milestones +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#list-milestones // //meta:operation GET /repos/{owner}/{repo}/milestones -func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { +func (s *IssuesService) ListMilestones(ctx context.Context, owner, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var milestones []*Milestone - resp, err := s.client.Do(ctx, req, &milestones) + resp, err := s.client.Do(req, &milestones) if err != nil { return nil, resp, err } @@ -80,18 +96,18 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s // GetMilestone gets a single milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#get-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#get-a-milestone // //meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *IssuesService) GetMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - milestone := new(Milestone) - resp, err := s.client.Do(ctx, req, milestone) + var milestone *Milestone + resp, err := s.client.Do(req, &milestone) if err != nil { return nil, resp, err } @@ -101,18 +117,18 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str // CreateMilestone creates a new milestone on the specified repository. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#create-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#create-a-milestone // //meta:operation POST /repos/{owner}/{repo}/milestones -func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { +func (s *IssuesService) CreateMilestone(ctx context.Context, owner, repo string, body CreateMilestoneRequest) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) - req, err := s.client.NewRequest("POST", u, milestone) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) + var m *Milestone + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -120,20 +136,20 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo return m, resp, nil } -// EditMilestone edits a milestone. +// UpdateMilestone updates a milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#update-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#update-a-milestone // //meta:operation PATCH /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("PATCH", u, milestone) +func (s *IssuesService) UpdateMilestone(ctx context.Context, owner, repo string, number int, body UpdateMilestoneRequest) (*Milestone, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - m := new(Milestone) - resp, err := s.client.Do(ctx, req, m) + var m *Milestone + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -143,15 +159,15 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st // DeleteMilestone deletes a milestone. // -// GitHub API docs: https://docs.github.com/rest/issues/milestones#delete-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones?apiVersion=2022-11-28#delete-a-milestone // //meta:operation DELETE /repos/{owner}/{repo}/milestones/{milestone_number} -func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *IssuesService) DeleteMilestone(ctx context.Context, owner, repo string, number int) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/issues_timeline.go b/vendor/github.com/google/go-github/v93/github/issues_timeline.go similarity index 97% rename from vendor/github.com/google/go-github/v69/github/issues_timeline.go rename to vendor/github.com/google/go-github/v93/github/issues_timeline.go index 903f5b89c..7cebc47c7 100644 --- a/vendor/github.com/google/go-github/v69/github/issues_timeline.go +++ b/vendor/github.com/google/go-github/v93/github/issues_timeline.go @@ -173,7 +173,7 @@ type Source struct { // ListIssueTimeline lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/timeline?apiVersion=2022-11-28#list-timeline-events-for-an-issue // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/timeline func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) { @@ -183,17 +183,16 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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, ", ")) var events []*Timeline - resp, err := s.client.Do(ctx, req, &events) + resp, err := s.client.Do(req, &events) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/licenses.go b/vendor/github.com/google/go-github/v93/github/licenses.go similarity index 75% rename from vendor/github.com/google/go-github/v69/github/licenses.go rename to vendor/github.com/google/go-github/v93/github/licenses.go index 34b8a3d8a..8d34f6feb 100644 --- a/vendor/github.com/google/go-github/v69/github/licenses.go +++ b/vendor/github.com/google/go-github/v93/github/licenses.go @@ -13,7 +13,7 @@ import ( // LicensesService handles communication with the license related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/licenses/ +// GitHub API docs: https://docs.github.com/rest/licenses?apiVersion=2022-11-28 type LicensesService service // RepositoryLicense represents the license for a repository. @@ -58,19 +58,32 @@ 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 +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#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(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var licenses []*License - resp, err := s.client.Do(ctx, req, &licenses) + resp, err := s.client.Do(req, &licenses) if err != nil { return nil, resp, err } @@ -80,19 +93,19 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // Get extended metadata for one license. // -// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-a-license +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#get-a-license // //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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - license := new(License) - resp, err := s.client.Do(ctx, req, license) + var license *License + resp, err := s.client.Do(req, &license) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/markdown.go b/vendor/github.com/google/go-github/v93/github/markdown.go similarity index 84% rename from vendor/github.com/google/go-github/v69/github/markdown.go rename to vendor/github.com/google/go-github/v93/github/markdown.go index 0fd896c6c..60e4660cd 100644 --- a/vendor/github.com/google/go-github/v69/github/markdown.go +++ b/vendor/github.com/google/go-github/v93/github/markdown.go @@ -40,27 +40,27 @@ type markdownRenderRequest struct { // Render renders an arbitrary Render document. // -// GitHub API docs: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document +// GitHub API docs: https://docs.github.com/rest/markdown/markdown?apiVersion=2022-11-28#render-a-markdown-document // //meta:operation POST /markdown func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRenderRequest{Text: Ptr(text)} + request := &markdownRenderRequest{Text: &text} if opts != nil { if opts.Mode != "" { - request.Mode = Ptr(opts.Mode) + request.Mode = &opts.Mode } if opts.Context != "" { - request.Context = Ptr(opts.Context) + request.Context = &opts.Context } } - req, err := s.client.NewRequest("POST", "markdown", request) + req, err := s.client.NewRequest(ctx, "POST", "markdown", request) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/messages.go b/vendor/github.com/google/go-github/v93/github/messages.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/messages.go rename to vendor/github.com/google/go-github/v93/github/messages.go index 59b214b35..9bb43c75d 100644 --- a/vendor/github.com/google/go-github/v69/github/messages.go +++ b/vendor/github.com/google/go-github/v93/github/messages.go @@ -19,11 +19,12 @@ import ( "fmt" "hash" "io" + "maps" "mime" "net/http" "net/url" "reflect" - "sort" + "slices" "strings" ) @@ -41,11 +42,15 @@ const ( EventTypeHeader = "X-Github-Event" // DeliveryIDHeader is the GitHub header key used to pass the unique ID for the webhook event. DeliveryIDHeader = "X-Github-Delivery" + + // maxPayloadSize is the maximum size of a GitHub webhook payload. + // GitHub documents a 25 MB limit for webhook payloads. + maxPayloadSize = 25 * 1024 * 1024 ) var ( // eventTypeMapping maps webhooks types to their corresponding go-github struct types. - eventTypeMapping = map[string]interface{}{ + eventTypeMapping = map[string]any{ "branch_protection_configuration": &BranchProtectionConfigurationEvent{}, "branch_protection_rule": &BranchProtectionRuleEvent{}, "check_run": &CheckRunEvent{}, @@ -95,6 +100,7 @@ var ( "pull_request_review_thread": &PullRequestReviewThreadEvent{}, "pull_request_target": &PullRequestTargetEvent{}, "push": &PushEvent{}, + "registry_package": &RegistryPackageEvent{}, "repository": &RepositoryEvent{}, "repository_dispatch": &RepositoryDispatchEvent{}, "repository_import": &RepositoryImportEvent{}, @@ -144,8 +150,19 @@ func checkMAC(message, messageMAC, key []byte, hashFunc func() hash.Hash) bool { return hmac.Equal(messageMAC, expectedMAC) } -// messageMAC returns the hex-decoded HMAC tag from the signature and its -// corresponding hash function. +// readPayloadBody reads the body from readable, enforcing maxPayloadSize. +func readPayloadBody(readable io.Reader) ([]byte, error) { + body, err := io.ReadAll(io.LimitReader(readable, maxPayloadSize+1)) + if err != nil { + return nil, err + } + if len(body) > maxPayloadSize { + return nil, errors.New("webhook payload exceeds maximum allowed size") + } + return body, nil +} + +// messageMAC returns the MAC method and the corresponding hash function. func messageMAC(signature string) ([]byte, func() hash.Hash, error) { if signature == "" { return nil, nil, errors.New("missing signature") @@ -185,11 +202,11 @@ func messageMAC(signature string) ([]byte, func() hash.Hash, error) { // Example usage: // // func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { -// // read signature from request -// signature := "" -// payload, err := github.ValidatePayloadFromBody(r.Header.Get("Content-Type"), r.Body, signature, s.webhookSecretKey) -// if err != nil { ... } -// // Process payload... +// // read signature from request +// signature := "" +// payload, err := github.ValidatePayloadFromBody(r.Header.Get("Content-Type"), r.Body, signature, s.webhookSecretKey) +// if err != nil { ... } +// // Process payload... // } func ValidatePayloadFromBody(contentType string, readable io.Reader, signature string, secretToken []byte) (payload []byte, err error) { var body []byte // Raw body that GitHub uses to calculate the signature. @@ -197,7 +214,7 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s switch contentType { case "application/json": var err error - if body, err = io.ReadAll(readable); err != nil { + if body, err = readPayloadBody(readable); err != nil { return nil, err } @@ -211,7 +228,7 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s const payloadFormParam = "payload" var err error - if body, err = io.ReadAll(readable); err != nil { + if body, err = readPayloadBody(readable); err != nil { return nil, err } @@ -248,9 +265,9 @@ func ValidatePayloadFromBody(contentType string, readable io.Reader, signature s // Example usage: // // func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { -// payload, err := github.ValidatePayload(r, s.webhookSecretKey) -// if err != nil { ... } -// // Process payload... +// payload, err := github.ValidatePayload(r, s.webhookSecretKey) +// if err != nil { ... } +// // Process payload... // } func ValidatePayload(r *http.Request, secretToken []byte) (payload []byte, err error) { signature := r.Header.Get(SHA256SignatureHeader) @@ -299,25 +316,25 @@ func DeliveryID(r *http.Request) string { // ParseWebHook parses the event payload. For recognized event types, a // value of the corresponding struct type will be returned (as returned -// by Event.ParsePayload()). An error will be returned for unrecognized event +// by [Event.ParsePayload]). An error will be returned for unrecognized event // types. // // Example usage: // // func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) { -// payload, err := github.ValidatePayload(r, s.webhookSecretKey) -// if err != nil { ... } -// event, err := github.ParseWebHook(github.WebHookType(r), payload) -// if err != nil { ... } -// switch event := event.(type) { -// case *github.CommitCommentEvent: -// processCommitCommentEvent(event) -// case *github.CreateEvent: -// processCreateEvent(event) -// ... -// } +// payload, err := github.ValidatePayload(r, s.webhookSecretKey) +// if err != nil { ... } +// event, err := github.ParseWebHook(github.WebHookType(r), payload) +// if err != nil { ... } +// switch event := event.(type) { +// case *github.CommitCommentEvent: +// processCommitCommentEvent(event) +// case *github.CreateEvent: +// processCreateEvent(event) +// ... +// } // } -func ParseWebHook(messageType string, payload []byte) (interface{}, error) { +func ParseWebHook(messageType string, payload []byte) (any, error) { eventType, ok := messageToTypeName[messageType] if !ok { return nil, fmt.Errorf("unknown X-Github-Event in message: %v", messageType) @@ -333,17 +350,12 @@ func ParseWebHook(messageType string, payload []byte) (interface{}, 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. // If messageType does not match any known event types, it returns nil. -func EventForType(messageType string) interface{} { +func EventForType(messageType string) any { prototype := eventTypeMapping[messageType] if prototype == nil { return nil diff --git a/vendor/github.com/google/go-github/v69/github/meta.go b/vendor/github.com/google/go-github/v93/github/meta.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/meta.go rename to vendor/github.com/google/go-github/v93/github/meta.go index cc90b618b..7d663a39b 100644 --- a/vendor/github.com/google/go-github/v69/github/meta.go +++ b/vendor/github.com/google/go-github/v93/github/meta.go @@ -52,6 +52,18 @@ type APIMeta struct { // GitHub Actions will originate from. Actions []string `json:"actions,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses + // 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"` @@ -82,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"` @@ -95,17 +114,17 @@ type APIMetaArtifactAttestations struct { // this endpoint on your organization’s GitHub Enterprise installation, this // endpoint provides information about that installation. // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-github-meta-information +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-github-meta-information // //meta:operation GET /meta func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { - req, err := s.client.NewRequest("GET", "meta", nil) + req, err := s.client.NewRequest(ctx, "GET", "meta", nil) if err != nil { return nil, nil, err } - meta := new(APIMeta) - resp, err := s.client.Do(ctx, req, meta) + var meta *APIMeta + resp, err := s.client.Do(req, &meta) if err != nil { return nil, resp, err } @@ -120,25 +139,46 @@ func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { return c.Meta.Get(ctx) } +// ListAPIVersions returns the API versions supported by the GitHub REST API, +// as dates in the YYYY-MM-DD format. +// +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-all-api-versions +// +//meta:operation GET /versions +func (s *MetaService) ListAPIVersions(ctx context.Context) ([]string, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", "versions", nil) + if err != nil { + return nil, nil, err + } + + var versions []string + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + // Octocat returns an ASCII art octocat with the specified message in a speech // bubble. If message is empty, a random zen phrase is used. // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-octocat +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-octocat // //meta:operation GET /octocat 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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -156,19 +196,19 @@ func (c *Client) Octocat(ctx context.Context, message string) (string, *Response // Zen returns a random line from The Zen of GitHub. // -// See also: http://warpspire.com/posts/taste/ +// See also: https://warpspire.com/posts/taste/ // -// GitHub API docs: https://docs.github.com/rest/meta/meta#get-the-zen-of-github +// GitHub API docs: https://docs.github.com/rest/meta/meta?apiVersion=2022-11-28#get-the-zen-of-github // //meta:operation GET /zen func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { - req, err := s.client.NewRequest("GET", "zen", nil) + req, err := s.client.NewRequest(ctx, "GET", "zen", nil) if err != nil { return "", nil, err } - buf := new(bytes.Buffer) - resp, err := s.client.Do(ctx, req, buf) + var buf bytes.Buffer + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/migrations.go b/vendor/github.com/google/go-github/v93/github/migrations.go similarity index 75% rename from vendor/github.com/google/go-github/v69/github/migrations.go rename to vendor/github.com/google/go-github/v93/github/migrations.go index 766c4c38e..0ebf8b122 100644 --- a/vendor/github.com/google/go-github/v69/github/migrations.go +++ b/vendor/github.com/google/go-github/v93/github/migrations.go @@ -9,14 +9,12 @@ import ( "context" "errors" "fmt" - "net/http" - "strings" ) // MigrationService provides access to the migration related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/migration/ +// GitHub API docs: https://docs.github.com/rest/migrations?apiVersion=2022-11-28 type MigrationService service // Migration represents a GitHub migration (archival). @@ -55,6 +53,14 @@ type MigrationOptions struct { // ExcludeAttachments indicates whether attachments should be excluded from // the migration (to reduce migration archive file size). ExcludeAttachments bool + + // ExcludeReleases indicates whether releases should be excluded from + // the migration (to reduce migration archive file size). + ExcludeReleases bool + + // Exclude is a slice of related items to exclude from the response in order + // to improve performance of the request. Supported values are: "repositories" + Exclude []string } // startMigration represents the body of a StartMigration request. @@ -69,12 +75,20 @@ type startMigration struct { // ExcludeAttachments indicates whether attachments should be excluded from // the migration (to reduce migration archive file size). ExcludeAttachments *bool `json:"exclude_attachments,omitempty"` + + // ExcludeReleases indicates whether releases should be excluded from + // the migration (to reduce migration archive file size). + ExcludeReleases *bool `json:"exclude_releases,omitempty"` + + // Exclude is a slice of related items to exclude from the response in order + // to improve performance of the request. Supported values are: "repositories" + Exclude []string `json:"exclude,omitempty"` } // StartMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#start-an-organization-migration // //meta:operation POST /orgs/{org}/migrations func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) { @@ -82,20 +96,21 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos body := &startMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Ptr(opts.LockRepositories) - body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) + body.LockRepositories = &opts.LockRepositories + body.ExcludeAttachments = &opts.ExcludeAttachments + body.ExcludeReleases = &opts.ExcludeReleases + body.Exclude = append(body.Exclude, opts.Exclude...) } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) + var m *Migration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -105,7 +120,7 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos // ListMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#list-organization-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#list-organization-migrations // //meta:operation GET /orgs/{org}/migrations func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) { @@ -115,16 +130,15 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*Migration - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -135,22 +149,21 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts // MigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#get-an-organization-migration-status // //meta:operation GET /orgs/{org}/migrations/{migration_id} func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &Migration{} - resp, err := s.client.Do(ctx, req, m) + var m *Migration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -161,60 +174,47 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i // MigrationArchiveURL fetches a migration archive URL. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#download-an-organization-migration-archive // //meta:operation GET /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", err } - - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - s.client.clientMu.Lock() - defer s.client.clientMu.Unlock() - - // Disable the redirect mechanism because AWS fails if the GitHub auth token is provided. - var loc string - saveRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - loc = req.URL.String() - return errors.New("disable redirect") + loc, _, err := s.client.bareDoUntilFound(req, 10) + if err != nil { + return "", err } - defer func() { s.client.client.CheckRedirect = saveRedirect }() - _, err = s.client.Do(ctx, req, nil) // expect error from disable redirect - if err == nil { + if loc == nil { return "", errors.New("expected redirect, none provided") } - if !strings.Contains(err.Error(), "disable redirect") { - return "", err - } - return loc, nil + + return loc.String(), nil } // DeleteMigration deletes a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#delete-an-organization-migration-archive // //meta:operation DELETE /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // UnlockRepo unlocks a repository that was locked for migration. @@ -222,19 +222,18 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository +// GitHub API docs: https://docs.github.com/rest/migrations/orgs?apiVersion=2022-11-28#unlock-an-organization-repository // //meta:operation DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/migrations_source_import.go b/vendor/github.com/google/go-github/v93/github/migrations_source_import.go similarity index 82% rename from vendor/github.com/google/go-github/v69/github/migrations_source_import.go rename to vendor/github.com/google/go-github/v93/github/migrations_source_import.go index f484b77d4..4454d6cc6 100644 --- a/vendor/github.com/google/go-github/v69/github/migrations_source_import.go +++ b/vendor/github.com/google/go-github/v93/github/migrations_source_import.go @@ -115,7 +115,7 @@ func (i Import) String() string { // SourceImportAuthor identifies an author imported from a source repository. // -// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-commit-authors +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-commit-authors type SourceImportAuthor struct { ID *int64 `json:"id,omitempty"` RemoteID *string `json:"remote_id,omitempty"` @@ -132,7 +132,7 @@ func (a SourceImportAuthor) String() string { // LargeFile identifies a file larger than 100MB found during a repository import. // -// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-large-files +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-large-files type LargeFile struct { RefName *string `json:"ref_name,omitempty"` Path *string `json:"path,omitempty"` @@ -146,18 +146,20 @@ func (f LargeFile) String() string { // StartImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#start-an-import +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#start-an-import // //meta:operation PUT /repos/{owner}/{repo}/import -func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PUT", u, in) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -167,18 +169,20 @@ func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, // ImportProgress queries for the status and progress of an ongoing repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-an-import-status +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-an-import-status // //meta:operation GET /repos/{owner}/{repo}/import func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -188,18 +192,20 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin // UpdateImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-an-import +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-an-import // //meta:operation PATCH /repos/{owner}/{repo}/import -func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -219,18 +225,20 @@ func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, // This method and MapCommitAuthor allow you to provide correct Git author // information. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-commit-authors +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-commit-authors // //meta:operation GET /repos/{owner}/{repo}/import/authors func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var authors []*SourceImportAuthor - resp, err := s.client.Do(ctx, req, &authors) + resp, err := s.client.Do(req, &authors) if err != nil { return nil, resp, err } @@ -242,18 +250,20 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // application can continue updating authors any time before you push new // commits to the repository. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#map-a-commit-author +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#map-a-commit-author // //meta:operation PATCH /repos/{owner}/{repo}/import/authors/{author_id} -func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { +func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, body *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, author) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - out := new(SourceImportAuthor) - resp, err := s.client.Do(ctx, req, out) + var out *SourceImportAuthor + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -265,18 +275,20 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri // files larger than 100MB. Only the UseLFS field on the provided Import is // used. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-git-lfs-preference +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#update-git-lfs-preference // //meta:operation PATCH /repos/{owner}/{repo}/import/lfs -func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { +func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, body *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) - req, err := s.client.NewRequest("PATCH", u, in) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - out := new(Import) - resp, err := s.client.Do(ctx, req, out) + var out *Import + resp, err := s.client.Do(req, &out) if err != nil { return nil, resp, err } @@ -286,18 +298,20 @@ func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo str // LargeFiles lists files larger than 100MB found during the import. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-large-files +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#get-large-files // //meta:operation GET /repos/{owner}/{repo}/import/large_files func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var files []*LargeFile - resp, err := s.client.Do(ctx, req, &files) + resp, err := s.client.Do(req, &files) if err != nil { return nil, resp, err } @@ -307,15 +321,17 @@ func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ( // CancelImport stops an import for a repository. // -// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#cancel-an-import +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports?apiVersion=2022-11-28#cancel-an-import // //meta:operation DELETE /repos/{owner}/{repo}/import func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/migrations_user.go b/vendor/github.com/google/go-github/v93/github/migrations_user.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/migrations_user.go rename to vendor/github.com/google/go-github/v93/github/migrations_user.go index a7bd79499..6387d7f15 100644 --- a/vendor/github.com/google/go-github/v69/github/migrations_user.go +++ b/vendor/github.com/google/go-github/v93/github/migrations_user.go @@ -67,7 +67,7 @@ type startUserMigration struct { // StartUserMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#start-a-user-migration +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#start-a-user-migration // //meta:operation POST /user/migrations func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) { @@ -75,20 +75,19 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin body := &startUserMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Ptr(opts.LockRepositories) - body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) + body.LockRepositories = &opts.LockRepositories + body.ExcludeAttachments = &opts.ExcludeAttachments } - req, err := s.client.NewRequest("POST", u, body) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) + var m *UserMigration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -98,7 +97,7 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin // ListUserMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#list-user-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#list-user-migrations // //meta:operation GET /user/migrations func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOptions) ([]*UserMigration, *Response, error) { @@ -108,16 +107,15 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*UserMigration - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -128,22 +126,21 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt // UserMigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#get-a-user-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#get-a-user-migration-status // //meta:operation GET /user/migrations/{migration_id} func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { u := fmt.Sprintf("user/migrations/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - resp, err := s.client.Do(ctx, req, m) + var m *UserMigration + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -154,35 +151,35 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* // UserMigrationArchiveURL gets the URL for a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#download-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#download-a-user-migration-archive // //meta:operation GET /user/migrations/{migration_id}/archive func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) - m := &UserMigration{} - var loc string originalRedirect := s.client.client.CheckRedirect - s.client.client.CheckRedirect = func(req *http.Request, via []*http.Request) error { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return http.ErrUseLastResponse } defer func() { s.client.client.CheckRedirect = originalRedirect }() - resp, err := s.client.Do(ctx, req, m) + + var m *UserMigration + resp, err := s.client.Do(req, &m) if err == nil { return "", errors.New("expected redirect, none provided") } + loc = resp.Header.Get("Location") return loc, nil } @@ -190,21 +187,20 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 // DeleteUserMigration will delete a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#delete-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#delete-a-user-migration-archive // //meta:operation DELETE /user/migrations/{migration_id}/archive func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { 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) + return s.client.Do(req, nil) } // UnlockUserRepo will unlock a repo that was locked for migration. @@ -212,19 +208,18 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/rest/migrations/users#unlock-a-user-repository +// GitHub API docs: https://docs.github.com/rest/migrations/users?apiVersion=2022-11-28#unlock-a-user-repository // //meta:operation DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) - req, err := s.client.NewRequest("DELETE", url, nil) + req, err := s.client.NewRequest(ctx, "DELETE", url, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs.go b/vendor/github.com/google/go-github/v93/github/orgs.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/orgs.go rename to vendor/github.com/google/go-github/v93/github/orgs.go index 27c0f1028..d4be778e9 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs.go +++ b/vendor/github.com/google/go-github/v93/github/orgs.go @@ -13,7 +13,7 @@ import ( // OrganizationsService provides access to the organization related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/orgs/ +// GitHub API docs: https://docs.github.com/rest/orgs?apiVersion=2022-11-28 type OrganizationsService service // Organization represents a GitHub organization account. @@ -36,6 +36,7 @@ type Organization struct { Following *int `json:"following,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ArchivedAt *Timestamp `json:"archived_at,omitempty"` TotalPrivateRepos *int64 `json:"total_private_repos,omitempty"` OwnedPrivateRepos *int64 `json:"owned_private_repos,omitempty"` PrivateGists *int `json:"private_gists,omitempty"` @@ -67,6 +68,9 @@ type Organization struct { // MembersCanForkPrivateRepos toggles whether organization members can fork private organization repositories. MembersCanForkPrivateRepos *bool `json:"members_can_fork_private_repositories,omitempty"` + // DeployKeysEnabledForRepositories toggles whether deploy keys may be added and used for repositories in the organization. + DeployKeysEnabledForRepositories *bool `json:"deploy_keys_enabled_for_repositories,omitempty"` + // MembersAllowedRepositoryCreationType denotes if organization members can create repositories // and the type of repositories they can create. Possible values are: "all", "private", or "none". // @@ -97,6 +101,28 @@ type Organization struct { SecretScanningPushProtectionEnabledForNewRepos *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` // SecretScanningValidityChecksEnabled toggles whether secret scanning validity check is enabled. SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"` + // SecretScanningPushProtectionCustomLinkEnabled toggles whether a custom link is shown to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLinkEnabled *bool `json:"secret_scanning_push_protection_custom_link_enabled,omitempty"` + // SecretScanningPushProtectionCustomLink is the URL displayed to contributors blocked by secret scanning push protection. + SecretScanningPushProtectionCustomLink *string `json:"secret_scanning_push_protection_custom_link,omitempty"` + // 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_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. + MembersCanDeleteIssues *bool `json:"members_can_delete_issues,omitempty"` + // DisplayCommenterFullNameSettingEnabled toggles whether members can see the comment author's profile name in private repositories. + DisplayCommenterFullNameSettingEnabled *bool `json:"display_commenter_full_name_setting_enabled,omitempty"` + // ReadersCanCreateDiscussions toggles whether users with read access can create and comment on discussions. + ReadersCanCreateDiscussions *bool `json:"readers_can_create_discussions,omitempty"` + // MembersCanCreateTeams toggles whether members of an organization can create new teams. + MembersCanCreateTeams *bool `json:"members_can_create_teams,omitempty"` + // MembersCanViewDependencyInsights toggles whether members may view dependency insights. + MembersCanViewDependencyInsights *bool `json:"members_can_view_dependency_insights,omitempty"` + // DefaultRepositoryBranch is the default branch for new repositories in the organization. + DefaultRepositoryBranch *string `json:"default_repository_branch,omitempty"` // API URLs URL *string `json:"url,omitempty"` @@ -135,13 +161,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. @@ -150,7 +174,7 @@ type OrganizationsListOptions struct { // listing the next set of organizations, use the ID of the last-returned organization // as the opts.Since parameter for the next call. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations // //meta:operation GET /organizations func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) { @@ -159,13 +183,13 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } orgs := []*Organization{} - resp, err := s.client.Do(ctx, req, &orgs) + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -175,8 +199,9 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL // List the organizations for a user. Passing the empty string will list // 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 +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-organizations-for-the-authenticated-user // //meta:operation GET /user/orgs //meta:operation GET /users/{username}/orgs @@ -192,13 +217,13 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var orgs []*Organization - resp, err := s.client.Do(ctx, req, &orgs) + resp, err := s.client.Do(req, &orgs) if err != nil { return nil, resp, err } @@ -208,26 +233,25 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List // Get fetches an organization by name. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#get-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#get-an-organization // //meta:operation GET /orgs/{org} func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } - return organization, resp, nil + return o, resp, nil } // GetByID fetches an organization. @@ -236,38 +260,37 @@ 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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("organizations/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - organization := new(Organization) - resp, err := s.client.Do(ctx, req, organization) + var org *Organization + resp, err := s.client.Do(req, &org) if err != nil { return nil, resp, err } - return organization, resp, nil + return org, resp, nil } // Edit an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#update-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#update-an-organization // //meta:operation PATCH /orgs/{org} -func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { +func (s *OrganizationsService) Edit(ctx context.Context, name string, body *Organization) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", name) - req, err := s.client.NewRequest("PATCH", u, org) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) - o := new(Organization) - resp, err := s.client.Do(ctx, req, o) + var o *Organization + resp, err := s.client.Do(req, &o) if err != nil { return nil, resp, err } @@ -277,22 +300,22 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ // Delete an organization by name. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#delete-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#delete-an-organization // //meta:operation DELETE /orgs/{org} func (s *OrganizationsService) Delete(ctx context.Context, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v", org) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListInstallations lists installations for an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs?apiVersion=2022-11-28#list-app-installations-for-an-organization // //meta:operation GET /orgs/{org}/installations func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) { @@ -303,13 +326,13 @@ func (s *OrganizationsService) ListInstallations(ctx context.Context, org string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - result := new(OrganizationInstallations) - resp, err := s.client.Do(ctx, req, result) + var result *OrganizationInstallations + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_actions_allowed.go b/vendor/github.com/google/go-github/v93/github/orgs_actions_allowed.go similarity index 61% rename from vendor/github.com/google/go-github/v69/github/orgs_actions_allowed.go rename to vendor/github.com/google/go-github/v93/github/orgs_actions_allowed.go index b115e094a..fdec0c73a 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_actions_allowed.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_actions_allowed.go @@ -13,7 +13,7 @@ import ( // // Deprecated: please use `client.Actions.GetActionsAllowed` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation GET /orgs/{org}/actions/permissions/selected-actions func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { @@ -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 +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *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/v69/github/orgs_actions_permissions.go b/vendor/github.com/google/go-github/v93/github/orgs_actions_permissions.go similarity index 60% rename from vendor/github.com/google/go-github/v69/github/orgs_actions_permissions.go rename to vendor/github.com/google/go-github/v93/github/orgs_actions_permissions.go index 97df1c967..8f2531886 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_actions_permissions.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_actions_permissions.go @@ -13,7 +13,7 @@ import ( // // Deprecated: please use `client.Actions.GetActionsPermissions` instead. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-an-organization // //meta:operation GET /orgs/{org}/actions/permissions func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { @@ -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 +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *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/v93/github/orgs_artifacts.go b/vendor/github.com/google/go-github/v93/github/orgs_artifacts.go new file mode 100644 index 000000000..b9f7b5062 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/orgs_artifacts.go @@ -0,0 +1,219 @@ +// 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?apiVersion=2022-11-28#create-an-artifact-deployment-record +// +//meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record +func (s *OrganizationsService) CreateArtifactDeploymentRecord(ctx context.Context, org string, body CreateArtifactDeploymentRequest) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record", org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-cluster-deployment-records +// +//meta:operation POST /orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster} +func (s *OrganizationsService) SetClusterDeploymentRecords(ctx context.Context, org, cluster string, body ClusterDeploymentRecordsRequest) (*ArtifactDeploymentResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/deployment-record/cluster/%v", org, cluster) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-artifact-metadata-storage-record +// +//meta:operation POST /orgs/{org}/artifacts/metadata/storage-record +func (s *OrganizationsService) CreateArtifactStorageRecord(ctx context.Context, org string, body CreateArtifactStorageRequest) (*ArtifactStorageResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/artifacts/metadata/storage-record", org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var v *ArtifactStorageResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var v *ArtifactDeploymentResponse + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var v *ArtifactStorageResponse + resp, err := s.client.Do(req, &v) + if err != nil { + return nil, resp, err + } + + return v, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_attestations.go b/vendor/github.com/google/go-github/v93/github/orgs_attestations.go similarity index 75% rename from vendor/github.com/google/go-github/v69/github/orgs_attestations.go rename to vendor/github.com/google/go-github/v93/github/orgs_attestations.go index 3d5793c18..bfc4f61c7 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_attestations.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_attestations.go @@ -14,24 +14,24 @@ 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?apiVersion=2022-11-28#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) { - var u = fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest) + u := fmt.Sprintf("orgs/%v/attestations/%v", org, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - resp, err := s.client.Do(ctx, req, &attestations) + resp, err := s.client.Do(req, &attestations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_audit_log.go b/vendor/github.com/google/go-github/v93/github/orgs_audit_log.go similarity index 65% rename from vendor/github.com/google/go-github/v69/github/orgs_audit_log.go rename to vendor/github.com/google/go-github/v93/github/orgs_audit_log.go index 025c5d023..db87e2b65 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_audit_log.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_audit_log.go @@ -9,6 +9,7 @@ import ( "context" "encoding/json" "fmt" + "strings" ) // GetAuditLogOptions sets up optional parameters to query audit-log endpoint. @@ -43,31 +44,59 @@ type AuditEntry struct { HashedToken *string `json:"hashed_token,omitempty"` Org *string `json:"org,omitempty"` OrgID *int64 `json:"org_id,omitempty"` - Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). + Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time). TokenID *int64 `json:"token_id,omitempty"` TokenScopes *string `json:"token_scopes,omitempty"` User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). UserID *int64 `json:"user_id,omitempty"` // Some events types have a data field that contains additional information about the event. - Data map[string]interface{} `json:"data,omitempty"` + Data map[string]any `json:"data,omitempty"` // All fields that are not explicitly defined in the struct are captured here. - AdditionalFields map[string]interface{} `json:"-"` + AdditionalFields map[string]any `json:"-"` } +// UnmarshalJSON implements the json.Unmarshaler interface. +// +// GitHub's audit-log API occasionally returns "org" as a JSON array of strings +// and "org_id" as a JSON array of integers instead of the documented scalar types. +// This implementation normalises both fields to their scalar forms +// (joining multiple org names with a comma, and using the first org_id) so +// callers always receive a consistent type regardless of the API response shape. func (a *AuditEntry) UnmarshalJSON(data []byte) error { type entryAlias AuditEntry - var v entryAlias - if err := json.Unmarshal(data, &v); err != nil { + var raw struct { + entryAlias + Org json.RawMessage `json:"org,omitempty"` + OrgID json.RawMessage `json:"org_id,omitempty"` + } + if err := json.Unmarshal(data, &raw); err != nil { return err } + v := raw.entryAlias + + if len(raw.Org) > 0 && string(raw.Org) != "null" { + var err error + v.Org, err = unmarshalStringOrArray(raw.Org) + if err != nil { + return fmt.Errorf("unmarshal org: %w", err) + } + } + + if len(raw.OrgID) > 0 && string(raw.OrgID) != "null" { + var err error + v.OrgID, err = unmarshalIntOrArray(raw.OrgID) + if err != nil { + return fmt.Errorf("unmarshal org_id: %w", err) + } + } rawDefinedFields, err := json.Marshal(v) if err != nil { return err } - definedFields := map[string]interface{}{} + definedFields := map[string]any{} if err := json.Unmarshal(rawDefinedFields, &definedFields); err != nil { return err } @@ -89,9 +118,44 @@ func (a *AuditEntry) UnmarshalJSON(data []byte) error { return nil } -func (a *AuditEntry) MarshalJSON() ([]byte, error) { +// unmarshalStringOrArray decodes a JSON value that is either a plain string or an array of strings. +// Arrays are joined with ", ". +func unmarshalStringOrArray(raw json.RawMessage) (*string, error) { + var s string + if err := json.Unmarshal(raw, &s); err == nil { + return &s, nil + } + var ss []string + if err := json.Unmarshal(raw, &ss); err != nil { + return nil, err + } + if len(ss) == 0 { + return nil, nil + } + return new(strings.Join(ss, ", ")), nil +} + +// unmarshalIntOrArray decodes a JSON value that is either a plain integer or an array of integers. +// Arrays use the first element. +func unmarshalIntOrArray(raw json.RawMessage) (*int64, error) { + var n int64 + if err := json.Unmarshal(raw, &n); err == nil { + return &n, nil + } + var ns []int64 + if err := json.Unmarshal(raw, &ns); err != nil { + return nil, err + } + if len(ns) == 0 { + return nil, nil + } + return &ns[0], nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (a AuditEntry) MarshalJSON() ([]byte, error) { type entryAlias AuditEntry - v := entryAlias(*a) + v := entryAlias(a) defBytes, err := json.Marshal(v) if err != nil { return nil, err @@ -99,7 +163,7 @@ func (a *AuditEntry) MarshalJSON() ([]byte, error) { if len(a.AdditionalFields) == 0 { return defBytes, err } - resMap := map[string]interface{}{} + resMap := map[string]any{} if err := json.Unmarshal(defBytes, &resMap); err != nil { return nil, err } @@ -117,7 +181,7 @@ func (a *AuditEntry) MarshalJSON() ([]byte, error) { // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization // //meta:operation GET /orgs/{org}/audit-log func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { @@ -127,13 +191,13 @@ func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var auditEntries []*AuditEntry - resp, err := s.client.Do(ctx, req, &auditEntries) + resp, err := s.client.Do(req, &auditEntries) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v93/github/orgs_codesecurity_configurations.go new file mode 100644 index 000000000..dafdf1ace --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/orgs_codesecurity_configurations.go @@ -0,0 +1,382 @@ +// Copyright 2024 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" +) + +// DependencyGraphAutosubmitActionOptions represents the options for the DependencyGraphAutosubmitAction. +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"` + AdvancedSecurity *string `json:"advanced_security,omitempty"` + DependencyGraph *string `json:"dependency_graph,omitempty"` + DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` + DependencyGraphAutosubmitActionOptions *DependencyGraphAutosubmitActionOptions `json:"dependency_graph_autosubmit_action_options,omitempty"` + DependabotAlerts *string `json:"dependabot_alerts,omitempty"` + DependabotDelegatedAlertDismissal *string `json:"dependabot_delegated_alert_dismissal,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"` + SecretScanningExtendedMetadata *string `json:"secret_scanning_extended_metadata,omitempty"` + SecretProtection *string `json:"secret_protection,omitempty"` + PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` + Enforcement *string `json:"enforcement,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// 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,omitempty"` +} + +// RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. +type RepositoryCodeSecurityConfiguration struct { + State *string `json:"state,omitempty"` + Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` +} + +// 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?apiVersion=2022-11-28#get-code-security-configurations-for-an-organization +// +//meta:operation GET /orgs/{org}/code-security/configurations +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// CreateCodeSecurityConfiguration creates a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#create-a-code-security-configuration +// +//meta:operation POST /orgs/{org}/code-security/configurations +func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// ListDefaultCodeSecurityConfigurations gets default code security configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-default-code-security-configurations +// +//meta:operation GET /orgs/{org}/code-security/configurations/defaults +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// DetachCodeSecurityConfigurationsFromRepositories detaches code security configuration from an organization's repositories. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#detach-configurations-from-repositories +// +//meta:operation DELETE /orgs/{org}/code-security/configurations/detach +func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories(ctx context.Context, org string, repoIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/detach", org) + type selectedRepoIDs struct { + SelectedIDs []int64 `json:"selected_repository_ids"` + } + req, err := s.client.NewRequest(ctx, "DELETE", u, selectedRepoIDs{SelectedIDs: repoIDs}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// GetCodeSecurityConfiguration gets a code security configuration available in an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-a-code-security-configuration +// +//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// UpdateCodeSecurityConfiguration updates a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#update-a-code-security-configuration +// +//meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} +func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, body CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// DeleteCodeSecurityConfiguration deletes a code security configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#delete-a-code-security-configuration +// +//meta:operation DELETE /orgs/{org}/code-security/configurations/{configuration_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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// AttachCodeSecurityConfigurationToRepositories attaches code security configurations to repositories for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#attach-a-configuration-to-repositories +// +//meta:operation POST /orgs/{org}/code-security/configurations/{configuration_id}/attach +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"` + } + req, err := s.client.NewRequest(ctx, "POST", u, selectedRepoIDs{Scope: scope, SelectedIDs: repoIDs}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(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 the default for an organization. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#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, 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"` + } + req, err := s.client.NewRequest(ctx, "PUT", u, configParam{DefaultForNewRepos: newReposParam}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(req, &config) + if err != nil { + return nil, resp, err + } + return config, resp, nil +} + +// ListCodeSecurityConfigurationRepositories gets repositories associated with a code security configuration. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-repositories-associated-with-a-code-security-configuration +// +//meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories +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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var attachments []*RepositoryAttachment + resp, err := s.client.Do(req, &attachments) + if err != nil { + return nil, resp, err + } + + return attachments, resp, nil +} + +// GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations?apiVersion=2022-11-28#get-the-code-security-configuration-associated-with-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-security-configuration +func (s *OrganizationsService) GetCodeSecurityConfigurationForRepository(ctx context.Context, org, repo string) (*RepositoryCodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-security-configuration", org, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + var repoConfig *RepositoryCodeSecurityConfiguration + resp, err := s.client.Do(req, &repoConfig) + if err != nil { + return nil, resp, err + } + return repoConfig, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_credential_authorizations.go b/vendor/github.com/google/go-github/v93/github/orgs_credential_authorizations.go similarity index 89% rename from vendor/github.com/google/go-github/v69/github/orgs_credential_authorizations.go rename to vendor/github.com/google/go-github/v93/github/orgs_credential_authorizations.go index dca42433c..c21bfaf5a 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_credential_authorizations.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_credential_authorizations.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // CredentialAuthorization represents a credential authorized through SAML SSO. @@ -58,7 +57,7 @@ type CredentialAuthorization struct { // CredentialAuthorizationsListOptions adds the Login option as supported by the // list SAML SSO authorizations for organizations endpoint alongside paging options // such as Page and PerPage. -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization type CredentialAuthorizationsListOptions struct { ListOptions // For credentials authorizations for an organization, limit the list of authorizations to a specific login (aka github username) @@ -68,7 +67,7 @@ type CredentialAuthorizationsListOptions struct { // ListCredentialAuthorizations lists credentials authorized through SAML SSO // for a given organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization // //meta:operation GET /orgs/{org}/credential-authorizations func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *CredentialAuthorizationsListOptions) ([]*CredentialAuthorization, *Response, error) { @@ -78,13 +77,13 @@ 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(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var creds []*CredentialAuthorization - resp, err := s.client.Do(ctx, req, &creds) + resp, err := s.client.Do(req, &creds) if err != nil { return nil, resp, err } @@ -95,15 +94,15 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, // RemoveCredentialAuthorization revokes the SAML SSO authorization for a given // credential within an organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#remove-a-saml-sso-authorization-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#remove-a-saml-sso-authorization-for-an-organization // //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(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_custom_repository_roles.go b/vendor/github.com/google/go-github/v93/github/orgs_custom_repository_roles.go similarity index 60% rename from vendor/github.com/google/go-github/v69/github/orgs_custom_repository_roles.go rename to vendor/github.com/google/go-github/v93/github/orgs_custom_repository_roles.go index 44408db14..c98785398 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_custom_repository_roles.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_custom_repository_roles.go @@ -30,30 +30,44 @@ type CustomRepoRoles struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } -// CreateOrUpdateCustomRepoRoleOptions represents options required to create or update a custom repository role. -type CreateOrUpdateCustomRepoRoleOptions struct { +// CreateCustomRepoRoleRequest represents the parameters to create a custom repository role. +type CreateCustomRepoRoleRequest struct { + Name string `json:"name"` + Description *string `json:"description,omitempty"` + BaseRole string `json:"base_role"` + Permissions []string `json:"permissions"` +} + +// UpdateCustomRepoRoleRequest represents the parameters to update a custom repository role. +type UpdateCustomRepoRoleRequest struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` BaseRole *string `json:"base_role,omitempty"` - Permissions []string `json:"permissions"` + Permissions []string `json:"permissions,omitzero"` +} + +// 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. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-custom-repository-roles-in-an-organization // //meta:operation GET /orgs/{org}/custom-repository-roles func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - customRepoRoles := new(OrganizationCustomRepoRoles) - resp, err := s.client.Do(ctx, req, customRepoRoles) + var customRepoRoles *OrganizationCustomRepoRoles + resp, err := s.client.Do(req, &customRepoRoles) if err != nil { return nil, resp, err } @@ -64,19 +78,19 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri // GetCustomRepoRole gets a 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. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#get-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#get-a-custom-repository-role // //meta:operation GET /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) GetCustomRepoRole(ctx context.Context, org string, roleID int64) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -87,19 +101,19 @@ func (s *OrganizationsService) GetCustomRepoRole(ctx context.Context, org string // CreateCustomRepoRole creates a custom repository role in this organization. // In order to create custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#create-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#create-a-custom-repository-role // //meta:operation POST /orgs/{org}/custom-repository-roles -func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { +func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, body CreateCustomRepoRoleRequest) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -110,19 +124,19 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str // UpdateCustomRepoRole updates a custom repository role in this organization. // In order to update custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#update-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#update-a-custom-repository-role // //meta:operation PATCH /orgs/{org}/custom-repository-roles/{role_id} -func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateCustomRepoRoleOptions) (*CustomRepoRoles, *Response, error) { +func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org string, roleID int64, body UpdateCustomRepoRoleRequest) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -133,22 +147,45 @@ func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org str // DeleteCustomRepoRole deletes an existing custom repository role in this organization. // In order to delete custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#delete-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#delete-a-custom-repository-role // //meta:operation DELETE /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resultingRole := new(CustomRepoRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomRepoRoles + resp, err := s.client.Do(req, &resultingRole) if err != nil { return resp, err } 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var perms []*RepoFineGrainedPermission + resp, err := s.client.Do(req, &perms) + if err != nil { + return nil, resp, err + } + + return perms, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_hooks.go b/vendor/github.com/google/go-github/v93/github/orgs_hooks.go similarity index 60% rename from vendor/github.com/google/go-github/v69/github/orgs_hooks.go rename to vendor/github.com/google/go-github/v93/github/orgs_hooks.go index c2eef77c9..12f03bb74 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_hooks.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_hooks.go @@ -7,12 +7,13 @@ package github import ( "context" + "errors" "fmt" ) // ListHooks lists all Hooks for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-organization-webhooks +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#list-organization-webhooks // //meta:operation GET /orgs/{org}/hooks func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) { @@ -22,13 +23,13 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -38,18 +39,18 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-an-organization-webhook // //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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hook := new(Hook) - resp, err := s.client.Do(ctx, req, hook) + var hook *Hook + resp, err := s.client.Do(req, &hook) if err != nil { return nil, resp, err } @@ -63,10 +64,14 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64 // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#create-an-organization-webhook // //meta:operation POST /orgs/{org}/hooks func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) { + if hook == nil { + return nil, nil, errors.New("hook must be provided") + } + u := fmt.Sprintf("orgs/%v/hooks", org) hookReq := &createHookRequest{ @@ -76,13 +81,13 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook Config: hook.Config, } - req, err := s.client.NewRequest("POST", u, hookReq) + req, err := s.client.NewRequest(ctx, "POST", u, hookReq) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -92,18 +97,18 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-an-organization-webhook // //meta:operation PATCH /orgs/{org}/hooks/{hook_id} -func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) - req, err := s.client.NewRequest("PATCH", u, hook) +func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, body *Hook) (*Hook, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -113,30 +118,30 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#ping-an-organization-webhook // //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) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v/pings", org, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#delete-an-organization-webhook // //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) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_hooks_configuration.go b/vendor/github.com/google/go-github/v93/github/orgs_hooks_configuration.go similarity index 54% rename from vendor/github.com/google/go-github/v69/github/orgs_hooks_configuration.go rename to vendor/github.com/google/go-github/v93/github/orgs_hooks_configuration.go index aeb616fc4..1bba535af 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_hooks_configuration.go @@ -12,18 +12,18 @@ import ( // GetHookConfiguration returns the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-organization // //meta:operation GET /orgs/{org}/hooks/{hook_id}/config func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -31,20 +31,20 @@ func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org str return config, resp, nil } -// EditHookConfiguration updates the configuration for the specified organization webhook. +// UpdateHookConfiguration updates the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-organization // //meta:operation PATCH /orgs/{org}/hooks/{hook_id}/config -func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) { +func (s *OrganizationsService) UpdateHookConfiguration(ctx context.Context, org string, id int64, body HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) - req, err := s.client.NewRequest("PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_hooks_deliveries.go b/vendor/github.com/google/go-github/v93/github/orgs_hooks_deliveries.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/orgs_hooks_deliveries.go rename to vendor/github.com/google/go-github/v93/github/orgs_hooks_deliveries.go index c1c301240..0150bc695 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_hooks_deliveries.go @@ -12,7 +12,7 @@ import ( // ListHookDeliveries lists webhook deliveries for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#list-deliveries-for-an-organization-webhook // //meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -22,13 +22,13 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -38,18 +38,18 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin // GetHookDelivery returns a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-delivery-for-an-organization-webhook // //meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -59,18 +59,18 @@ func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string // RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-an-organization-webhook // //meta:operation POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/orgs_immutable_releases.go b/vendor/github.com/google/go-github/v93/github/orgs_immutable_releases.go new file mode 100644 index 000000000..0e2beba84 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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"` + // 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *ImmutableReleaseSettings + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-immutable-releases-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) UpdateImmutableReleasesSettings(ctx context.Context, org string, body ImmutableReleasePolicy) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repositories *ListRepositories + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/orgs_issue_types.go b/vendor/github.com/google/go-github/v93/github/orgs_issue_types.go new file mode 100644 index 000000000..0edc7ad50 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/orgs_issue_types.go @@ -0,0 +1,99 @@ +// 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" +) + +// CreateOrUpdateIssueTypesOptions represents the parameters for creating or updating an issue type. +type CreateOrUpdateIssueTypesOptions struct { + Name string `json:"name"` // Name of the issue type. (Required.) + IsEnabled bool `json:"is_enabled"` // Whether or not the issue type is enabled at the organization level. (Required.) + IsPrivate *bool `json:"is_private,omitempty"` // Whether or not the issue type is restricted to issues in private repositories. (Optional.) + Description *string `json:"description,omitempty"` // Description of the issue type. (Optional.) + Color *string `json:"color,omitempty"` // Color for the issue type. Can be one of "gray", "blue", green "orange", "red", "pink", "purple", "null". (Optional.) +} + +// ListIssueTypes lists all issue types for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#list-issue-types-for-an-organization +// +//meta:operation GET /orgs/{org}/issue-types +func (s *OrganizationsService) ListIssueTypes(ctx context.Context, org string) ([]*IssueType, *Response, error) { + u := fmt.Sprintf("orgs/%v/issue-types", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var issueTypes []*IssueType + resp, err := s.client.Do(req, &issueTypes) + if err != nil { + return nil, resp, err + } + + return issueTypes, resp, nil +} + +// CreateIssueType creates a new issue type for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#create-issue-type-for-an-organization +// +//meta:operation POST /orgs/{org}/issue-types +func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { + u := fmt.Sprintf("orgs/%v/issue-types", org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var issueType *IssueType + resp, err := s.client.Do(req, &issueType) + if err != nil { + return nil, resp, err + } + + return issueType, resp, nil +} + +// UpdateIssueType updates GitHub Pages for the named repo. +// +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#update-issue-type-for-an-organization +// +//meta:operation PUT /orgs/{org}/issue-types/{issue_type_id} +func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, body *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { + u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var issueType *IssueType + resp, err := s.client.Do(req, &issueType) + if err != nil { + return nil, resp, err + } + + return issueType, resp, nil +} + +// DeleteIssueType deletes an issue type for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/issue-types?apiVersion=2022-11-28#delete-issue-type-for-an-organization +// +//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/%v", org, issueTypeID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_members.go b/vendor/github.com/google/go-github/v93/github/orgs_members.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/orgs_members.go rename to vendor/github.com/google/go-github/v93/github/orgs_members.go index d818d7f9f..2dafc14ec 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_members.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_members.go @@ -69,10 +69,11 @@ 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 +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-members +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-public-organization-members // //meta:operation GET /orgs/{org}/members //meta:operation GET /orgs/{org}/public_members @@ -88,13 +89,13 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -104,96 +105,96 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts // IsMember checks if a user is a member of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/members/{username} func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) member, err := parseBoolResponse(err) return member, resp, err } // IsPublicMember checks if a user is a public member of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#check-public-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/public_members/{username} func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) member, err := parseBoolResponse(err) return member, resp, err } // RemoveMember removes a user from all teams of an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-an-organization-member +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-an-organization-member // //meta:operation DELETE /orgs/{org}/members/{username} func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // CancelInvite cancels an organization invitation. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#cancel-an-organization-invitation +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#cancel-an-organization-invitation // //meta:operation DELETE /orgs/{org}/invitations/{invitation_id} func (s *OrganizationsService) CancelInvite(ctx context.Context, org string, invitationID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/invitations/%v", org, invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PublicizeMembership publicizes a user's membership in an organization. (A // user cannot publicize the membership for another user.) // -// GitHub API docs: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#set-public-organization-membership-for-the-authenticated-user // //meta:operation PUT /orgs/{org}/public_members/{username} func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConcealMembership conceals a user's membership in an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-public-organization-membership-for-the-authenticated-user // //meta:operation DELETE /orgs/{org}/public_members/{username} func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListOrgMembershipsOptions specifies optional parameters to the @@ -208,7 +209,7 @@ type ListOrgMembershipsOptions struct { // ListOrgMemberships lists the organization memberships for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-memberships-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-memberships-for-the-authenticated-user // //meta:operation GET /user/memberships/orgs func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { @@ -218,13 +219,13 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var memberships []*Membership - resp, err := s.client.Do(ctx, req, &memberships) + resp, err := s.client.Do(req, &memberships) if err != nil { return nil, resp, err } @@ -236,8 +237,9 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis // Passing an empty string for user will get the membership for the // 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 +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#get-an-organization-membership-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#get-organization-membership-for-a-user // //meta:operation GET /orgs/{org}/memberships/{username} //meta:operation GET /user/memberships/orgs/{org} @@ -249,13 +251,13 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s u = fmt.Sprintf("user/memberships/orgs/%v", org) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - membership := new(Membership) - resp, err := s.client.Do(ctx, req, membership) + var membership *Membership + resp, err := s.client.Do(req, &membership) if err != nil { return nil, resp, err } @@ -267,8 +269,9 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s // Passing an empty string for user will edit the membership for the // 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 +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#set-organization-membership-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#update-an-organization-membership-for-the-authenticated-user // //meta:operation PUT /orgs/{org}/memberships/{username} //meta:operation PATCH /user/memberships/orgs/{org} @@ -282,13 +285,13 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org method = "PATCH" } - req, err := s.client.NewRequest(method, u, membership) + req, err := s.client.NewRequest(ctx, method, u, membership) if err != nil { return nil, nil, err } - m := new(Membership) - resp, err := s.client.Do(ctx, req, m) + var m *Membership + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -299,22 +302,22 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org // RemoveOrgMembership removes user from the specified organization. If the // user has been invited to the organization, this will cancel their invitation. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#remove-organization-membership-for-a-user // //meta:operation DELETE /orgs/{org}/memberships/{username} func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v/memberships/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListPendingOrgInvitations returns a list of pending invitations. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-pending-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-pending-organization-invitations // //meta:operation GET /orgs/{org}/invitations func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -324,13 +327,13 @@ func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, or return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } @@ -338,9 +341,8 @@ func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, or return pendingInvitations, resp, nil } -// CreateOrgInvitationOptions specifies the parameters to the OrganizationService.Invite -// method. -type CreateOrgInvitationOptions struct { +// CreateOrgInvitationRequest specifies the request body for OrganizationsService.CreateOrgInvitation. +type CreateOrgInvitationRequest struct { // GitHub user ID for the person you are inviting. Not required if you provide Email. InviteeID *int64 `json:"invitee_id,omitempty"` // Email address of the person you are inviting, which can be an existing GitHub user. @@ -354,27 +356,27 @@ type CreateOrgInvitationOptions struct { // * billing_manager - Non-owner organization members with ability to // manage the billing settings of your organization. // Default is "direct_member". - Role *string `json:"role,omitempty"` - TeamID []int64 `json:"team_ids,omitempty"` + Role *string `json:"role,omitempty"` + TeamIDs []int64 `json:"team_ids,omitempty"` } // CreateOrgInvitation invites people to an organization by using their GitHub user ID or their email address. // In order to create invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#create-an-organization-invitation +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#create-an-organization-invitation // //meta:operation POST /orgs/{org}/invitations -func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) { +func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, body CreateOrgInvitationRequest) (*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var invitation *Invitation - resp, err := s.client.Do(ctx, req, &invitation) + resp, err := s.client.Do(req, &invitation) if err != nil { return nil, resp, err } @@ -385,7 +387,7 @@ func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org stri // ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-invitation-teams +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-organization-invitation-teams // //meta:operation GET /orgs/{org}/invitations/{invitation_id}/teams func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) { @@ -395,13 +397,13 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var orgInvitationTeams []*Team - resp, err := s.client.Do(ctx, req, &orgInvitationTeams) + resp, err := s.client.Do(req, &orgInvitationTeams) if err != nil { return nil, resp, err } @@ -411,7 +413,7 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, // ListFailedOrgInvitations returns a list of failed invitations. // -// GitHub API docs: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members?apiVersion=2022-11-28#list-failed-organization-invitations // //meta:operation GET /orgs/{org}/failed_invitations func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -421,13 +423,13 @@ func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var failedInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &failedInvitations) + resp, err := s.client.Do(req, &failedInvitations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/orgs_network_configurations.go b/vendor/github.com/google/go-github/v93/github/orgs_network_configurations.go new file mode 100644 index 000000000..0de09e97b --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/orgs_network_configurations.go @@ -0,0 +1,239 @@ +// 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" + "errors" + "fmt" + "regexp" +) + +// ComputeService represents a hosted compute service the network configuration supports. +type ComputeService string + +const ( + ComputeServiceNone ComputeService = "none" + ComputeServiceActions ComputeService = "actions" + ComputeServiceCodespaces ComputeService = "codespaces" +) + +// NetworkConfigurations represents a hosted compute network configuration. This type is identical +// for enterprise and organization endpoints. +type NetworkConfigurations struct { + TotalCount *int64 `json:"total_count,omitempty"` + NetworkConfigurations []*NetworkConfiguration `json:"network_configurations,omitempty"` +} + +// NetworkConfiguration represents a hosted compute network configurations. This type is identical +// for enterprise and organization endpoints. +type NetworkConfiguration struct { + ID *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + ComputeService *ComputeService `json:"compute_service,omitempty"` + NetworkSettingsIDs []string `json:"network_settings_ids,omitempty"` + CreatedOn *Timestamp `json:"created_on"` +} + +// NetworkSettingsResource represents a hosted compute network settings resource. This type is identical +// for enterprise and organization endpoints. +type NetworkSettingsResource struct { + ID *string `json:"id,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` + Name *string `json:"name,omitempty"` + SubnetID *string `json:"subnet_id,omitempty"` + Region *string `json:"region,omitempty"` +} + +func validateComputeService(compute *ComputeService) error { + if compute == nil { + return nil + } + if *compute != ComputeServiceNone && *compute != ComputeServiceActions { + return errors.New("compute service can only be one of: none, actions") + } + return nil +} + +var validNetworkNameRE = regexp.MustCompile(`^[a-zA-Z0-9._-]+$`) + +func validateNetworkName(name string) error { + if len(name) < 1 || len(name) > 100 { + return errors.New("must be between 1 and 100 characters") + } + if !validNetworkNameRE.MatchString(name) { + return errors.New("may only contain upper and lowercase letters a-z, numbers 0-9, '.', '-', and '_'") + } + return nil +} + +func validateNetworkSettingsID(settingsID []string) error { + if len(settingsID) != 1 { + return errors.New("exactly one network settings id must be specified") + } + return nil +} + +func validateNetworkConfigurationRequest(req NetworkConfigurationRequest) error { + networkName := req.GetName() + if err := validateNetworkName(networkName); err != nil { + return err + } + + computeService := req.GetComputeService() + if err := validateComputeService(computeService); err != nil { + return err + } + + networkIDs := req.NetworkSettingsIDs + return validateNetworkSettingsID(networkIDs) +} + +// NetworkConfigurationRequest represents a request to create or update a network configuration for an organization. +type NetworkConfigurationRequest struct { + Name *string `json:"name,omitempty"` + ComputeService *ComputeService `json:"compute_service,omitempty"` + NetworkSettingsIDs []string `json:"network_settings_ids,omitempty"` +} + +// ListNetworkConfigurations lists all hosted compute network configurations configured in an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#list-hosted-compute-network-configurations-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/network-configurations +func (s *OrganizationsService) ListNetworkConfigurations(ctx context.Context, org string, opts *ListOptions) (*NetworkConfigurations, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/network-configurations", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations *NetworkConfigurations + resp, err := s.client.Do(req, &configurations) + if err != nil { + return nil, resp, err + } + + return configurations, resp, nil +} + +// CreateNetworkConfiguration creates a hosted compute network configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#create-a-hosted-compute-network-configuration-for-an-organization +// +//meta:operation POST /orgs/{org}/settings/network-configurations +func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, org string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/settings/network-configurations", org) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + + return configuration, resp, nil +} + +// GetNetworkConfiguration gets a hosted compute network configuration configured in an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-configuration-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/network-configurations/{network_configuration_id} +func (s *OrganizationsService) GetNetworkConfiguration(ctx context.Context, org, networkID string) (*NetworkConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + + return configuration, resp, nil +} + +// UpdateNetworkConfiguration updates a hosted compute network configuration for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#update-a-hosted-compute-network-configuration-for-an-organization +// +//meta:operation PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id} +func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, org, networkID string, body NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(body); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return nil, resp, err + } + + return configuration, resp, nil +} + +// DeleteNetworkConfigurations deletes a hosted compute network configuration from an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#delete-a-hosted-compute-network-configuration-from-an-organization +// +//meta:operation DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id} +func (s *OrganizationsService) DeleteNetworkConfigurations(ctx context.Context, org, networkID string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/network-configurations/%v", org, networkID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + var configuration *NetworkConfiguration + resp, err := s.client.Do(req, &configuration) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetNetworkConfigurationResource gets a hosted compute network settings resource configured for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/network-configurations?apiVersion=2022-11-28#get-a-hosted-compute-network-settings-resource-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/network-settings/{network_settings_id} +func (s *OrganizationsService) GetNetworkConfigurationResource(ctx context.Context, org, networkID string) (*NetworkSettingsResource, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/network-settings/%v", org, networkID) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var resource *NetworkSettingsResource + resp, err := s.client.Do(req, &resource) + if err != nil { + return nil, resp, err + } + + return resource, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/orgs_organization_properties.go b/vendor/github.com/google/go-github/v93/github/orgs_organization_properties.go new file mode 100644 index 000000000..c0d0167b7 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/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"` +} + +// 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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*CustomPropertyValue + resp, err := s.client.Do(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?apiVersion=2022-11-28#create-or-update-custom-property-values-for-an-organization +// +//meta:operation PATCH /organizations/{org}/org-properties/values +func (s *OrganizationsService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, org string, body OrganizationCustomPropertyValues) (*Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_organization_roles.go b/vendor/github.com/google/go-github/v93/github/orgs_organization_roles.go similarity index 63% rename from vendor/github.com/google/go-github/v69/github/orgs_organization_roles.go rename to vendor/github.com/google/go-github/v93/github/orgs_organization_roles.go index 0954b92d4..36cf57b66 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_organization_roles.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_organization_roles.go @@ -12,12 +12,12 @@ import ( // OrganizationCustomRoles represents custom organization roles available in specified organization. type OrganizationCustomRoles struct { - TotalCount *int `json:"total_count,omitempty"` - CustomRepoRoles []*CustomOrgRoles `json:"roles,omitempty"` + TotalCount *int `json:"total_count,omitempty"` + CustomRepoRoles []*CustomOrgRole `json:"roles,omitempty"` } -// CustomOrgRoles represents custom organization role available in specified organization. -type CustomOrgRoles struct { +// CustomOrgRole represents custom organization role available in specified organization. +type CustomOrgRole struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` @@ -29,30 +29,44 @@ type CustomOrgRoles struct { BaseRole *string `json:"base_role,omitempty"` } -// CreateOrUpdateOrgRoleOptions represents options required to create or update a custom organization role. -type CreateOrUpdateOrgRoleOptions struct { - Name *string `json:"name,omitempty"` +// CreateCustomOrgRoleRequest represents body parameters required to create a custom organization role. +type CreateCustomOrgRoleRequest struct { + Name string `json:"name"` Description *string `json:"description,omitempty"` Permissions []string `json:"permissions"` - BaseRole *string `json:"base_role,omitempty"` + BaseRole *string `json:"base_role,omitempty"` // Can be one of: read, triage, write, maintain, admin +} + +// UpdateCustomOrgRoleRequest represents body parameters to update a custom organization role. +type UpdateCustomOrgRoleRequest struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Permissions []string `json:"permissions,omitempty"` + BaseRole *string `json:"base_role,omitempty"` // Can be one of: none, read, triage, write, maintain, admin +} + +// OrganizationFineGrainedPermission represents a fine-grained permission that protects organization resources. +type OrganizationFineGrainedPermission struct { + Name string `json:"name"` + Description string `json:"description"` } // ListRoles lists the custom roles available in this organization. // In order to see custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-all-organization-roles-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#get-all-organization-roles-for-an-organization // //meta:operation GET /orgs/{org}/organization-roles func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*OrganizationCustomRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - customRepoRoles := new(OrganizationCustomRoles) - resp, err := s.client.Do(ctx, req, customRepoRoles) + var customRepoRoles *OrganizationCustomRoles + resp, err := s.client.Do(req, &customRepoRoles) if err != nil { return nil, resp, err } @@ -63,19 +77,19 @@ func (s *OrganizationsService) ListRoles(ctx context.Context, org string) (*Orga // GetOrgRole gets an organization role in this organization. // In order to get organization roles in an organization, the authenticated user must be an organization owner, or have access via an organization role. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#get-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id} -func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleID int64) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -86,19 +100,19 @@ func (s *OrganizationsService) GetOrgRole(ctx context.Context, org string, roleI // CreateCustomOrgRole creates a custom role in this organization. // In order to create custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#create-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#create-a-custom-organization-role // //meta:operation POST /orgs/{org}/organization-roles -func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org string, body CreateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -109,19 +123,19 @@ func (s *OrganizationsService) CreateCustomOrgRole(ctx context.Context, org stri // UpdateCustomOrgRole updates a custom role in this organization. // In order to update custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#update-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#update-a-custom-organization-role // //meta:operation PATCH /orgs/{org}/organization-roles/{role_id} -func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, opts *CreateOrUpdateOrgRoleOptions) (*CustomOrgRoles, *Response, error) { +func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org string, roleID int64, body UpdateCustomOrgRoleRequest) (*CustomOrgRole, *Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return nil, resp, err } @@ -132,19 +146,19 @@ func (s *OrganizationsService) UpdateCustomOrgRole(ctx context.Context, org stri // DeleteCustomOrgRole deletes an existing custom role in this organization. // In order to delete custom roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles#delete-a-custom-organization-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#delete-a-custom-organization-role // //meta:operation DELETE /orgs/{org}/organization-roles/{role_id} func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/%v", org, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resultingRole := new(CustomOrgRoles) - resp, err := s.client.Do(ctx, req, resultingRole) + var resultingRole *CustomOrgRole + resp, err := s.client.Do(req, &resultingRole) if err != nil { return resp, err } @@ -155,18 +169,18 @@ func (s *OrganizationsService) DeleteCustomOrgRole(ctx context.Context, org stri // AssignOrgRoleToTeam assigns an existing organization role to a team in this organization. // In order to assign organization roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-team // //meta:operation PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -177,18 +191,18 @@ func (s *OrganizationsService) AssignOrgRoleToTeam(ctx context.Context, org, tea // RemoveOrgRoleFromTeam removes an existing organization role assignment from a team in this organization. // In order to remove organization role assignments in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#remove-an-organization-role-from-a-team // //meta:operation DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, teamSlug string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/teams/%v/%v", org, teamSlug, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -199,18 +213,18 @@ func (s *OrganizationsService) RemoveOrgRoleFromTeam(ctx context.Context, org, t // AssignOrgRoleToUser assigns an existing organization role to a user in this organization. // In order to assign organization roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#assign-an-organization-role-to-a-user // //meta:operation PUT /orgs/{org}/organization-roles/users/{username}/{role_id} func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -221,18 +235,18 @@ func (s *OrganizationsService) AssignOrgRoleToUser(ctx context.Context, org, use // RemoveOrgRoleFromUser removes an existing organization role assignment from a user in this organization. // In order to remove organization role assignments in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#remove-an-organization-role-from-a-user // //meta:operation DELETE /orgs/{org}/organization-roles/users/{username}/{role_id} func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, username string, roleID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/organization-roles/users/%v/%v", org, username, roleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -243,7 +257,7 @@ func (s *OrganizationsService) RemoveOrgRoleFromUser(ctx context.Context, org, u // ListTeamsAssignedToOrgRole returns all teams assigned to a specific organization role. // In order to list teams assigned to an organization role, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-teams-that-are-assigned-to-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#list-teams-that-are-assigned-to-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id}/teams func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*Team, *Response, error) { @@ -253,13 +267,13 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -270,7 +284,7 @@ func (s *OrganizationsService) ListTeamsAssignedToOrgRole(ctx context.Context, o // ListUsersAssignedToOrgRole returns all users assigned to a specific organization role. // In order to list users assigned to an organization role, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles#list-users-that-are-assigned-to-an-organization-role +// GitHub API docs: https://docs.github.com/rest/orgs/organization-roles?apiVersion=2022-11-28#list-users-that-are-assigned-to-an-organization-role // //meta:operation GET /orgs/{org}/organization-roles/{role_id}/users func (s *OrganizationsService) ListUsersAssignedToOrgRole(ctx context.Context, org string, roleID int64, opts *ListOptions) ([]*User, *Response, error) { @@ -280,16 +294,44 @@ func (s *OrganizationsService) ListUsersAssignedToOrgRole(ctx context.Context, o return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } return users, resp, nil } + +// ListFineGrainedPermissions lists the fine-grained permissions that can be used in custom organization roles for an organization. +// +// To use this endpoint, the authenticated user must be one of: +// - An administrator for the organization. +// - A user, or a user on a team, with the fine-grained permissions of `read_organization_custom_org_role` in the organization. +// +// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/organization-roles?apiVersion=2022-11-28#list-organization-fine-grained-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/organization-fine-grained-permissions +func (s *OrganizationsService) ListFineGrainedPermissions(ctx context.Context, org string) ([]*OrganizationFineGrainedPermission, *Response, error) { + u := fmt.Sprintf("orgs/%v/organization-fine-grained-permissions", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions []*OrganizationFineGrainedPermission + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v93/github/orgs_outside_collaborators.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/orgs_outside_collaborators.go rename to vendor/github.com/google/go-github/v93/github/orgs_outside_collaborators.go index 56034d726..61a4861d4 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_outside_collaborators.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_outside_collaborators.go @@ -27,7 +27,7 @@ type ListOutsideCollaboratorsOptions struct { // Warning: The API may change without advance notice during the preview period. // Preview features are not supported for production use. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#list-outside-collaborators-for-an-organization // //meta:operation GET /orgs/{org}/outside_collaborators func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) { @@ -37,13 +37,13 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -54,17 +54,17 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org // RemoveOutsideCollaborator removes a user from the list of outside collaborators; // consequently, removing them from all the organization's repositories. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#remove-outside-collaborator-from-an-organization // //meta:operation DELETE /orgs/{org}/outside_collaborators/{username} -func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ConvertMemberToOutsideCollaborator reduces the permission level of a member of the @@ -73,15 +73,15 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or // Responses for converting a non-member or the last owner to an outside collaborator // are listed in GitHub API docs. // -// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators?apiVersion=2022-11-28#convert-an-organization-member-to-outside-collaborator // //meta:operation PUT /orgs/{org}/outside_collaborators/{username} -func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_packages.go b/vendor/github.com/google/go-github/v93/github/orgs_packages.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/orgs_packages.go rename to vendor/github.com/google/go-github/v93/github/orgs_packages.go index edd8e508f..54762e5e7 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_packages.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_packages.go @@ -13,7 +13,7 @@ import ( // ListPackages lists the packages for an organization. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-an-organization // //meta:operation GET /orgs/{org}/packages func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { @@ -23,13 +23,13 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var packages []*Package - resp, err := s.client.Do(ctx, req, &packages) + resp, err := s.client.Do(req, &packages) if err != nil { return nil, resp, err } @@ -41,18 +41,18 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pack *Package - resp, err := s.client.Do(ctx, req, &pack) + resp, err := s.client.Do(req, &pack) if err != nil { return nil, resp, err } @@ -64,41 +64,41 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RestorePackage restores a package to an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restore func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, url.PathEscape(packageName)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageGetAllVersions gets all versions of a package in an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { @@ -108,13 +108,13 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var versions []*PackageVersion - resp, err := s.client.Do(ctx, req, &versions) + resp, err := s.client.Do(req, &versions) if err != nil { return nil, resp, err } @@ -126,18 +126,18 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var version *PackageVersion - resp, err := s.client.Do(ctx, req, &version) + resp, err := s.client.Do(req, &version) if err != nil { return nil, resp, err } @@ -149,32 +149,32 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-package-version-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageRestoreVersion restores a package version to an organization. // // Note that packageName is escaped for the URL path so that you don't need to. // -// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-package-version-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, url.PathEscape(packageName), packageVersionID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_personal_access_tokens.go b/vendor/github.com/google/go-github/v93/github/orgs_personal_access_tokens.go similarity index 55% rename from vendor/github.com/google/go-github/v69/github/orgs_personal_access_tokens.go rename to vendor/github.com/google/go-github/v93/github/orgs_personal_access_tokens.go index 276fbbb49..98b1ea81a 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_personal_access_tokens.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_personal_access_tokens.go @@ -7,15 +7,16 @@ package github import ( "context" + "errors" "fmt" - "net/http" "net/url" + "strconv" "strings" ) // PersonalAccessToken represents the minimal representation of an organization programmatic access grant. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/personal-access-tokens?apiVersion=2022-11-28 +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28 type PersonalAccessToken struct { // "Unique identifier of the fine-grained personal access token. // The `pat_id` used to get details about an approved fine-grained personal access token. @@ -83,13 +84,16 @@ 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 } // ListFineGrainedPersonalAccessTokens lists approved fine-grained personal access tokens owned by organization members that can access organization resources. // 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-fine-grained-personal-access-tokens-with-access-to-organization-resources +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#list-fine-grained-personal-access-tokens-with-access-to-organization-resources // //meta:operation GET /orgs/{org}/personal-access-tokens func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.Context, org string, opts *ListFineGrainedPATOptions) ([]*PersonalAccessToken, *Response, error) { @@ -100,14 +104,83 @@ 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(ctx, "GET", u, opts) if err != nil { return nil, nil, err } var pats []*PersonalAccessToken - resp, err := s.client.Do(ctx, req, &pats) + resp, err := s.client.Do(req, &pats) + if err != nil { + return nil, resp, err + } + + 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?apiVersion=2022-11-28#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(ctx, "GET", u, opts) + if err != nil { + return nil, nil, err + } + + var pats []*FineGrainedPersonalAccessTokenRequest + resp, err := s.client.Do(req, &pats) if err != nil { return nil, resp, err } @@ -125,40 +198,44 @@ type ReviewPersonalAccessTokenRequestOptions struct { // Only GitHub Apps can call this API, using the `organization_personal_access_token_requests: write` permission. // `action` can be one of `approve` or `deny`. // -// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token // //meta:operation POST /orgs/{org}/personal-access-token-requests/{pat_request_id} 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(ctx, "POST", u, &opts) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(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 { return s, err } + if opts == nil { + return "", errors.New("opts must be provided") + } + 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, "&") @@ -168,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/v69/github/orgs_properties.go b/vendor/github.com/google/go-github/v93/github/orgs_properties.go similarity index 63% rename from vendor/github.com/google/go-github/v69/github/orgs_properties.go rename to vendor/github.com/google/go-github/v93/github/orgs_properties.go index f59d9f467..2955082ab 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_properties.go +++ b/vendor/github.com/google/go-github/v93/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,18 @@ 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"` + // Whether setting property values is mandatory. + RequireExplicitValues *bool `json:"require_explicit_values,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 +51,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"` @@ -44,8 +111,15 @@ type RepoCustomPropertyValue struct { // CustomPropertyValue represents a custom property value. type CustomPropertyValue struct { - PropertyName string `json:"property_name"` - Value interface{} `json:"value"` + PropertyName string `json:"property_name"` + Value any `json:"value"` +} + +// ListCustomPropertyValuesOptions specifies the optional parameters to the +// OrganizationsService.ListCustomPropertyValues method. +type ListCustomPropertyValuesOptions struct { + RepositoryQuery string `url:"repository_query,omitempty"` + ListOptions } // UnmarshalJSON implements the json.Unmarshaler interface. @@ -66,7 +140,7 @@ func (cpv *CustomPropertyValue) UnmarshalJSON(data []byte) error { cpv.Value = nil case string: cpv.Value = v - case []interface{}: + case []any: strSlice := make([]string, len(v)) for i, item := range v { str, ok := item.(string) @@ -84,19 +158,19 @@ func (cpv *CustomPropertyValue) UnmarshalJSON(data []byte) error { // GetAllCustomProperties gets all custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#get-all-custom-properties-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org string) ([]*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -106,7 +180,7 @@ func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org s // CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-custom-properties-for-an-organization // //meta:operation PATCH /orgs/{org}/properties/schema func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Context, org string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { @@ -118,13 +192,13 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, nil, err } var customProperties []*CustomProperty - resp, err := s.client.Do(ctx, req, &customProperties) + resp, err := s.client.Do(req, &customProperties) if err != nil { return nil, resp, err } @@ -134,19 +208,19 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex // GetCustomProperty gets a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#get-a-custom-property-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name string) (*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, name) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -156,19 +230,19 @@ func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name // CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-a-custom-property-for-an-organization // //meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name} -func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { +func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, body *CustomProperty) (*CustomProperty, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) - req, err := s.client.NewRequest("PUT", u, property) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var customProperty *CustomProperty - resp, err := s.client.Do(ctx, req, &customProperty) + resp, err := s.client.Do(req, &customProperty) if err != nil { return nil, resp, err } @@ -178,39 +252,39 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, // RemoveCustomProperty removes a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#remove-a-custom-property-for-an-organization // //meta:operation DELETE /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, customPropertyName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListCustomPropertyValues lists all custom property values for repositories in the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#list-custom-property-values-for-organization-repositories // //meta:operation GET /orgs/{org}/properties/values -func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org string, opts *ListOptions) ([]*RepoCustomPropertyValue, *Response, error) { +func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org string, opts *ListCustomPropertyValuesOptions) ([]*RepoCustomPropertyValue, *Response, error) { u := fmt.Sprintf("orgs/%v/properties/values", org) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repoCustomPropertyValues []*RepoCustomPropertyValue - resp, err := s.client.Do(ctx, req, &repoCustomPropertyValues) + resp, err := s.client.Do(req, &repoCustomPropertyValues) if err != nil { return nil, resp, err } @@ -220,7 +294,7 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org // CreateOrUpdateRepoCustomPropertyValues creates new or updates existing custom property values across multiple repositories for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties?apiVersion=2022-11-28#create-or-update-custom-property-values-for-organization-repositories // //meta:operation PATCH /orgs/{org}/properties/values func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomPropertyValue) (*Response, error) { @@ -234,10 +308,10 @@ func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx contex Properties: properties, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/orgs_rules.go b/vendor/github.com/google/go-github/v93/github/orgs_rules.go new file mode 100644 index 000000000..fde484ab2 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/orgs_rules.go @@ -0,0 +1,120 @@ +// 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" +) + +// ListAllRepositoryRulesets gets all the repository rulesets for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#get-all-organization-repository-rulesets +// +//meta:operation GET /orgs/{org}/rulesets +func (s *OrganizationsService) ListAllRepositoryRulesets(ctx context.Context, org string, opts *ListOptions) ([]*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("orgs/%v/rulesets", org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var rulesets []*RepositoryRuleset + resp, err := s.client.Do(req, &rulesets) + if err != nil { + return nil, resp, err + } + + return rulesets, resp, nil +} + +// CreateRepositoryRuleset creates a repository ruleset for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#create-an-organization-repository-ruleset +// +//meta:operation POST /orgs/{org}/rulesets +func (s *OrganizationsService) CreateRepositoryRuleset(ctx context.Context, org string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("orgs/%v/rulesets", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(req, &rs) + if err != nil { + return nil, resp, err + } + + return rs, resp, nil +} + +// GetRepositoryRuleset gets a repository ruleset for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#get-an-organization-repository-ruleset +// +//meta:operation GET /orgs/{org}/rulesets/{ruleset_id} +func (s *OrganizationsService) GetRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var ruleset *RepositoryRuleset + resp, err := s.client.Do(req, &ruleset) + if err != nil { + return nil, resp, err + } + + return ruleset, resp, nil +} + +// UpdateRepositoryRuleset updates a repository ruleset for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#update-an-organization-repository-ruleset +// +//meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} +func (s *OrganizationsService) UpdateRepositoryRuleset(ctx context.Context, org string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(req, &rs) + if err != nil { + return nil, resp, err + } + + return rs, resp, nil +} + +// DeleteRepositoryRuleset deletes a repository ruleset from the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/rules?apiVersion=2022-11-28#delete-an-organization-repository-ruleset +// +//meta:operation DELETE /orgs/{org}/rulesets/{ruleset_id} +func (s *OrganizationsService) DeleteRepositoryRuleset(ctx context.Context, org string, rulesetID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/orgs_security_managers.go b/vendor/github.com/google/go-github/v93/github/orgs_security_managers.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/orgs_security_managers.go rename to vendor/github.com/google/go-github/v93/github/orgs_security_managers.go index b8562a2fd..088a5700a 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_security_managers.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_security_managers.go @@ -14,19 +14,19 @@ import ( // // Deprecated: Please use `client.Organizations.ListTeamsAssignedToOrgRole` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#list-security-manager-teams // //meta:operation GET /orgs/{org}/security-managers func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org string) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/security-managers", org) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -38,32 +38,32 @@ func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org // // Deprecated: Please use `client.Organizations.AssignOrgRoleToTeam` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#add-a-security-manager-team // //meta:operation PUT /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) AddSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveSecurityManagerTeam removes a team from the list of security managers for an organization. // // Deprecated: Please use `client.Organizations.RemoveOrgRoleFromTeam` instead. // -// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers?apiVersion=2022-11-28#remove-a-security-manager-team // //meta:operation DELETE /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) RemoveSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v93/github/orgs_users_blocking.go similarity index 61% rename from vendor/github.com/google/go-github/v69/github/orgs_users_blocking.go rename to vendor/github.com/google/go-github/v93/github/orgs_users_blocking.go index 62bd9116c..62d578c93 100644 --- a/vendor/github.com/google/go-github/v69/github/orgs_users_blocking.go +++ b/vendor/github.com/google/go-github/v93/github/orgs_users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the users blocked by an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#list-users-blocked-by-an-organization // //meta:operation GET /orgs/{org}/blocks func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) { @@ -22,16 +22,15 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) + resp, err := s.client.Do(req, &blockedUsers) if err != nil { return nil, resp, err } @@ -41,59 +40,56 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, // IsBlocked reports whether specified user is blocked from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#check-if-a-user-is-blocked-by-an-organization // //meta:operation GET /orgs/{org}/blocks/{username} -func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) { +func (s *OrganizationsService) IsBlocked(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + resp, err := s.client.Do(req, nil) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err } // BlockUser blocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#block-a-user-from-an-organization // //meta:operation PUT /orgs/{org}/blocks/{username} -func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) BlockUser(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // UnblockUser unblocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/blocking#unblock-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking?apiVersion=2022-11-28#unblock-a-user-from-an-organization // //meta:operation DELETE /orgs/{org}/blocks/{username} -func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) { +func (s *OrganizationsService) UnblockUser(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/packages.go b/vendor/github.com/google/go-github/v93/github/packages.go new file mode 100644 index 000000000..0ad0ed69e --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/packages.go @@ -0,0 +1,319 @@ +// Copyright 2020 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 ( + "encoding/json" +) + +// Package represents a GitHub package. +type Package struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + PackageType *string `json:"package_type,omitempty"` // One of "npm", "maven", "rubygems", "docker", "nuget", "container". For webhook events "container" is "CONTAINER" + HTMLURL *string `json:"html_url,omitempty"` + Visibility *string `json:"visibility,omitempty"` + Owner *User `json:"owner,omitempty"` + Repository *Repository `json:"repository,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + + // The following are only populated for webhook events + Namespace *string `json:"namespace,omitempty"` + Description *string `json:"description,omitempty"` + Ecosystem *string `json:"ecosystem,omitempty"` + PackageVersion *PackageVersion `json:"package_version,omitempty"` + Registry *PackageRegistry `json:"registry,omitempty"` + + // The following are NOT populated for webhook events + URL *string `json:"url,omitempty"` + VersionCount *int64 `json:"version_count,omitempty"` +} + +func (p Package) String() string { + return Stringify(p) +} + +// PackageVersion represents a GitHub package version. +type PackageVersion struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + URL *string `json:"url,omitempty"` + PackageHTMLURL *string `json:"package_html_url,omitempty"` + License *string `json:"license,omitempty"` + Description *string `json:"description,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Metadata json.RawMessage `json:"metadata,omitempty"` // For webhook events this will be []interface, else it will be of type PackageMetadata + + // The following are only populated for webhook events + Version *string `json:"version,omitempty"` + Summary *string `json:"summary,omitempty"` + Body json.RawMessage `json:"body,omitempty"` // Can either be a string or of type PackageVersionBody + BodyHTML *string `json:"body_html,omitempty"` + Release *PackageRelease `json:"release,omitempty"` + Manifest *string `json:"manifest,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + TagName *string `json:"tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + TargetOID *string `json:"target_oid,omitempty"` + Draft *bool `json:"draft,omitempty"` + Prerelease *bool `json:"prerelease,omitempty"` + ContainerMetadata *PackageEventContainerMetadata `json:"container_metadata,omitempty"` + DockerMetadata []any `json:"docker_metadata,omitempty"` + NPMMetadata *PackageNPMMetadata `json:"npm_metadata,omitempty"` + NugetMetadata []*PackageNugetMetadata `json:"nuget_metadata,omitempty"` + RubyMetadata map[string]any `json:"ruby_metadata,omitempty"` + PackageFiles []*PackageFile `json:"package_files,omitempty"` + PackageURL *string `json:"package_url,omitempty"` + Author *User `json:"author,omitempty"` + SourceURL *string `json:"source_url,omitempty"` + InstallationCommand *string `json:"installation_command,omitempty"` + + // The following are NOT populated for webhook events + DeletedAt *Timestamp `json:"deleted_at,omitempty"` +} + +// GetBody returns the body field as a string if it's valid. +func (pv *PackageVersion) GetBody() (body string, ok bool) { + if pv == nil || pv.Body == nil { + return "", false + } + + if err := json.Unmarshal(pv.Body, &body); err != nil { + return "", false + } + + return body, true +} + +// GetBodyAsPackageVersionBody returns the body field as a PackageVersionBody if it's valid. +func (pv *PackageVersion) GetBodyAsPackageVersionBody() (body *PackageVersionBody, ok bool) { + if pv == nil || pv.Body == nil { + return nil, false + } + + if err := json.Unmarshal(pv.Body, &body); err != nil { + return nil, false + } + + return body, true +} + +// GetMetadata returns the metadata field as PackageMetadata if it's valid. +func (pv *PackageVersion) GetMetadata() (metadata *PackageMetadata, ok bool) { + if pv == nil || pv.Metadata == nil { + return nil, false + } + + if err := json.Unmarshal(pv.Metadata, &metadata); err != nil { + return nil, false + } + + return metadata, true +} + +// GetRawMetadata returns the metadata field as a json.RawMessage. +func (pv *PackageVersion) GetRawMetadata() json.RawMessage { + if pv == nil || pv.Metadata == nil { + return json.RawMessage{} + } + + return pv.Metadata +} + +func (pv PackageVersion) String() string { + return Stringify(pv) +} + +// PackageRelease represents a GitHub package version release. +type PackageRelease struct { + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + ID *int64 `json:"id,omitempty"` + TagName *string `json:"tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + Name *string `json:"name,omitempty"` + Draft *bool `json:"draft,omitempty"` + Author *User `json:"author,omitempty"` + Prerelease *bool `json:"prerelease,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PublishedAt *Timestamp `json:"published_at,omitempty"` +} + +func (r PackageRelease) String() string { + return Stringify(r) +} + +// PackageFile represents a GitHub package version release file. +type PackageFile struct { + DownloadURL *string `json:"download_url,omitempty"` + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + SHA256 *string `json:"sha256,omitempty"` + SHA1 *string `json:"sha1,omitempty"` + MD5 *string `json:"md5,omitempty"` + ContentType *string `json:"content_type,omitempty"` + State *string `json:"state,omitempty"` + Author *User `json:"author,omitempty"` + Size *int64 `json:"size,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +func (pf PackageFile) String() string { + return Stringify(pf) +} + +// PackageRegistry represents a GitHub package registry. +type PackageRegistry struct { + AboutURL *string `json:"about_url,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + URL *string `json:"url,omitempty"` + Vendor *string `json:"vendor,omitempty"` +} + +func (r PackageRegistry) String() string { + return Stringify(r) +} + +// PackageListOptions represents the optional list options for a package. +type PackageListOptions struct { + // Visibility of packages "public", "internal" or "private". + Visibility *string `url:"visibility,omitempty"` + + // PackageType represents the type of package. + // It can be one of "npm", "maven", "rubygems", "nuget", "docker", or "container". + PackageType *string `url:"package_type,omitempty"` + + // State of package either "active" or "deleted". + State *string `url:"state,omitempty"` + + ListOptions +} + +// PackageMetadata represents metadata from a package. +type PackageMetadata struct { + PackageType *string `json:"package_type,omitempty"` + Container *PackageContainerMetadata `json:"container,omitempty"` +} + +func (r PackageMetadata) String() string { + return Stringify(r) +} + +// PackageContainerMetadata represents container metadata for docker container packages. +type PackageContainerMetadata struct { + Tags []string `json:"tags,omitempty"` +} + +func (r PackageContainerMetadata) String() string { + return Stringify(r) +} + +// PackageVersionBody represents the body field of a package version. +type PackageVersionBody struct { + Repo *Repository `json:"repository,omitempty"` + Info *PackageVersionBodyInfo `json:"info,omitempty"` +} + +func (b PackageVersionBody) String() string { + return Stringify(b) +} + +// PackageVersionBodyInfo represents the info field of a PackageVersionBody. +type PackageVersionBodyInfo struct { + Type *string `json:"type,omitempty"` + OID *string `json:"oid,omitempty"` + Mode *int64 `json:"mode,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` + Size *int64 `json:"size,omitempty"` + Collection *bool `json:"collection,omitempty"` +} + +func (bi PackageVersionBodyInfo) String() string { + return Stringify(bi) +} + +// PackageEventContainerMetadata represents metadata for container packages as part of a webhook event. +// See also PackageContainerMetadata. +type PackageEventContainerMetadata struct { + Labels map[string]any `json:"labels,omitempty"` + Manifest map[string]any `json:"manifest,omitempty"` + Tag *PackageEventContainerMetadataTag `json:"tag,omitempty"` +} + +func (m PackageEventContainerMetadata) String() string { + return Stringify(m) +} + +// PackageEventContainerMetadataTag represents a tag of a GitHub container package. +type PackageEventContainerMetadataTag struct { + Name *string `json:"name,omitempty"` + Digest *string `json:"digest,omitempty"` +} + +func (mt PackageEventContainerMetadataTag) String() string { + return Stringify(mt) +} + +// PackageNugetMetadata represents nuget metadata for a GitHub package. +type PackageNugetMetadata struct { + 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 +} + +func (nm PackageNugetMetadata) String() string { + return Stringify(nm) +} + +// PackageNPMMetadata represents NPM metadata for a GitHub package. +type PackageNPMMetadata struct { + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` + NPMUser *string `json:"npm_user,omitempty"` + Author map[string]string `json:"author,omitempty"` + Bugs map[string]string `json:"bugs,omitempty"` + Dependencies map[string]string `json:"dependencies,omitempty"` + DevDependencies map[string]string `json:"dev_dependencies,omitempty"` + PeerDependencies map[string]string `json:"peer_dependencies,omitempty"` + OptionalDependencies map[string]string `json:"optional_dependencies,omitempty"` + Description *string `json:"description,omitempty"` + Dist map[string]string `json:"dist,omitempty"` + GitHead *string `json:"git_head,omitempty"` + Homepage *string `json:"homepage,omitempty"` + License *string `json:"license,omitempty"` + Main *string `json:"main,omitempty"` + Repository map[string]string `json:"repository,omitempty"` + Scripts map[string]any `json:"scripts,omitempty"` + ID *string `json:"id,omitempty"` + NodeVersion *string `json:"node_version,omitempty"` + NPMVersion *string `json:"npm_version,omitempty"` + HasShrinkwrap *bool `json:"has_shrinkwrap,omitempty"` + Maintainers []any `json:"maintainers,omitempty"` + Contributors []any `json:"contributors,omitempty"` + Engines map[string]string `json:"engines,omitempty"` + Keywords []string `json:"keywords,omitempty"` + Files []string `json:"files,omitempty"` + Bin map[string]any `json:"bin,omitempty"` + Man map[string]any `json:"man,omitempty"` + Directories map[string]string `json:"directories,omitempty"` + OS []string `json:"os,omitempty"` + CPU []string `json:"cpu,omitempty"` + Readme *string `json:"readme,omitempty"` + InstallationCommand *string `json:"installation_command,omitempty"` + ReleaseID *int64 `json:"release_id,omitempty"` + CommitOID *string `json:"commit_oid,omitempty"` + PublishedViaActions *bool `json:"published_via_actions,omitempty"` + DeletedByID *int64 `json:"deleted_by_id,omitempty"` +} + +func (nm PackageNPMMetadata) String() string { + return Stringify(nm) +} diff --git a/vendor/github.com/google/go-github/v93/github/private_registries.go b/vendor/github.com/google/go-github/v93/github/private_registries.go new file mode 100644 index 000000000..192cb0861 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/private_registries.go @@ -0,0 +1,362 @@ +// 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?apiVersion=2026-03-10 +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" +) + +// PrivateRegistryAuthType represents the authentication type for a private registry. +type PrivateRegistryAuthType string + +const ( + PrivateRegistryAuthTypeToken PrivateRegistryAuthType = "token" + PrivateRegistryAuthTypeUsernamePassword PrivateRegistryAuthType = "username_password" + PrivateRegistryAuthTypeOIDCAzure PrivateRegistryAuthType = "oidc_azure" + PrivateRegistryAuthTypeOIDCAWS PrivateRegistryAuthType = "oidc_aws" + PrivateRegistryAuthTypeOIDCJFrog PrivateRegistryAuthType = "oidc_jfrog" +) + +// 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 *PrivateRegistryType `json:"registry_type,omitempty"` + // AuthType is the authentication type for the private registry. + AuthType *PrivateRegistryAuthType `json:"auth_type,omitempty"` + // URL is the URL of the private registry. + URL *string `json:"url,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"` + // ReplacesBase indicates whether this private registry should replace the base registry. + ReplacesBase *bool `json:"replaces_base,omitempty"` + // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + // SelectedRepositoryIDs is an array of repository IDs that can access the organization private registry. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` + // TenantID is the tenant ID of the Azure AD application. + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. + ClientID *string `json:"client_id,omitempty"` + // AWSRegion is the AWS region. + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner. + DomainOwner *string `json:"domain_owner,omitempty"` + // JFrogOIDCProviderName is the JFrog OIDC provider name. + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + // Audience is the OIDC audience. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. + IdentityMappingName *string `json:"identity_mapping_name,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"` +} + +// 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 PrivateRegistryType `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"` + + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,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. + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + EncryptedValue *string `json:"encrypted_value,omitempty"` + // KeyID is the ID of the public key used to encrypt the secret. + // Required when AuthType is "token" or "username_password". Should be omitted for OIDC auth types. + 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"` + + // 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"` + + // AuthType is the authentication type for the private registry. + // Defaults to "token" if not specified. Use "oidc_azure", "oidc_aws", or "oidc_jfrog" for OIDC authentication. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AWSRegion is the AWS region. Required when AuthType is "oidc_aws". + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JFrogOIDCProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,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 *PrivateRegistryType `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"` + + // ReplacesBase indicates whether this private registry should replace the base registry + // (e.g., npmjs.org for npm, rubygems.org for rubygems). + ReplacesBase *bool `json:"replaces_base,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 UpdateOrganizationPrivateRegistry.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"` + + // AuthType is the authentication type for the private registry. + // This field cannot be changed after creation. If provided, it must match the existing auth_type. + AuthType *string `json:"auth_type,omitempty"` + + // TenantID is the tenant ID of the Azure AD application. Required when AuthType is "oidc_azure". + TenantID *string `json:"tenant_id,omitempty"` + // ClientID is the client ID of the Azure AD application. Required when AuthType is "oidc_azure". + ClientID *string `json:"client_id,omitempty"` + + // AWSRegion is the AWS region. Required when AuthType is "oidc_aws". + AWSRegion *string `json:"aws_region,omitempty"` + // AccountID is the AWS account ID. Required when AuthType is "oidc_aws". + AccountID *string `json:"account_id,omitempty"` + // RoleName is the AWS IAM role name. Required when AuthType is "oidc_aws". + RoleName *string `json:"role_name,omitempty"` + // Domain is the CodeArtifact domain. Required when AuthType is "oidc_aws". + Domain *string `json:"domain,omitempty"` + // DomainOwner is the CodeArtifact domain owner (AWS account ID). Required when AuthType is "oidc_aws". + DomainOwner *string `json:"domain_owner,omitempty"` + + // JFrogOIDCProviderName is the JFrog OIDC provider name. Required when AuthType is "oidc_jfrog". + JFrogOIDCProviderName *string `json:"jfrog_oidc_provider_name,omitempty"` + + // Audience is the OIDC audience. Optional for "oidc_aws" and "oidc_jfrog" auth types. + Audience *string `json:"audience,omitempty"` + // IdentityMappingName is the JFrog identity mapping name. Optional for "oidc_jfrog" auth type. + IdentityMappingName *string `json:"identity_mapping_name,omitempty"` +} + +// ListOrganizationPrivateRegistries lists private registries for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations?apiVersion=2026-03-10#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(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var privateRegistries *PrivateRegistries + resp, err := s.client.Do(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?apiVersion=2026-03-10#create-a-private-registry-for-an-organization +// +//meta:operation POST /orgs/{org}/private-registries +func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, body CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var result *PrivateRegistry + resp, err := s.client.Do(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?apiVersion=2026-03-10#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(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var publicKey *PublicKey + resp, err := s.client.Do(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?apiVersion=2026-03-10#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(ctx, "GET", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, nil, err + } + + var privateRegistry *PrivateRegistry + resp, err := s.client.Do(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?apiVersion=2026-03-10#update-a-private-registry-for-an-organization +// +//meta:operation PATCH /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, body UpdateOrganizationPrivateRegistry) (*Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + return s.client.Do(req, 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?apiVersion=2026-03-10#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(ctx, "DELETE", u, nil, WithVersion(api20260310)) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/projects.go b/vendor/github.com/google/go-github/v93/github/projects.go new file mode 100644 index 000000000..5936bdd4d --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/projects.go @@ -0,0 +1,1055 @@ +// 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" + "strconv" +) + +// ProjectsService handles communication with the project V2 +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/projects?apiVersion=2022-11-28 +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?apiVersion=2022-11-28 +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?apiVersion=2022-11-28 +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?apiVersion=2022-11-28 +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?apiVersion=2022-11-28 +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?apiVersion=2022-11-28 +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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var project *ProjectV2 + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var project *ProjectV2 + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(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"` +} + +// AddProjectItemRequest 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). +// The item is identified either by ID, the numerical ID of that issue or pull request, +// or by Owner, Repo, and Number. +type AddProjectItemRequest struct { + Type ProjectV2ItemContentType `json:"type"` + ID *int64 `json:"id,omitempty"` + Owner *string `json:"owner,omitempty"` + Repo *string `json:"repo,omitempty"` + Number *int `json:"number,omitempty"` +} + +// UpdateProjectV2Field represents a field update for a project item. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#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"` +} + +// UpdateProjectItemRequest represents fields that can be modified for a project item. +type UpdateProjectItemRequest struct { + // Fields contains field updates to apply to the project item. + // Each entry specifies a field ID and its new value. + Fields []*UpdateProjectV2Field `json:"fields"` +} + +// ListOrganizationProjectItems lists items for an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#add-item-to-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org string, projectNumber int, body AddProjectItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-project-item-for-organization +// +//meta:operation PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, body UpdateProjectItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListUserProjectItems lists items for a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#add-item-to-user-owned-project +// +//meta:operation POST /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username string, projectNumber int, body AddProjectItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#update-project-item-for-user +// +//meta:operation PATCH /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, body UpdateProjectItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// CreateProjectV2DraftItemRequest specifies the parameters to create a draft item in a project. +type CreateProjectV2DraftItemRequest struct { + // Title is the title of the draft issue item to create. + Title string `json:"title"` + // Body is the body content of the draft issue item to create. + Body *string `json:"body,omitempty"` +} + +// CreateOrganizationProjectDraftItem creates a draft item in an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/drafts?apiVersion=2022-11-28#create-draft-item-for-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/drafts +func (s *ProjectsService) CreateOrganizationProjectDraftItem(ctx context.Context, org string, projectNumber int, body CreateProjectV2DraftItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/drafts", org, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// CreateUserProjectDraftItem creates a draft item in a user owned project. +// +// Note: this endpoint identifies the user by their unique numeric ID (user_id) +// in the path, not by username, mirroring the GitHub REST API. +// +// GitHub API docs: https://docs.github.com/rest/projects/drafts?apiVersion=2022-11-28#create-draft-item-for-user-owned-project +// +//meta:operation POST /user/{user_id}/projectsV2/{project_number}/drafts +func (s *ProjectsService) CreateUserProjectDraftItem(ctx context.Context, userID int64, projectNumber int, body CreateProjectV2DraftItemRequest) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("user/%v/projectsV2/%v/drafts", userID, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var item *ProjectV2Item + resp, err := s.client.Do(req, &item) + if err != nil { + return nil, resp, err + } + + return item, resp, nil +} + +// ProjectV2FieldSingleSelectOption represents an option to create for a single_select project field. +type ProjectV2FieldSingleSelectOption struct { + // Name is the display name of the option. + Name string `json:"name"` + // Color is the color associated with the option. + // One of: BLUE, GRAY, GREEN, ORANGE, PINK, PURPLE, RED, YELLOW. + Color *string `json:"color,omitempty"` + // Description is an optional description of the option. + Description *string `json:"description,omitempty"` +} + +// ProjectV2FieldIterationConfiguration represents the configuration to create an iteration project field. +type ProjectV2FieldIterationConfiguration struct { + // StartDate is the start date of the first iteration in ISO 8601 (YYYY-MM-DD) format. + StartDate *string `json:"start_date,omitempty"` + // Duration is the default duration for iterations in days. + Duration *int `json:"duration,omitempty"` + // Iterations holds zero or more iterations for the field. + Iterations []*ProjectV2FieldIterationConfigurationIteration `json:"iterations,omitempty"` +} + +// ProjectV2FieldIterationConfigurationIteration represents a single iteration within a ProjectV2FieldIterationConfiguration. +type ProjectV2FieldIterationConfigurationIteration struct { + // Title is the title of the iteration. + Title *string `json:"title,omitempty"` + // StartDate is the start date of the iteration in ISO 8601 (YYYY-MM-DD) format. + StartDate *string `json:"start_date,omitempty"` + // Duration is the duration of the iteration in days. + Duration *int `json:"duration,omitempty"` +} + +// AddProjectV2FieldRequest specifies the parameters to add a field to a project. +// +// The GitHub API models the body as a one-of: set IssueFieldID to link a +// built-in issue field, or set Name and DataType to create a new field. When +// DataType is "single_select", SingleSelectOptions is required; when DataType +// is "iteration", IterationConfiguration is required. +type AddProjectV2FieldRequest struct { + // Name is the name of the field. + Name *string `json:"name,omitempty"` + // DataType is the field's data type. + // One of: text, number, date, single_select, iteration. + DataType *string `json:"data_type,omitempty"` + // SingleSelectOptions holds the options for a single_select field. (Required for single_select.) + SingleSelectOptions []*ProjectV2FieldSingleSelectOption `json:"single_select_options,omitempty"` + // IterationConfiguration holds the configuration for an iteration field. (Required for iteration.) + IterationConfiguration *ProjectV2FieldIterationConfiguration `json:"iteration_configuration,omitempty"` + // IssueFieldID links an existing built-in issue field to the project. (Organization owned projects only.) + IssueFieldID *int64 `json:"issue_field_id,omitempty"` +} + +// AddOrganizationProjectField adds a field to an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#add-a-field-to-an-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/fields +func (s *ProjectsService) AddOrganizationProjectField(ctx context.Context, org string, projectNumber int, body AddProjectV2FieldRequest) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields", org, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(req, &field) + if err != nil { + return nil, resp, err + } + + return field, resp, nil +} + +// AddUserProjectField adds a field to a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields?apiVersion=2022-11-28#add-field-to-user-owned-project +// +//meta:operation POST /users/{username}/projectsV2/{project_number}/fields +func (s *ProjectsService) AddUserProjectField(ctx context.Context, username string, projectNumber int, body AddProjectV2FieldRequest) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields", username, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var field *ProjectV2Field + resp, err := s.client.Do(req, &field) + if err != nil { + return nil, resp, err + } + + return field, resp, nil +} + +// ProjectV2View represents a view in a project. +type ProjectV2View struct { + ID int64 `json:"id"` + Number int `json:"number"` + Name string `json:"name"` + Layout string `json:"layout"` + NodeID string `json:"node_id"` + ProjectURL string `json:"project_url"` + HTMLURL string `json:"html_url"` + Creator User `json:"creator"` + Filter *string `json:"filter,omitempty"` + VisibleFields []int64 `json:"visible_fields"` + SortBy []*ProjectV2ViewSortBy `json:"sort_by"` + GroupBy []int64 `json:"group_by"` + VerticalGroupBy []int64 `json:"vertical_group_by"` + CreatedAt Timestamp `json:"created_at"` + UpdatedAt Timestamp `json:"updated_at"` +} + +// ProjectV2ViewSortBy represents a single sort criterion of a project view. +// +// On the wire it is encoded as a [field_id, direction] tuple rather than an +// object, so it has custom JSON (un)marshaling. +type ProjectV2ViewSortBy struct { + // FieldID is the ID of the field to sort by. + FieldID *int64 `json:"-"` + // Direction is the sort direction, one of "asc" or "desc". + Direction *string `json:"-"` +} + +// UnmarshalJSON implements custom unmarshaling for the [field_id, direction] +// tuple. The field_id may be encoded as either a number or a string. +func (s *ProjectV2ViewSortBy) UnmarshalJSON(data []byte) error { + var tuple []json.RawMessage + if err := json.Unmarshal(data, &tuple); err != nil { + return err + } + if len(tuple) != 2 { + return fmt.Errorf("expected a [field_id, direction] tuple, got %v elements", len(tuple)) + } + + var fieldID int64 + if err := json.Unmarshal(tuple[0], &fieldID); err != nil { + // The OpenAPI schema allows the field_id to be a string as well. + var str string + if err2 := json.Unmarshal(tuple[0], &str); err2 != nil { + return fmt.Errorf("invalid field_id: %w", err2) + } + fieldID, err = strconv.ParseInt(str, 10, 64) + if err != nil { + return fmt.Errorf("invalid field_id %q: %w", str, err) + } + } + + var direction string + if err := json.Unmarshal(tuple[1], &direction); err != nil { + return fmt.Errorf("invalid direction: %w", err) + } + + s.FieldID = &fieldID + s.Direction = &direction + return nil +} + +// MarshalJSON implements custom marshaling to the [field_id, direction] tuple. +func (s ProjectV2ViewSortBy) MarshalJSON() ([]byte, error) { + return json.Marshal([]any{s.FieldID, s.Direction}) +} + +// CreateProjectV2ViewRequest specifies the parameters to create a project view. +type CreateProjectV2ViewRequest struct { + // Name is the view's display name. + Name string `json:"name"` + // Layout is the view's layout. One of: table, board, roadmap. + Layout string `json:"layout"` + // Filter is an optional query string to filter the items shown in the view. + Filter *string `json:"filter,omitempty"` + // VisibleFields lists the field IDs to display. Not applicable to the roadmap layout. + VisibleFields []int64 `json:"visible_fields,omitempty"` +} + +// CreateOrganizationProjectView creates a view for an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/views?apiVersion=2022-11-28#create-a-view-for-an-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/views +func (s *ProjectsService) CreateOrganizationProjectView(ctx context.Context, org string, projectNumber int, body CreateProjectV2ViewRequest) (*ProjectV2View, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/views", org, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var view *ProjectV2View + resp, err := s.client.Do(req, &view) + if err != nil { + return nil, resp, err + } + + return view, resp, nil +} + +// CreateUserProjectView creates a view for a user owned project. +// +// Note: this endpoint identifies the user by their unique numeric ID (user_id) +// in the path, not by username, mirroring the GitHub REST API. +// +// GitHub API docs: https://docs.github.com/rest/projects/views?apiVersion=2022-11-28#create-a-view-for-a-user-owned-project +// +//meta:operation POST /users/{user_id}/projectsV2/{project_number}/views +func (s *ProjectsService) CreateUserProjectView(ctx context.Context, userID int64, projectNumber int, body CreateProjectV2ViewRequest) (*ProjectV2View, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/views", userID, projectNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var view *ProjectV2View + resp, err := s.client.Do(req, &view) + if err != nil { + return nil, resp, err + } + + return view, resp, nil +} + +// ListOrganizationProjectViewItems lists the items of a view in an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#list-items-for-an-organization-project-view +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/views/{view_number}/items +func (s *ProjectsService) ListOrganizationProjectViewItems(ctx context.Context, org string, projectNumber, viewNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/views/%v/items", org, projectNumber, viewNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(req, &items) + if err != nil { + return nil, resp, err + } + + return items, resp, nil +} + +// ListUserProjectViewItems lists the items of a view in a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items?apiVersion=2022-11-28#list-items-for-a-user-project-view +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/views/{view_number}/items +func (s *ProjectsService) ListUserProjectViewItems(ctx context.Context, username string, projectNumber, viewNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/views/%v/items", username, projectNumber, viewNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(req, &items) + if err != nil { + return nil, resp, err + } + + return items, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/pulls.go b/vendor/github.com/google/go-github/v93/github/pulls.go similarity index 52% rename from vendor/github.com/google/go-github/v69/github/pulls.go rename to vendor/github.com/google/go-github/v93/github/pulls.go index f3c6e929c..3000b93e4 100644 --- a/vendor/github.com/google/go-github/v69/github/pulls.go +++ b/vendor/github.com/google/go-github/v93/github/pulls.go @@ -15,7 +15,7 @@ import ( // PullRequestsService handles communication with the pull request related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/pulls/ +// GitHub API docs: https://docs.github.com/rest/pulls?apiVersion=2022-11-28 type PullRequestsService service // PullRequestAutoMerge represents the "auto_merge" response for a PullRequest. @@ -28,32 +28,40 @@ type PullRequestAutoMerge struct { // PullRequest represents a GitHub pull request on a repository. type PullRequest struct { - ID *int64 `json:"id,omitempty"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - Locked *bool `json:"locked,omitempty"` - Title *string `json:"title,omitempty"` - Body *string `json:"body,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - ClosedAt *Timestamp `json:"closed_at,omitempty"` - MergedAt *Timestamp `json:"merged_at,omitempty"` - Labels []*Label `json:"labels,omitempty"` - User *User `json:"user,omitempty"` - Draft *bool `json:"draft,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - IssueURL *string `json:"issue_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` - CommitsURL *string `json:"commits_url,omitempty"` - CommentsURL *string `json:"comments_url,omitempty"` - ReviewCommentsURL *string `json:"review_comments_url,omitempty"` - ReviewCommentURL *string `json:"review_comment_url,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` + ID *int64 `json:"id,omitempty"` + Number *int `json:"number,omitempty"` + State *string `json:"state,omitempty"` + Locked *bool `json:"locked,omitempty"` + Title *string `json:"title,omitempty"` + Body *string `json:"body,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` + Labels []*Label `json:"labels,omitempty"` + User *User `json:"user,omitempty"` + Draft *bool `json:"draft,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + IssueURL *string `json:"issue_url,omitempty"` + StatusesURL *string `json:"statuses_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + CommitsURL *string `json:"commits_url,omitempty"` + CommentsURL *string `json:"comments_url,omitempty"` + ReviewCommentsURL *string `json:"review_comments_url,omitempty"` + ReviewCommentURL *string `json:"review_comment_url,omitempty"` + // Deprecated: GitHub REST API version 2026-03-10 removed the singular assignee field. + // Use Assignees instead. + Assignee *User `json:"assignee,omitempty"` + Assignees []*User `json:"assignees,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + // AuthorAssociation is the pull request author's relationship to the repository. + // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Requests REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` NodeID *string `json:"node_id,omitempty"` RequestedReviewers []*User `json:"requested_reviewers,omitempty"` @@ -81,6 +89,7 @@ type PullRequest struct { Links *PRLinks `json:"_links,omitempty"` Head *PullRequestBranch `json:"head,omitempty"` Base *PullRequestBranch `json:"base,omitempty"` + Stack *PullRequestStack `json:"stack,omitempty"` // ActiveLockReason is populated only when LockReason is provided while locking the pull request. // Possible values are: "off-topic", "too heated", "resolved", and "spam". @@ -117,6 +126,31 @@ type PullRequestBranch struct { User *User `json:"user,omitempty"` } +// PullRequestStack represents the stack a pull request belongs to, in +// repositories that use stacked pull requests. Base reports the branch the +// entire stack ultimately targets, which can differ from the pull request's own +// Base branch (the branch below it in the stack). +type PullRequestStack struct { + // Base is the base of the stack: the branch the entire stack ultimately targets. + Base *PullRequestStackBase `json:"base"` + // Size is the total number of pull requests in the stack. + Size *int `json:"size,omitempty"` + // Position is the one-based position of this pull request within the stack, + // where 1 is the bottom of the stack. + Position *int `json:"position,omitempty"` + // ID is the ID of the stack that this pull request belongs to. + ID *int64 `json:"id,omitempty"` + // Number is the number of the stack that this pull request belongs to. + Number *int `json:"number,omitempty"` +} + +// PullRequestStackBase represents the base of a stacked pull request's stack: +// the branch the entire stack ultimately targets. +type PullRequestStackBase struct { + Ref string `json:"ref"` + SHA string `json:"sha"` +} + // PullRequestListOptions specifies the optional parameters to the // PullRequestsService.List method. type PullRequestListOptions struct { @@ -136,7 +170,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"` @@ -145,23 +179,23 @@ type PullRequestListOptions struct { // List the pull requests for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests // //meta:operation GET /repos/{owner}/{repo}/pulls -func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { +func (s *PullRequestsService) List(ctx context.Context, owner, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pulls []*PullRequest - resp, err := s.client.Do(ctx, req, &pulls) + resp, err := s.client.Do(req, &pulls) if err != nil { return nil, resp, err } @@ -176,7 +210,7 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin // not present in the repository's default branch, the result will only include // open pull requests. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*PullRequest, *Response, error) { @@ -186,15 +220,14 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + resp, err := s.client.Do(req, &pulls) if err != nil { return nil, resp, err } @@ -204,18 +237,18 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // Get a single pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) Get(ctx context.Context, owner, repo string, number int) (*PullRequest, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - pull := new(PullRequest) - resp, err := s.client.Do(ctx, req, pull) + var pull *PullRequest + resp, err := s.client.Do(req, &pull) if err != nil { return nil, resp, err } @@ -225,12 +258,12 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string // GetRaw gets a single pull request in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) GetRaw(ctx context.Context, owner, repo string, number int, opts RawOptions) (string, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -241,11 +274,11 @@ func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo str 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 - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -253,19 +286,19 @@ func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo str return buf.String(), resp, nil } -// NewPullRequest represents a new pull request to be created. -type NewPullRequest struct { +// CreatePullRequest represents a request to create a pull request. +type CreatePullRequest struct { Title *string `json:"title,omitempty"` // The name of the branch where your changes are implemented. For // cross-repository pull requests in the same network, namespace head with // a user like this: username:branch. - Head *string `json:"head,omitempty"` + Head string `json:"head"` HeadRepo *string `json:"head_repo,omitempty"` // The name of the branch you want the changes pulled into. This should be // an existing branch on the current repository. You cannot submit a pull // request to one repository that requests a merge to a base of another // repository. - Base *string `json:"base,omitempty"` + Base string `json:"base"` Body *string `json:"body,omitempty"` Issue *int `json:"issue,omitempty"` MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` @@ -274,18 +307,18 @@ type NewPullRequest struct { // Create a new pull request on the specified repository. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#create-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#create-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls -func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Create(ctx context.Context, owner, repo string, body CreatePullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) - req, err := s.client.NewRequest("POST", u, pull) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequest + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -293,9 +326,8 @@ func (s *PullRequestsService) Create(ctx context.Context, owner string, repo str return p, resp, nil } -// PullRequestBranchUpdateOptions specifies the optional parameters to the -// PullRequestsService.UpdateBranch method. -type PullRequestBranchUpdateOptions struct { +// UpdatePullRequestBranchRequest represents a request to update a pull request branch. +type UpdatePullRequestBranchRequest struct { // ExpectedHeadSHA specifies the most recent commit on the pull request's branch. // Default value is the SHA of the pull request's current HEAD ref. ExpectedHeadSHA *string `json:"expected_head_sha,omitempty"` @@ -315,22 +347,21 @@ type PullRequestBranchUpdateResponse struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request-branch // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch -func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) +func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, body UpdatePullRequestBranchRequest) (*PullRequestBranchUpdateResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/update-branch", owner, repo, number) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) 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) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequestBranchUpdateResponse + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -352,15 +383,15 @@ type pullRequestUpdate struct { // The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. // Base.Ref updates the base branch of the pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#update-a-pull-request // //meta:operation PATCH /repos/{owner}/{repo}/pulls/{pull_number} -func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { +func (s *PullRequestsService) Edit(ctx context.Context, owner, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { if pull == nil { 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, @@ -375,13 +406,13 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin update.Base = pull.Base.Ref } - req, err := s.client.NewRequest("PATCH", u, update) + req, err := s.client.NewRequest(ctx, "PATCH", u, update) if err != nil { return nil, nil, err } - p := new(PullRequest) - resp, err := s.client.Do(ctx, req, p) + var p *PullRequest + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -391,23 +422,23 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin // ListCommits lists the commits in a pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-commits-on-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/commits -func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) +func (s *PullRequestsService) ListCommits(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/commits", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) + resp, err := s.client.Do(req, &commits) if err != nil { return nil, resp, err } @@ -417,23 +448,23 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep // ListFiles lists the files in a pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/files -func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) +func (s *PullRequestsService) ListFiles(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/files", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commitFiles []*CommitFile - resp, err := s.client.Do(ctx, req, &commitFiles) + resp, err := s.client.Do(req, &commitFiles) if err != nil { return nil, resp, err } @@ -443,17 +474,17 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo // IsMerged checks if a pull request has been merged. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#check-if-a-pull-request-has-been-merged // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/merge -func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) - req, err := s.client.NewRequest("GET", u, nil) +func (s *PullRequestsService) IsMerged(ctx context.Context, owner, repo string, number int) (bool, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge", owner, repo, number) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) merged, err := parseBoolResponse(err) return merged, resp, err } @@ -484,16 +515,46 @@ type pullRequestMergeRequest struct { SHA string `json:"sha,omitempty"` } +// PullRequestMergeAsyncRequest represents a request to merge a pull request asynchronously. +type PullRequestMergeAsyncRequest struct { + // MergeMethod is the merge method: merge, squash, or rebase. Not supported on merge_queue actions. + MergeMethod *string `json:"merge_method,omitempty"` + // MergeAction is how to merge: default, direct_merge, or merge_queue. + MergeAction *string `json:"merge_action,omitempty"` + // CommitTitle is the title for the automatic commit message. Not supported on merge_queue actions. + CommitTitle *string `json:"commit_title,omitempty"` + // CommitMessage is extra detail to append to the automatic commit message. Not supported on merge_queue actions. + CommitMessage *string `json:"commit_message,omitempty"` + // SHA that the pull request head must match to allow the merge. + SHA *string `json:"sha,omitempty"` +} + +// PullRequestMergeAsyncResult represents the current state of an asynchronous merge request. +type PullRequestMergeAsyncResult struct { + Status *string `json:"status,omitempty"` + Details *PullRequestMergeAsyncDetails `json:"details,omitempty"` +} + +// PullRequestMergeAsyncDetails represents details for the current state of a PullRequestMergeAsyncResult. +type PullRequestMergeAsyncDetails struct { + Message *string `json:"message,omitempty"` + UUID *string `json:"uuid,omitempty"` + MergeMethod *string `json:"merge_method,omitempty"` + MergeAction *string `json:"merge_action,omitempty"` + ExpectedHeadSHA *string `json:"expected_head_sha,omitempty"` + SHA *string `json:"sha,omitempty"` +} + // Merge a pull request. // commitMessage is an extra detail to append to automatic commit message. // -// GitHub API docs: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge -func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) +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/%v/merge", owner, repo, number) - pullRequestBody := &pullRequestMergeRequest{} + var pullRequestBody pullRequestMergeRequest if commitMessage != "" { pullRequestBody.CommitMessage = &commitMessage } @@ -505,16 +566,74 @@ func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo stri pullRequestBody.CommitMessage = &commitMessage } } - req, err := s.client.NewRequest("PUT", u, pullRequestBody) + req, err := s.client.NewRequest(ctx, "PUT", u, &pullRequestBody) if err != nil { return nil, nil, err } - mergeResult := new(PullRequestMergeResult) - resp, err := s.client.Do(ctx, req, mergeResult) + var mergeResult *PullRequestMergeResult + resp, err := s.client.Do(req, &mergeResult) if err != nil { return nil, resp, err } return mergeResult, resp, nil } + +// MergeAsync merges a pull request asynchronously. For stacked pull requests, +// this also merges everything below it in the stack. This is the required +// method for merging stacked pull requests; the legacy Merge method cannot be +// used for stacks. +// +// This endpoint typically returns a 202 Accepted status along with the initial +// AsyncMergeResult, since the merge is processed asynchronously. Because this +// is an explicitly asynchronous call, the returned status code is not treated +// as an error here. +// +// A pending response includes a UUID in PullRequestMergeAsyncResult.Details.UUID +// that must be passed to GetMergeAsyncResult to poll for the outcome. +// +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request-asynchronously +// +//meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async +func (s *PullRequestsService) MergeAsync(ctx context.Context, owner, repo string, number int, body PullRequestMergeAsyncRequest) (*PullRequestMergeAsyncResult, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge-async", owner, repo, number) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var result *PullRequestMergeAsyncResult + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetMergeAsyncResult fetches the current result of an asynchronous merge +// request, identified by the uuid returned when the merge was submitted via +// MergeAsync. Poll this method until the returned status is no longer +// "pending". Results are retained for 24 hours after their most recent update. +// +// GitHub API docs: https://docs.github.com/rest/pulls/pulls?apiVersion=2022-11-28#get-the-result-of-an-asynchronous-merge +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid} +func (s *PullRequestsService) GetMergeAsyncResult(ctx context.Context, owner, repo string, number int, uuid string) (*PullRequestMergeAsyncResult, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/merge-async/%v", owner, repo, number, uuid) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var result *PullRequestMergeAsyncResult + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/pulls_comments.go b/vendor/github.com/google/go-github/v93/github/pulls_comments.go similarity index 57% rename from vendor/github.com/google/go-github/v69/github/pulls_comments.go rename to vendor/github.com/google/go-github/v93/github/pulls_comments.go index a9ffe8d7c..7bd2c970e 100644 --- a/vendor/github.com/google/go-github/v69/github/pulls_comments.go +++ b/vendor/github.com/google/go-github/v93/github/pulls_comments.go @@ -18,6 +18,8 @@ type PullRequestComment struct { NodeID *string `json:"node_id,omitempty"` InReplyTo *int64 `json:"in_reply_to_id,omitempty"` Body *string `json:"body,omitempty"` + BodyHTML *string `json:"body_html,omitempty"` + BodyText *string `json:"body_text,omitempty"` Path *string `json:"path,omitempty"` DiffHunk *string `json:"diff_hunk,omitempty"` PullRequestReviewID *int64 `json:"pull_request_review_id,omitempty"` @@ -37,14 +39,27 @@ type PullRequestComment struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the pull request's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". - AuthorAssociation *string `json:"author_association,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequestURL *string `json:"pull_request_url,omitempty"` - // Can be one of: LINE, FILE from https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Comments REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#get-a-review-comment-for-a-pull-request + AuthorAssociation *string `json:"author_association,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + PullRequestURL *string `json:"pull_request_url,omitempty"` + Links *PullRequestCommentLinks `json:"_links,omitempty"` + // Can be one of: LINE, FILE from https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request SubjectType *string `json:"subject_type,omitempty"` } +// PullRequestCommentLinks represents the "_links" object in a pull request +// review comment. +type PullRequestCommentLinks struct { + Self *PRLink `json:"self,omitempty"` + HTML *PRLink `json:"html,omitempty"` + PullRequest *PRLink `json:"pull_request,omitempty"` +} + func (p PullRequestComment) String() string { return Stringify(p) } @@ -68,8 +83,9 @@ type PullRequestListCommentsOptions struct { // pull request number of 0 will return all comments on all pull requests for // 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 +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#list-review-comments-in-a-repository +// +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#list-review-comments-on-a-pull-request // //meta:operation GET /repos/{owner}/{repo}/pulls/comments //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/comments @@ -78,24 +94,23 @@ 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 { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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, ", ")) var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -105,22 +120,21 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // GetComment fetches the specified pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#get-a-review-comment-for-a-pull-request // //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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "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, ", ")) - comment := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, comment) + var comment *PullRequestComment + resp, err := s.client.Do(req, &comment) if err != nil { return nil, resp, err } @@ -128,23 +142,44 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string return comment, resp, nil } +// CreatePullRequestCommentRequest represents a request to create a review +// comment on a pull request. +type CreatePullRequestCommentRequest struct { + Body string `json:"body"` + CommitID string `json:"commit_id"` + Path string `json:"path"` + // Deprecated: Use Line and Side instead. + Position *int `json:"position,omitempty"` + Line *int `json:"line,omitempty"` + Side *string `json:"side,omitempty"` + StartLine *int `json:"start_line,omitempty"` + StartSide *string `json:"start_side,omitempty"` + InReplyTo *int64 `json:"in_reply_to,omitempty"` + SubjectType *string `json:"subject_type,omitempty"` +} + +// UpdatePullRequestCommentRequest represents a request to update a review +// comment on a pull request. +type UpdatePullRequestCommentRequest struct { + Body string `json:"body"` +} + // CreateComment creates a new comment on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments -func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) +func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, body CreatePullRequestCommentRequest) (*PullRequestComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, body) 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, ", ")) - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -154,7 +189,7 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str // CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { @@ -165,14 +200,14 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, Body: body, InReplyTo: commentID, } - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) - req, err := s.client.NewRequest("POST", u, comment) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, comment) if err != nil { return nil, nil, err } - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -180,21 +215,20 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, return c, resp, nil } -// EditComment updates a pull request comment. -// A non-nil comment.Body must be provided. Other comment fields should be left nil. +// UpdateComment updates a pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#update-a-review-comment-for-a-pull-request // //meta:operation PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} -func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) - req, err := s.client.NewRequest("PATCH", u, comment) +func (s *PullRequestsService) UpdateComment(ctx context.Context, owner, repo string, commentID int64, body UpdatePullRequestCommentRequest) (*PullRequestComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(PullRequestComment) - resp, err := s.client.Do(ctx, req, c) + var c *PullRequestComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -204,14 +238,15 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // DeleteComment deletes a pull request comment. // -// GitHub API docs: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments?apiVersion=2022-11-28#delete-a-review-comment-for-a-pull-request // //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) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v93/github/pulls_reviewers.go similarity index 77% rename from vendor/github.com/google/go-github/v69/github/pulls_reviewers.go rename to vendor/github.com/google/go-github/v93/github/pulls_reviewers.go index 526047937..612291a51 100644 --- a/vendor/github.com/google/go-github/v69/github/pulls_reviewers.go +++ b/vendor/github.com/google/go-github/v93/github/pulls_reviewers.go @@ -32,18 +32,18 @@ type removeReviewersRequest struct { // RequestReviewers creates a review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#request-reviewers-for-a-pull-request // //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) - req, err := s.client.NewRequest("POST", u, &reviewers) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) + req, err := s.client.NewRequest(ctx, "POST", u, &reviewers) if err != nil { return nil, nil, err } - r := new(PullRequest) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequest + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -53,23 +53,19 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // ListReviewers lists reviewers whose reviews have been requested on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - reviewers := new(Reviewers) - resp, err := s.client.Do(ctx, req, reviewers) + var reviewers *Reviewers + resp, err := s.client.Do(req, &reviewers) if err != nil { return nil, resp, err } @@ -79,7 +75,7 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str // RemoveReviewers removes the review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests?apiVersion=2022-11-28#remove-requested-reviewers-from-a-pull-request // //meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { @@ -93,11 +89,11 @@ 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) - req, err := s.client.NewRequest("DELETE", u, &removeRequest) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) + req, err := s.client.NewRequest(ctx, "DELETE", u, &removeRequest) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/pulls_reviews.go b/vendor/github.com/google/go-github/v93/github/pulls_reviews.go similarity index 68% rename from vendor/github.com/google/go-github/v69/github/pulls_reviews.go rename to vendor/github.com/google/go-github/v93/github/pulls_reviews.go index 27b8dc37d..f901f32ce 100644 --- a/vendor/github.com/google/go-github/v69/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/v93/github/pulls_reviews.go @@ -24,8 +24,12 @@ type PullRequestReview struct { HTMLURL *string `json:"html_url,omitempty"` PullRequestURL *string `json:"pull_request_url,omitempty"` State *string `json:"state,omitempty"` - // AuthorAssociation is the comment author's relationship to the issue's repository. + // AuthorAssociation is the review author's relationship to the repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". + // + // Deprecated: GitHub will remove this field from Events API payloads on October 7, 2025. + // Use the Pull Request Reviews REST API endpoint to retrieve this information. + // See: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#get-a-review-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` } @@ -89,34 +93,41 @@ func (r *PullRequestReviewRequest) isComfortFadePreview() (bool, error) { return false, nil } -// PullRequestReviewDismissalRequest represents a request to dismiss a review. -type PullRequestReviewDismissalRequest struct { - Message *string `json:"message,omitempty"` +// PullRequestDismissReviewRequest represents a request to dismiss a review. +type PullRequestDismissReviewRequest struct { + Message string `json:"message"` + Event *string `json:"event,omitempty"` } -func (r PullRequestReviewDismissalRequest) String() string { +func (r PullRequestDismissReviewRequest) String() string { return Stringify(r) } +// PullRequestSubmitReviewRequest represents a request to submit a review. +type PullRequestSubmitReviewRequest struct { + Body *string `json:"body,omitempty"` + Event string `json:"event"` +} + // ListReviews lists all reviews on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#list-reviews-for-a-pull-request // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var reviews []*PullRequestReview - resp, err := s.client.Do(ctx, req, &reviews) + resp, err := s.client.Do(req, &reviews) if err != nil { return nil, resp, err } @@ -126,19 +137,19 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // GetReview fetches the specified pull request review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#get-a-review-for-a-pull-request // //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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -148,19 +159,19 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // DeletePendingReview deletes the specified pull request pending review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#delete-a-pending-review-for-a-pull-request // //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) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, nil, err } - review := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -170,23 +181,23 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // ListReviewComments lists all the comments for the specified review. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#list-comments-for-a-pull-request-review // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*PullRequestComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -230,19 +241,19 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // It is waaaaaay better. // ``` // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews -func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) +func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, body *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) - req, err := s.client.NewRequest("POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } // Detect which style of review comment is being used. - if isCF, err := review.isComfortFadePreview(); err != nil { + if isCF, err := body.isComfortFadePreview(); err != nil { return nil, nil, err } else if isCF { // If the review comments are using the comfort fade preview fields, @@ -250,8 +261,8 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri req.Header.Set("Accept", mediaTypeMultiLineCommentsPreview) } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -261,22 +272,22 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri // UpdateReview updates the review summary on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#update-a-review-for-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) { 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) + req, err := s.client.NewRequest(ctx, "PUT", u, opts) if err != nil { return nil, nil, err } - review := &PullRequestReview{} - resp, err := s.client.Do(ctx, req, review) + var review *PullRequestReview + resp, err := s.client.Do(req, &review) if err != nil { return nil, resp, err } @@ -286,19 +297,19 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // SubmitReview submits a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#submit-a-review-for-a-pull-request // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events -func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) +func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, body PullRequestSubmitReviewRequest) (*PullRequestReview, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/events", owner, repo, number, reviewID) - req, err := s.client.NewRequest("POST", u, review) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -308,19 +319,19 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // DismissReview dismisses a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews?apiVersion=2022-11-28#dismiss-a-review-for-a-pull-request // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals -func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) +func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, body PullRequestDismissReviewRequest) (*PullRequestReview, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/dismissals", owner, repo, number, reviewID) - req, err := s.client.NewRequest("PUT", u, review) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - r := new(PullRequestReview) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReview + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/pulls_stacks.go b/vendor/github.com/google/go-github/v93/github/pulls_stacks.go new file mode 100644 index 000000000..da1b9b680 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/pulls_stacks.go @@ -0,0 +1,270 @@ +// 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" +) + +// PullRequestListStacksOptions specifies the optional parameters to the +// PullRequestsService.ListStacks method. +type PullRequestListStacksOptions struct { + // PullRequest filters stacks to the stack containing this pull request number. + PullRequest int `url:"pull_request,omitempty"` + + ListOptions +} + +// PullRequestCreateStackRequest represents a request to create a pull request stack. +type PullRequestCreateStackRequest struct { + // PullRequests is an ordered list of pull request numbers from the bottom of the stack to the top. + PullRequests []int `json:"pull_requests"` +} + +// PullRequestAddToStackRequest represents a request to append pull requests to a stack. +type PullRequestAddToStackRequest struct { + // PullRequests is an ordered list of pull request numbers to append from the current top upward. + PullRequests []int `json:"pull_requests"` +} + +// PullRequestStackRef represents the branch a pull request stack ultimately +// targets. The stacked pull request endpoints return the ref alone, unlike +// PullRequestStackBase, which the pull request endpoints return with a SHA. +type PullRequestStackRef struct { + // Ref is the name of the branch the entire stack ultimately targets. + Ref string `json:"ref"` +} + +// PullRequestStackDetails represents a pull request stack returned by +// PullRequestsService.CreateStack, GetStack, AddToStack, and Unstack. +type PullRequestStackDetails struct { + // ID is the ID of the stack. + ID int64 `json:"id"` + // Number is the number of the stack. + Number int `json:"number"` + // NodeID is the global node ID of the stack. + NodeID string `json:"node_id"` + // URL is the API URL of the stack. + URL string `json:"url"` + // Base is the branch the entire stack ultimately targets. + Base *PullRequestStackRef `json:"base"` + // Open reports whether the stack contains any open pull requests. + Open bool `json:"open"` + // CreatedAt is the time the stack was created. + CreatedAt Timestamp `json:"created_at"` + // PullRequests contains the pull requests in the stack, from bottom to top. + PullRequests []*PullRequestStackEntry `json:"pull_requests"` +} + +// PullRequestStackEntry represents a pull request in a stack returned by +// PullRequestsService.CreateStack, GetStack, AddToStack, and Unstack. +type PullRequestStackEntry struct { + // ID is the ID of the pull request. + ID int64 `json:"id"` + // Number is the number of the pull request. + Number int `json:"number"` + // NodeID is the global node ID of the pull request. + NodeID string `json:"node_id"` + // URL is the API URL of the pull request. + URL string `json:"url"` + // HTMLURL is the web URL of the pull request. + HTMLURL string `json:"html_url"` + // Title is the title of the pull request. + Title string `json:"title"` + // State is the state of the pull request. Possible values are: "open" and "closed". + State string `json:"state"` + // Draft reports whether the pull request is a draft. + Draft bool `json:"draft"` + // MergedAt is the time the pull request was merged, or nil if it is unmerged. + MergedAt *Timestamp `json:"merged_at"` + // User is the author of the pull request. + User *User `json:"user"` + // Head is the branch the pull request merges from. + Head *PullRequestStackBranch `json:"head"` + // Base is the branch the pull request merges into, which is the pull + // request below it in the stack. + Base *PullRequestStackBranch `json:"base"` +} + +// PullRequestStackBranch represents the head or base branch of a pull request +// returned by the stacked pull request endpoints. +type PullRequestStackBranch struct { + // Ref is the name of the branch. + Ref string `json:"ref"` + // SHA is the SHA of the most recent commit on the branch. + SHA string `json:"sha"` + // Repo is the repository the branch belongs to. + Repo *PullRequestStackRepository `json:"repo"` +} + +// PullRequestStackRepository represents the repository a stacked pull +// request's branch belongs to. +type PullRequestStackRepository struct { + // ID is the ID of the repository. + ID int64 `json:"id"` + // URL is the API URL of the repository. + URL string `json:"url"` + // Name is the name of the repository. + Name string `json:"name"` +} + +// PullRequestStackMinimal represents a pull request stack returned by +// PullRequestsService.ListStacks. This endpoint returns less detail about each +// pull request in the stack than PullRequestStackDetails carries. +type PullRequestStackMinimal struct { + // ID is the ID of the stack. + ID int64 `json:"id"` + // Number is the number of the stack. + Number int `json:"number"` + // NodeID is the global node ID of the stack. + NodeID string `json:"node_id"` + // URL is the API URL of the stack. + URL string `json:"url"` + // Base is the branch the entire stack ultimately targets. + Base *PullRequestStackRef `json:"base"` + // Open reports whether the stack contains any open pull requests. + Open bool `json:"open"` + // CreatedAt is the time the stack was created. + CreatedAt Timestamp `json:"created_at"` + // PullRequests contains the pull requests in the stack, from bottom to top. + PullRequests []*PullRequestStackMinimalEntry `json:"pull_requests"` +} + +// PullRequestStackMinimalEntry represents a pull request in a stack +// returned by PullRequestsService.ListStacks. +type PullRequestStackMinimalEntry struct { + // Number is the number of the pull request. + Number int `json:"number"` + // State is the state of the pull request. Possible values are: "open" and "closed". + State string `json:"state"` + // Draft reports whether the pull request is a draft. + Draft bool `json:"draft"` + // MergedAt is the time the pull request was merged, or nil if it is unmerged. + MergedAt *Timestamp `json:"merged_at"` + // Head is the branch the pull request merges from. + Head *PullRequestStackMinimalHead `json:"head"` +} + +// PullRequestStackMinimalHead represents the head branch of a pull request +// returned by PullRequestsService.ListStacks. +type PullRequestStackMinimalHead struct { + // Ref is the name of the branch. + Ref string `json:"ref"` + // SHA is the SHA of the most recent commit on the branch. + SHA string `json:"sha"` +} + +// ListStacks lists pull request stacks in a repository. +// +// GitHub API docs: https://docs.github.com/rest/pulls/stacks?apiVersion=2022-11-28#list-pull-request-stacks +// +//meta:operation GET /repos/{owner}/{repo}/stacks +func (s *PullRequestsService) ListStacks(ctx context.Context, owner, repo string, opts *PullRequestListStacksOptions) ([]*PullRequestStackMinimal, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stacks", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var stacks []*PullRequestStackMinimal + resp, err := s.client.Do(req, &stacks) + if err != nil { + return nil, resp, err + } + + return stacks, resp, nil +} + +// CreateStack creates a pull request stack from an ordered list of pull request numbers. +// +// GitHub API docs: https://docs.github.com/rest/pulls/stacks?apiVersion=2022-11-28#create-a-pull-request-stack +// +//meta:operation POST /repos/{owner}/{repo}/stacks +func (s *PullRequestsService) CreateStack(ctx context.Context, owner, repo string, body PullRequestCreateStackRequest) (*PullRequestStackDetails, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stacks", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var stack *PullRequestStackDetails + resp, err := s.client.Do(req, &stack) + if err != nil { + return nil, resp, err + } + + return stack, resp, nil +} + +// GetStack gets a pull request stack by its stack number. +// +// GitHub API docs: https://docs.github.com/rest/pulls/stacks?apiVersion=2022-11-28#get-a-pull-request-stack +// +//meta:operation GET /repos/{owner}/{repo}/stacks/{stack_number} +func (s *PullRequestsService) GetStack(ctx context.Context, owner, repo string, stackNumber int) (*PullRequestStackDetails, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stacks/%v", owner, repo, stackNumber) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var stack *PullRequestStackDetails + resp, err := s.client.Do(req, &stack) + if err != nil { + return nil, resp, err + } + + return stack, resp, nil +} + +// AddToStack appends pull requests to a pull request stack. +// +// GitHub API docs: https://docs.github.com/rest/pulls/stacks?apiVersion=2022-11-28#add-pull-requests-to-a-pull-request-stack +// +//meta:operation POST /repos/{owner}/{repo}/stacks/{stack_number}/add +func (s *PullRequestsService) AddToStack(ctx context.Context, owner, repo string, stackNumber int, body PullRequestAddToStackRequest) (*PullRequestStackDetails, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stacks/%v/add", owner, repo, stackNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var stack *PullRequestStackDetails + resp, err := s.client.Do(req, &stack) + if err != nil { + return nil, resp, err + } + + return stack, resp, nil +} + +// Unstack removes the unmerged pull requests from a pull request stack. It +// returns nil when no pull requests remain and the stack is dissolved. +// +// GitHub API docs: https://docs.github.com/rest/pulls/stacks?apiVersion=2022-11-28#remove-pull-requests-from-a-pull-request-stack +// +//meta:operation POST /repos/{owner}/{repo}/stacks/{stack_number}/unstack +func (s *PullRequestsService) Unstack(ctx context.Context, owner, repo string, stackNumber int) (*PullRequestStackDetails, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/stacks/%v/unstack", owner, repo, stackNumber) + req, err := s.client.NewRequest(ctx, "POST", u, nil) + if err != nil { + return nil, nil, err + } + + var stack *PullRequestStackDetails + resp, err := s.client.Do(req, &stack) + if err != nil { + return nil, resp, err + } + + return stack, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/pulls_threads.go b/vendor/github.com/google/go-github/v93/github/pulls_threads.go similarity index 100% rename from vendor/github.com/google/go-github/v69/github/pulls_threads.go rename to vendor/github.com/google/go-github/v93/github/pulls_threads.go diff --git a/vendor/github.com/google/go-github/v69/github/rate_limit.go b/vendor/github.com/google/go-github/v93/github/rate_limit.go similarity index 82% rename from vendor/github.com/google/go-github/v69/github/rate_limit.go rename to vendor/github.com/google/go-github/v93/github/rate_limit.go index 6236eba8f..a63f8382d 100644 --- a/vendor/github.com/google/go-github/v69/github/rate_limit.go +++ b/vendor/github.com/google/go-github/v93/github/rate_limit.go @@ -26,7 +26,7 @@ type Rate struct { // The rate limit resource that the request counted against. // For more information about the different resources, see REST API endpoints for rate limits. - // GitHub API docs: https://docs.github.com/en/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user + // GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user Resource string `json:"resource,omitempty"` } @@ -40,20 +40,20 @@ type RateLimits struct { // requests are limited to 60 per hour. Authenticated requests are // limited to 5,000 per hour. // - // GitHub API docs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting + // GitHub API docs: https://docs.github.com/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting Core *Rate `json:"core"` // The rate limit for search API requests. Unauthenticated requests // are limited to 10 requests per minutes. Authenticated requests are // limited to 30 per minute. // - // GitHub API docs: https://docs.github.com/en/rest/search#rate-limit + // GitHub API docs: https://docs.github.com/rest/search?apiVersion=2022-11-28#rate-limit Search *Rate `json:"search"` // GitHub API docs: https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit GraphQL *Rate `json:"graphql"` - // GitHub API dos: https://docs.github.com/en/rest/rate-limit + // GitHub API docs: https://docs.github.com/rest/rate-limit?apiVersion=2022-11-28 IntegrationManifest *Rate `json:"integration_manifest"` SourceImport *Rate `json:"source_import"` @@ -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 { @@ -71,11 +72,16 @@ func (r RateLimits) String() string { // Get returns the rate limits for the current client. // -// GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit?apiVersion=2022-11-28#get-rate-limit-status-for-the-authenticated-user // //meta:operation GET /rate_limit func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { - req, err := s.client.NewRequest("GET", "rate_limit", nil) + // This resource is not subject to rate limits. + if !s.client.disableRateLimitCheck { + ctx = context.WithValue(ctx, BypassRateLimitCheck, true) + } + + req, err := s.client.NewRequest(ctx, "GET", "rate_limit", nil) if err != nil { return nil, nil, err } @@ -84,9 +90,7 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err Resources *RateLimits `json:"resources"` }) - // This resource is not subject to rate limits. - ctx = context.WithValue(ctx, BypassRateLimitCheck, true) - resp, err := s.client.Do(ctx, req, response) + resp, err := s.client.Do(req, response) if err != nil { return nil, resp, err } @@ -126,6 +130,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/v69/github/reactions.go b/vendor/github.com/google/go-github/v93/github/reactions.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/reactions.go rename to vendor/github.com/google/go-github/v93/github/reactions.go index 9f9f72fae..85b6e8319 100644 --- a/vendor/github.com/google/go-github/v69/github/reactions.go +++ b/vendor/github.com/google/go-github/v93/github/reactions.go @@ -8,13 +8,12 @@ package github import ( "context" "fmt" - "net/http" ) // ReactionsService provides access to the reactions-related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/reactions +// GitHub API docs: https://docs.github.com/rest/reactions?apiVersion=2022-11-28 type ReactionsService service // Reaction represents a GitHub reaction. @@ -26,7 +25,8 @@ type Reaction struct { // Content is the type of reaction. // Possible values are: // "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". - Content *string `json:"content,omitempty"` + Content *string `json:"content,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` } // Reactions represents a summary of GitHub reactions. @@ -47,9 +47,8 @@ func (r Reaction) String() string { return Stringify(r) } -// ListCommentReactionOptions specifies the optional parameters to the -// ReactionsService.ListCommentReactions method. -type ListCommentReactionOptions struct { +// ListReactionOptions specifies the optional parameters to the list reactions endpoints. +type ListReactionOptions struct { // Content restricts the returned comment reactions to only those with the given type. // Omit this parameter to list all reactions to a commit comment. // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". @@ -60,26 +59,25 @@ type ListCommentReactionOptions struct { // ListCommentReactions lists the reactions for a commit comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-commit-comment // //meta:operation GET /repos/{owner}/{repo}/comments/{comment_id}/reactions -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -92,23 +90,22 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo // previously created reaction will be returned with Status: 200 OK. // 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-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-commit-comment // //meta:operation POST /repos/{owner}/{repo}/comments/{comment_id}/reactions func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -118,7 +115,7 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep // DeleteCommentReaction deletes the reaction for a commit comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-commit-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -129,7 +126,7 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep // DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-commit-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -140,26 +137,25 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID // ListIssueReactions lists the reactions for an issue. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue // //meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/reactions -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -172,23 +168,22 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s // previously created reaction will be returned with Status: 200 OK. // 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-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue // //meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/reactions func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -198,7 +193,7 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo // DeleteIssueReaction deletes the reaction to an issue. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { @@ -209,7 +204,7 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo // DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { @@ -220,26 +215,25 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, // ListIssueCommentReactions lists the reactions for an issue comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-an-issue-comment // //meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -252,23 +246,22 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, // previously created reaction will be returned with Status: 200 OK. // 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-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment // //meta:operation POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -278,7 +271,7 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReaction deletes the reaction to an issue comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -289,7 +282,7 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-an-issue-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -300,26 +293,25 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-pull-request-review-comment // //meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -332,23 +324,22 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, // previously created reaction will be returned with Status: 200 OK. // 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-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-pull-request-review-comment // //meta:operation POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -358,7 +349,7 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-pull-request-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { @@ -369,7 +360,7 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. // -// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-pull-request-comment-reaction // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { @@ -380,17 +371,19 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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 *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -398,7 +391,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -409,22 +402,24 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -434,7 +429,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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 +442,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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,17 +455,19 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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 *ListOptions) ([]*Reaction, *Response, error) { +func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } @@ -474,7 +475,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -484,22 +485,24 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m *Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } @@ -509,7 +512,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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 +525,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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,15 +537,14 @@ 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(ctx, "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) + return s.client.Do(req, nil) } // CreateReleaseReaction creates a reaction to a release. @@ -546,25 +552,75 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res // added the reaction type to this release. // 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-release +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-release // //meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/reactions func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, repo string, releaseID int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) - body := &Reaction{Content: Ptr(content)} - req, err := s.client.NewRequest("POST", u, body) + body := &Reaction{Content: &content} + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m *Reaction + resp, err := s.client.Do(req, &m) + if err != nil { + return nil, resp, err + } + + return m, resp, nil +} + +// ListReleaseReactions lists the reactions for a release. +// +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#list-reactions-for-a-release +// +//meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/reactions +func (s *ReactionsService) ListReleaseReactions(ctx context.Context, owner, repo string, releaseID int64, opts *ListReactionOptions) ([]*Reaction, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeReactionsPreview) - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) + var m []*Reaction + resp, err := s.client.Do(req, &m) if err != nil { return nil, resp, err } return m, resp, nil } + +// DeleteReleaseReaction deletes the reaction for a release. +// +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} +func (s *ReactionsService) DeleteReleaseReaction(ctx context.Context, owner, repo string, releaseID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions/%v", owner, repo, releaseID, reactionID) + + return s.deleteReaction(ctx, u) +} + +// DeleteReleaseReactionByID deletes the reaction for a release by repository ID. +// +// GitHub API docs: https://docs.github.com/rest/reactions/reactions?apiVersion=2022-11-28#delete-a-release-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} +func (s *ReactionsService) DeleteReleaseReactionByID(ctx context.Context, repoID, releaseID, reactionID int64) (*Response, error) { + u := fmt.Sprintf("repositories/%v/releases/%v/reactions/%v", repoID, releaseID, reactionID) + + return s.deleteReaction(ctx, u) +} diff --git a/vendor/github.com/google/go-github/v69/github/repos.go b/vendor/github.com/google/go-github/v93/github/repos.go similarity index 79% rename from vendor/github.com/google/go-github/v69/github/repos.go rename to vendor/github.com/google/go-github/v93/github/repos.go index 9faed401f..e7671b2d2 100644 --- a/vendor/github.com/google/go-github/v69/github/repos.go +++ b/vendor/github.com/google/go-github/v93/github/repos.go @@ -22,7 +22,7 @@ var ErrBranchNotProtected = errors.New("branch is not protected") // RepositoriesService handles communication with the repository related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/repos/ +// GitHub API docs: https://docs.github.com/rest/repos?apiVersion=2022-11-28 type RepositoriesService service // Repository represents a GitHub repository. @@ -62,7 +62,7 @@ type Repository struct { Source *Repository `json:"source,omitempty"` TemplateRepository *Repository `json:"template_repository,omitempty"` Organization *Organization `json:"organization,omitempty"` - Permissions map[string]bool `json:"permissions,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"` @@ -77,7 +77,7 @@ type Repository struct { 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]interface{} `json:"custom_properties,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` Archived *bool `json:"archived,omitempty"` Disabled *bool `json:"disabled,omitempty"` @@ -85,16 +85,18 @@ type Repository struct { License *License `json:"license,omitempty"` // Additional mutable fields when creating and editing a repository - Private *bool `json:"private,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - HasPages *bool `json:"has_pages,omitempty"` - HasProjects *bool `json:"has_projects,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` - HasDiscussions *bool `json:"has_discussions,omitempty"` - IsTemplate *bool `json:"is_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` + Private *bool `json:"private,omitempty"` + HasIssues *bool `json:"has_issues,omitempty"` + HasWiki *bool `json:"has_wiki,omitempty"` + HasPages *bool `json:"has_pages,omitempty"` + HasProjects *bool `json:"has_projects,omitempty"` + HasDownloads *bool `json:"has_downloads,omitempty"` + HasDiscussions *bool `json:"has_discussions,omitempty"` + HasPullRequests *bool `json:"has_pull_requests,omitempty"` + PullRequestCreationPolicy *string `json:"pull_request_creation_policy,omitempty"` // Can be one of: "all", "collaborators_only" + IsTemplate *bool `json:"is_template,omitempty"` + LicenseTemplate *string `json:"license_template,omitempty"` + GitignoreTemplate *string `json:"gitignore_template,omitempty"` // Options for configuring Advanced Security and Secret Scanning SecurityAndAnalysis *SecurityAndAnalysis `json:"security_and_analysis,omitempty"` @@ -142,7 +144,7 @@ type Repository struct { TeamsURL *string `json:"teams_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search?apiVersion=2022-11-28#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Visibility is only used for Create and Edit endpoints. The visibility field @@ -151,7 +153,7 @@ type Repository struct { Visibility *string `json:"visibility,omitempty"` // RoleName is only returned by the API 'check team permissions for a repository'. - // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository + // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository RoleName *string `json:"role_name,omitempty"` } @@ -200,6 +202,16 @@ type SecurityAndAnalysis struct { SecretScanningPushProtection *SecretScanningPushProtection `json:"secret_scanning_push_protection,omitempty"` DependabotSecurityUpdates *DependabotSecurityUpdates `json:"dependabot_security_updates,omitempty"` SecretScanningValidityChecks *SecretScanningValidityChecks `json:"secret_scanning_validity_checks,omitempty"` + CodeSecurity *CodeSecurity `json:"code_security,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 { @@ -257,13 +269,25 @@ type SecretScanningValidityChecks struct { Status *string `json:"status,omitempty"` } +// CodeSecurity represents the state of code security on a repository. +// +// GitHub API docs: https://docs.github.com/en/code-security/getting-started/github-security-features#available-with-github-code-security +type CodeSecurity struct { + Status *string `json:"status,omitempty"` +} + +func (c CodeSecurity) String() string { + return Stringify(c) +} + // List calls either RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser // depending on whether user is empty. // // 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 +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user // //meta:operation GET /user/repos //meta:operation GET /users/{username}/repos @@ -303,7 +327,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"` @@ -312,7 +336,7 @@ type RepositoryListByUserOptions struct { // ListByUser lists public repositories for the specified user. // -// 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?apiVersion=2022-11-28#list-repositories-for-a-user // //meta:operation GET /users/{username}/repos func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts *RepositoryListByUserOptions) ([]*Repository, *Response, error) { @@ -322,13 +346,13 @@ func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -375,7 +399,7 @@ type RepositoryListByAuthenticatedUserOptions struct { // ListByAuthenticatedUser lists repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user // //meta:operation GET /user/repos func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) ([]*Repository, *Response, error) { @@ -385,13 +409,13 @@ func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -419,7 +443,7 @@ type RepositoryListByOrgOptions struct { // ListByOrg lists the repositories for an organization. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-organization-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories // //meta:operation GET /orgs/{org}/repos func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { @@ -429,17 +453,16 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -456,7 +479,7 @@ type RepositoryListAllOptions struct { // ListAll lists all GitHub repositories in the order that they were created. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-public-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-public-repositories // //meta:operation GET /repositories func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) { @@ -465,13 +488,13 @@ func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListA return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -479,14 +502,9 @@ func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListA return repos, resp, nil } -// createRepoRequest is a subset of Repository and is used internally -// by Create to pass only the known fields for the endpoint. -// -// See https://github.com/google/go-github/issues/1014 for more -// information. -type createRepoRequest struct { - // Name is required when creating a repo. - Name *string `json:"name,omitempty"` +// CreateRepositoryRequest specifies the repository to create. +type CreateRepositoryRequest struct { + Name string `json:"name"` Description *string `json:"description,omitempty"` Homepage *string `json:"homepage,omitempty"` @@ -498,44 +516,45 @@ type createRepoRequest struct { HasDiscussions *bool `json:"has_discussions,omitempty"` IsTemplate *bool `json:"is_template,omitempty"` - // Creating an organization repository. Required for non-owners. + // TeamID is used when creating an organization repository. 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"` +} + +func (r CreateRepositoryRequest) String() string { return Stringify(r) } // Create a new repository. If an organization is specified, the new // repository will be created under that org. If the empty string is // specified, it will be created for the authenticated user. // -// Note that only a subset of the repo fields are used and repo must -// not be nil. -// // Also note that this method will return the response without actually // waiting for GitHub to finish creating the repository and letting the // changes propagate throughout its servers. You may set up a loop with // 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 +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository // //meta:operation POST /orgs/{org}/repos //meta:operation POST /user/repos -func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) { +func (s *RepositoriesService) Create(ctx context.Context, org string, body CreateRepositoryRequest) (*Repository, *Response, error) { var u string if org != "" { u = fmt.Sprintf("orgs/%v/repos", org) @@ -543,44 +562,15 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo u = "user/repos" } - repoReq := &createRepoRequest{ - Name: repo.Name, - Description: repo.Description, - Homepage: repo.Homepage, - Private: repo.Private, - Visibility: repo.Visibility, - HasIssues: repo.HasIssues, - HasProjects: repo.HasProjects, - HasWiki: repo.HasWiki, - HasDiscussions: repo.HasDiscussions, - IsTemplate: repo.IsTemplate, - TeamID: repo.TeamID, - AutoInit: repo.AutoInit, - GitignoreTemplate: repo.GitignoreTemplate, - LicenseTemplate: repo.LicenseTemplate, - AllowSquashMerge: repo.AllowSquashMerge, - AllowMergeCommit: repo.AllowMergeCommit, - AllowRebaseMerge: repo.AllowRebaseMerge, - AllowUpdateBranch: repo.AllowUpdateBranch, - AllowAutoMerge: repo.AllowAutoMerge, - AllowForking: repo.AllowForking, - DeleteBranchOnMerge: repo.DeleteBranchOnMerge, - UseSquashPRTitleAsDefault: repo.UseSquashPRTitleAsDefault, - SquashMergeCommitTitle: repo.SquashMergeCommitTitle, - SquashMergeCommitMessage: repo.SquashMergeCommitMessage, - MergeCommitTitle: repo.MergeCommitTitle, - MergeCommitMessage: repo.MergeCommitMessage, - } - - req, err := s.client.NewRequest("POST", u, repoReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -590,31 +580,29 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo // TemplateRepoRequest represents a request to create a repository from a template. type TemplateRepoRequest struct { - // Name is required when creating a repo. - Name *string `json:"name,omitempty"` - Owner *string `json:"owner,omitempty"` - Description *string `json:"description,omitempty"` - - IncludeAllBranches *bool `json:"include_all_branches,omitempty"` - Private *bool `json:"private,omitempty"` + Name string `json:"name"` + Owner *string `json:"owner,omitempty"` + Description *string `json:"description,omitempty"` + IncludeAllBranches *bool `json:"include_all_branches,omitempty"` + Private *bool `json:"private,omitempty"` } // CreateFromTemplate generates a repository from a template. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-using-a-template // //meta:operation POST /repos/{template_owner}/{template_repo}/generate -func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { +func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, body TemplateRepoRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) - req, err := s.client.NewRequest("POST", u, templateRepoReq) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeRepositoryTemplatePreview) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -624,18 +612,17 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw // Get fetches a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#get-a-repository // //meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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 + // https://docs.github.com/rest/licenses?apiVersion=2022-11-28#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, @@ -644,8 +631,8 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -654,24 +641,23 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // GetCodeOfConduct gets the contents of a repository's code of conduct. -// Note that https://docs.github.com/rest/codes-of-conduct#about-the-codes-of-conduct-api +// Note that https://docs.github.com/rest/codes-of-conduct?apiVersion=2022-11-28#about-the-codes-of-conduct-api // says to use the GET /repos/{owner}/{repo} endpoint. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#get-a-repository // //meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -685,14 +671,14 @@ 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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repositories/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -702,20 +688,20 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor // Edit updates a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#update-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#update-a-repository // //meta:operation PATCH /repos/{owner}/{repo} -func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { +func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, body *Repository) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("PATCH", u, repository) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } acceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -725,17 +711,17 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo // Delete a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#delete-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#delete-a-repository // //meta:operation DELETE /repos/{owner}/{repo} func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Contributor represents a repository contributor. @@ -774,78 +760,75 @@ type ListContributorsOptions struct { // GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-vulnerability-alerts-are-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + resp, err := s.client.Do(req, nil) vulnerabilityAlertsEnabled, err := parseBoolResponse(err) return vulnerabilityAlertsEnabled, resp, err } // EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-vulnerability-alerts // //meta:operation PUT /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-vulnerability-alerts // //meta:operation DELETE /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // GetAutomatedSecurityFixes checks if the automated security fixes for a repository are enabled. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-automated-security-fixes-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-dependabot-security-updates-are-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*AutomatedSecurityFixes, *Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - p := new(AutomatedSecurityFixes) - resp, err := s.client.Do(ctx, req, p) + var p *AutomatedSecurityFixes + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -854,55 +837,55 @@ func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, own // EnableAutomatedSecurityFixes enables the automated security fixes for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-automated-security-fixes +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-dependabot-security-updates // //meta:operation PUT /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-automated-security-fixes +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-dependabot-security-updates // //meta:operation DELETE /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListContributors lists contributors for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-contributors +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors // //meta:operation GET /repos/{owner}/{repo}/contributors -func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { +func (s *RepositoriesService) ListContributors(ctx context.Context, owner, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var contributor []*Contributor - resp, err := s.client.Do(ctx, req, &contributor) + resp, err := s.client.Do(req, &contributor) if err != nil { return nil, resp, err } @@ -919,18 +902,18 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string // "Python": 7769 // } // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-languages +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-languages // //meta:operation GET /repos/{owner}/{repo}/languages -func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) { +func (s *RepositoriesService) ListLanguages(ctx context.Context, owner, repo string) (map[string]int, *Response, error) { u := fmt.Sprintf("repos/%v/%v/languages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } languages := make(map[string]int) - resp, err := s.client.Do(ctx, req, &languages) + resp, err := s.client.Do(req, &languages) if err != nil { return nil, resp, err } @@ -940,23 +923,23 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r // ListTeams lists the teams for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-teams +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-teams // //meta:operation GET /repos/{owner}/{repo}/teams -func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) { +func (s *RepositoriesService) ListTeams(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/teams", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -974,23 +957,23 @@ type RepositoryTag struct { // ListTags lists tags for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-tags +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-tags // //meta:operation GET /repos/{owner}/{repo}/tags -func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { +func (s *RepositoriesService) ListTags(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var tags []*RepositoryTag - resp, err := s.client.Do(ctx, req, &tags) + resp, err := s.client.Do(req, &tags) if err != nil { return nil, resp, err } @@ -1010,7 +993,8 @@ type Branch struct { // such as 'List branches'. In such cases, if branch protection is // enabled, Protected will be `true` but this will be nil, and // additional protection details can be obtained by calling GetBranch(). - Protection *Protection `json:"protection,omitempty"` + Protection *Protection `json:"protection,omitempty"` + ProtectionURL *string `json:"protection_url,omitempty"` } // Protection represents a repository branch's protection. @@ -1073,6 +1057,7 @@ type BranchProtectionRule struct { RequiredConversationResolutionLevel *string `json:"required_conversation_resolution_level,omitempty"` AuthorizedActorsOnly *bool `json:"authorized_actors_only,omitempty"` AuthorizedActorNames []string `json:"authorized_actor_names,omitempty"` + RequireLastPushApproval *bool `json:"require_last_push_approval,omitempty"` } // ProtectionChanges represents the changes to the rule if the BranchProtection was edited. @@ -1092,6 +1077,7 @@ type ProtectionChanges struct { RequiredStatusChecks *RequiredStatusChecksChanges `json:"required_status_checks,omitempty"` RequiredStatusChecksEnforcementLevel *RequiredStatusChecksEnforcementLevelChanges `json:"required_status_checks_enforcement_level,omitempty"` SignatureRequirementEnforcementLevel *SignatureRequirementEnforcementLevelChanges `json:"signature_requirement_enforcement_level,omitempty"` + RequireLastPushApproval *RequireLastPushApprovalChanges `json:"require_last_push_approval,omitempty"` } // AdminEnforcedChanges represents the changes made to the AdminEnforced policy. @@ -1169,6 +1155,11 @@ type SignatureRequirementEnforcementLevelChanges struct { From *string `json:"from,omitempty"` } +// RequireLastPushApprovalChanges represents the changes made to the RequireLastPushApproval policy. +type RequireLastPushApprovalChanges struct { + From *bool `json:"from,omitempty"` +} + // ProtectionRequest represents a request to create/edit a branch's protection. type ProtectionRequest struct { RequiredStatusChecks *RequiredStatusChecks `json:"required_status_checks"` @@ -1194,7 +1185,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"` @@ -1400,23 +1391,23 @@ type AutomatedSecurityFixes struct { // ListBranches lists branches for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#list-branches +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#list-branches // //meta:operation GET /repos/{owner}/{repo}/branches -func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { +func (s *RepositoriesService) ListBranches(ctx context.Context, owner, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var branches []*Branch - resp, err := s.client.Do(ctx, req, &branches) + resp, err := s.client.Do(req, &branches) if err != nil { return nil, resp, err } @@ -1428,7 +1419,7 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branches#get-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#get-a-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch} func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error) { @@ -1441,11 +1432,11 @@ 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) - err = json.NewDecoder(resp.Body).Decode(b) + var b *Branch + err = json.NewDecoder(resp.Body).Decode(&b) return b, newResponse(resp), err } @@ -1461,19 +1452,19 @@ type renameBranchRequest struct { // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branches#rename-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#rename-a-branch // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/rename func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, url.PathEscape(branch)) r := &renameBranchRequest{NewName: newName} - req, err := s.client.NewRequest("POST", u, r) + req, err := s.client.NewRequest(ctx, "POST", u, r) if err != nil { return nil, nil, err } - b := new(Branch) - resp, err := s.client.Do(ctx, req, b) + var b *Branch + resp, err := s.client.Do(req, &b) if err != nil { return nil, resp, err } @@ -1485,21 +1476,20 @@ func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, bra // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-branch-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) + var p *Protection + resp, err := s.client.Do(req, &p) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1514,18 +1504,18 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-status-checks-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - p := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, p) + var p *RequiredStatusChecks + resp, err := s.client.Do(req, &p) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1540,17 +1530,17 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-all-status-check-contexts // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - resp, err = s.client.Do(ctx, req, &contexts) + resp, err = s.client.Do(req, &contexts) if err != nil { if isBranchNotProtected(err) { err = ErrBranchNotProtected @@ -1565,21 +1555,20 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection -func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { +func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, body *ProtectionRequest) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, preq) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - p := new(Protection) - resp, err := s.client.Do(ctx, req, p) + var p *Protection + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } @@ -1591,39 +1580,41 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-branch-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetSignaturesProtectedBranch gets required signatures of protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-commit-signature-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + var p *SignaturesProtectedBranch + resp, err := s.client.Do(req, &p) if err != nil { + if isBranchNotProtected(err) { + err = ErrBranchNotProtected + } return nil, resp, err } @@ -1635,21 +1626,20 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#create-commit-signature-protection // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) - r := new(SignaturesProtectedBranch) - resp, err := s.client.Do(ctx, req, r) + var r *SignaturesProtectedBranch + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1661,38 +1651,37 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-commit-signature-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // UpdateRequiredStatusChecks updates the required status checks for a given protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-status-check-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks -func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { +func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, body *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PATCH", u, sreq) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - sc := new(RequiredStatusChecks) - resp, err := s.client.Do(ctx, req, sc) + var sc *RequiredStatusChecks + resp, err := s.client.Do(req, &sc) if err != nil { return nil, resp, err } @@ -1704,33 +1693,33 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-status-check-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // License gets the contents of a repository's license if one is detected. // -// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository +// GitHub API docs: https://docs.github.com/rest/licenses/licenses?apiVersion=2022-11-28#get-the-license-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/license func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) { u := fmt.Sprintf("repos/%v/%v/license", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := &RepositoryLicense{} - resp, err := s.client.Do(ctx, req, r) + var r *RepositoryLicense + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1742,21 +1731,20 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) ( // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-pull-request-review-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1769,21 +1757,20 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-pull-request-review-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews -func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { +func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, body *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PATCH", u, patch) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1796,7 +1783,7 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#update-pull-request-review-protection // //meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { @@ -1806,16 +1793,15 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, DismissalRestrictionsRequest `json:"dismissal_restrictions"` }) - req, err := s.client.NewRequest("PATCH", u, data) + req, err := s.client.NewRequest(ctx, "PATCH", u, data) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) - r := new(PullRequestReviewsEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *PullRequestReviewsEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1827,35 +1813,35 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-pull-request-review-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // GetAdminEnforcement gets admin enforcement information of a protected branch. // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-admin-branch-protection // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *AdminEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1868,18 +1854,18 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-admin-branch-protection // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - r := new(AdminEnforcement) - resp, err := s.client.Do(ctx, req, r) + var r *AdminEnforcement + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -1891,17 +1877,17 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#delete-admin-branch-protection // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // repositoryTopics represents a collection of repository topics. @@ -1911,21 +1897,25 @@ type repositoryTopics struct { // ListAllTopics lists topics for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#get-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#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) - req, err := s.client.NewRequest("GET", u, nil) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "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) - resp, err := s.client.Do(ctx, req, topics) + var topics *repositoryTopics + resp, err := s.client.Do(req, &topics) if err != nil { return nil, resp, err } @@ -1935,7 +1925,7 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str // ReplaceAllTopics replaces all repository topics. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#replace-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#replace-all-repository-topics // //meta:operation PUT /repos/{owner}/{repo}/topics func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) { @@ -1946,16 +1936,15 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo if t.Names == nil { t.Names = []string{} } - req, err := s.client.NewRequest("PUT", u, t) + req, err := s.client.NewRequest(ctx, "PUT", u, t) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) t = new(repositoryTopics) - resp, err := s.client.Do(ctx, req, t) + resp, err := s.client.Do(req, t) if err != nil { return nil, resp, err } @@ -1970,18 +1959,18 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo // // Deprecated: Please use ListAppRestrictions instead. // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-apps-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var apps []*App - resp, err := s.client.Do(ctx, req, &apps) + resp, err := s.client.Do(req, &apps) if err != nil { return nil, resp, err } @@ -1994,7 +1983,7 @@ func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch // // Note: This is a wrapper around ListApps so a naming convention with ListUserRestrictions and ListTeamRestrictions is preserved. // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-apps-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { @@ -2009,18 +1998,18 @@ func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-app-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps -func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { +func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, apps) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2035,18 +2024,18 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-app-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps -func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { +func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, apps) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2061,18 +2050,18 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-app-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, apps) + req, err := s.client.NewRequest(ctx, "DELETE", u, apps) if err != nil { return nil, nil, err } var newApps []*App - resp, err := s.client.Do(ctx, req, &newApps) + resp, err := s.client.Do(req, &newApps) if err != nil { return nil, resp, err } @@ -2085,18 +2074,18 @@ func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-teams-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, repo, branch string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -2112,18 +2101,18 @@ func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-team-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams -func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { +func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, teams) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2138,18 +2127,18 @@ func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-team-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams -func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { +func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, teams) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2164,18 +2153,18 @@ func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-team-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, teams) + req, err := s.client.NewRequest(ctx, "DELETE", u, teams) if err != nil { return nil, nil, err } var newTeams []*Team - resp, err := s.client.Do(ctx, req, &newTeams) + resp, err := s.client.Do(req, &newTeams) if err != nil { return nil, resp, err } @@ -2188,18 +2177,18 @@ func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#get-users-with-access-to-the-protected-branch // //meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, repo, branch string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -2215,18 +2204,18 @@ func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#set-user-access-restrictions // //meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users -func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { +func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("PUT", u, users) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2241,18 +2230,18 @@ func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#add-user-access-restrictions // //meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users -func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { +func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, body []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("POST", u, users) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2267,18 +2256,18 @@ func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection?apiVersion=2022-11-28#remove-user-access-restrictions // //meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) - req, err := s.client.NewRequest("DELETE", u, users) + req, err := s.client.NewRequest(ctx, "DELETE", u, users) if err != nil { return nil, nil, err } var newUsers []*User - resp, err := s.client.Do(ctx, req, &newUsers) + resp, err := s.client.Do(req, &newUsers) if err != nil { return nil, resp, err } @@ -2301,19 +2290,19 @@ type TransferRequest struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#transfer-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#transfer-a-repository // //meta:operation POST /repos/{owner}/{repo}/transfer func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo) - req, err := s.client.NewRequest("POST", u, &transfer) + req, err := s.client.NewRequest(ctx, "POST", u, &transfer) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -2332,19 +2321,19 @@ type DispatchRequestOptions struct { // Dispatch triggers a repository_dispatch event in a GitHub Actions workflow. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event // //meta:operation POST /repos/{owner}/{repo}/dispatches func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo) - req, err := s.client.NewRequest("POST", u, &opts) + req, err := s.client.NewRequest(ctx, "POST", u, &opts) if err != nil { return nil, nil, err } - r := new(Repository) - resp, err := s.client.Do(ctx, req, r) + var r *Repository + resp, err := s.client.Do(req, &r) if err != nil { return nil, resp, err } @@ -2355,25 +2344,25 @@ 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 // repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-private-vulnerability-reporting-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -2384,18 +2373,18 @@ func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, // DisablePrivateReporting disables private reporting of vulnerabilities for a // repository. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-private-vulnerability-reporting-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) DisablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -2411,18 +2400,114 @@ type checkPrivateReporting struct { // IsPrivateReportingEnabled checks if private vulnerability reporting is enabled // for the repository and returns a boolean indicating the status. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-private-vulnerability-reporting-is-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-private-vulnerability-reporting-is-enabled-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) IsPrivateReportingEnabled(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - privateReporting := new(checkPrivateReporting) - resp, err := s.client.Do(ctx, req, privateReporting) + var privateReporting checkPrivateReporting + resp, err := s.client.Do(req, &privateReporting) return privateReporting.Enabled, resp, err } + +// ListRepositoryActivityOptions specifies the optional parameters to the +// RepositoriesService.ListRepositoryActivities method. +type ListRepositoryActivityOptions struct { + // The direction to sort the results by. + // Default: desc + // Can be one of: asc, desc + Direction string `url:"direction,omitempty"` + + // For paginated result sets, The number of results per page (max 100). + PerPage int `url:"per_page,omitempty"` + + // 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"` + + // The Git reference for the activities you want to list. + // The ref for a branch can be formatted either as refs/heads/BRANCH_NAME or BRANCH_NAME, where BRANCH_NAME is the name of your branch. + Ref string `url:"ref,omitempty"` + + // The GitHub username to use to filter by the actor who performed the activity. + Actor string `url:"actor,omitempty"` + + // The time period to filter by. + // For example, day will filter for activity that occurred in the past 24 hours, and week will filter for activity that occurred in the past 7 days (168 hours). + // Can be one of: day, week, month, quarter, year + TimePeriod string `url:"time_period,omitempty"` + + // The activity type to filter by. + // For example, you can choose to filter by "force_push", to see all force pushes to the repository. + // Can be one of: push, force_push, branch_creation, branch_deletion, pr_merge, merge_queue_merge + ActivityType string `url:"activity_type,omitempty"` +} + +// RepositoryActor represents a repository actor. +type RepositoryActor struct { + Login *string `json:"login,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + AvatarURL *string `json:"avatar_url,omitempty"` + GravatarID *string `json:"gravatar_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + FollowersURL *string `json:"followers_url,omitempty"` + FollowingURL *string `json:"following_url,omitempty"` + GistsURL *string `json:"gists_url,omitempty"` + StarredURL *string `json:"starred_url,omitempty"` + SubscriptionsURL *string `json:"subscriptions_url,omitempty"` + OrganizationsURL *string `json:"organizations_url,omitempty"` + ReposURL *string `json:"repos_url,omitempty"` + EventsURL *string `json:"events_url,omitempty"` + ReceivedEventsURL *string `json:"received_events_url,omitempty"` + Type *string `json:"type,omitempty"` + UserViewType *string `json:"user_view_type,omitempty"` + SiteAdmin *bool `json:"site_admin,omitempty"` +} + +// RepositoryActivity represents a repository activity. +type RepositoryActivity struct { + ID int64 `json:"id"` + NodeID string `json:"node_id"` + Before string `json:"before"` + After string `json:"after"` + Ref string `json:"ref"` + Timestamp *Timestamp `json:"timestamp"` + ActivityType string `json:"activity_type"` + Actor *RepositoryActor `json:"actor,omitempty"` +} + +// ListRepositoryActivities lists the activities for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-repository-activities +// +//meta:operation GET /repos/{owner}/{repo}/activity +func (s *RepositoriesService) ListRepositoryActivities(ctx context.Context, owner, repo string, opts *ListRepositoryActivityOptions) ([]*RepositoryActivity, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/activity", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var activities []*RepositoryActivity + resp, err := s.client.Do(req, &activities) + if err != nil { + return nil, resp, err + } + + return activities, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/repos_actions_access.go b/vendor/github.com/google/go-github/v93/github/repos_actions_access.go similarity index 73% rename from vendor/github.com/google/go-github/v69/github/repos_actions_access.go rename to vendor/github.com/google/go-github/v93/github/repos_actions_access.go index 2da1f01cc..f227170d5 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_actions_access.go +++ b/vendor/github.com/google/go-github/v93/github/repos_actions_access.go @@ -12,29 +12,29 @@ import ( // RepositoryActionsAccessLevel represents the repository actions access level. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-the-level-of-access-for-workflows-outside-of-the-repository type RepositoryActionsAccessLevel struct { // AccessLevel specifies the level of access that workflows outside of the repository have // to actions and reusable workflows within the repository. // Possible values are: "none", "organization" "enterprise". - AccessLevel *string `json:"access_level,omitempty"` + AccessLevel string `json:"access_level"` } // GetActionsAccessLevel gets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-the-level-of-access-for-workflows-outside-of-the-repository // //meta:operation GET /repos/{owner}/{repo}/actions/permissions/access func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, repo string) (*RepositoryActionsAccessLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - raal := new(RepositoryActionsAccessLevel) - resp, err := s.client.Do(ctx, req, raal) + var raal *RepositoryActionsAccessLevel + resp, err := s.client.Do(req, &raal) if err != nil { return nil, resp, err } @@ -45,15 +45,15 @@ func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, // EditActionsAccessLevel sets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-the-level-of-access-for-workflows-outside-of-the-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/access -func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) { +func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, body RepositoryActionsAccessLevel) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) - req, err := s.client.NewRequest("PUT", u, repositoryActionsAccessLevel) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_actions_allowed.go b/vendor/github.com/google/go-github/v93/github/repos_actions_allowed.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/repos_actions_allowed.go rename to vendor/github.com/google/go-github/v93/github/repos_actions_allowed.go index e9ebff1d3..c1536d0c7 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_actions_allowed.go +++ b/vendor/github.com/google/go-github/v93/github/repos_actions_allowed.go @@ -12,18 +12,18 @@ import ( // GetActionsAllowed gets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-allowed-actions-and-reusable-workflows-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/actions/permissions/selected-actions func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) + var actionsAllowed *ActionsAllowed + resp, err := s.client.Do(req, &actionsAllowed) if err != nil { return nil, resp, err } @@ -33,18 +33,18 @@ func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo s // EditActionsAllowed sets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-allowed-actions-and-reusable-workflows-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/actions/permissions/selected-actions -func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, body ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) + var p *ActionsAllowed + resp, err := s.client.Do(req, &p) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v93/github/repos_actions_permissions.go new file mode 100644 index 000000000..5dd35c7b8 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/repos_actions_permissions.go @@ -0,0 +1,230 @@ +// Copyright 2022 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" +) + +// ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type ActionsPermissionsRepository struct { + Enabled bool `json:"enabled"` + 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 { + return Stringify(a) +} + +// DefaultWorkflowPermissionRepository represents the default permissions for GitHub Actions workflows for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28 +type DefaultWorkflowPermissionRepository struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + +// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-github-actions-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions +func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-github-actions-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions +func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, body ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var permissions *ActionsPermissionsRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-default-workflow-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *DefaultWorkflowPermissionRepository + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdateDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, body DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var p *DefaultWorkflowPermissionRepository + resp, err := s.client.Do(req, &p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// GetArtifactAndLogRetentionPeriod gets the artifact and log retention period for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-artifact-and-log-retention-settings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention +func (s *RepositoriesService) GetArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string) (*ArtifactPeriod, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var arp *ArtifactPeriod + resp, err := s.client.Do(req, &arp) + if err != nil { + return nil, resp, err + } + + return arp, resp, nil +} + +// UpdateArtifactAndLogRetentionPeriod sets the artifact and log retention period for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-artifact-and-log-retention-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention +func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, body ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetPrivateRepoForkPRWorkflowSettings gets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#get-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) GetPrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string) (*WorkflowsPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var permissions *WorkflowsPermissions + resp, err := s.client.Do(req, &permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// UpdatePrivateRepoForkPRWorkflowSettings sets the settings for whether workflows from fork pull requests can run on a private repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#set-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, body *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// GetForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var policy *ContributorApprovalPermissions + resp, err := s.client.Do(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?apiVersion=2022-11-28#set-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string, body ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/repos_attestations.go b/vendor/github.com/google/go-github/v93/github/repos_attestations.go similarity index 74% rename from vendor/github.com/google/go-github/v69/github/repos_attestations.go rename to vendor/github.com/google/go-github/v93/github/repos_attestations.go index 2e5425502..edca5dc66 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_attestations.go +++ b/vendor/github.com/google/go-github/v93/github/repos_attestations.go @@ -13,24 +13,24 @@ 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?apiVersion=2022-11-28#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) { - var u = fmt.Sprintf("repos/%v/%v/attestations/%v", owner, repo, subjectDigest) + u := fmt.Sprintf("repos/%v/%v/attestations/%v", owner, repo, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - resp, err := s.client.Do(ctx, req, &attestations) + resp, err := s.client.Do(req, &attestations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_autolinks.go b/vendor/github.com/google/go-github/v93/github/repos_autolinks.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/repos_autolinks.go rename to vendor/github.com/google/go-github/v93/github/repos_autolinks.go index 6c209b2d5..c097f6015 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_autolinks.go +++ b/vendor/github.com/google/go-github/v93/github/repos_autolinks.go @@ -10,14 +10,14 @@ import ( "fmt" ) -// AutolinkOptions specifies parameters for RepositoriesService.AddAutolink method. -type AutolinkOptions struct { - KeyPrefix *string `json:"key_prefix,omitempty"` - URLTemplate *string `json:"url_template,omitempty"` - IsAlphanumeric *bool `json:"is_alphanumeric,omitempty"` +// CreateAutolinkRequest specifies parameters for RepositoriesService.CreateAutolink method. +type CreateAutolinkRequest struct { + KeyPrefix string `json:"key_prefix"` + URLTemplate string `json:"url_template"` + 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"` @@ -28,23 +28,19 @@ type Autolink struct { // ListAutolinks returns a list of autolinks configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var autolinks []*Autolink - resp, err := s.client.Do(ctx, req, &autolinks) + resp, err := s.client.Do(req, &autolinks) if err != nil { return nil, resp, err } @@ -52,21 +48,21 @@ func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo str return autolinks, resp, nil } -// AddAutolink creates an autolink reference for a repository. +// CreateAutolink creates an autolink reference for a repository. // Users with admin access to the repository can create an autolink. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#create-an-autolink-reference-for-a-repository // //meta:operation POST /repos/{owner}/{repo}/autolinks -func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { +func (s *RepositoriesService) CreateAutolink(ctx context.Context, owner, repo string, body CreateAutolinkRequest) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - al := new(Autolink) - resp, err := s.client.Do(ctx, req, al) + var al *Autolink + resp, err := s.client.Do(req, &al) if err != nil { return nil, resp, err } @@ -76,19 +72,19 @@ func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo strin // GetAutolink returns a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#get-an-autolink-reference-of-a-repository // //meta:operation GET /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var autolink *Autolink - resp, err := s.client.Do(ctx, req, &autolink) + resp, err := s.client.Do(req, &autolink) if err != nil { return nil, resp, err } @@ -99,14 +95,14 @@ func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo strin // DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks?apiVersion=2022-11-28#delete-an-autolink-reference-from-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_codeowners.go b/vendor/github.com/google/go-github/v93/github/repos_codeowners.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/repos_codeowners.go rename to vendor/github.com/google/go-github/v93/github/repos_codeowners.go index 93eeae09b..d178294f7 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_codeowners.go +++ b/vendor/github.com/google/go-github/v93/github/repos_codeowners.go @@ -36,7 +36,7 @@ type CodeownersError struct { // GetCodeownersErrors lists any syntax errors that are detected in the CODEOWNERS file. // -// GitHub API docs: https://docs.github.com/rest/repos/repos#list-codeowners-errors +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#list-codeowners-errors // //meta:operation GET /repos/{owner}/{repo}/codeowners/errors func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string, opts *GetCodeownersErrorsOptions) (*CodeownersErrors, *Response, error) { @@ -46,13 +46,13 @@ func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - codeownersErrors := &CodeownersErrors{} - resp, err := s.client.Do(ctx, req, codeownersErrors) + var codeownersErrors *CodeownersErrors + resp, err := s.client.Do(req, &codeownersErrors) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_collaborators.go b/vendor/github.com/google/go-github/v93/github/repos_collaborators.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/repos_collaborators.go rename to vendor/github.com/google/go-github/v93/github/repos_collaborators.go index d6c985359..d600d22e5 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_collaborators.go +++ b/vendor/github.com/google/go-github/v93/github/repos_collaborators.go @@ -34,7 +34,7 @@ type ListCollaboratorsOptions struct { } // CollaboratorInvitation represents an invitation created when adding a collaborator. -// GitHub API docs: https://docs.github.com/rest/repos/collaborators/#response-when-a-new-invitation-is-created +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#add-a-repository-collaborator type CollaboratorInvitation struct { ID *int64 `json:"id,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -48,7 +48,7 @@ type CollaboratorInvitation struct { // ListCollaborators lists the GitHub users that have access to the repository. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#list-repository-collaborators +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators // //meta:operation GET /repos/{owner}/{repo}/collaborators func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) { @@ -58,13 +58,13 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -77,17 +77,17 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo // Note: This will return false if the user is not a collaborator OR the user // is not a GitHub user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#check-if-a-user-is-a-repository-collaborator // //meta:operation GET /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) isCollab, err := parseBoolResponse(err) return isCollab, resp, err } @@ -105,18 +105,18 @@ type RepositoryPermissionLevel struct { // GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user // //meta:operation GET /repos/{owner}/{repo}/collaborators/{username}/permission func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - rpl := new(RepositoryPermissionLevel) - resp, err := s.client.Do(ctx, req, rpl) + var rpl *RepositoryPermissionLevel + resp, err := s.client.Do(req, &rpl) if err != nil { return nil, resp, err } @@ -124,36 +124,35 @@ func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, rep return rpl, resp, nil } -// RepositoryAddCollaboratorOptions specifies the optional parameters to the -// RepositoriesService.AddCollaborator method. -type RepositoryAddCollaboratorOptions struct { +// AddCollaboratorRequest represents a request to add a collaborator to a repository. +type AddCollaboratorRequest 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. // // Default value is "push". This option is only valid for organization-owned repositories. - Permission string `json:"permission,omitempty"` + Permission *string `json:"permission,omitempty"` } // AddCollaborator sends an invitation to the specified GitHub user // to become a collaborator to the given repo. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#add-a-repository-collaborator // //meta:operation PUT /repos/{owner}/{repo}/collaborators/{username} -func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { +func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, body AddCollaboratorRequest) (*CollaboratorInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - acr := new(CollaboratorInvitation) - resp, err := s.client.Do(ctx, req, acr) + var acr *CollaboratorInvitation + resp, err := s.client.Do(req, &acr) if err != nil { return nil, resp, err } @@ -164,15 +163,15 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, // RemoveCollaborator removes the specified GitHub user as collaborator from the given repo. // Note: Does not return error if a valid user that is not a collaborator is removed. // -// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators?apiVersion=2022-11-28#remove-a-repository-collaborator // //meta:operation DELETE /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_comments.go b/vendor/github.com/google/go-github/v93/github/repos_comments.go similarity index 57% rename from vendor/github.com/google/go-github/v69/github/repos_comments.go rename to vendor/github.com/google/go-github/v93/github/repos_comments.go index 766a614cc..ccbda0594 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_comments.go +++ b/vendor/github.com/google/go-github/v93/github/repos_comments.go @@ -12,30 +12,43 @@ import ( // RepositoryComment represents a comment for a commit, file, or line in a repository. type RepositoryComment struct { - HTMLURL *string `json:"html_url,omitempty"` - URL *string `json:"url,omitempty"` - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - User *User `json:"user,omitempty"` - Reactions *Reactions `json:"reactions,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - - // User-mutable fields - Body *string `json:"body"` - // User-initialized fields - Path *string `json:"path,omitempty"` - Position *int `json:"position,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + URL *string `json:"url,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + CommitID *string `json:"commit_id,omitempty"` + User *User `json:"user,omitempty"` + AuthorAssociation *string `json:"author_association,omitempty"` + Reactions *Reactions `json:"reactions,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Body *string `json:"body,omitempty"` + Path *string `json:"path,omitempty"` + Position *int `json:"position,omitempty"` + Line *int `json:"line,omitempty"` } func (r RepositoryComment) String() string { return Stringify(r) } +// CreateCommitCommentRequest represents a request to create a commit comment. +type CreateCommitCommentRequest struct { + Body string `json:"body"` + Path *string `json:"path,omitempty"` + Position *int `json:"position,omitempty"` + // Deprecated: Use Position instead. + Line *int `json:"line,omitempty"` +} + +// UpdateCommitCommentRequest represents a request to update a commit comment. +type UpdateCommitCommentRequest struct { + Body string `json:"body"` +} + // ListComments lists all the comments for the repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#list-commit-comments-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/comments func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { @@ -45,16 +58,15 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -64,7 +76,7 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri // ListCommitComments lists all the comments for a given commit SHA. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#list-commit-comments // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/comments func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { @@ -74,16 +86,15 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) var comments []*RepositoryComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -94,18 +105,18 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep // CreateComment creates a comment for the given commit. // Note: GitHub allows for comments to be created for non-existing files and positions. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#create-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#create-a-commit-comment // //meta:operation POST /repos/{owner}/{repo}/commits/{commit_sha}/comments -func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { +func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, body CreateCommitCommentRequest) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -115,21 +126,20 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh // GetComment gets a single comment from a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#get-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#get-a-commit-comment // //meta:operation GET /repos/{owner}/{repo}/comments/{comment_id} -func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) +func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*RepositoryComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "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) - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -139,18 +149,18 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // UpdateComment updates the body of a single comment. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#update-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#update-a-commit-comment // //meta:operation PATCH /repos/{owner}/{repo}/comments/{comment_id} -func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, comment) +func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, commentID int64, body UpdateCommitCommentRequest) (*RepositoryComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(RepositoryComment) - resp, err := s.client.Do(ctx, req, c) + var c *RepositoryComment + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } @@ -160,14 +170,15 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str // DeleteComment deletes a single comment from a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/comments#delete-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments?apiVersion=2022-11-28#delete-a-commit-comment // //meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id} -func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) +func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, commentID) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_commits.go b/vendor/github.com/google/go-github/v93/github/repos_commits.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/repos_commits.go rename to vendor/github.com/google/go-github/v93/github/repos_commits.go index cca7430cb..cf380af1a 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_commits.go +++ b/vendor/github.com/google/go-github/v93/github/repos_commits.go @@ -124,7 +124,7 @@ type BranchCommit struct { // ListCommits lists the commits of a repository. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-commits // //meta:operation GET /repos/{owner}/{repo}/commits func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { @@ -134,13 +134,13 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var commits []*RepositoryCommit - resp, err := s.client.Do(ctx, req, &commits) + resp, err := s.client.Do(req, &commits) if err != nil { return nil, resp, err } @@ -150,7 +150,7 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin // GetCommit fetches the specified commit, including all details about it. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error) { @@ -160,13 +160,13 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) + var commit *RepositoryCommit + resp, err := s.client.Do(req, &commit) if err != nil { return nil, resp, err } @@ -176,12 +176,12 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st // GetCommitRaw fetches the specified commit in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} -func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) { +func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner, repo, sha string, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -192,11 +192,11 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re 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 - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -207,13 +207,13 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re // GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is // supplied and no new commits have occurred, a 304 Unmodified response is returned. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#get-a-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -224,7 +224,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re req.Header.Set("Accept", mediaTypeV3SHA) var buf bytes.Buffer - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -234,10 +234,10 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits // //meta:operation GET /repos/{owner}/{repo}/compare/{basehead} -func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { +func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -247,13 +247,13 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - comp := new(CommitsComparison) - resp, err := s.client.Do(ctx, req, comp) + var comp *CommitsComparison + resp, err := s.client.Do(req, &comp) if err != nil { return nil, resp, err } @@ -267,7 +267,7 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st // To compare branches across other repositories in the same network as "repo", // use the format ":branch". // -// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits // //meta:operation GET /repos/{owner}/{repo}/compare/{basehead} func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error) { @@ -276,7 +276,7 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo u := fmt.Sprintf("repos/%v/%v/compare/%v...%v", owner, repo, escapedBase, escapedHead) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return "", nil, err } @@ -287,11 +287,11 @@ 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 - resp, err := s.client.Do(ctx, req, &buf) + resp, err := s.client.Do(req, &buf) if err != nil { return "", resp, err } @@ -302,21 +302,20 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo // ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD, // or latest commit for the branch. // -// GitHub API docs: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits?apiVersion=2022-11-28#list-branches-for-head-commit // //meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + resp, err := s.client.Do(req, &branchCommits) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_community_health.go b/vendor/github.com/google/go-github/v93/github/repos_community_health.go similarity index 91% rename from vendor/github.com/google/go-github/v69/github/repos_community_health.go rename to vendor/github.com/google/go-github/v93/github/repos_community_health.go index 54d1b414e..143da8c4e 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_community_health.go +++ b/vendor/github.com/google/go-github/v93/github/repos_community_health.go @@ -43,18 +43,18 @@ type CommunityHealthMetrics struct { // GetCommunityHealthMetrics retrieves all the community health metrics for a repository. // -// GitHub API docs: https://docs.github.com/rest/metrics/community#get-community-profile-metrics +// GitHub API docs: https://docs.github.com/rest/metrics/community?apiVersion=2022-11-28#get-community-profile-metrics // //meta:operation GET /repos/{owner}/{repo}/community/profile func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - metrics := &CommunityHealthMetrics{} - resp, err := s.client.Do(ctx, req, metrics) + var metrics *CommunityHealthMetrics + resp, err := s.client.Do(req, &metrics) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_contents.go b/vendor/github.com/google/go-github/v93/github/repos_contents.go similarity index 65% rename from vendor/github.com/google/go-github/v69/github/repos_contents.go rename to vendor/github.com/google/go-github/v93/github/repos_contents.go index 013993e5b..dc6b4a03c 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_contents.go +++ b/vendor/github.com/google/go-github/v93/github/repos_contents.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. // Repository contents API methods. -// GitHub API docs: https://docs.github.com/rest/repos/contents/ +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28 package github @@ -17,11 +17,17 @@ import ( "io" "net/http" "net/url" - "path" "strings" ) -var ErrPathForbidden = errors.New("path must not contain '..' due to auth vulnerability issue") +// ErrContentsDirectory indicates that the contents are not available for a directory. +var ErrContentsDirectory = errors.New("contents not available for directory") + +// ErrContentsSubmodule indicates that the contents are not available for a submodule. +var ErrContentsSubmodule = errors.New("contents not available for submodule") + +// ErrContentsNoDownloadURL indicates that the contents download URL is empty, which may occur when file size > 100 MB. +var ErrContentsNoDownloadURL = errors.New("contents download url is empty") // RepositoryContent represents a file or directory in a github repository. type RepositoryContent struct { @@ -48,7 +54,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. @@ -62,7 +68,7 @@ type RepositoryContentFileOptions struct { } // RepositoryContentGetOptions represents an optional ref parameter, which can be a SHA, -// branch, or tag. +// branch, or tag. E.g., `6540c41b`, `heads/main`, `tags/v1.0`. type RepositoryContentGetOptions struct { Ref string `url:"ref,omitempty"` } @@ -100,7 +106,7 @@ func (r *RepositoryContent) GetContent() (string, error) { // GetReadme gets the Readme file for the repository. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-a-repository-readme +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-a-repository-readme // //meta:operation GET /repos/{owner}/{repo}/readme func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { @@ -110,13 +116,13 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - readme := new(RepositoryContent) - resp, err := s.client.Do(ctx, req, readme) + var readme *RepositoryContent + resp, err := s.client.Do(req, &readme) if err != nil { return nil, resp, err } @@ -133,37 +139,16 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// DownloadContents returns [ErrContentsDirectory] if the path references a +// directory, [ErrContentsSubmodule] if the path references a submodule, and +// [ErrContentsNoDownloadURL] if the file's download URL is empty. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *Response, error) { - dir := path.Dir(filepath) - filename := path.Base(filepath) - _, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, opts) - if err != nil { - return nil, resp, err - } - - for _, contents := range dirContents { - if *contents.Name == filename { - if contents.DownloadURL == nil || *contents.DownloadURL == "" { - return nil, resp, fmt.Errorf("no download link found for %s", filepath) - } - - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) - if err != nil { - return nil, resp, err - } - dlResp, err := s.client.client.Do(dlReq) - if err != nil { - return nil, &Response{Response: dlResp}, err - } - - return dlResp.Body, &Response{Response: dlResp}, nil - } - } - - return nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + rc, _, resp, err := s.DownloadContentsWithMeta(ctx, owner, repo, filepath, opts) + return rc, resp, err } // DownloadContentsWithMeta is identical to DownloadContents but additionally @@ -175,37 +160,61 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// DownloadContentsWithMeta returns [ErrContentsDirectory] if the path +// references a directory, [ErrContentsSubmodule] if the path references a +// submodule, and [ErrContentsNoDownloadURL] if the file's download URL is +// empty. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *RepositoryContent, *Response, error) { - dir := path.Dir(filepath) - filename := path.Base(filepath) - _, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, opts) + fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts) if err != nil { return nil, nil, resp, err } - for _, contents := range dirContents { - if *contents.Name == filename { - if contents.DownloadURL == nil || *contents.DownloadURL == "" { - return nil, contents, resp, fmt.Errorf("no download link found for %s", filepath) - } - - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) - if err != nil { - return nil, contents, resp, err - } - dlResp, err := s.client.client.Do(dlReq) - if err != nil { - return nil, contents, &Response{Response: dlResp}, err - } - - return dlResp.Body, contents, &Response{Response: dlResp}, nil - } + if fileContent == nil { + return nil, nil, resp, ErrContentsDirectory + } + + if fileContent.GetType() == "submodule" { + return nil, fileContent, resp, ErrContentsSubmodule } - return nil, nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + content, err := fileContent.GetContent() + if err == nil && content != "" { + return io.NopCloser(strings.NewReader(content)), fileContent, resp, nil + } + + downloadURL := fileContent.GetDownloadURL() + if downloadURL == "" { + return nil, fileContent, resp, ErrContentsNoDownloadURL + } + + // download_url is a value the API chose, not the caller, so it is in the same + // family as a release's UploadURL. The two are not handled the same way, and + // the difference is what travels: this request carries no body of the + // caller's, and a download link is cross-origin by design — GitHub serves + // file content from raw.githubusercontent.com, and asset downloads from a + // pre-signed CDN host — so refusing a foreign origin here would break the + // ordinary path rather than a dangerous one. What the rules do cover is the + // credential: s.client's token is attached only to this client's configured + // origins, so a link naming another host is fetched without it. The residual + // is that the bytes come from whatever host the response named; a caller that + // needs the content to be provably GitHub's should read it from the API + // response itself. + dlReq, err := http.NewRequestWithContext(ctx, "GET", downloadURL, nil) + if err != nil { + return nil, fileContent, resp, err + } + + dlResp, err := s.client.client.Do(dlReq) + if err != nil { + return nil, fileContent, &Response{Response: dlResp}, err + } + + return dlResp.Body, fileContent, &Response{Response: dlResp}, nil } // GetContents can return either the metadata and content of a single file @@ -215,31 +224,24 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne // as possible, both result types will be returned but only one will contain a // value and the other will be nil. // -// Due to an auth vulnerability issue in the GitHub v3 API, ".." is not allowed -// to appear anywhere in the "path" or this method will return an error. -// -// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#get-repository-content // //meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { - if strings.Contains(path, "..") { - return nil, nil, nil, ErrPathForbidden - } - 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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, nil, err } var rawJSON json.RawMessage - resp, err = s.client.Do(ctx, req, &rawJSON) + resp, err = s.client.Do(req, &rawJSON) if err != nil { return nil, nil, resp, err } @@ -254,24 +256,24 @@ 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 // the commit and file metadata. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} -func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opts) +func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, body *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - createResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, createResponse) + var createResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &createResponse) if err != nil { return nil, resp, err } @@ -282,18 +284,18 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // UpdateFile updates a file in a repository at the given path and returns the // commit and file metadata. Requires the blob SHA of the file being updated. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} -func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) - req, err := s.client.NewRequest("PUT", u, opts) +func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, body *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - updateResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, updateResponse) + var updateResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &updateResponse) if err != nil { return nil, resp, err } @@ -304,18 +306,18 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // DeleteFile deletes a file from a repository and returns the commit. // Requires the blob SHA of the file to be deleted. // -// GitHub API docs: https://docs.github.com/rest/repos/contents#delete-a-file +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#delete-a-file // //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) - req, err := s.client.NewRequest("DELETE", u, opts) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) + req, err := s.client.NewRequest(ctx, "DELETE", u, opts) if err != nil { return nil, nil, err } - deleteResponse := new(RepositoryContentResponse) - resp, err := s.client.Do(ctx, req, deleteResponse) + var deleteResponse *RepositoryContentResponse + resp, err := s.client.Do(req, &deleteResponse) if err != nil { return nil, resp, err } @@ -338,18 +340,19 @@ const ( // repository. The archiveFormat can be specified by either the github.Tarball // 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 +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-tar +// +// GitHub API docs: https://docs.github.com/rest/repos/contents?apiVersion=2022-11-28#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 { + if s.client.rateLimitRedirectionalEndpoints { return s.getArchiveLinkWithRateLimit(ctx, u, maxRedirects) } @@ -376,12 +379,12 @@ func (s *RepositoriesService) getArchiveLinkWithoutRateLimit(ctx context.Context } func (s *RepositoriesService) getArchiveLinkWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + url, resp, err := s.client.bareDoUntilFound(req, maxRedirects) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_deployment_branch_policies.go b/vendor/github.com/google/go-github/v93/github/repos_deployment_branch_policies.go similarity index 60% rename from vendor/github.com/google/go-github/v69/github/repos_deployment_branch_policies.go rename to vendor/github.com/google/go-github/v93/github/repos_deployment_branch_policies.go index 77ac73e44..d57c600f2 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_deployment_branch_policies.go +++ b/vendor/github.com/google/go-github/v93/github/repos_deployment_branch_policies.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "net/url" ) // DeploymentBranchPolicy represents a single deployment branch policy for an environment. @@ -24,27 +25,38 @@ type DeploymentBranchPolicyResponse struct { BranchPolicies []*DeploymentBranchPolicy `json:"branch_policies,omitempty"` } -// DeploymentBranchPolicyRequest represents a deployment branch policy request. -type DeploymentBranchPolicyRequest struct { - Name *string `json:"name,omitempty"` +// CreateDeploymentBranchPolicyRequest represents a request to create a deployment branch policy. +type CreateDeploymentBranchPolicyRequest struct { + Name string `json:"name"` Type *string `json:"type,omitempty"` } +// UpdateDeploymentBranchPolicyRequest represents a request to update a deployment branch policy. +type UpdateDeploymentBranchPolicyRequest struct { + Name string `json:"name"` +} + // ListDeploymentBranchPolicies lists the deployment branch policies for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#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) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) +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, url.PathEscape(environment)) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *DeploymentBranchPolicyResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -54,19 +66,21 @@ func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, // GetDeploymentBranchPolicy gets a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#get-a-deployment-branch-policy // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*DeploymentBranchPolicy, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, url.PathEscape(environment), branchPolicyID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -76,19 +90,21 @@ func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, own // CreateDeploymentBranchPolicy creates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#create-a-deployment-branch-policy // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies -func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) +func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, body CreateDeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, url.PathEscape(environment)) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -98,19 +114,21 @@ func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, // UpdateDeploymentBranchPolicy updates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#update-a-deployment-branch-policy // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} -func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) +func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, body UpdateDeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, url.PathEscape(environment), branchPolicyID) - req, err := s.client.NewRequest("PUT", u, request) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } var policy *DeploymentBranchPolicy - resp, err := s.client.Do(ctx, req, &policy) + resp, err := s.client.Do(req, &policy) if err != nil { return nil, resp, err } @@ -120,16 +138,18 @@ func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, // DeleteDeploymentBranchPolicy deletes a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies?apiVersion=2022-11-28#delete-a-deployment-branch-policy // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) DeleteDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, url.PathEscape(environment), branchPolicyID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_deployment_protection_rules.go b/vendor/github.com/google/go-github/v93/github/repos_deployment_protection_rules.go similarity index 69% rename from vendor/github.com/google/go-github/v69/github/repos_deployment_protection_rules.go rename to vendor/github.com/google/go-github/v93/github/repos_deployment_protection_rules.go index 29d490328..a7ebc4de3 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_deployment_protection_rules.go +++ b/vendor/github.com/google/go-github/v93/github/repos_deployment_protection_rules.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "net/url" ) // CustomDeploymentProtectionRuleApp represents a single deployment protection rule app for an environment. @@ -45,19 +46,21 @@ type CustomDeploymentProtectionRuleRequest struct { // GetAllDeploymentProtectionRules gets all the deployment protection rules for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#get-all-deployment-protection-rules-for-an-environment // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Context, owner, repo, environment string) (*ListDeploymentProtectionRuleResponse, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, url.PathEscape(environment)) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *ListDeploymentProtectionRuleResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -67,19 +70,21 @@ func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Contex // CreateCustomDeploymentProtectionRule creates a custom deployment protection rule on an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#create-a-custom-deployment-protection-rule-on-an-environment // //meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules -func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, request *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) +func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, body *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, url.PathEscape(environment)) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - protectionRule := new(CustomDeploymentProtectionRule) - resp, err := s.client.Do(ctx, req, protectionRule) + var protectionRule *CustomDeploymentProtectionRule + resp, err := s.client.Do(req, &protectionRule) if err != nil { return nil, resp, err } @@ -89,19 +94,25 @@ func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.C // ListCustomDeploymentRuleIntegrations lists the custom deployment rule integrations for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#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) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/apps", owner, repo, environment) +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, url.PathEscape(environment)) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *ListCustomDeploymentRuleIntegrationsResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -111,19 +122,21 @@ func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.C // GetCustomDeploymentProtectionRule gets a custom deployment protection rule for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#get-a-custom-deployment-protection-rule // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*CustomDeploymentProtectionRule, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, url.PathEscape(environment), protectionRuleID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var protectionRule *CustomDeploymentProtectionRule - resp, err := s.client.Do(ctx, req, &protectionRule) + resp, err := s.client.Do(req, &protectionRule) if err != nil { return nil, resp, err } @@ -133,16 +146,18 @@ func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Cont // DisableCustomDeploymentProtectionRule disables a custom deployment protection rule for an environment. // -// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules?apiVersion=2022-11-28#disable-a-custom-protection-rule-for-an-environment // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} func (s *RepositoriesService) DisableCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, url.PathEscape(environment), protectionRuleID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_deployments.go b/vendor/github.com/google/go-github/v93/github/repos_deployments.go similarity index 77% rename from vendor/github.com/google/go-github/v69/github/repos_deployments.go rename to vendor/github.com/google/go-github/v93/github/repos_deployments.go index 6277ac215..a0e6c405a 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_deployments.go +++ b/vendor/github.com/google/go-github/v93/github/repos_deployments.go @@ -32,15 +32,15 @@ type Deployment struct { // DeploymentRequest represents a deployment request. type DeploymentRequest struct { - Ref *string `json:"ref,omitempty"` - Task *string `json:"task,omitempty"` - AutoMerge *bool `json:"auto_merge,omitempty"` - RequiredContexts *[]string `json:"required_contexts,omitempty"` - Payload interface{} `json:"payload,omitempty"` - Environment *string `json:"environment,omitempty"` - Description *string `json:"description,omitempty"` - TransientEnvironment *bool `json:"transient_environment,omitempty"` - ProductionEnvironment *bool `json:"production_environment,omitempty"` + Ref string `json:"ref"` + Task *string `json:"task,omitempty"` + AutoMerge *bool `json:"auto_merge,omitempty"` + RequiredContexts []string `json:"required_contexts,omitzero"` + Payload any `json:"payload,omitempty"` + Environment *string `json:"environment,omitempty"` + Description *string `json:"description,omitempty"` + TransientEnvironment *bool `json:"transient_environment,omitempty"` + ProductionEnvironment *bool `json:"production_environment,omitempty"` } // DeploymentsListOptions specifies the optional parameters to the @@ -49,7 +49,7 @@ type DeploymentsListOptions struct { // SHA of the Deployment. SHA string `url:"sha,omitempty"` - // List deployments for a given ref. + // List deployments for a given ref. This can be a branch, tag, or SHA. Ref string `url:"ref,omitempty"` // List deployments for a given task. @@ -63,7 +63,7 @@ type DeploymentsListOptions struct { // ListDeployments lists the deployments of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#list-deployments +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#list-deployments // //meta:operation GET /repos/{owner}/{repo}/deployments func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) { @@ -73,13 +73,13 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var deployments []*Deployment - resp, err := s.client.Do(ctx, req, &deployments) + resp, err := s.client.Do(req, &deployments) if err != nil { return nil, resp, err } @@ -89,19 +89,19 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s // GetDeployment returns a single deployment of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#get-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#get-a-deployment // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - deployment := new(Deployment) - resp, err := s.client.Do(ctx, req, deployment) + var deployment *Deployment + resp, err := s.client.Do(req, &deployment) if err != nil { return nil, resp, err } @@ -111,23 +111,22 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str // CreateDeployment creates a new deployment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#create-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment // //meta:operation POST /repos/{owner}/{repo}/deployments -func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { +func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, body DeploymentRequest) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(Deployment) - resp, err := s.client.Do(ctx, req, d) + var d *Deployment + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } @@ -137,16 +136,16 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo // DeleteDeployment deletes an existing deployment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/deployments#delete-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments?apiVersion=2022-11-28#delete-a-deployment // //meta:operation DELETE /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeploymentStatus represents the status of a @@ -171,9 +170,12 @@ type DeploymentStatus struct { URL *string `json:"url,omitempty"` } -// DeploymentStatusRequest represents a deployment request. +// DeploymentStatusRequest represents a deployment status request. type DeploymentStatusRequest struct { - State *string `json:"state,omitempty"` + State string `json:"state"` + // TargetURL is the target URL to associate with this status. + // It's recommended to use LogURL instead, which replaces TargetURL. + TargetURL *string `json:"target_url,omitempty"` LogURL *string `json:"log_url,omitempty"` Description *string `json:"description,omitempty"` Environment *string `json:"environment,omitempty"` @@ -183,7 +185,7 @@ type DeploymentStatusRequest struct { // ListDeploymentStatuses lists the statuses of a given deployment of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#list-deployment-statuses // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) { @@ -193,17 +195,16 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) var statuses []*DeploymentStatus - resp, err := s.client.Do(ctx, req, &statuses) + resp, err := s.client.Do(req, &statuses) if err != nil { return nil, resp, err } @@ -213,23 +214,22 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, // GetDeploymentStatus returns a single deployment status of a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#get-a-deployment-status // //meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) + var d *DeploymentStatus + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } @@ -239,23 +239,22 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // CreateDeploymentStatus creates a new status for a deployment. // -// GitHub API docs: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses?apiVersion=2022-11-28#create-a-deployment-status // //meta:operation POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses -func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) +func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deploymentID int64, body DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deploymentID) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - d := new(DeploymentStatus) - resp, err := s.client.Do(ctx, req, d) + var d *DeploymentStatus + resp, err := s.client.Do(req, &d) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_environments.go b/vendor/github.com/google/go-github/v93/github/repos_environments.go similarity index 79% rename from vendor/github.com/google/go-github/v69/github/repos_environments.go rename to vendor/github.com/google/go-github/v93/github/repos_environments.go index d3e34fa8f..9ed3aa2f0 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_environments.go +++ b/vendor/github.com/google/go-github/v93/github/repos_environments.go @@ -8,8 +8,10 @@ package github import ( "context" "encoding/json" + "errors" "fmt" "net/http" + "net/url" ) // Environment represents a single environment in a repository. @@ -62,8 +64,8 @@ type ProtectionRule struct { // RequiredReviewer represents a required reviewer. type RequiredReviewer struct { - Type *string `json:"type,omitempty"` - Reviewer interface{} `json:"reviewer,omitempty"` + Type *string `json:"type,omitempty"` + Reviewer any `json:"reviewer,omitempty"` } // EnvironmentListOptions specifies the optional parameters to the @@ -82,6 +84,10 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { } r.Type = reviewer.Type + if reviewer.Type == nil { + r.Reviewer = nil + return errors.New("reviewer.Type is nil, not a string of 'User' or 'Team', unable to unmarshal") + } switch *reviewer.Type { case "User": @@ -107,23 +113,23 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // ListEnvironments lists all environments for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#list-environments +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#list-environments // //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 } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var list *EnvResponse - resp, err := s.client.Do(ctx, req, &list) + resp, err := s.client.Do(req, &list) if err != nil { return nil, resp, err } @@ -132,19 +138,20 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // GetEnvironment get a single environment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#get-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#get-an-environment // //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) - - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, url.PathEscape(name)) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var env *Environment - resp, err := s.client.Do(ctx, req, &env) + resp, err := s.client.Do(req, &env) if err != nil { return nil, resp, err } @@ -154,18 +161,18 @@ func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, n // MarshalJSON implements the json.Marshaler interface. // As the only way to clear a WaitTimer is to set it to 0, a missing WaitTimer object should default to 0, not null. // As the default value for CanAdminsBypass is true, a nil value here marshals to true. -func (c *CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { - type Alias CreateUpdateEnvironment +func (c CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { + type alias CreateUpdateEnvironment if c.WaitTimer == nil { - c.WaitTimer = Ptr(0) + c.WaitTimer = new(0) } if c.CanAdminsBypass == nil { - c.CanAdminsBypass = Ptr(true) + c.CanAdminsBypass = new(true) } return json.Marshal(&struct { - *Alias + alias }{ - Alias: (*Alias)(c), + alias: alias(c), }) } @@ -190,19 +197,20 @@ type createUpdateEnvironmentNoEnterprise struct { // CreateUpdateEnvironment create or update a new environment for a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#create-or-update-an-environment // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name} -func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) - - req, err := s.client.NewRequest("PUT", u, environment) +func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, body *CreateUpdateEnvironment) (*Environment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, url.PathEscape(name)) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - e := new(Environment) - resp, err := s.client.Do(ctx, req, e) + var e *Environment + resp, err := s.client.Do(req, &e) if err != nil { // The API returns 422 when the pricing plan doesn't support all the fields sent. // This path will be executed for Pro/Teams private repos. @@ -210,43 +218,47 @@ func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner // For Free plan private repos the returned error code is 404. // We are checking that the user didn't try to send a value for unsupported fields, // and return an error if they did. - if resp != nil && resp.StatusCode == http.StatusUnprocessableEntity && environment != nil && len(environment.Reviewers) == 0 && environment.GetWaitTimer() == 0 { - return s.createNewEnvNoEnterprise(ctx, u, environment) + if resp != nil && resp.StatusCode == http.StatusUnprocessableEntity && body != nil && len(body.Reviewers) == 0 && body.GetWaitTimer() == 0 { + return s.createNewEnvNoEnterprise(ctx, u, body) } return nil, resp, err } + return e, resp, nil } // createNewEnvNoEnterprise is an internal function for cases where the original call returned 422. // Currently only the `deployment_branch_policy` parameter is supported for Pro/Team private repos. func (s *RepositoriesService) createNewEnvNoEnterprise(ctx context.Context, u string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { - req, err := s.client.NewRequest("PUT", u, &createUpdateEnvironmentNoEnterprise{ + req, err := s.client.NewRequest(ctx, "PUT", u, &createUpdateEnvironmentNoEnterprise{ DeploymentBranchPolicy: environment.DeploymentBranchPolicy, }) if err != nil { return nil, nil, err } - e := new(Environment) - resp, err := s.client.Do(ctx, req, e) + var e *Environment + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } + return e, resp, nil } // DeleteEnvironment delete an environment from a repository. // -// GitHub API docs: https://docs.github.com/rest/deployments/environments#delete-an-environment +// Note: the environment name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/deployments/environments?apiVersion=2022-11-28#delete-an-environment // //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) - - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, url.PathEscape(name)) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_forks.go b/vendor/github.com/google/go-github/v93/github/repos_forks.go similarity index 68% rename from vendor/github.com/google/go-github/v69/github/repos_forks.go rename to vendor/github.com/google/go-github/v93/github/repos_forks.go index 60fb49da5..3698a14b9 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_forks.go +++ b/vendor/github.com/google/go-github/v93/github/repos_forks.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) @@ -23,7 +24,7 @@ type RepositoryListForksOptions struct { // ListForks lists the forks of the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/forks#list-forks +// GitHub API docs: https://docs.github.com/rest/repos/forks?apiVersion=2022-11-28#list-forks // //meta:operation GET /repos/{owner}/{repo}/forks func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) { @@ -33,16 +34,15 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -50,13 +50,12 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return repos, resp, nil } -// RepositoryCreateForkOptions specifies the optional parameters to the -// RepositoriesService.CreateFork method. -type RepositoryCreateForkOptions struct { +// CreateForkRequest represents a request to create a fork of a repository. +type CreateForkRequest struct { // The organization to fork the repository into. - Organization string `json:"organization,omitempty"` - Name string `json:"name,omitempty"` - DefaultBranchOnly bool `json:"default_branch_only,omitempty"` + Organization *string `json:"organization,omitempty"` + Name *string `json:"name,omitempty"` + DefaultBranchOnly *bool `json:"default_branch_only,omitempty"` } // CreateFork creates a fork of the specified repository. @@ -68,23 +67,23 @@ type RepositoryCreateForkOptions struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/rest/repos/forks#create-a-fork +// GitHub API docs: https://docs.github.com/rest/repos/forks?apiVersion=2022-11-28#create-a-fork // //meta:operation POST /repos/{owner}/{repo}/forks -func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) { +func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, body CreateForkRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - fork := new(Repository) - resp, err := s.client.Do(ctx, req, fork) + var fork *Repository + resp, err := s.client.Do(req, &fork) if err != nil { // Persist AcceptedError's metadata to the Repository object. - if aerr, ok := err.(*AcceptedError); ok { - if err := json.Unmarshal(aerr.Raw, fork); err != nil { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { + if err := json.Unmarshal(aerr.Raw, &fork); err != nil { return fork, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_hooks.go b/vendor/github.com/google/go-github/v93/github/repos_hooks.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/repos_hooks.go rename to vendor/github.com/google/go-github/v93/github/repos_hooks.go index d221db21b..baf410eb8 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_hooks.go +++ b/vendor/github.com/google/go-github/v93/github/repos_hooks.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" "net/http" "net/url" @@ -39,15 +40,15 @@ type WebHookAuthor = CommitAuthor // Hook represents a GitHub (web and service) hook for a repository. type Hook struct { - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - URL *string `json:"url,omitempty"` - ID *int64 `json:"id,omitempty"` - Type *string `json:"type,omitempty"` - Name *string `json:"name,omitempty"` - TestURL *string `json:"test_url,omitempty"` - PingURL *string `json:"ping_url,omitempty"` - LastResponse map[string]interface{} `json:"last_response,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + URL *string `json:"url,omitempty"` + ID *int64 `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + TestURL *string `json:"test_url,omitempty"` + PingURL *string `json:"ping_url,omitempty"` + LastResponse map[string]any `json:"last_response,omitempty"` // Only the following fields are used when creating a hook. // Config is required. @@ -79,10 +80,14 @@ type createHookRequest struct { // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#create-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { + if hook == nil { + return nil, nil, errors.New("hook must be provided") + } + u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) hookReq := &createHookRequest{ @@ -92,13 +97,13 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string Config: hook.Config, } - req, err := s.client.NewRequest("POST", u, hookReq) + req, err := s.client.NewRequest(ctx, "POST", u, hookReq) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -108,7 +113,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-repository-webhooks +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#list-repository-webhooks // //meta:operation GET /repos/{owner}/{repo}/hooks func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) { @@ -118,13 +123,13 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var hooks []*Hook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -134,17 +139,18 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-repository-webhook // //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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -154,17 +160,18 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-repository-webhook // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} -func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, hook) +func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, body *Hook) (*Hook, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - h := new(Hook) - resp, err := s.client.Do(ctx, req, h) + + var h *Hook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -174,44 +181,45 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#delete-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#delete-a-repository-webhook // //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) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + + return s.client.Do(req, nil) } // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#ping-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#ping-a-repository-webhook // //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) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/pings", owner, repo, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // TestHook triggers a test Hook by github. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#test-the-push-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#test-the-push-repository-webhook // //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) - req, err := s.client.NewRequest("POST", u, nil) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/tests", owner, repo, id) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Subscribe lets servers register to receive updates when a topic is updated. @@ -220,12 +228,12 @@ func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, // //meta:operation POST /hub func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { - req, err := s.createWebSubRequest("subscribe", owner, repo, event, callback, secret) + req, err := s.createWebSubRequest(ctx, "subscribe", owner, repo, event, callback, secret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unsubscribe lets servers unregister to no longer receive updates when a topic is updated. @@ -234,21 +242,21 @@ func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, // //meta:operation POST /hub func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { - req, err := s.createWebSubRequest("unsubscribe", owner, repo, event, callback, secret) + req, err := s.createWebSubRequest(ctx, "unsubscribe", owner, repo, event, callback, secret) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // createWebSubRequest returns a subscribe/unsubscribe request that implements // the WebSub (formerly PubSubHubbub) protocol. // // 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) { +func (s *RepositoriesService) createWebSubRequest(ctx context.Context, 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, @@ -262,7 +270,7 @@ func (s *RepositoriesService) createWebSubRequest(hubMode, owner, repo, event, c } body := strings.NewReader(form.Encode()) - req, err := s.client.NewFormRequest("hub", body) + req, err := s.client.NewFormRequest(ctx, "hub", body) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_hooks_configuration.go b/vendor/github.com/google/go-github/v93/github/repos_hooks_configuration.go similarity index 66% rename from vendor/github.com/google/go-github/v69/github/repos_hooks_configuration.go rename to vendor/github.com/google/go-github/v93/github/repos_hooks_configuration.go index 9560bd7a4..ceb76fd98 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v93/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"` @@ -27,18 +27,18 @@ type HookConfig struct { // GetHookConfiguration returns the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - config := new(HookConfig) - resp, err := s.client.Do(ctx, req, config) + var config *HookConfig + resp, err := s.client.Do(req, &config) if err != nil { return nil, resp, err } @@ -46,20 +46,20 @@ func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, r return config, resp, nil } -// EditHookConfiguration updates the configuration for the specified repository webhook. +// UpdateHookConfiguration updates the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config -func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { +func (s *RepositoriesService) UpdateHookConfiguration(ctx context.Context, owner, repo string, id int64, body HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) - req, err := s.client.NewRequest("PATCH", u, config) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - c := new(HookConfig) - resp, err := s.client.Do(ctx, req, c) + var c *HookConfig + resp, err := s.client.Do(req, &c) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_hooks_deliveries.go b/vendor/github.com/google/go-github/v93/github/repos_hooks_deliveries.go similarity index 70% rename from vendor/github.com/google/go-github/v69/github/repos_hooks_deliveries.go rename to vendor/github.com/google/go-github/v93/github/repos_hooks_deliveries.go index c8029f626..e7b6dabfd 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v93/github/repos_hooks_deliveries.go @@ -9,13 +9,14 @@ import ( "context" "encoding/json" "fmt" + "strings" ) // HookDelivery represents the data that is received from GitHub's Webhook Delivery API // // GitHub API docs: -// - https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook -// - https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries?apiVersion=2022-11-28#list-deliveries-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries?apiVersion=2022-11-28#get-a-delivery-for-a-repository-webhook type HookDelivery struct { ID *int64 `json:"id,omitempty"` GUID *string `json:"guid,omitempty"` @@ -28,6 +29,7 @@ type HookDelivery struct { Action *string `json:"action,omitempty"` InstallationID *int64 `json:"installation_id,omitempty"` RepositoryID *int64 `json:"repository_id,omitempty"` + ThrottledAt *Timestamp `json:"throttled_at,omitempty"` // Request is populated by GetHookDelivery. Request *HookRequest `json:"request,omitempty"` @@ -39,6 +41,16 @@ func (d HookDelivery) String() string { return Stringify(d) } +// getHeader common function for GetHeader funcs of HookRequest & HookResponse. +func getHeader(headers map[string]string, key string) string { + for k, v := range headers { + if strings.EqualFold(k, key) { + return v + } + } + return "" +} + // HookRequest is a part of HookDelivery that contains // the HTTP headers and the JSON payload of the webhook request. type HookRequest struct { @@ -46,6 +58,11 @@ type HookRequest struct { RawPayload *json.RawMessage `json:"payload,omitempty"` } +// GetHeader gets the value associated with the given key (ignoring key case). +func (r *HookRequest) GetHeader(key string) string { + return getHeader(r.Headers, key) +} + func (r HookRequest) String() string { return Stringify(r) } @@ -57,13 +74,18 @@ type HookResponse struct { RawPayload *json.RawMessage `json:"payload,omitempty"` } +// GetHeader gets the value associated with the given key (ignoring key case). +func (r *HookResponse) GetHeader(key string) string { + return getHeader(r.Headers, key) +} + func (r HookResponse) String() string { return Stringify(r) } // ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-deliveries-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#list-deliveries-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -73,13 +95,13 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } deliveries := []*HookDelivery{} - resp, err := s.client.Do(ctx, req, &deliveries) + resp, err := s.client.Do(req, &deliveries) if err != nil { return nil, resp, err } @@ -89,18 +111,18 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep // GetHookDelivery returns a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#get-a-delivery-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -110,18 +132,18 @@ func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo s // RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/webhooks#redeliver-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks?apiVersion=2022-11-28#redeliver-a-delivery-for-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v/attempts", owner, repo, hookID, deliveryID) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - h := new(HookDelivery) - resp, err := s.client.Do(ctx, req, h) + var h *HookDelivery + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -131,7 +153,7 @@ func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, // ParseRequestPayload parses the request payload. For recognized event types, // a value of the corresponding struct type will be returned. -func (d *HookDelivery) ParseRequestPayload() (interface{}, error) { +func (d *HookDelivery) ParseRequestPayload() (any, error) { eType, ok := messageToTypeName[d.GetEvent()] if !ok { return nil, fmt.Errorf("unsupported event type %q", d.GetEvent()) diff --git a/vendor/github.com/google/go-github/v93/github/repos_immutable_releases.go b/vendor/github.com/google/go-github/v93/github/repos_immutable_releases.go new file mode 100644 index 000000000..db91b6d02 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/repos_immutable_releases.go @@ -0,0 +1,82 @@ +// 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" +) + +// RepoImmutableReleasesStatus represents the immutable releases status for a repository. +type RepoImmutableReleasesStatus struct { + Enabled *bool `json:"enabled,omitempty"` + EnforcedByOwner *bool `json:"enforced_by_owner,omitempty"` +} + +// EnableImmutableReleases enables immutable releases for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#enable-immutable-releases +// +//meta:operation PUT /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) EnableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisableImmutableReleases disables immutable releases for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#disable-immutable-releases +// +//meta:operation DELETE /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) DisableImmutableReleases(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AreImmutableReleasesEnabled checks if immutable releases are enabled for +// the repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos?apiVersion=2022-11-28#check-if-immutable-releases-are-enabled-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/immutable-releases +func (s *RepositoriesService) AreImmutableReleasesEnabled(ctx context.Context, owner, repo string) (*RepoImmutableReleasesStatus, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/immutable-releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var status *RepoImmutableReleasesStatus + resp, err := s.client.Do(req, &status) + if err != nil { + return nil, resp, err + } + + return status, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/repos_invitations.go b/vendor/github.com/google/go-github/v93/github/repos_invitations.go similarity index 85% rename from vendor/github.com/google/go-github/v69/github/repos_invitations.go rename to vendor/github.com/google/go-github/v93/github/repos_invitations.go index 98fe01d1c..944610134 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_invitations.go +++ b/vendor/github.com/google/go-github/v93/github/repos_invitations.go @@ -28,7 +28,7 @@ type RepositoryInvitation struct { // ListInvitations lists all currently-open repository invitations. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#list-repository-invitations // //meta:operation GET /repos/{owner}/{repo}/invitations func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { @@ -38,13 +38,13 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) + resp, err := s.client.Do(req, &invites) if err != nil { return nil, resp, err } @@ -54,17 +54,17 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s // DeleteInvitation deletes a repository invitation. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#delete-a-repository-invitation // //meta:operation DELETE /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // UpdateInvitation updates the permissions associated with a repository @@ -73,7 +73,7 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo // permissions represents the permissions that the associated user will have // on the repository. Possible values are: "read", "write", "admin". // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#update-a-repository-invitation // //meta:operation PATCH /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) { @@ -81,13 +81,13 @@ func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo Permissions string `json:"permissions"` }{Permissions: permissions} u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, opts) if err != nil { return nil, nil, err } - invite := &RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, invite) + var invite *RepositoryInvitation + resp, err := s.client.Do(req, &invite) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_keys.go b/vendor/github.com/google/go-github/v93/github/repos_keys.go similarity index 62% rename from vendor/github.com/google/go-github/v69/github/repos_keys.go rename to vendor/github.com/google/go-github/v93/github/repos_keys.go index cc86f8bbd..1b43379ae 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_keys.go +++ b/vendor/github.com/google/go-github/v93/github/repos_keys.go @@ -14,23 +14,23 @@ import ( // ListKeys lists the deploy keys for a repository. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#list-deploy-keys // //meta:operation GET /repos/{owner}/{repo}/keys -func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) { +func (s *RepositoriesService) ListKeys(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -40,19 +40,19 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GetKey fetches a single deploy key. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#get-a-deploy-key // //meta:operation GET /repos/{owner}/{repo}/keys/{key_id} -func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) { +func (s *RepositoriesService) GetKey(ctx context.Context, owner, repo string, id int64) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(Key) - resp, err := s.client.Do(ctx, req, key) + var key *Key + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -60,21 +60,28 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str return key, resp, nil } +// CreateDeployKeyRequest represents a request to create a deploy key. +type CreateDeployKeyRequest struct { + Title *string `json:"title,omitempty"` + Key string `json:"key"` + ReadOnly *bool `json:"read_only,omitempty"` +} + // CreateKey adds a deploy key for a repository. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#create-a-deploy-key // //meta:operation POST /repos/{owner}/{repo}/keys -func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) { +func (s *RepositoriesService) CreateKey(ctx context.Context, owner, repo string, body CreateDeployKeyRequest) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - k := new(Key) - resp, err := s.client.Do(ctx, req, k) + var k *Key + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -84,16 +91,16 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo // DeleteKey deletes a deploy key. // -// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys?apiVersion=2022-11-28#delete-a-deploy-key // //meta:operation DELETE /repos/{owner}/{repo}/keys/{key_id} -func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) { +func (s *RepositoriesService) DeleteKey(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_lfs.go b/vendor/github.com/google/go-github/v93/github/repos_lfs.go similarity index 77% rename from vendor/github.com/google/go-github/v69/github/repos_lfs.go rename to vendor/github.com/google/go-github/v93/github/repos_lfs.go index f0153c080..685e17b27 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_lfs.go +++ b/vendor/github.com/google/go-github/v93/github/repos_lfs.go @@ -12,18 +12,18 @@ import ( // EnableLFS turns the LFS (Large File Storage) feature ON for the selected repo. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#enable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs?apiVersion=2022-11-28#enable-git-lfs-for-a-repository // //meta:operation PUT /repos/{owner}/{repo}/lfs func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } @@ -33,18 +33,18 @@ func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) // DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#disable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs?apiVersion=2022-11-28#disable-git-lfs-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/lfs func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_merging.go b/vendor/github.com/google/go-github/v93/github/repos_merging.go similarity index 72% rename from vendor/github.com/google/go-github/v69/github/repos_merging.go rename to vendor/github.com/google/go-github/v93/github/repos_merging.go index b26e5da1a..a19795425 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_merging.go +++ b/vendor/github.com/google/go-github/v93/github/repos_merging.go @@ -13,15 +13,15 @@ import ( // RepositoryMergeRequest represents a request to merge a branch in a // repository. type RepositoryMergeRequest struct { - Base *string `json:"base,omitempty"` - Head *string `json:"head,omitempty"` + Base string `json:"base"` + Head string `json:"head"` CommitMessage *string `json:"commit_message,omitempty"` } // RepoMergeUpstreamRequest represents a request to sync a branch of // a forked repository to keep it up-to-date with the upstream repository. type RepoMergeUpstreamRequest struct { - Branch *string `json:"branch,omitempty"` + Branch string `json:"branch"` } // RepoMergeUpstreamResult represents the result of syncing a branch of @@ -34,18 +34,18 @@ type RepoMergeUpstreamResult struct { // Merge a branch in the specified repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#merge-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#merge-a-branch // //meta:operation POST /repos/{owner}/{repo}/merges -func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { +func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, body RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - commit := new(RepositoryCommit) - resp, err := s.client.Do(ctx, req, commit) + var commit *RepositoryCommit + resp, err := s.client.Do(req, &commit) if err != nil { return nil, resp, err } @@ -56,18 +56,18 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req // MergeUpstream syncs a branch of a forked repository to keep it up-to-date // with the upstream repository. // -// GitHub API docs: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository +// GitHub API docs: https://docs.github.com/rest/branches/branches?apiVersion=2022-11-28#sync-a-fork-branch-with-the-upstream-repository // //meta:operation POST /repos/{owner}/{repo}/merge-upstream -func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { +func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, body RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo) - req, err := s.client.NewRequest("POST", u, request) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - result := new(RepoMergeUpstreamResult) - resp, err := s.client.Do(ctx, req, result) + var result *RepoMergeUpstreamResult + resp, err := s.client.Do(req, &result) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_pages.go b/vendor/github.com/google/go-github/v93/github/repos_pages.go similarity index 75% rename from vendor/github.com/google/go-github/v69/github/repos_pages.go rename to vendor/github.com/google/go-github/v93/github/repos_pages.go index 6b9ba76e4..49b01a6ba 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_pages.go +++ b/vendor/github.com/google/go-github/v93/github/repos_pages.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -103,10 +104,14 @@ type createPagesRequest struct { // EnablePages enables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#create-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#create-a-github-pages-site // //meta:operation POST /repos/{owner}/{repo}/pages func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) { + if pages == nil { + return nil, nil, errors.New("pages must be provided") + } + u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) pagesReq := &createPagesRequest{ @@ -114,15 +119,15 @@ func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo strin Source: pages.Source, } - req, err := s.client.NewRequest("POST", u, pagesReq) + req, err := s.client.NewRequest(ctx, "POST", u, pagesReq) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) - enable := new(Pages) - resp, err := s.client.Do(ctx, req, enable) + var enable *Pages + resp, err := s.client.Do(req, &enable) if err != nil { return nil, resp, err } @@ -155,57 +160,84 @@ type PagesUpdate struct { // UpdatePages updates GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#update-information-about-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site // //meta:operation PUT /repos/{owner}/{repo}/pages -func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) { +func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, body *PagesUpdate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } + return resp, nil +} + +// PagesUpdateWithoutCNAME defines parameters for updating a GitHub Pages site on GitHub Enterprise Servers. +// Sending a request with a CNAME (any value, empty string, or null) results in a 400 error: "Custom domains are not available for GitHub Pages". +type PagesUpdateWithoutCNAME struct { + BuildType *string `json:"build_type,omitempty"` + Source *PagesSource `json:"source,omitempty"` + Public *bool `json:"public,omitempty"` + HTTPSEnforced *bool `json:"https_enforced,omitempty"` +} + +// UpdatePagesGHES updates GitHub Pages for the named repo in GitHub Enterprise Servers. +// +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#update-information-about-a-github-pages-site +// +//meta:operation PUT /repos/{owner}/{repo}/pages +func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, body *PagesUpdateWithoutCNAME) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, err + } + resp, err := s.client.Do(req, nil) + if err != nil { + return resp, err + } return resp, nil } // DisablePages disables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#delete-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#delete-a-github-pages-site // //meta:operation DELETE /repos/{owner}/{repo}/pages func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // GetPagesInfo fetches information about a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-a-github-pages-site // //meta:operation GET /repos/{owner}/{repo}/pages func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - site := new(Pages) - resp, err := s.client.Do(ctx, req, site) + var site *Pages + resp, err := s.client.Do(req, &site) if err != nil { return nil, resp, err } @@ -215,7 +247,7 @@ func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo stri // ListPagesBuilds lists the builds for a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#list-github-pages-builds +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#list-github-pages-builds // //meta:operation GET /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) { @@ -225,13 +257,13 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pages []*PagesBuild - resp, err := s.client.Do(ctx, req, &pages) + resp, err := s.client.Do(req, &pages) if err != nil { return nil, resp, err } @@ -241,18 +273,18 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s // GetLatestPagesBuild fetches the latest build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-latest-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-latest-pages-build // //meta:operation GET /repos/{owner}/{repo}/pages/builds/latest func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -262,18 +294,18 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re // GetPageBuild fetches the specific build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-github-pages-build // //meta:operation GET /repos/{owner}/{repo}/pages/builds/{build_id} func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -283,18 +315,18 @@ func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo stri // RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#request-a-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#request-a-github-pages-build // //meta:operation POST /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, nil, err } - build := new(PagesBuild) - resp, err := s.client.Do(ctx, req, build) + var build *PagesBuild + resp, err := s.client.Do(req, &build) if err != nil { return nil, resp, err } @@ -304,18 +336,18 @@ func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo // GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. // -// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages +// GitHub API docs: https://docs.github.com/rest/pages/pages?apiVersion=2022-11-28#get-a-dns-health-check-for-github-pages // //meta:operation GET /repos/{owner}/{repo}/pages/health func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/health", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - healthCheckResponse := new(PagesHealthCheckResponse) - resp, err := s.client.Do(ctx, req, healthCheckResponse) + var healthCheckResponse *PagesHealthCheckResponse + resp, err := s.client.Do(req, &healthCheckResponse) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v93/github/repos_prereceive_hooks.go similarity index 70% rename from vendor/github.com/google/go-github/v69/github/repos_prereceive_hooks.go rename to vendor/github.com/google/go-github/v93/github/repos_prereceive_hooks.go index e97075d02..23e6a68c1 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_prereceive_hooks.go +++ b/vendor/github.com/google/go-github/v93/github/repos_prereceive_hooks.go @@ -22,9 +22,15 @@ func (p PreReceiveHook) String() string { return Stringify(p) } +// UpdatePreReceiveHookRequest represents a request to update the enforcement +// of a pre-receive hook for a repository. +type UpdatePreReceiveHookRequest struct { + Enforcement *string `json:"enforcement,omitempty"` +} + // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { @@ -34,16 +40,15 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "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) var hooks []*PreReceiveHook - resp, err := s.client.Do(ctx, req, &hooks) + resp, err := s.client.Do(req, &hooks) if err != nil { return nil, resp, err } @@ -53,21 +58,20 @@ 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.15/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.22/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) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "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) - resp, err := s.client.Do(ctx, req, h) + var h *PreReceiveHook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -77,21 +81,20 @@ 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.15/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.22/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) - req, err := s.client.NewRequest("PATCH", u, hook) +func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, body UpdatePreReceiveHookRequest) (*PreReceiveHook, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) 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) - resp, err := s.client.Do(ctx, req, h) + var h *PreReceiveHook + resp, err := s.client.Do(req, &h) if err != nil { return nil, resp, err } @@ -101,18 +104,17 @@ 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.15/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.22/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) - req, err := s.client.NewRequest("DELETE", u, nil) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) + req, err := s.client.NewRequest(ctx, "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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_properties.go b/vendor/github.com/google/go-github/v93/github/repos_properties.go similarity index 80% rename from vendor/github.com/google/go-github/v69/github/repos_properties.go rename to vendor/github.com/google/go-github/v93/github/repos_properties.go index 5b12bc8b3..11be33bc9 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_properties.go +++ b/vendor/github.com/google/go-github/v93/github/repos_properties.go @@ -12,19 +12,19 @@ import ( // GetAllCustomPropertyValues gets all custom property values that are set for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties?apiVersion=2022-11-28#get-all-custom-property-values-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/properties/values func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, org, repo string) ([]*CustomPropertyValue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/properties/values", org, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var customPropertyValues []*CustomPropertyValue - resp, err := s.client.Do(ctx, req, &customPropertyValues) + resp, err := s.client.Do(req, &customPropertyValues) if err != nil { return nil, resp, err } @@ -34,7 +34,7 @@ func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, or // CreateOrUpdateCustomProperties creates new or updates existing custom property values for a repository. // -// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#create-or-update-custom-property-values-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties?apiVersion=2022-11-28#create-or-update-custom-property-values-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/properties/values func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context, org, repo string, customPropertyValues []*CustomPropertyValue) (*Response, error) { @@ -46,12 +46,12 @@ func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context Properties: customPropertyValues, } - req, err := s.client.NewRequest("PATCH", u, params) + req, err := s.client.NewRequest(ctx, "PATCH", u, params) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { return resp, err } diff --git a/vendor/github.com/google/go-github/v93/github/repos_releases.go b/vendor/github.com/google/go-github/v93/github/repos_releases.go new file mode 100644 index 000000000..44c021ad1 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/repos_releases.go @@ -0,0 +1,562 @@ +// Copyright 2013 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" + "errors" + "fmt" + "io" + "mime" + "net/http" + "os" + "path/filepath" + "strings" +) + +// RepositoryRelease represents a GitHub release in a repository. +type RepositoryRelease struct { + TagName string `json:"tag_name"` + TargetCommitish string `json:"target_commitish"` + Name *string `json:"name"` + Body *string `json:"body,omitempty"` + Draft bool `json:"draft"` + Prerelease bool `json:"prerelease"` + Immutable *bool `json:"immutable,omitempty"` + ID int64 `json:"id"` + CreatedAt Timestamp `json:"created_at"` + PublishedAt *Timestamp `json:"published_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + URL string `json:"url"` + HTMLURL string `json:"html_url"` + AssetsURL string `json:"assets_url"` + Assets []*ReleaseAsset `json:"assets"` + UploadURL string `json:"upload_url"` + ZipballURL *string `json:"zipball_url"` + TarballURL *string `json:"tarball_url"` + Author *User `json:"author"` + NodeID string `json:"node_id"` + BodyHTML *string `json:"body_html,omitempty"` + BodyText *string `json:"body_text,omitempty"` + MentionsCount *int `json:"mentions_count,omitempty"` + DiscussionURL *string `json:"discussion_url,omitempty"` + Reactions *Reactions `json:"reactions,omitempty"` +} + +func (r RepositoryRelease) String() string { + return Stringify(r) +} + +// RepositoryReleaseNotes represents a GitHub-generated release notes. +type RepositoryReleaseNotes struct { + Name string `json:"name"` + Body string `json:"body"` +} + +// GenerateNotesRequest represents the request to generate release notes. +type GenerateNotesRequest struct { + 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. +type ReleaseAsset struct { + ID *int64 `json:"id,omitempty"` + URL *string `json:"url,omitempty"` + Name *string `json:"name,omitempty"` + Label *string `json:"label,omitempty"` + State *string `json:"state,omitempty"` + ContentType *string `json:"content_type,omitempty"` + Size *int `json:"size,omitempty"` + DownloadCount *int `json:"download_count,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + BrowserDownloadURL *string `json:"browser_download_url,omitempty"` + Uploader *User `json:"uploader,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Digest *string `json:"digest,omitempty"` +} + +// UpdateReleaseAssetRequest represents the request to update a release asset. +type UpdateReleaseAssetRequest struct { + Name *string `json:"name,omitempty"` + Label *string `json:"label,omitempty"` + State *string `json:"state,omitempty"` +} + +func (r ReleaseAsset) String() string { + return Stringify(r) +} + +// ListReleases lists the releases for a repository. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#list-releases +// +//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/%v/%v/releases", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var releases []*RepositoryRelease + resp, err := s.client.Do(req, &releases) + if err != nil { + return nil, resp, err + } + return releases, resp, nil +} + +// GetRelease fetches a single release. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-a-release +// +//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/%v/%v/releases/%v", owner, repo, id) + return s.getSingleRelease(ctx, u) +} + +// GetLatestRelease fetches the latest published release for the repository. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release +// +//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/%v/%v/releases/latest", owner, repo) + return s.getSingleRelease(ctx, u) +} + +// GetReleaseByTag fetches a release with the specified tag. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name +// +//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/%v/%v/releases/tags/%v", owner, repo, tag) + return s.getSingleRelease(ctx, u) +} + +// GenerateReleaseNotes generates the release notes for the given tag. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release +// +//meta:operation POST /repos/{owner}/{repo}/releases/generate-notes +func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, body GenerateNotesRequest) (*RepositoryReleaseNotes, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases/generate-notes", owner, repo) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var r *RepositoryReleaseNotes + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string) (*RepositoryRelease, *Response, error) { + req, err := s.client.NewRequest(ctx, "GET", url, nil) + if err != nil { + return nil, nil, err + } + + var release *RepositoryRelease + resp, err := s.client.Do(req, &release) + if err != nil { + return nil, resp, err + } + + return release, resp, nil +} + +// CreateReleaseRequest represents a request to create a release in a repository. +type CreateReleaseRequest struct { + TagName string `json:"tag_name"` + TargetCommitish *string `json:"target_commitish,omitempty"` + Name *string `json:"name,omitempty"` + Body *string `json:"body,omitempty"` + Draft *bool `json:"draft,omitempty"` + Prerelease *bool `json:"prerelease,omitempty"` + // MakeLatest can be one of: "true", "false", or "legacy". + MakeLatest *string `json:"make_latest,omitempty"` + DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` + GenerateReleaseNotes *bool `json:"generate_release_notes,omitempty"` +} + +// UpdateReleaseRequest represents a request to update a release in a repository. +type UpdateReleaseRequest struct { + TagName *string `json:"tag_name,omitempty"` + TargetCommitish *string `json:"target_commitish,omitempty"` + Name *string `json:"name,omitempty"` + Body *string `json:"body,omitempty"` + Draft *bool `json:"draft,omitempty"` + Prerelease *bool `json:"prerelease,omitempty"` + // MakeLatest can be one of: "true", "false", or "legacy". + MakeLatest *string `json:"make_latest,omitempty"` + DiscussionCategoryName *string `json:"discussion_category_name,omitempty"` +} + +// CreateRelease adds a new release for a repository. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#create-a-release +// +//meta:operation POST /repos/{owner}/{repo}/releases +func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, body CreateReleaseRequest) (*RepositoryRelease, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var r *RepositoryRelease + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// UpdateRelease updates a repository release. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#update-a-release +// +//meta:operation PATCH /repos/{owner}/{repo}/releases/{release_id} +func (s *RepositoriesService) UpdateRelease(ctx context.Context, owner, repo string, id int64, body UpdateReleaseRequest) (*RepositoryRelease, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var r *RepositoryRelease + resp, err := s.client.Do(req, &r) + if err != nil { + return nil, resp, err + } + + return r, resp, nil +} + +// DeleteRelease delete a single release from a repository. +// +// GitHub API docs: https://docs.github.com/rest/releases/releases?apiVersion=2022-11-28#delete-a-release +// +//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/%v/%v/releases/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + +// ListReleaseAssets lists the release's assets. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#list-release-assets +// +//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/%v/%v/releases/%v/assets", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assets []*ReleaseAsset + resp, err := s.client.Do(req, &assets) + if err != nil { + return nil, resp, err + } + return assets, resp, nil +} + +// GetReleaseAsset fetches a single release asset. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset +// +//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/%v/%v/releases/assets/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) + if err != nil { + return nil, resp, err + } + + return asset, resp, nil +} + +// DownloadReleaseAsset downloads a release asset or returns a redirect URL. +// +// DownloadReleaseAsset returns an io.ReadCloser that reads the contents of the +// specified release asset. It is the caller's responsibility to close the ReadCloser. +// If a redirect is returned, the redirect URL will be returned as a string instead +// of the io.ReadCloser. Exactly one of rc and redirectURL will be zero. +// +// followRedirectsClient can be passed to download the asset from a redirected +// location. The redirect target is typically a pre-signed third-party URL (for +// example S3), so http.DefaultClient is recommended. The client's own +// credentials reach only its configured API and upload origins, so they are not +// attached to the redirected request in any case; supply a client that adds its +// own credentials only if the redirect target requires them. +// If nil is passed the redirectURL will be returned instead. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset +// +//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/%v/%v/releases/assets/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, "", err + } + req.Header.Set("Accept", defaultMediaType) + + loc, resp, err := s.client.bareDoUntilFound(req, 10) + if err != nil { + return nil, "", err + } + + // No redirect, stream the response body directly. + if loc == nil { + return resp.Body, "", nil + } + + // Close body as it's not needed when following redirects or returning the redirect URL. + _ = resp.Body.Close() + + // Got a redirect URL. + redirectStr := loc.String() + if followRedirectsClient != nil { + rc, err := s.downloadReleaseAssetFromURL(ctx, followRedirectsClient, redirectStr) + return rc, "", err + } + + return nil, redirectStr, nil +} + +func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, followRedirectsClient *http.Client, url string) (rc io.ReadCloser, err error) { + req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + if err != nil { + return nil, err + } + req.Header.Set("Accept", defaultMediaType) + resp, err := followRedirectsClient.Do(req) + if err != nil { + return nil, err + } + // CheckResponse substitutes resp.Body with a re-readable copy on error + // responses, so capture the original body first: it is the one that must + // be closed. + origBody := resp.Body + if err := CheckResponse(resp); err != nil { + _ = origBody.Close() + return nil, err + } + return resp.Body, nil +} + +// UpdateReleaseAsset updates a repository release asset. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#update-a-release-asset +// +//meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} +func (s *RepositoriesService) UpdateReleaseAsset(ctx context.Context, owner, repo string, id int64, body UpdateReleaseAssetRequest) (*ReleaseAsset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) + if err != nil { + return nil, resp, err + } + + return asset, resp, nil +} + +// DeleteReleaseAsset delete a single release asset from a repository. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#delete-a-release-asset +// +//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/%v/%v/releases/assets/%v", owner, repo, id) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} + +// UploadReleaseAsset creates an asset by uploading a file into a release repository. +// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset +// +//meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/assets +func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { + if file == nil { + return nil, nil, errors.New("file must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + stat, err := file.Stat() + if err != nil { + return nil, nil, err + } + if stat.IsDir() { + return nil, nil, errors.New("the asset to upload can't be a directory") + } + + mediaType := mime.TypeByExtension(filepath.Ext(file.Name())) + if opts.MediaType != "" { + mediaType = opts.MediaType + } + + req, err := s.client.NewUploadRequest(ctx, u, file, stat.Size(), mediaType) + if err != nil { + return nil, nil, err + } + + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) + if err != nil { + return nil, resp, err + } + + 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. +// +// Because release is normally the object an API call returned, its UploadURL is +// a value the server chose rather than one the caller did. A release whose +// UploadURL names an origin the client was not configured for is refused with +// [ErrUntrustedDestination] rather than uploaded to, so that a response cannot +// take the artifact to a host of its own choosing. This function performs no +// host check of its own: the refusal comes from [Client.NewUploadRequest], which +// every upload here is built through. Configure a legitimate alternate upload +// host with [WithURLs] or [WithEnterpriseURLs]. +// +// GitHub API docs: https://docs.github.com/rest/releases/assets?apiVersion=2022-11-28#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 == "" { + 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/"). + // + // An absolute URL replaces the client's configured upload host entirely, and + // release.UploadURL is normally whatever the API last answered with, so the + // host in it is not the caller's choice. NewUploadRequest refuses that case + // with ErrUntrustedDestination unless it names a configured origin, so + // there is no host check here: every upload this helper builds goes through + // that one gate. In the default configuration the upload host is + // uploads.github.com rather than api.github.com, and both are configured + // origins, so the URL the API hands back is accepted as-is. + 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(ctx, u, reader, size, mediaType) + if err != nil { + return nil, nil, err + } + + var asset *ReleaseAsset + resp, err := s.client.Do(req, &asset) + if err != nil { + return nil, resp, err + } + + return asset, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/repos_rules.go b/vendor/github.com/google/go-github/v93/github/repos_rules.go new file mode 100644 index 000000000..b6635705a --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/repos_rules.go @@ -0,0 +1,303 @@ +// 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" + "iter" + "net/url" +) + +// ListRulesForBranch gets all the repository rules that apply to the specified branch. +// +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-rules-for-a-branch +// +//meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} +func (s *RepositoriesService) ListRulesForBranch(ctx context.Context, owner, repo, branch string, opts *ListOptions) (*BranchRules, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, url.PathEscape(branch)) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var rules *BranchRules + resp, err := s.client.Do(req, &rules) + if err != nil { + return nil, resp, err + } + + return rules, resp, nil +} + +// ListRulesForBranchIter returns an iterator that paginates through all results of ListRulesForBranch. +// +// Note that since [BranchRules] contains a large number of slices, this iterator +// returns type `any` and it is therefore the responsibility of the caller to perform a +// type switch to determine what item is being returned for each iteration. +func (s *RepositoriesService) ListRulesForBranchIter(ctx context.Context, owner, repo, branch string, opts *ListOptions) iter.Seq2[any, error] { + return func(yield func(any, error) bool) { + // Create a copy of opts to avoid mutating the caller's struct + if opts == nil { + opts = &ListOptions{} + } else { + opts = new(*opts) + } + + for { + results, resp, err := s.ListRulesForBranch(ctx, owner, repo, branch, opts) + if err != nil { + yield(nil, err) + return + } + + // Now iterate through ALL possible results from [BranchRules]. + for _, item := range results.Creation { + if !yield(item, nil) { + return + } + } + for _, item := range results.Update { + if !yield(item, nil) { + return + } + } + for _, item := range results.Deletion { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredLinearHistory { + if !yield(item, nil) { + return + } + } + for _, item := range results.MergeQueue { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredDeployments { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredSignatures { + if !yield(item, nil) { + return + } + } + for _, item := range results.PullRequest { + if !yield(item, nil) { + return + } + } + for _, item := range results.RequiredStatusChecks { + if !yield(item, nil) { + return + } + } + for _, item := range results.NonFastForward { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitMessagePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitAuthorEmailPattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.CommitterEmailPattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.BranchNamePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.TagNamePattern { + if !yield(item, nil) { + return + } + } + for _, item := range results.Workflows { + if !yield(item, nil) { + return + } + } + for _, item := range results.CodeScanning { + if !yield(item, nil) { + return + } + } + for _, item := range results.CopilotCodeReview { + if !yield(item, nil) { + return + } + } + for _, item := range results.FileExtensionRestriction { + if !yield(item, nil) { + return + } + } + for _, item := range results.FilePathRestriction { + if !yield(item, nil) { + return + } + } + for _, item := range results.MaxFilePathLength { + if !yield(item, nil) { + return + } + } + for _, item := range results.MaxFileSize { + if !yield(item, nil) { + return + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + } +} + +// RepositoryListRulesetsOptions specifies optional parameters to the +// RepositoriesService.GetAllRulesets method. +type RepositoryListRulesetsOptions struct { + // IncludesParents indicates whether to include rulesets configured at the organization or enterprise level that apply to the repository. + IncludesParents *bool `url:"includes_parents,omitempty"` + ListOptions +} + +// GetAllRulesets gets all the repository rulesets for the specified repository. +// By default, this endpoint will include rulesets configured at the organization or enterprise level that apply to the repository. +// To exclude those rulesets, set the `RepositoryListRulesetsOptions.IncludesParents` parameter to `false`. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-all-repository-rulesets +// +//meta:operation GET /repos/{owner}/{repo}/rulesets +func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions) ([]*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var ruleset []*RepositoryRuleset + resp, err := s.client.Do(req, &ruleset) + if err != nil { + return nil, resp, err + } + + return ruleset, resp, nil +} + +// CreateRuleset creates a repository ruleset for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#create-a-repository-ruleset +// +//meta:operation POST /repos/{owner}/{repo}/rulesets +func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(req, &rs) + if err != nil { + return nil, resp, err + } + + return rs, resp, nil +} + +// GetRuleset gets a repository ruleset for the specified repository. +// If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#get-a-repository-ruleset +// +//meta:operation GET /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v?includes_parents=%v", owner, repo, rulesetID, includesParents) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var ruleset *RepositoryRuleset + resp, err := s.client.Do(req, &ruleset) + if err != nil { + return nil, resp, err + } + + return ruleset, resp, nil +} + +// UpdateRuleset updates a repository ruleset for the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/rules?apiVersion=2022-11-28#update-a-repository-ruleset +// +//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, body RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) + + req, err := s.client.NewRequest(ctx, "PUT", u, body) + if err != nil { + return nil, nil, err + } + + var rs *RepositoryRuleset + resp, err := s.client.Do(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?apiVersion=2022-11-28#delete-a-repository-ruleset +// +//meta:operation DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} +func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) + + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v69/github/repos_stats.go b/vendor/github.com/google/go-github/v93/github/repos_stats.go similarity index 87% rename from vendor/github.com/google/go-github/v69/github/repos_stats.go rename to vendor/github.com/google/go-github/v93/github/repos_stats.go index a6ef9c0da..32156a34c 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_stats.go +++ b/vendor/github.com/google/go-github/v93/github/repos_stats.go @@ -45,18 +45,18 @@ func (w WeeklyStats) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-all-contributor-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/contributors func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var contributorStats []*ContributorStats - resp, err := s.client.Do(ctx, req, &contributorStats) + resp, err := s.client.Do(req, &contributorStats) if err != nil { return nil, resp, err } @@ -86,18 +86,18 @@ func (w WeeklyCommitActivity) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-last-year-of-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/commit_activity func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var weeklyCommitActivity []*WeeklyCommitActivity - resp, err := s.client.Do(ctx, req, &weeklyCommitActivity) + resp, err := s.client.Do(req, &weeklyCommitActivity) if err != nil { return nil, resp, err } @@ -115,18 +115,18 @@ func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, rep // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity // //meta:operation GET /repos/{owner}/{repo}/stats/code_frequency func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var weeks [][]int - resp, err := s.client.Do(ctx, req, &weeks) + resp, err := s.client.Do(req, &weeks) if err != nil { return nil, resp, err } @@ -139,8 +139,8 @@ func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo } stat := &WeeklyStats{ Week: &Timestamp{time.Unix(int64(week[0]), 0)}, - Additions: Ptr(week[1]), - Deletions: Ptr(week[2]), + Additions: new(week[1]), + Deletions: new(week[2]), } stats = append(stats, stat) } @@ -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"` @@ -173,18 +173,18 @@ func (r RepositoryParticipation) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-count // //meta:operation GET /repos/{owner}/{repo}/stats/participation func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - participation := new(RepositoryParticipation) - resp, err := s.client.Do(ctx, req, participation) + var participation *RepositoryParticipation + resp, err := s.client.Do(req, &participation) if err != nil { return nil, resp, err } @@ -208,18 +208,18 @@ type PunchCard struct { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day +// GitHub API docs: https://docs.github.com/rest/metrics/statistics?apiVersion=2022-11-28#get-the-hourly-commit-count-for-each-day // //meta:operation GET /repos/{owner}/{repo}/stats/punch_card func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var results [][]int - resp, err := s.client.Do(ctx, req, &results) + resp, err := s.client.Do(req, &results) if err != nil { return nil, resp, err } @@ -231,9 +231,9 @@ func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo str continue } card := &PunchCard{ - Day: Ptr(result[0]), - Hour: Ptr(result[1]), - Commits: Ptr(result[2]), + Day: new(result[0]), + Hour: new(result[1]), + Commits: new(result[2]), } cards = append(cards, card) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_statuses.go b/vendor/github.com/google/go-github/v93/github/repos_statuses.go similarity index 78% rename from vendor/github.com/google/go-github/v69/github/repos_statuses.go rename to vendor/github.com/google/go-github/v93/github/repos_statuses.go index e7b030475..396175e98 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/v93/github/repos_statuses.go @@ -36,6 +36,11 @@ type RepoStatus struct { Creator *User `json:"creator,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` + + // Required indicates whether this status is required for merging. Only + // populated in combined status responses; nil means the API did not include + // the field (e.g. when not part of a branch-protection rule). + Required *bool `json:"required,omitempty"` } func (r RepoStatus) String() string { @@ -43,9 +48,9 @@ func (r RepoStatus) String() string { } // ListStatuses lists the statuses of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#list-commit-statuses-for-a-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) { @@ -55,13 +60,13 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var statuses []*RepoStatus - resp, err := s.client.Do(ctx, req, &statuses) + resp, err := s.client.Do(req, &statuses) if err != nil { return nil, resp, err } @@ -70,20 +75,20 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref } // CreateStatus creates a new status for a repository at the specified -// reference. Ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#create-a-commit-status +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#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(ctx, "POST", u, &status) if err != nil { return nil, nil, err } - repoStatus := new(RepoStatus) - resp, err := s.client.Do(ctx, req, repoStatus) + var repoStatus *RepoStatus + resp, err := s.client.Do(req, &repoStatus) if err != nil { return nil, resp, err } @@ -111,9 +116,9 @@ func (s CombinedStatus) String() string { } // GetCombinedStatus returns the combined status of a repository at the specified -// reference. ref can be a SHA, a branch name, or a tag name. +// reference. The ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference // //meta:operation GET /repos/{owner}/{repo}/commits/{ref}/status func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) { @@ -123,13 +128,13 @@ func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - status := new(CombinedStatus) - resp, err := s.client.Do(ctx, req, status) + var status *CombinedStatus + resp, err := s.client.Do(req, &status) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/repos_tags.go b/vendor/github.com/google/go-github/v93/github/repos_tags.go similarity index 51% rename from vendor/github.com/google/go-github/v69/github/repos_tags.go rename to vendor/github.com/google/go-github/v93/github/repos_tags.go index b6dc36e2a..a45e76cc5 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_tags.go +++ b/vendor/github.com/google/go-github/v93/github/repos_tags.go @@ -22,22 +22,23 @@ type tagProtectionRequest struct { Pattern string `json:"pattern"` } -// Deprecated: ListTagProtection lists tag protection of the specified repository. -// Deprecation notice: 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 +// ListTagProtection lists tag protection of the specified repository. // -// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository +// 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?apiVersion=2022-11-28#get-all-repository-rulesets +// +// 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) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var tagProtections []*TagProtection - resp, err := s.client.Do(ctx, req, &tagProtections) + resp, err := s.client.Do(req, &tagProtections) if err != nil { return nil, resp, err } @@ -45,22 +46,23 @@ func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo return tagProtections, resp, nil } -// Deprecated: CreateTagProtection creates the tag protection of the specified repository. -// Deprecation notice: 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 +// CreateTagProtection creates the tag protection of the specified repository. +// +// 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?apiVersion=2022-11-28#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) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) r := &tagProtectionRequest{Pattern: pattern} - req, err := s.client.NewRequest("POST", u, r) + req, err := s.client.NewRequest(ctx, "POST", u, r) if err != nil { return nil, nil, err } - tagProtection := new(TagProtection) - resp, err := s.client.Do(ctx, req, tagProtection) + var tagProtection *TagProtection + resp, err := s.client.Do(req, &tagProtection) if err != nil { return nil, resp, err } @@ -68,18 +70,19 @@ func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, re return tagProtection, resp, nil } -// Deprecated: DeleteTagProtection deletes a tag protection from the specified repository. -// Deprecation notice: 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 +// DeleteTagProtection deletes a tag protection from the specified repository. +// +// 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?apiVersion=2022-11-28#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) { u := fmt.Sprintf("repos/%v/%v/tags/protection/%v", owner, repo, tagProtectionID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/repos_traffic.go b/vendor/github.com/google/go-github/v93/github/repos_traffic.go similarity index 86% rename from vendor/github.com/google/go-github/v69/github/repos_traffic.go rename to vendor/github.com/google/go-github/v93/github/repos_traffic.go index ae2f1a86b..b67af094b 100644 --- a/vendor/github.com/google/go-github/v69/github/repos_traffic.go +++ b/vendor/github.com/google/go-github/v93/github/repos_traffic.go @@ -54,19 +54,19 @@ type TrafficBreakdownOptions struct { // ListTrafficReferrers list the top 10 referrers over the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-sources +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-top-referral-sources // //meta:operation GET /repos/{owner}/{repo}/traffic/popular/referrers func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var trafficReferrers []*TrafficReferrer - resp, err := s.client.Do(ctx, req, &trafficReferrers) + resp, err := s.client.Do(req, &trafficReferrers) if err != nil { return nil, resp, err } @@ -76,19 +76,19 @@ func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, r // ListTrafficPaths list the top 10 popular content over the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-paths +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-top-referral-paths // //meta:operation GET /repos/{owner}/{repo}/traffic/popular/paths func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var paths []*TrafficPath - resp, err := s.client.Do(ctx, req, &paths) + resp, err := s.client.Do(req, &paths) if err != nil { return nil, resp, err } @@ -98,7 +98,7 @@ func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo // ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-page-views +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-page-views // //meta:operation GET /repos/{owner}/{repo}/traffic/views func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { @@ -108,13 +108,13 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - trafficViews := new(TrafficViews) - resp, err := s.client.Do(ctx, req, &trafficViews) + var trafficViews *TrafficViews + resp, err := s.client.Do(req, &trafficViews) if err != nil { return nil, resp, err } @@ -124,7 +124,7 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo // ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days. // -// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-repository-clones +// GitHub API docs: https://docs.github.com/rest/metrics/traffic?apiVersion=2022-11-28#get-repository-clones // //meta:operation GET /repos/{owner}/{repo}/traffic/clones func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { @@ -134,13 +134,13 @@ func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - trafficClones := new(TrafficClones) - resp, err := s.client.Do(ctx, req, &trafficClones) + var trafficClones *TrafficClones + resp, err := s.client.Do(req, &trafficClones) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/rules.go b/vendor/github.com/google/go-github/v93/github/rules.go similarity index 74% rename from vendor/github.com/google/go-github/v69/github/rules.go rename to vendor/github.com/google/go-github/v93/github/rules.go index 8312d9523..8f858b3a8 100644 --- a/vendor/github.com/google/go-github/v69/github/rules.go +++ b/vendor/github.com/google/go-github/v93/github/rules.go @@ -7,7 +7,8 @@ package github import ( "encoding/json" - "reflect" + "fmt" + "strconv" ) // RulesetTarget represents a GitHub ruleset target. @@ -15,9 +16,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. @@ -58,8 +60,9 @@ type BypassMode string // This is the set of GitHub ruleset bypass modes. const ( BypassModeAlways BypassMode = "always" - BypassModePullRequest BypassMode = "pull_request" + BypassModeExempt BypassMode = "exempt" BypassModeNever BypassMode = "never" + BypassModePullRequest BypassMode = "pull_request" ) // RepositoryRuleType represents a GitHub ruleset rule type. @@ -67,27 +70,39 @@ type RepositoryRuleType string // This is the set of GitHub ruleset rule types. const ( + // Branch or tag target rules. + RulesetRuleTypeBranchNamePattern RepositoryRuleType = "branch_name_pattern" + RulesetRuleTypeCodeCoverage RepositoryRuleType = "code_coverage" + 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. @@ -99,14 +114,53 @@ const ( MergeGroupingStrategyHeadGreen MergeGroupingStrategy = "HEADGREEN" ) -// MergeMethod models a GitHub merge method. -type MergeMethod string +// PullRequestMergeMethod is used in PullRequestRuleParameters, +// where the GitHub API expects lowercase merge method values: "merge", "rebase", "squash". +// +// NOTE: GitHub's API inconsistently uses different casing for the same logical values +// across different rules. +// +// TODO: Unify with MergeQueueMergeMethod once the GitHub API uses consistent casing. +type PullRequestMergeMethod string -// This is the set of GitHub merge methods. const ( - MergeMethodMerge MergeMethod = "merge" - MergeMethodRebase MergeMethod = "rebase" - MergeMethodSquash MergeMethod = "squash" + PullRequestMergeMethodMerge PullRequestMergeMethod = "merge" + PullRequestMergeMethodRebase PullRequestMergeMethod = "rebase" + PullRequestMergeMethodSquash PullRequestMergeMethod = "squash" +) + +// MergeQueueMergeMethod is used in MergeQueueRuleParameters, +// where the GitHub API expects uppercase merge method values: "MERGE", "REBASE", "SQUASH". +// +// NOTE: This type exists alongside PullRequestMergeMethod solely due to API casing inconsistencies. +// It enforces the correct usage by API context. +// +// TODO: Unify with PullRequestMergeMethod once the GitHub API uses consistent casing. +type MergeQueueMergeMethod string + +const ( + MergeQueueMergeMethodMerge MergeQueueMergeMethod = "MERGE" + MergeQueueMergeMethodRebase MergeQueueMergeMethod = "REBASE" + 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" +) + +// DismissalRestrictionActorType represents the type of actor allowed to dismiss pull request reviews. +type DismissalRestrictionActorType string + +// This is the set of GitHub dismissal restriction actor types. +const ( + DismissalRestrictionActorTypeUser DismissalRestrictionActorType = "User" + DismissalRestrictionActorTypeTeam DismissalRestrictionActorType = "Team" + DismissalRestrictionActorTypeIntegrationInstallation DismissalRestrictionActorType = "IntegrationInstallation" + DismissalRestrictionActorTypeRepositoryRole DismissalRestrictionActorType = "RepositoryRole" ) // PatternRuleOperator models a GitHub pattern rule operator. @@ -151,7 +205,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"` @@ -182,12 +236,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. @@ -196,6 +251,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"` @@ -241,6 +302,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 @@ -256,17 +318,29 @@ type RepositoryRulesetRules struct { CommitterEmailPattern *PatternRuleParameters BranchNamePattern *PatternRuleParameters TagNamePattern *PatternRuleParameters + Workflows *WorkflowsRuleParameters + CodeScanning *CodeScanningRuleParameters + CodeCoverage *CodeCoverageRuleParameters + 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 @@ -282,12 +356,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. @@ -369,6 +446,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{} @@ -383,7 +466,7 @@ type MergeQueueRuleParameters struct { GroupingStrategy MergeGroupingStrategy `json:"grouping_strategy"` MaxEntriesToBuild int `json:"max_entries_to_build"` MaxEntriesToMerge int `json:"max_entries_to_merge"` - MergeMethod MergeMethod `json:"merge_method"` + MergeMethod MergeQueueMergeMethod `json:"merge_method"` MinEntriesToMerge int `json:"min_entries_to_merge"` MinEntriesToMergeWaitMinutes int `json:"min_entries_to_merge_wait_minutes"` } @@ -395,12 +478,70 @@ type RequiredDeploymentsRuleParameters struct { // PullRequestRuleParameters represents the pull_request rule parameters. type PullRequestRuleParameters struct { - AllowedMergeMethods []MergeMethod `json:"allowed_merge_methods"` - 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"` + DismissalRestriction *DismissalRestriction `json:"dismissal_restriction,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"` +} + +// DismissalRestriction represents the people, teams, or apps allowed to dismiss pull request reviews. +type DismissalRestriction struct { + AllowedActors []*DismissalRestrictionActor `json:"allowed_actors,omitempty"` + Enabled bool `json:"enabled"` +} + +// DismissalRestrictionActor represents an actor allowed to dismiss pull request reviews. +type DismissalRestrictionActor struct { + ID int64 `json:"id"` + Type DismissalRestrictionActorType `json:"type"` +} + +// 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"` +} + +// UnmarshalJSON is a custom JSON unmarshaler for RulesetReviewer. +func (r *RulesetReviewer) UnmarshalJSON(data []byte) error { + var aux struct { + ID any `json:"id,omitempty"` + Type *RulesetReviewerType `json:"type,omitempty"` + } + + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + + r.Type = aux.Type + + if aux.ID != nil { + switch id := aux.ID.(type) { + case float64: + r.ID = new(int64(id)) + case string: + i, err := strconv.ParseInt(id, 10, 64) + if err != nil { + return err + } + r.ID = &i + default: + return fmt.Errorf("unexpected type for reviewer.ID: %T", id) + } + } + + return nil } // RequiredStatusChecksRuleParameters represents the required status checks rule parameters. @@ -464,6 +605,18 @@ type CodeScanningRuleParameters struct { CodeScanningTools []*RuleCodeScanningTool `json:"code_scanning_tools"` } +// CodeCoverageRuleParameters represents the code_coverage rule parameters. +type CodeCoverageRuleParameters struct { + MaxCoverageDrop *float64 `json:"max_coverage_drop,omitempty"` + MinimumCoverage *float64 `json:"minimum_coverage,omitempty"` +} + +// 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"` @@ -471,6 +624,19 @@ 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"` + Public bool `json:"public"` +} + // repositoryRulesetRuleWrapper is a helper type to marshal & unmarshal a ruleset rule. type repositoryRulesetRuleWrapper struct { Type RepositoryRuleType `json:"type"` @@ -478,10 +644,8 @@ 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) +func (r RepositoryRulesetRules) MarshalJSON() ([]byte, error) { + var rawRules []json.RawMessage if r.Creation != nil { bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCreation, r.Creation) @@ -651,17 +815,94 @@ func (r *RepositoryRulesetRules) MarshalJSON() ([]byte, error) { rawRules = append(rawRules, json.RawMessage(bytes)) } + if r.CodeCoverage != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCodeCoverage, r.CodeCoverage) + if err != nil { + return nil, err + } + 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}) } @@ -821,6 +1062,44 @@ func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error { return err } } + case RulesetRuleTypeCodeCoverage: + r.CodeCoverage = &CodeCoverageRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CodeCoverage); err != nil { + 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 + } + } } } @@ -1014,6 +1293,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}) } } @@ -1031,7 +1320,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{} @@ -1043,10 +1339,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{} @@ -1067,8 +1359,6 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeRequiredSignatures: - r.Parameters = nil case RulesetRuleTypePullRequest: p := &PullRequestRuleParameters{} @@ -1089,9 +1379,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 { @@ -1101,8 +1393,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCommitAuthorEmailPattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFilePathRestriction: + p := &FilePathRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1111,8 +1403,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeCommitterEmailPattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeMaxFilePathLength: + p := &MaxFilePathLengthRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1121,8 +1413,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeBranchNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeFileExtensionRestriction: + p := &FileExtensionRestrictionRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1131,8 +1423,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeTagNamePattern: - p := &PatternRuleParameters{} + case RulesetRuleTypeMaxFileSize: + p := &MaxFileSizeRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1141,8 +1433,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFilePathRestriction: - p := &FilePathRestrictionRuleParameters{} + case RulesetRuleTypeWorkflows: + p := &WorkflowsRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1151,8 +1443,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeMaxFilePathLength: - p := &MaxFilePathLengthRuleParameters{} + case RulesetRuleTypeCodeScanning: + p := &CodeScanningRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1161,8 +1453,8 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { } r.Parameters = p - case RulesetRuleTypeFileExtensionRestriction: - p := &FileExtensionRestrictionRuleParameters{} + case RulesetRuleTypeCodeCoverage: + p := &CodeCoverageRuleParameters{} if w.Parameters != nil { if err := json.Unmarshal(w.Parameters, p); err != nil { @@ -1171,8 +1463,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 { @@ -1181,8 +1473,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 { @@ -1191,15 +1483,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/v69/github/scim.go b/vendor/github.com/google/go-github/v93/github/scim.go similarity index 64% rename from vendor/github.com/google/go-github/v69/github/scim.go rename to vendor/github.com/google/go-github/v93/github/scim.go index 70f063caa..6537ab4ff 100644 --- a/vendor/github.com/google/go-github/v69/github/scim.go +++ b/vendor/github.com/google/go-github/v93/github/scim.go @@ -14,32 +14,13 @@ import ( // SCIMService provides access to SCIM related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/rest/scim +// GitHub API docs: https://docs.github.com/rest/scim?apiVersion=2022-11-28 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?apiVersion=2022-11-28#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"` @@ -110,7 +95,7 @@ type ListSCIMProvisionedIdentitiesOptions struct { // ListSCIMProvisionedIdentities lists SCIM provisioned identities. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#list-scim-provisioned-identities // //meta:operation GET /scim/v2/organizations/{org}/Users func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org string, opts *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedIdentities, *Response, error) { @@ -120,13 +105,13 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - identities := new(SCIMProvisionedIdentities) - resp, err := s.client.Do(ctx, req, identities) + var identities *SCIMProvisionedIdentities + resp, err := s.client.Do(req, &identities) if err != nil { return nil, resp, err } @@ -136,19 +121,19 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str // ProvisionAndInviteSCIMUser provisions organization membership for a user, and sends an activation email to the email address. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#provision-and-invite-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#provision-and-invite-a-scim-user // //meta:operation POST /scim/v2/organizations/{org}/Users -func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*SCIMUserAttributes, *Response, error) { +func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, body *SCIMUserAttributes) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) - req, err := s.client.NewRequest("POST", u, opts) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - user := new(SCIMUserAttributes) - resp, err := s.client.Do(ctx, req, user) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -158,18 +143,18 @@ func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string // GetSCIMProvisioningInfoForUser returns SCIM provisioning information for a user. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#get-scim-provisioning-information-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#get-scim-provisioning-information-for-a-user // //meta:operation GET /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, scimUserID string) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - user := new(SCIMUserAttributes) - resp, err := s.client.Do(ctx, req, &user) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -177,32 +162,47 @@ func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, s return user, resp, nil } +// UpdateProvisionedOrgMembershipRequest represents the body of a request to +// update a provisioned organization membership. +type UpdateProvisionedOrgMembershipRequest struct { + UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) + Name SCIMUserName `json:"name"` // (Required.) + DisplayName *string `json:"displayName,omitempty"` // The name of the user, suitable for display to end-users. (Optional.) + Emails []*SCIMUserEmail `json:"emails"` // User emails. (Required.) + Schemas []string `json:"schemas,omitempty"` // (Optional.) + ExternalID *string `json:"externalId,omitempty"` // (Optional.) + Groups []string `json:"groups,omitempty"` // (Optional.) + Active *bool `json:"active,omitempty"` // (Optional.) +} + // UpdateProvisionedOrgMembership updates a provisioned organization membership. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-a-provisioned-organization-membership +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#update-a-provisioned-organization-membership // //meta:operation PUT /scim/v2/organizations/{org}/Users/{scim_user_id} -func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, opts *SCIMUserAttributes) (*Response, error) { +func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, body UpdateProvisionedOrgMembershipRequest) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - u, err := addOptions(u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { - return nil, err + return nil, nil, err } - req, err := s.client.NewRequest("PUT", u, nil) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { - return nil, err + return nil, resp, err } - return s.client.Do(ctx, req, nil) + return user, resp, nil } -// UpdateAttributeForSCIMUserOptions represents options for UpdateAttributeForSCIMUser. +// UpdateAttributeForSCIMUserRequest represents the body of a request to update an +// attribute for a SCIM user. // // GitHub API docs: https://docs.github.com/rest/scim#update-an-attribute-for-a-scim-user--parameters -type UpdateAttributeForSCIMUserOptions struct { - Schemas []string `json:"schemas,omitempty"` // (Optional.) - Operations UpdateAttributeForSCIMUserOperations `json:"operations"` // Set of operations to be performed. (Required.) +type UpdateAttributeForSCIMUserRequest struct { + Schemas []string `json:"schemas,omitempty"` // (Optional.) + Operations []*UpdateAttributeForSCIMUserOperations `json:"Operations"` // Set of operations to be performed. (Required.) } // UpdateAttributeForSCIMUserOperations represents operations for UpdateAttributeForSCIMUser. @@ -214,57 +214,36 @@ type UpdateAttributeForSCIMUserOperations struct { // UpdateAttributeForSCIMUser updates an attribute for an SCIM user. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-an-attribute-for-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#update-an-attribute-for-a-scim-user // //meta:operation PATCH /scim/v2/organizations/{org}/Users/{scim_user_id} -func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, opts *UpdateAttributeForSCIMUserOptions) (*Response, error) { +func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, body UpdateAttributeForSCIMUserRequest) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - u, err := addOptions(u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { - return nil, err + return nil, nil, err } - req, err := s.client.NewRequest("PATCH", u, nil) + var user *SCIMUserAttributes + resp, err := s.client.Do(req, &user) if err != nil { - return nil, err + return nil, resp, err } - return s.client.Do(ctx, req, nil) + return user, resp, nil } // DeleteSCIMUserFromOrg deletes SCIM user from an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#delete-a-scim-user-from-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim?apiVersion=2022-11-28#delete-a-scim-user-from-an-organization // //meta:operation DELETE /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID string) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - 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 *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedGroups, *Response, error) { - u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) - - 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 + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/search.go b/vendor/github.com/google/go-github/v93/github/search.go similarity index 85% rename from vendor/github.com/google/go-github/v69/github/search.go rename to vendor/github.com/google/go-github/v93/github/search.go index 54bc6d5e1..a25e4010c 100644 --- a/vendor/github.com/google/go-github/v69/github/search.go +++ b/vendor/github.com/google/go-github/v93/github/search.go @@ -32,7 +32,7 @@ import ( // For example, querying with "language:c++" and "leveldb", then query should be // "language:c++ leveldb" but not "language:c+++leveldb". // -// GitHub API docs: https://docs.github.com/rest/search/ +// GitHub API docs: https://docs.github.com/rest/search?apiVersion=2022-11-28 type SearchService service // SearchOptions specifies optional parameters to the SearchService methods. @@ -54,6 +54,13 @@ 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"` + + // The type of search to perform on issues. Possible values are: + // semantic, hybrid. Default is lexical search. + SearchType string `url:"search_type,omitempty"` + ListOptions } @@ -72,12 +79,12 @@ type RepositoriesSearchResult struct { // Repositories searches repositories via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-repositories +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-repositories // //meta:operation GET /search/repositories func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) { - result := new(RepositoriesSearchResult) - resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result) + var result *RepositoriesSearchResult + resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -92,6 +99,7 @@ type TopicsSearchResult struct { Topics []*TopicResult `json:"items,omitempty"` } +// TopicResult represents a topic search result. type TopicResult struct { Name *string `json:"name,omitempty"` DisplayName *string `json:"display_name,omitempty"` @@ -109,12 +117,12 @@ type TopicResult struct { // Please see https://help.github.com/articles/searching-topics for more // information about search qualifiers. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-topics +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-topics // //meta:operation GET /search/topics func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) { - result := new(TopicsSearchResult) - resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result) + var result *TopicsSearchResult + resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -146,12 +154,12 @@ type CommitResult struct { // Commits searches commits via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-commits +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-commits // //meta:operation GET /search/commits func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) { - result := new(CommitsSearchResult) - resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result) + var result *CommitsSearchResult + resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -163,17 +171,18 @@ func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchO type IssuesSearchResult struct { Total *int `json:"total_count,omitempty"` IncompleteResults *bool `json:"incomplete_results,omitempty"` + SearchType *string `json:"search_type,omitempty"` Issues []*Issue `json:"items,omitempty"` } // Issues searches issues via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-issues-and-pull-requests +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests // //meta:operation GET /search/issues func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) { - result := new(IssuesSearchResult) - resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result) + var result *IssuesSearchResult + resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -190,12 +199,12 @@ type UsersSearchResult struct { // Users searches users via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-users +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-users // //meta:operation GET /search/users func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) { - result := new(UsersSearchResult) - resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result) + var result *UsersSearchResult + resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -245,12 +254,12 @@ func (c CodeResult) String() string { // Code searches code via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-code +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-code // //meta:operation GET /search/code func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) { - result := new(CodeSearchResult) - resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result) + var result *CodeSearchResult + resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -282,12 +291,12 @@ func (l LabelResult) String() string { // Labels searches labels in the repository with ID repoID via various criteria. // -// GitHub API docs: https://docs.github.com/rest/search/search#search-labels +// GitHub API docs: https://docs.github.com/rest/search/search?apiVersion=2022-11-28#search-labels // //meta:operation GET /search/labels func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) { - result := new(LabelsSearchResult) - resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result) + var result *LabelsSearchResult + resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, &result) if err != nil { return nil, resp, err } @@ -300,7 +309,7 @@ func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, // // If searchParameters.Query includes multiple condition, it MUST NOT include "+" as condition separator. // For example, querying with "language:c++" and "leveldb", then searchParameters.Query should be "language:c++ leveldb" but not "language:c+++leveldb". -func (s *SearchService) search(ctx context.Context, searchType string, parameters *searchParameters, opts *SearchOptions, result interface{}) (*Response, error) { +func (s *SearchService) search(ctx context.Context, searchType string, parameters *searchParameters, opts *SearchOptions, result any) (*Response, error) { params, err := qs.Values(opts) if err != nil { return nil, err @@ -310,32 +319,25 @@ 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) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, err } var acceptHeaders []string - switch { - case searchType == "commits": + 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 searchType == "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 searchType == "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 searchType == "issues": + 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 + // https://docs.github.com/rest/search?apiVersion=2022-11-28#search-repositories // Accept header defaults to "application/vnd.github.v3+json" // We change it here to fetch back text-match metadata if opts != nil && opts.TextMatch { @@ -343,5 +345,5 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter } req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) - return s.client.Do(ctx, req, result) + return s.client.Do(req, result) } diff --git a/vendor/github.com/google/go-github/v93/github/secret_scanning.go b/vendor/github.com/google/go-github/v93/github/secret_scanning.go new file mode 100644 index 000000000..1b13a057e --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/secret_scanning.go @@ -0,0 +1,401 @@ +// Copyright 2022 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" +) + +// SecretScanningService handles communication with the secret scanning related +// methods of the GitHub API. +type SecretScanningService service + +// SecretScanningAlert represents a GitHub secret scanning alert. +type SecretScanningAlert struct { + Number *int `json:"number,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + LocationsURL *string `json:"locations_url,omitempty"` + FirstLocationDetected *SecretScanningAlertLocationDetails `json:"first_location_detected,omitempty"` + HasMoreLocations *bool `json:"has_more_locations,omitempty"` + State *string `json:"state,omitempty"` + Resolution *string `json:"resolution,omitempty"` + ResolvedAt *Timestamp `json:"resolved_at,omitempty"` + ResolvedBy *User `json:"resolved_by,omitempty"` + SecretType *string `json:"secret_type,omitempty"` + SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` + Secret *string `json:"secret,omitempty"` + Repository *Repository `json:"repository,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + IsBase64Encoded *bool `json:"is_base64_encoded,omitempty"` + MultiRepo *bool `json:"multi_repo,omitempty"` + PubliclyLeaked *bool `json:"publicly_leaked,omitempty"` + PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` + PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` + PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` + ResolutionComment *string `json:"resolution_comment,omitempty"` + PushProtectionBypassRequestComment *string `json:"push_protection_bypass_request_comment,omitempty"` + PushProtectionBypassRequestHTMLURL *string `json:"push_protection_bypass_request_html_url,omitempty"` + PushProtectionBypassRequestReviewer *User `json:"push_protection_bypass_request_reviewer,omitempty"` + PushProtectionBypassRequestReviewerComment *string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` + Validity *string `json:"validity,omitempty"` + AssignedTo *User `json:"assigned_to,omitempty"` + ClosureRequestComment *string `json:"closure_request_comment,omitempty"` + ClosureRequestReviewer *User `json:"closure_request_reviewer,omitempty"` + ClosureRequestReviewerComment *string `json:"closure_request_reviewer_comment,omitempty"` + Provider *string `json:"provider,omitempty"` + ProviderSlug *string `json:"provider_slug,omitempty"` + Metadata []*SecretScanningAlertMetadata `json:"metadata,omitempty"` +} + +// SecretScanningAlertMetadata represents a metadata key/value pair associated with a secret scanning alert. +type SecretScanningAlertMetadata struct { + Key string `json:"key"` + Value string `json:"value"` +} + +// SecretScanningAlertLocation represents the location for a secret scanning alert. +type SecretScanningAlertLocation struct { + Type *string `json:"type,omitempty"` + Details *SecretScanningAlertLocationDetails `json:"details,omitempty"` +} + +// SecretScanningAlertLocationDetails represents the location details for a secret scanning alert. +type SecretScanningAlertLocationDetails struct { + Path *string `json:"path,omitempty"` + Startline *int `json:"start_line,omitempty"` + EndLine *int `json:"end_line,omitempty"` + StartColumn *int `json:"start_column,omitempty"` + EndColumn *int `json:"end_column,omitempty"` + BlobSHA *string `json:"blob_sha,omitempty"` + BlobURL *string `json:"blob_url,omitempty"` + CommitSHA *string `json:"commit_sha,omitempty"` + CommitURL *string `json:"commit_url,omitempty"` + PullRequestCommentURL *string `json:"pull_request_comment_url,omitempty"` +} + +// SecretScanningAlertListOptions specifies optional parameters to the SecretScanningService.ListAlertsForEnterprise method. +type SecretScanningAlertListOptions struct { + // State of the secret scanning alerts to list. Set to open or resolved to only list secret scanning alerts in a specific state. + State string `url:"state,omitempty"` + + // A comma-separated list of secret types to return. By default all secret types are returned. + SecretType string `url:"secret_type,omitempty"` + + // A comma-separated list of resolutions. Only secret scanning alerts with one of these resolutions are listed. + // Valid resolutions are false_positive, wont_fix, revoked, pattern_edited, pattern_deleted or used_in_tests. + Resolution string `url:"resolution,omitempty"` + + // A comma-separated list of validities that, when present, will return alerts that match the validities in this list. + // Valid options are active, inactive, and unknown. + Validity string `url:"validity,omitempty"` + + // A boolean value representing whether or not to filter alerts by the publicly-leaked tag being present. Default: false. + IsPubliclyLeaked bool `url:"is_publicly_leaked,omitempty"` + + // A boolean value representing whether or not to filter alerts by the multi-repo tag being present. Default: false. + IsMultiRepo bool `url:"is_multi_repo,omitempty"` + + // The direction to sort the results by. Possible values are: asc, desc. Default: desc. + Direction string `url:"direction,omitempty"` + + // The property by which to sort the results. Possible values are: created, updated. Default: created. + Sort string `url:"sort,omitempty"` + + ListCursorOptions + + // List options can vary on the Enterprise type. + // On Enterprise Cloud, Secret Scan alerts support requesting by page number + // along with providing a cursor for an "after" param. + // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization + // Whereas on Enterprise Server, pagination is by index. + // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization + ListOptions +} + +// UpdateSecretScanningAlertRequest represents a request to update a secret scanning alert. +type UpdateSecretScanningAlertRequest struct { + // State sets the state of the secret scanning alert. Can be either "open" or "resolved". + // You must provide resolution when you set the state to "resolved". + State *string `json:"state,omitempty"` + + // Required when the state is "resolved" and represents the reason for resolving the alert. + // Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests". + Resolution *string `json:"resolution,omitempty"` + + // An optional comment when closing an alert. + ResolutionComment *string `json:"resolution_comment,omitempty"` + + // Assignee is the username of the user to assign to the alert. + Assignee *string `json:"assignee,omitempty"` + + // Validity sets the validity of the secret scanning alert. Can be either "active" or "inactive". + Validity *string `json:"validity,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/enterprise-cloud@latest/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#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) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/alerts", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var alerts []*SecretScanningAlert + resp, err := s.client.Do(req, &alerts) + if err != nil { + return nil, resp, err + } + + return alerts, resp, nil +} + +// ListAlertsForOrg lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. +// +// 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?apiVersion=2022-11-28#list-secret-scanning-alerts-for-an-organization +// +//meta:operation GET /orgs/{org}/secret-scanning/alerts +func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/alerts", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var alerts []*SecretScanningAlert + resp, err := s.client.Do(req, &alerts) + if err != nil { + return nil, resp, err + } + + return alerts, resp, nil +} + +// ListAlertsForRepo lists secret scanning alerts for a private repository, from newest to oldest. +// +// 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?apiVersion=2022-11-28#list-secret-scanning-alerts-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts +func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var alerts []*SecretScanningAlert + resp, err := s.client.Do(req, &alerts) + if err != nil { + return nil, resp, err + } + + return alerts, resp, nil +} + +// GetAlert gets a single secret scanning alert detected in a private 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?apiVersion=2022-11-28#get-a-secret-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} +func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string, number int64) (*SecretScanningAlert, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var alert *SecretScanningAlert + resp, err := s.client.Do(req, &alert) + if err != nil { + return nil, resp, err + } + + return alert, resp, nil +} + +// UpdateAlert updates the status of a secret scanning alert in a private 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?apiVersion=2022-11-28#update-a-secret-scanning-alert +// +//meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} +func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, body UpdateSecretScanningAlertRequest) (*SecretScanningAlert, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var alert *SecretScanningAlert + resp, err := s.client.Do(req, &alert) + if err != nil { + return nil, resp, err + } + + return alert, resp, nil +} + +// ListLocationsForAlert lists all locations for a given secret scanning alert for a private 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?apiVersion=2022-11-28#list-locations-for-a-secret-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations +func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner, repo string, number int64, opts *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v/locations", owner, repo, number) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var locations []*SecretScanningAlertLocation + resp, err := s.client.Do(req, &locations) + if err != nil { + return nil, resp, err + } + + 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?apiVersion=2022-11-28#create-a-push-protection-bypass +// +//meta:operation POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses +func (s *SecretScanningService) CreatePushProtectionBypass(ctx context.Context, owner, repo string, body PushProtectionBypassRequest) (*PushProtectionBypass, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/push-protection-bypasses", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var pushProtectionBypass *PushProtectionBypass + resp, err := s.client.Do(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?apiVersion=2022-11-28#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(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secretScanningHistory *SecretScanningScanHistory + resp, err := s.client.Do(req, &secretScanningHistory) + if err != nil { + return nil, resp, err + } + + return secretScanningHistory, resp, nil +} diff --git a/vendor/github.com/google/go-github/v93/github/secret_scanning_custom_patterns.go b/vendor/github.com/google/go-github/v93/github/secret_scanning_custom_patterns.go new file mode 100644 index 000000000..4725f2f7d --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/secret_scanning_custom_patterns.go @@ -0,0 +1,424 @@ +// 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" +) + +// SecretScanningCustomPattern represents a custom pattern for secret scanning, +// as returned by the GitHub API. +// +// GitHub API docs: https://docs.github.com/en/rest/secret-scanning/secret-scanning +type SecretScanningCustomPattern struct { + // ID is the unique identifier of the custom pattern. + ID int64 `json:"id"` + + // Name is the name of the custom pattern. + Name string `json:"name"` + + // Pattern is the regular expression that defines the custom pattern. + Pattern string `json:"pattern"` + + // Slug is the URL-friendly identifier derived from the pattern name. + Slug string `json:"slug"` + + // State is the publish state of the pattern. Possible values are: + // "published" or "unpublished". + State string `json:"state"` + + // PushProtectionEnabled reports whether push protection is enabled for + // this custom pattern. + PushProtectionEnabled bool `json:"push_protection_enabled"` + + // StartDelimiter is the start delimiter regex for the custom pattern. + StartDelimiter *string `json:"start_delimiter,omitempty"` + + // EndDelimiter is the end delimiter regex for the custom pattern. + EndDelimiter *string `json:"end_delimiter,omitempty"` + + // MustMatch is the list of regexes that the secret must match. + MustMatch []string `json:"must_match,omitempty"` + + // MustNotMatch is the list of regexes that the secret must not match. + MustNotMatch []string `json:"must_not_match,omitempty"` + + // CustomPatternVersion is used to confirm you're updating the current + // version of the pattern and to avoid unintentionally overriding + // someone else's update. + CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` + + // CreatedAt is the time the custom pattern was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` + + // UpdatedAt is the time the custom pattern was last updated. + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// SecretScanningCustomPatternRequest represents a single custom pattern to +// be created for secret scanning. +type SecretScanningCustomPatternRequest struct { + // Name is the name of the custom pattern. + Name string `json:"name"` + + // Pattern is the regular expression that defines the custom pattern. + Pattern string `json:"pattern"` + + // StartDelimiter is the start delimiter regex for the custom pattern. + // Defaults to a sensible boundary regex when not specified. + StartDelimiter *string `json:"start_delimiter,omitempty"` + + // EndDelimiter is the end delimiter regex for the custom pattern. + // Defaults to a sensible boundary regex when not specified. + EndDelimiter *string `json:"end_delimiter,omitempty"` + + // MustMatch is the list of regexes that the secret must match. + MustMatch []string `json:"must_match,omitempty"` + + // MustNotMatch is the list of regexes that the secret must not match. + MustNotMatch []string `json:"must_not_match,omitempty"` +} + +// SecretScanningCreateCustomPatternsRequest represents the bulk request body +// used to create one or more custom patterns. +type SecretScanningCreateCustomPatternsRequest struct { + // Patterns is the list of custom patterns to create. + Patterns []*SecretScanningCustomPatternRequest `json:"patterns"` +} + +// SecretScanningCreateCustomPatternsResponse represents the bulk response +// returned after creating one or more custom patterns. +type SecretScanningCreateCustomPatternsResponse struct { + // CreatedPatterns is the list of successfully created custom patterns. + CreatedPatterns []*SecretScanningCustomPattern `json:"created_patterns"` +} + +// SecretScanningCustomPatternToDelete identifies a single custom pattern to +// remove in a bulk delete operation. +type SecretScanningCustomPatternToDelete struct { + // PatternID is the ID of the custom pattern to delete. + PatternID int64 `json:"pattern_id"` + + // CustomPatternVersion is used to confirm you're deleting the current + // version of the pattern. + CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` +} + +// SecretScanningDeleteCustomPatternsRequest represents the bulk request body +// used to delete one or more custom patterns. +type SecretScanningDeleteCustomPatternsRequest struct { + // Patterns is the list of custom patterns to delete. + Patterns []*SecretScanningCustomPatternToDelete `json:"patterns"` + + // PostDeleteAction controls what happens to alerts associated with the + // deleted patterns. Possible values are: "delete_alerts" (default) or + // "resolve_alerts". + PostDeleteAction *string `json:"post_delete_action,omitempty"` +} + +// SecretScanningUpdateCustomPatternRequest represents the fields that can be +// updated on an existing custom pattern. At least one of Pattern, +// StartDelimiter, EndDelimiter, MustMatch, or MustNotMatch must be set. +type SecretScanningUpdateCustomPatternRequest struct { + // Pattern is the updated regular expression of the custom pattern. + Pattern *string `json:"pattern,omitempty"` + + // StartDelimiter is the updated start delimiter regex for the custom + // pattern. + StartDelimiter *string `json:"start_delimiter,omitempty"` + + // EndDelimiter is the updated end delimiter regex for the custom + // pattern. + EndDelimiter *string `json:"end_delimiter,omitempty"` + + // MustMatch is the updated list of regexes that the secret must match. + MustMatch []string `json:"must_match,omitempty"` + + // MustNotMatch is the updated list of regexes that the secret must not + // match. + MustNotMatch []string `json:"must_not_match,omitempty"` + + // CustomPatternVersion is required and is used to confirm you're + // updating the current version of the pattern. + CustomPatternVersion *string `json:"custom_pattern_version"` +} + +// SecretScanningCustomPatternListOptions specifies the optional parameters +// to the SecretScanningService.ListCustomPatternsForRepo method. +type SecretScanningCustomPatternListOptions struct { + // State filters custom patterns by state. Possible values are: + // "published" or "unpublished". When absent, returns patterns in all + // states. + State string `url:"state,omitempty"` + + // PushProtection filters custom patterns by whether push protection is + // enabled. Possible values are: "enabled" or "disabled". When absent, + // returns patterns regardless of push protection status. + PushProtection string `url:"push_protection,omitempty"` + + // Sort is the property to sort the results by. Possible values are: + // "created", "updated", or "name". Default: "created". + Sort string `url:"sort,omitempty"` + + // Direction is the direction to sort the results by. Possible values + // are: "asc" or "desc". Default: "desc". + Direction string `url:"direction,omitempty"` + + // ListOptions controls pagination via Page and PerPage. + ListOptions +} + +// ListCustomPatternsForRepo lists the secret scanning custom patterns +// defined at the repository level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#list-repository-custom-patterns +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/custom-patterns +func (s *SecretScanningService) ListCustomPatternsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningCustomPatternListOptions) ([]*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/custom-patterns", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patterns []*SecretScanningCustomPattern + resp, err := s.client.Do(req, &patterns) + if err != nil { + return nil, resp, err + } + + return patterns, resp, nil +} + +// CreateCustomPatternsForRepo creates one or more secret scanning custom +// patterns at the repository level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-create-repository-custom-patterns +// +//meta:operation POST /repos/{owner}/{repo}/secret-scanning/custom-patterns +func (s *SecretScanningService) CreateCustomPatternsForRepo(ctx context.Context, owner, repo string, body SecretScanningCreateCustomPatternsRequest) (*SecretScanningCreateCustomPatternsResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/custom-patterns", owner, repo) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var result *SecretScanningCreateCustomPatternsResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// UpdateCustomPatternForRepo updates a single secret scanning custom pattern +// at the repository level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#update-a-repository-custom-pattern +// +//meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/custom-patterns/{pattern_id} +func (s *SecretScanningService) UpdateCustomPatternForRepo(ctx context.Context, owner, repo string, patternID int64, body SecretScanningUpdateCustomPatternRequest) (*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/custom-patterns/%v", owner, repo, patternID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var pattern *SecretScanningCustomPattern + resp, err := s.client.Do(req, &pattern) + if err != nil { + return nil, resp, err + } + + return pattern, resp, nil +} + +// DeleteCustomPatternsForRepo deletes one or more secret scanning custom +// patterns at the repository level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-delete-repository-custom-patterns +// +//meta:operation DELETE /repos/{owner}/{repo}/secret-scanning/custom-patterns +func (s *SecretScanningService) DeleteCustomPatternsForRepo(ctx context.Context, owner, repo string, body SecretScanningDeleteCustomPatternsRequest) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/custom-patterns", owner, repo) + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListCustomPatternsForOrg lists the secret scanning custom patterns defined at the organization level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#list-organization-custom-patterns +// +//meta:operation GET /orgs/{org}/secret-scanning/custom-patterns +func (s *SecretScanningService) ListCustomPatternsForOrg(ctx context.Context, org string, opts *SecretScanningCustomPatternListOptions) ([]*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/custom-patterns", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patterns []*SecretScanningCustomPattern + resp, err := s.client.Do(req, &patterns) + if err != nil { + return nil, resp, err + } + + return patterns, resp, nil +} + +// CreateCustomPatternsForOrg creates one or more secret scanning custom patterns at organization level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-create-organization-custom-patterns +// +//meta:operation POST /orgs/{org}/secret-scanning/custom-patterns +func (s *SecretScanningService) CreateCustomPatternsForOrg(ctx context.Context, org string, body SecretScanningCreateCustomPatternsRequest) (*SecretScanningCreateCustomPatternsResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/custom-patterns", org) + + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var result *SecretScanningCreateCustomPatternsResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// UpdateCustomPatternForOrg updates a single secret scanning custom pattern at organization level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#update-an-organization-custom-pattern +// +//meta:operation PATCH /orgs/{org}/secret-scanning/custom-patterns/{pattern_id} +func (s *SecretScanningService) UpdateCustomPatternForOrg(ctx context.Context, org string, patternID int64, body SecretScanningUpdateCustomPatternRequest) (*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/custom-patterns/%v", org, patternID) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var pattern *SecretScanningCustomPattern + resp, err := s.client.Do(req, &pattern) + if err != nil { + return nil, resp, err + } + + return pattern, resp, nil +} + +// DeleteCustomPatternsForOrg deletes one or more secret scanning custom patterns at the organization level. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-delete-organization-custom-patterns +// +//meta:operation DELETE /orgs/{org}/secret-scanning/custom-patterns +func (s *SecretScanningService) DeleteCustomPatternsForOrg(ctx context.Context, org string, body SecretScanningDeleteCustomPatternsRequest) (*Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/custom-patterns", org) + + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListCustomPatternsForEnterprise lists the secret scanning custom patterns defined at the enterprise level. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#list-enterprise-custom-patterns +// +//meta:operation GET /enterprises/{enterprise}/secret-scanning/custom-patterns +func (s *SecretScanningService) ListCustomPatternsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningCustomPatternListOptions) ([]*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/custom-patterns", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + var patterns []*SecretScanningCustomPattern + resp, err := s.client.Do(req, &patterns) + if err != nil { + return nil, resp, err + } + return patterns, resp, nil +} + +// CreateCustomPatternsForEnterprise creates one or more secret scanning custom patterns at the enterprise level. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-create-enterprise-custom-patterns +// +//meta:operation POST /enterprises/{enterprise}/secret-scanning/custom-patterns +func (s *SecretScanningService) CreateCustomPatternsForEnterprise(ctx context.Context, enterprise string, body SecretScanningCreateCustomPatternsRequest) (*SecretScanningCreateCustomPatternsResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/custom-patterns", enterprise) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + var result *SecretScanningCreateCustomPatternsResponse + resp, err := s.client.Do(req, &result) + if err != nil { + return nil, resp, err + } + return result, resp, nil +} + +// UpdateCustomPatternForEnterprise updates a single secret scanning custom pattern at the enterprise level. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#update-an-enterprise-custom-pattern +// +//meta:operation PATCH /enterprises/{enterprise}/secret-scanning/custom-patterns/{pattern_id} +func (s *SecretScanningService) UpdateCustomPatternForEnterprise(ctx context.Context, enterprise string, patternID int64, body SecretScanningUpdateCustomPatternRequest) (*SecretScanningCustomPattern, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/custom-patterns/%v", enterprise, patternID) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + var pattern *SecretScanningCustomPattern + resp, err := s.client.Do(req, &pattern) + if err != nil { + return nil, resp, err + } + return pattern, resp, nil +} + +// DeleteCustomPatternsForEnterprise deletes one or more secret scanning custom patterns at the enterprise level. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/custom-patterns?apiVersion=2022-11-28#bulk-delete-enterprise-custom-patterns +// +//meta:operation DELETE /enterprises/{enterprise}/secret-scanning/custom-patterns +func (s *SecretScanningService) DeleteCustomPatternsForEnterprise(ctx context.Context, enterprise string, body SecretScanningDeleteCustomPatternsRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/custom-patterns", enterprise) + req, err := s.client.NewRequest(ctx, "DELETE", u, body) + if err != nil { + return nil, err + } + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/google/go-github/v93/github/secret_scanning_pattern_configs.go b/vendor/github.com/google/go-github/v93/github/secret_scanning_pattern_configs.go new file mode 100644 index 000000000..de990db99 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/secret_scanning_pattern_configs.go @@ -0,0 +1,163 @@ +// 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" +) + +// SecretScanningPatternConfigs represents a collection of GitHub secret scanning patterns +// and their settings related to push protection. +type SecretScanningPatternConfigs struct { + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` + ProviderPatternOverrides []*SecretScanningPatternOverride `json:"provider_pattern_overrides,omitempty"` + CustomPatternOverrides []*SecretScanningPatternOverride `json:"custom_pattern_overrides,omitempty"` +} + +// 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"` + Slug *string `json:"slug,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + AlertTotal *int `json:"alert_total,omitempty"` + AlertTotalPercentage *int `json:"alert_total_percentage,omitempty"` + FalsePositives *int `json:"false_positives,omitempty"` + FalsePositiveRate *int `json:"false_positive_rate,omitempty"` + Bypassrate *int `json:"bypass_rate,omitempty"` + DefaultSetting *string `json:"default_setting,omitempty"` + EnterpriseSetting *string `json:"enterprise_setting,omitempty"` + Setting *string `json:"setting,omitempty"` +} + +// SecretScanningPatternConfigsUpdate represents a secret scanning pattern configurations update. +type SecretScanningPatternConfigsUpdate struct { + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` +} + +// UpdateSecretScanningPatternConfigsRequest represents a request to update secret scanning pattern configurations. +type UpdateSecretScanningPatternConfigsRequest struct { + // The version of the entity. + PatternConfigVersion *string `json:"pattern_config_version,omitempty"` + + // Pattern settings for provider patterns. + ProviderPatternSettings []*SecretScanningProviderPatternSetting `json:"provider_pattern_settings,omitempty"` + + // Pattern settings for custom patterns. + CustomPatternSettings []*SecretScanningCustomPatternSetting `json:"custom_pattern_settings,omitempty"` +} + +// SecretScanningProviderPatternSetting defines an optional pattern setting for provider patterns. +type SecretScanningProviderPatternSetting struct { + // The ID of the pattern to configure. + TokenType string `json:"token_type"` + + // Push protection setting to set for the pattern. + // Can be one of: "not-set", "disabled", "enabled" + PushProtectionSetting string `json:"push_protection_setting"` +} + +// SecretScanningCustomPatternSetting defines an optional pattern setting for custom patterns. +type SecretScanningCustomPatternSetting struct { + // The ID of the pattern to configure. + TokenType string `json:"token_type"` + + // The version of the entity + CustomPatternVersion *string `json:"custom_pattern_version,omitempty"` + + // Push protection setting to set for the pattern. + // Can be one of: "not-set", "disabled", "enabled" + PushProtectionSetting string `json:"push_protection_setting"` +} + +// ListPatternConfigsForEnterprise lists the secret scanning pattern configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/push-protection?apiVersion=2022-11-28#list-enterprise-pattern-configurations +// +//meta:operation GET /enterprises/{enterprise}/secret-scanning/pattern-configurations +func (s *SecretScanningService) ListPatternConfigsForEnterprise(ctx context.Context, enterprise string) (*SecretScanningPatternConfigs, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(req, &patternConfigs) + if err != nil { + return nil, resp, err + } + + return patternConfigs, resp, nil +} + +// ListPatternConfigsForOrg lists the secret scanning pattern configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/push-protection?apiVersion=2022-11-28#list-organization-pattern-configurations +// +//meta:operation GET /orgs/{org}/secret-scanning/pattern-configurations +func (s *SecretScanningService) ListPatternConfigsForOrg(ctx context.Context, org string) (*SecretScanningPatternConfigs, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(req, &patternConfigs) + if err != nil { + return nil, resp, err + } + + return patternConfigs, resp, nil +} + +// UpdatePatternConfigsForEnterprise updates the secret scanning pattern configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-enterprise-pattern-configurations +// +//meta:operation PATCH /enterprises/{enterprise}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Context, enterprise string, body UpdateSecretScanningPatternConfigsRequest) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(req, &patternConfigsUpdate) + if err != nil { + return nil, resp, err + } + + return patternConfigsUpdate, resp, nil +} + +// UpdatePatternConfigsForOrg updates the secret scanning pattern configurations for an organization. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/push-protection?apiVersion=2022-11-28#update-organization-pattern-configurations +// +//meta:operation PATCH /orgs/{org}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForOrg(ctx context.Context, org string, body UpdateSecretScanningPatternConfigsRequest) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) + + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(req, &patternConfigsUpdate) + if err != nil { + return nil, resp, err + } + + return patternConfigsUpdate, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/security_advisories.go b/vendor/github.com/google/go-github/v93/github/security_advisories.go similarity index 83% rename from vendor/github.com/google/go-github/v69/github/security_advisories.go rename to vendor/github.com/google/go-github/v93/github/security_advisories.go index b5a43f1aa..0b48469bd 100644 --- a/vendor/github.com/google/go-github/v69/github/security_advisories.go +++ b/vendor/github.com/google/go-github/v93/github/security_advisories.go @@ -8,9 +8,14 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) +// SecurityAdvisoriesService handles communication with the security advisories +// related methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/security-advisories?apiVersion=2022-11-28 type SecurityAdvisoriesService service // SecurityAdvisorySubmission represents the Security Advisory Submission. @@ -126,20 +131,20 @@ type Credit struct { // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#request-a-cve-for-a-repository-security-advisory // //meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, ghsaID string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/cve", owner, repo, ghsaID) - req, err := s.client.NewRequest("POST", url, nil) + req, err := s.client.NewRequest(ctx, "POST", url, nil) if err != nil { return nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) if err != nil { - if _, ok := err.(*AcceptedError); ok { + if errors.As(err, new(*AcceptedError)) { return resp, nil } @@ -152,22 +157,22 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, // CreateTemporaryPrivateFork creates a temporary private fork to collaborate on fixing a security vulnerability in your repository. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#create-a-temporary-private-fork // //meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Context, owner, repo, ghsaID string) (*Repository, *Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/forks", owner, repo, ghsaID) - req, err := s.client.NewRequest("POST", url, nil) + req, err := s.client.NewRequest(ctx, "POST", url, nil) if err != nil { return nil, nil, err } - fork := new(Repository) - resp, err := s.client.Do(ctx, req, fork) + var fork *Repository + resp, err := s.client.Do(req, &fork) if err != nil { - if aerr, ok := err.(*AcceptedError); ok { - if err := json.Unmarshal(aerr.Raw, fork); err != nil { + if aerr, ok := errors.AsType[*AcceptedError](err); ok { + if err := json.Unmarshal(aerr.Raw, &fork); err != nil { return fork, resp, err } @@ -181,23 +186,23 @@ func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Conte // ListRepositorySecurityAdvisoriesForOrg lists the repository security advisories for an organization. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#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 } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*SecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -207,23 +212,23 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx c // ListRepositorySecurityAdvisories lists the security advisories in a repository. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#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 } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*SecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -233,7 +238,7 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context // ListGlobalSecurityAdvisories lists all global security advisories. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories?apiVersion=2022-11-28#list-global-security-advisories // //meta:operation GET /advisories func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) ([]*GlobalSecurityAdvisory, *Response, error) { @@ -243,13 +248,13 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con return nil, nil, err } - req, err := s.client.NewRequest("GET", url, nil) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisories []*GlobalSecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisories) + resp, err := s.client.Do(req, &advisories) if err != nil { return nil, resp, err } @@ -259,18 +264,18 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con // GetGlobalSecurityAdvisories gets a global security advisory using its GitHub Security Advisory (GHSA) identifier. // -// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories?apiVersion=2022-11-28#get-a-global-security-advisory // //meta:operation GET /advisories/{ghsa_id} func (s *SecurityAdvisoriesService) GetGlobalSecurityAdvisories(ctx context.Context, ghsaID string) (*GlobalSecurityAdvisory, *Response, error) { - url := fmt.Sprintf("advisories/%s", ghsaID) - req, err := s.client.NewRequest("GET", url, nil) + url := fmt.Sprintf("advisories/%v", ghsaID) + req, err := s.client.NewRequest(ctx, "GET", url, nil) if err != nil { return nil, nil, err } var advisory *GlobalSecurityAdvisory - resp, err := s.client.Do(ctx, req, &advisory) + resp, err := s.client.Do(req, &advisory) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/strings.go b/vendor/github.com/google/go-github/v93/github/strings.go similarity index 56% rename from vendor/github.com/google/go-github/v69/github/strings.go rename to vendor/github.com/google/go-github/v93/github/strings.go index f5e61aa32..dfbe3c685 100644 --- a/vendor/github.com/google/go-github/v69/github/strings.go +++ b/vendor/github.com/google/go-github/v93/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 interface{}) string { - var buf bytes.Buffer +func Stringify(message any) string { + 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/v93/github/sub_issue.go b/vendor/github.com/google/go-github/v93/github/sub_issue.go new file mode 100644 index 000000000..210cee501 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/sub_issue.go @@ -0,0 +1,161 @@ +// 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" +) + +// SubIssueService handles communication with the sub-issue related +// methods of the GitHub API. +// +// Sub-issues help you group and manage your issues with a parent/child relationship. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28 +type SubIssueService service + +// SubIssue represents a GitHub sub-issue on a repository. +// Note: As far as the GitHub API is concerned, every pull request is an issue, +// but not every issue is a pull request. Some endpoints, events, and webhooks +// may also return pull requests via this struct. If PullRequestLinks is nil, +// this is an issue, and if PullRequestLinks is not nil, this is a pull request. +// The IsPullRequest helper method can be used to check that. +type SubIssue Issue + +func (i SubIssue) String() string { + return Stringify(i) +} + +// SubIssueListByIssueOptions specifies the optional parameters to the +// SubIssueService.ListByIssue method. +type SubIssueListByIssueOptions struct { + IssueListByRepoOptions +} + +// SubIssueRequest represents a request to add, remove, or reprioritize sub-issues. +type SubIssueRequest struct { + SubIssueID int64 `json:"sub_issue_id"` // Required: The ID of the sub-issue + AfterID *int64 `json:"after_id,omitempty"` // Optional: Position after this sub-issue ID + BeforeID *int64 `json:"before_id,omitempty"` // Optional: Position before this sub-issue ID + ReplaceParent *bool `json:"replace_parent,omitempty"` // Optional: Whether to replace the existing parent +} + +// Remove a sub-issue from the specified repository. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#remove-sub-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue +func (s *SubIssueService) Remove(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issue", owner, repo, issueNumber) + + req, err := s.client.NewRequest(ctx, "DELETE", u, subIssue) + if err != nil { + return nil, nil, err + } + + var si *SubIssue + resp, err := s.client.Do(req, &si) + if err != nil { + return nil, resp, err + } + + return si, resp, nil +} + +// ListByIssue lists all sub-issues for the specified issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#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 *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 { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var subIssues []*SubIssue + resp, err := s.client.Do(req, &subIssues) + if err != nil { + return nil, resp, err + } + + return subIssues, resp, nil +} + +// Add adds a sub-issue to the specified issue. +// +// The sub-issue to be added must belong to the same repository owner as the parent issue. +// To replace the existing parent of a sub-issue, set replaceParent to true. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#add-sub-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues +func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, body SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) + req, err := s.client.NewRequest(ctx, "POST", u, body) + if err != nil { + return nil, nil, err + } + + var si *SubIssue + resp, err := s.client.Do(req, &si) + if err != nil { + return nil, resp, err + } + + return si, resp, nil +} + +// Reprioritize changes a sub-issue's priority to a different position in the parent list. +// +// Either afterId or beforeId must be specified to determine the new position of the sub-issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#reprioritize-sub-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority +func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, body SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues/priority", owner, repo, issueNumber) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) + if err != nil { + return nil, nil, err + } + + var si *SubIssue + resp, err := s.client.Do(req, &si) + if err != nil { + return nil, resp, err + } + + return si, resp, nil +} + +// GetParentIssue gets the parent issue of a sub-issue. +// +// GitHub API docs: https://docs.github.com/rest/issues/sub-issues?apiVersion=2022-11-28#get-parent-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/parent +func (s *SubIssueService) GetParentIssue(ctx context.Context, owner, repo string, subIssueNumber int64) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/parent", owner, repo, subIssueNumber) + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var parentIssue *Issue + resp, err := s.client.Do(req, &parentIssue) + if err != nil { + return nil, resp, err + } + + return parentIssue, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/teams.go b/vendor/github.com/google/go-github/v93/github/teams.go similarity index 64% rename from vendor/github.com/google/go-github/v69/github/teams.go rename to vendor/github.com/google/go-github/v93/github/teams.go index d334110f4..fe88b8888 100644 --- a/vendor/github.com/google/go-github/v69/github/teams.go +++ b/vendor/github.com/google/go-github/v93/github/teams.go @@ -7,14 +7,14 @@ package github import ( "context" + "encoding/json" "fmt" - "net/http" ) // TeamsService provides access to the team-related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/teams/ +// GitHub API docs: https://docs.github.com/rest/teams?apiVersion=2022-11-28 type TeamsService service // Team represents a team within a GitHub organization. Teams are used to @@ -60,6 +60,15 @@ 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"` + + // AccessSource identifies the source of the team's access to a specific + // repository. Possible values are: "direct", "organization" or "enterprise". + // This is only populated when calling [RepositoriesService.ListTeams]. + AccessSource *string `json:"access_source,omitempty"` } func (t Team) String() string { @@ -88,7 +97,7 @@ func (i Invitation) String() string { // ListTeams lists all of the teams for an organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-teams // //meta:operation GET /orgs/{org}/teams func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) { @@ -98,13 +107,13 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -114,20 +123,18 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti // GetTeamByID fetches a team, given a specified organization ID, by ID. // -// Deprecated: Use GetTeamBySlug instead. -// -// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name // -//meta:operation GET /orgs/{org}/teams/{team_slug} +//meta:operation GET /organizations/{organization_id}/team/{team_id} func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -137,18 +144,18 @@ func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*T // GetTeamBySlug fetches a team, given a specified organization name, by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name // //meta:operation GET /orgs/{org}/teams/{team_slug} func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -156,13 +163,26 @@ func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Te return t, resp, nil } -// NewTeam represents a team to be created or modified. -type NewTeam struct { - Name string `json:"name"` // Name of the team. (Required.) - Description *string `json:"description,omitempty"` - Maintainers []string `json:"maintainers,omitempty"` - RepoNames []string `json:"repo_names,omitempty"` - ParentTeamID *int64 `json:"parent_team_id,omitempty"` +// CreateTeamRequest represents a team to be created. +type CreateTeamRequest struct { + // The name of the team (required). + Name string `json:"name"` + + // The description of the team. + Description *string `json:"description,omitempty"` + + // List GitHub usernames for organization members who will become team maintainers. + Maintainers []string `json:"maintainers,omitempty"` + + // The full name (e.g., "organization-name/repository-name") of repositories to add the team to. + RepoNames []string `json:"repo_names,omitempty"` + + // Privacy identifies the level of privacy this team should have. + // Possible values are: + // secret - only visible to organization owners and members of this team + // closed - visible to all members of this organization + // Default is "secret". + Privacy *string `json:"privacy,omitempty"` // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". NotificationSetting *string `json:"notification_setting,omitempty"` @@ -174,36 +194,36 @@ type NewTeam struct { // specifying a permission value when calling AddTeamRepo. Permission *string `json:"permission,omitempty"` - // Privacy identifies the level of privacy this team should have. - // Possible values are: - // secret - only visible to organization owners and members of this team - // closed - visible to all members of this organization - // Default is "secret". - Privacy *string `json:"privacy,omitempty"` + // The ID of a team to set as the parent team. + ParentTeamID *int64 `json:"parent_team_id,omitempty"` + + // The slug of a team to set as the parent team. + // Ignored when ParentTeamID is also provided. + ParentTeamSlug *string `json:"parent_team_slug,omitempty"` - // LDAPDN may be used in GitHub Enterprise when the team membership - // is synchronized with LDAP. + // Set the distinguished name (DN) of the LDAP entry to map to a team. This is + // only supported by GitHub Enterprise Server. LDAPDN *string `json:"ldap_dn,omitempty"` } -func (s NewTeam) String() string { - return Stringify(s) +func (r CreateTeamRequest) String() string { + return Stringify(r) } // CreateTeam creates a new team within an organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#create-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#create-a-team // //meta:operation POST /orgs/{org}/teams -func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { +func (s *TeamsService) CreateTeam(ctx context.Context, org string, body CreateTeamRequest) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) - req, err := s.client.NewRequest("POST", u, team) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -211,59 +231,75 @@ func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) return t, resp, nil } -// newTeamNoParent is the same as NewTeam but ensures that the -// "parent_team_id" field will be null. It is for internal use -// only and should not be exported. -type newTeamNoParent struct { - Name string `json:"name"` - Description *string `json:"description,omitempty"` - Maintainers []string `json:"maintainers,omitempty"` - RepoNames []string `json:"repo_names,omitempty"` - ParentTeamID *int64 `json:"parent_team_id"` // This will be "null" - NotificationSetting *string `json:"notification_setting,omitempty"` - Privacy *string `json:"privacy,omitempty"` - LDAPDN *string `json:"ldap_dn,omitempty"` +// UpdateTeamRequest represents a team to be updated. +type UpdateTeamRequest struct { + // The name of the team (required). + Name *string `json:"name"` + + // The description of the team. + Description *string `json:"description,omitempty"` + + // Privacy identifies the level of privacy this team should have. + // Possible values are: + // secret - only visible to organization owners and members of this team + // closed - visible to all members of this organization + // Default is "secret". + Privacy *string `json:"privacy,omitempty"` + + // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". + NotificationSetting *string `json:"notification_setting,omitempty"` + + // Deprecated: Permission is deprecated when creating or editing a team in an org + // using the new GitHub permission model. It no longer identifies the + // permission a team has on its repos, but only specifies the default + // permission a repo is initially added with. Avoid confusion by + // specifying a permission value when calling AddTeamRepo. + Permission *string `json:"permission,omitempty"` + + // The ID of a team to set as the parent team. + ParentTeamID *int64 `json:"parent_team_id,omitempty"` + + // The slug of a team to set as the parent team. + // Ignored when ParentTeamID is also provided. + ParentTeamSlug *string `json:"parent_team_slug,omitempty"` + + // If set to true, the parent team will be removed from the team. + RemoveParentTeam bool `json:"-"` +} + +func (r UpdateTeamRequest) String() string { + return Stringify(r) } -// copyNewTeamWithoutParent is used to set the "parent_team_id" -// field to "null" after copying the other fields from a NewTeam. -// It is for internal use only and should not be exported. -func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { - return &newTeamNoParent{ - Name: team.Name, - Description: team.Description, - Maintainers: team.Maintainers, - RepoNames: team.RepoNames, - NotificationSetting: team.NotificationSetting, - Privacy: team.Privacy, - LDAPDN: team.LDAPDN, - } +// MarshalJSON implements the json.Marshaler interface. +func (r UpdateTeamRequest) MarshalJSON() ([]byte, error) { + type alias UpdateTeamRequest + if !r.RemoveParentTeam { + return json.Marshal(alias(r)) + } + return json.Marshal(&struct { + alias + ParentTeamID *int64 `json:"parent_team_id"` + ParentTeamSlug *string `json:"parent_team_slug"` + }{ + alias: alias(r), + }) } -// EditTeamByID edits a team, given an organization ID, selected by ID. -// -// Deprecated: Use EditTeamBySlug instead. +// UpdateTeamByID updates a team, given an organization ID, selected by ID. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // -//meta:operation PATCH /orgs/{org}/teams/{team_slug} -func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) { +//meta:operation PATCH /organizations/{organization_id}/team/{team_id} +func (s *TeamsService) UpdateTeamByID(ctx context.Context, orgID, teamID int64, body UpdateTeamRequest) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) - - var req *http.Request - var err error - if removeParent { - teamRemoveParent := copyNewTeamWithoutParent(&team) - req, err = s.client.NewRequest("PATCH", u, teamRemoveParent) - } else { - req, err = s.client.NewRequest("PATCH", u, team) - } + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -271,28 +307,20 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te return t, resp, nil } -// EditTeamBySlug edits a team, given an organization name, by slug. +// UpdateTeamBySlug updates a team, given an organization name, by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} -func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) { +func (s *TeamsService) UpdateTeamBySlug(ctx context.Context, org, slug string, body UpdateTeamRequest) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - - var req *http.Request - var err error - if removeParent { - teamRemoveParent := copyNewTeamWithoutParent(&team) - req, err = s.client.NewRequest("PATCH", u, teamRemoveParent) - } else { - req, err = s.client.NewRequest("PATCH", u, team) - } + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - t := new(Team) - resp, err := s.client.Do(ctx, req, t) + var t *Team + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -302,43 +330,39 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea // DeleteTeamByID deletes a team referenced by ID. // -// Deprecated: Use DeleteTeamBySlug instead. +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#delete-a-team // -// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team -// -//meta:operation DELETE /orgs/{org}/teams/{team_slug} +//meta:operation DELETE /organizations/{organization_id}/team/{team_id} func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeleteTeamBySlug deletes a team reference by slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#delete-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug} func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListChildTeamsByParentID lists child teams for a parent team given parent ID. // -// Deprecated: Use ListChildTeamsByParentSlug instead. +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-child-teams // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams -// -//meta:operation GET /orgs/{org}/teams/{team_slug}/teams +//meta:operation GET /organizations/{organization_id}/team/{team_id}/teams func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/teams", orgID, teamID) u, err := addOptions(u, opts) @@ -346,13 +370,13 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -362,7 +386,7 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team // ListChildTeamsByParentSlug lists child teams for a parent team given parent slug. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-child-teams // //meta:operation GET /orgs/{org}/teams/{team_slug}/teams func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) { @@ -372,13 +396,13 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -388,11 +412,9 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug // ListTeamReposByID lists the repositories given a team ID that the specified team has access to. // -// Deprecated: Use ListTeamReposBySlug instead. -// -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-team-repositories // -//meta:operation GET /orgs/{org}/teams/{team_slug}/repos +//meta:operation GET /organizations/{organization_id}/team/{team_id}/repos func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos", orgID, teamID) u, err := addOptions(u, opts) @@ -400,16 +422,15 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -419,7 +440,7 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 // ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-team-repositories // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) { @@ -429,16 +450,15 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository - resp, err := s.client.Do(ctx, req, &repos) + resp, err := s.client.Do(req, &repos) if err != nil { return nil, resp, err } @@ -450,22 +470,20 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// Deprecated: Use IsTeamRepoBySlug instead. -// -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository // -//meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} +//meta:operation GET /organizations/{organization_id}/team/{team_id}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOrgPermissionRepo) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -477,20 +495,20 @@ func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#check-team-permissions-for-a-repository // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } req.Header.Set("Accept", mediaTypeOrgPermissionRepo) - repository := new(Repository) - resp, err := s.client.Do(ctx, req, repository) + var repository *Repository + resp, err := s.client.Do(req, &repository) if err != nil { return nil, resp, err } @@ -498,96 +516,91 @@ func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, r return repository, resp, nil } -// TeamAddTeamRepoOptions specifies the optional parameters to the -// TeamsService.AddTeamRepoByID and TeamsService.AddTeamRepoBySlug methods. -type TeamAddTeamRepoOptions struct { +// AddTeamRepoRequest represents a request to add or update a team's permissions on a repository. +type AddTeamRepoRequest 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. // // If not specified, the team's permission attribute will be used. - Permission string `json:"permission,omitempty"` + Permission *string `json:"permission,omitempty"` } // AddTeamRepoByID adds a repository to be managed by the specified team given the team ID. // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// Deprecated: Use AddTeamRepoBySlug instead. -// -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // -//meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} -func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { +//meta:operation PUT /organizations/{organization_id}/team/{team_id}/repos/{owner}/{repo} +func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, body AddTeamRepoRequest) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // AddTeamRepoBySlug adds a repository to be managed by the specified team given the team slug. // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#add-or-update-team-repository-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} -func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { +func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, body AddTeamRepoRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamRepoByID removes a repository from being managed by the specified // team given the team ID. Note that this does not delete the repository, it // just removes it from the team. // -// Deprecated: Use RemoveTeamRepoBySlug instead. -// -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#remove-a-repository-from-a-team // -//meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} +//meta:operation DELETE /organizations/{organization_id}/team/{team_id}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamRepoBySlug removes a repository from being managed by the specified // team given the team slug. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#remove-a-repository-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListUserTeams lists a user's teams // -// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/teams/teams?apiVersion=2022-11-28#list-teams-for-the-authenticated-user // //meta:operation GET /user/teams func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) { @@ -597,13 +610,13 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teams []*Team - resp, err := s.client.Do(ctx, req, &teams) + resp, err := s.client.Do(req, &teams) if err != nil { return nil, resp, err } @@ -613,24 +626,23 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] // ListTeamProjectsByID lists the organization projects for a team given the team ID. // -// Deprecated: Use ListTeamProjectsBySlug instead. +// Deprecated: This endpoint has been deprecated by GitHub. // -// 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 +//meta:operation GET /organizations/{organization_id}/team/{team_id}/projects func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*ProjectV2, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 - resp, err := s.client.Do(ctx, req, &projects) + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -640,22 +652,23 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) var projects []*ProjectV2 - resp, err := s.client.Do(ctx, req, &projects) + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -666,23 +679,22 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str // ReviewTeamProjectsByID checks whether a team, given its ID, has read, write, or admin // permissions for an organization project. // -// Deprecated: Use ReviewTeamProjectsBySlug instead. +// Deprecated: This endpoint has been deprecated by GitHub. // -// 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} +//meta:operation GET /organizations/{organization_id}/team/{team_id}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*ProjectV2, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &ProjectV2{} - resp, err := s.client.Do(ctx, req, &projects) + var projects *ProjectV2 + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -693,21 +705,22 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &ProjectV2{} - resp, err := s.client.Do(ctx, req, &projects) + var projects *ProjectV2 + resp, err := s.client.Do(req, &projects) if err != nil { return nil, resp, err } @@ -715,9 +728,8 @@ func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug s return projects, resp, nil } -// TeamProjectOptions specifies the optional parameters to the -// TeamsService.AddTeamProject method. -type TeamProjectOptions struct { +// AddTeamProjectRequest represents a request to add or update a team's permissions on a project. +type AddTeamProjectRequest struct { // Permission specifies the permission to grant to the team for this project. // Possible values are: // "read" - team members can read, but not write to or administer this project. @@ -731,42 +743,42 @@ type TeamProjectOptions struct { // 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. // -// Deprecated: Use AddTeamProjectBySlug instead. +// Deprecated: This endpoint has been deprecated by GitHub. // -// 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) { +//meta:operation PUT /organizations/{organization_id}/team/{team_id}/projects/{project_id} +func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, body AddTeamProjectRequest) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { 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) + return s.client.Do(req, nil) } // AddTeamProjectBySlug adds an organization project to a team given the team slug. // 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.16/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} -func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) { +func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, body AddTeamProjectRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { 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) + return s.client.Do(req, nil) } // RemoveTeamProjectByID removes an organization project from a team given team ID. @@ -776,22 +788,21 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// Deprecated: Use RemoveTeamProjectBySlug instead. +// Deprecated: This endpoint has been deprecated by GitHub. // -// 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} +//meta:operation DELETE /organizations/{organization_id}/team/{team_id}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // RemoveTeamProjectBySlug removes an organization project from a team given team slug. @@ -801,20 +812,21 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // ListIDPGroupsOptions specifies the optional parameters to the ListIDPGroupsInOrganization method. @@ -839,7 +851,7 @@ type IDPGroup struct { // ListIDPGroupsInOrganization lists IDP groups available in an organization. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-an-organization // //meta:operation GET /orgs/{org}/team-sync/groups func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListIDPGroupsOptions) (*IDPGroupList, *Response, error) { @@ -849,13 +861,13 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -866,21 +878,19 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri // ListIDPGroupsForTeamByID lists IDP groups connected to a team on GitHub // given organization and team IDs. // -// Deprecated: Use ListIDPGroupsForTeamBySlug instead. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-a-team // -//meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings +//meta:operation GET /organizations/{organization_id}/team/{team_id}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -891,19 +901,19 @@ func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, team // ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub // given organization name and team slug. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#list-idp-groups-for-a-team // //meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -914,21 +924,19 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug // CreateOrUpdateIDPGroupConnectionsByID creates, updates, or removes a connection // between a team and an IDP group given organization and team IDs. // -// Deprecated: Use CreateOrUpdateIDPGroupConnectionsBySlug instead. -// -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // -//meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings -func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) { +//meta:operation PATCH /organizations/{organization_id}/team/{team_id}/team-sync/group-mappings +func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, body IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -939,19 +947,19 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context // CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection // between a team and an IDP group given organization name and team slug. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync?apiVersion=2022-11-28#create-or-update-idp-group-connections // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings -func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) { +func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, body IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) - req, err := s.client.NewRequest("PATCH", u, opts) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - groups := new(IDPGroupList) - resp, err := s.client.Do(ctx, req, groups) + var groups *IDPGroupList + resp, err := s.client.Do(req, &groups) if err != nil { return nil, resp, err } @@ -987,20 +995,26 @@ type ExternalGroupList struct { Groups []*ExternalGroup `json:"groups"` } +// UpdateConnectedExternalGroupRequest represents a request to update the connection +// between an external group and a team. +type UpdateConnectedExternalGroupRequest struct { + GroupID int64 `json:"group_id"` +} + // GetExternalGroup fetches an external group. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#get-an-external-group +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#get-an-external-group // //meta:operation GET /orgs/{org}/external-group/{group_id} func (s *TeamsService) GetExternalGroup(ctx context.Context, org string, groupID int64) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/external-group/%v", org, groupID) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroup := new(ExternalGroup) - resp, err := s.client.Do(ctx, req, externalGroup) + var externalGroup *ExternalGroup + resp, err := s.client.Do(req, &externalGroup) if err != nil { return nil, resp, err } @@ -1018,7 +1032,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?apiVersion=2022-11-28#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) { @@ -1028,13 +1042,13 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroups := new(ExternalGroupList) - resp, err := s.client.Do(ctx, req, externalGroups) + var externalGroups *ExternalGroupList + resp, err := s.client.Do(req, &externalGroups) if err != nil { return nil, resp, err } @@ -1044,19 +1058,19 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts // ListExternalGroupsForTeamBySlug lists external groups connected to a team on GitHub. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#list-a-connection-between-an-external-group-and-a-team // //meta:operation GET /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, slug string) (*ExternalGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - externalGroups := new(ExternalGroupList) - resp, err := s.client.Do(ctx, req, externalGroups) + var externalGroups *ExternalGroupList + resp, err := s.client.Do(req, &externalGroups) if err != nil { return nil, resp, err } @@ -1066,19 +1080,19 @@ func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, // UpdateConnectedExternalGroup updates the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#update-the-connection-between-an-external-group-and-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/external-groups -func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, eg *ExternalGroup) (*ExternalGroup, *Response, error) { +func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, body UpdateConnectedExternalGroupRequest) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("PATCH", u, eg) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - externalGroup := new(ExternalGroup) - resp, err := s.client.Do(ctx, req, externalGroup) + var externalGroup *ExternalGroup + resp, err := s.client.Do(req, &externalGroup) if err != nil { return nil, resp, err } @@ -1088,16 +1102,16 @@ func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, sl // RemoveConnectedExternalGroup removes the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups?apiVersion=2022-11-28#remove-the-connection-between-an-external-group-and-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) RemoveConnectedExternalGroup(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v93/github/teams_discussion_comments.go similarity index 65% rename from vendor/github.com/google/go-github/v69/github/teams_discussion_comments.go rename to vendor/github.com/google/go-github/v93/github/teams_discussion_comments.go index 70bcbbc95..84e5e98a8 100644 --- a/vendor/github.com/google/go-github/v69/github/teams_discussion_comments.go +++ b/vendor/github.com/google/go-github/v93/github/teams_discussion_comments.go @@ -43,23 +43,25 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { +func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, opts *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) - u, err := addOptions(u, options) + u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*DiscussionComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -70,23 +72,25 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { +func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, opts *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) - u, err := addOptions(u, options) + u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var comments []*DiscussionComment - resp, err := s.client.Do(ctx, req, &comments) + resp, err := s.client.Do(req, &comments) if err != nil { return nil, resp, err } @@ -97,18 +101,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -119,19 +125,21 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -142,18 +150,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments -func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -164,18 +174,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#create-a-discussion-comment // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments -func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) - req, err := s.client.NewRequest("POST", u, comment) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -187,18 +199,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} -func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -210,18 +224,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussion-comments#update-a-discussion-comment // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} -func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { +func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, body DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("PATCH", u, comment) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - discussionComment := &DiscussionComment{} - resp, err := s.client.Do(ctx, req, discussionComment) + var discussionComment *DiscussionComment + resp, err := s.client.Do(req, &discussionComment) if err != nil { return nil, resp, err } @@ -232,31 +248,35 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/teams_discussions.go b/vendor/github.com/google/go-github/v93/github/teams_discussions.go similarity index 69% rename from vendor/github.com/google/go-github/v69/github/teams_discussions.go rename to vendor/github.com/google/go-github/v93/github/teams_discussions.go index b056525f4..7a17997aa 100644 --- a/vendor/github.com/google/go-github/v69/github/teams_discussions.go +++ b/vendor/github.com/google/go-github/v93/github/teams_discussions.go @@ -49,7 +49,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { @@ -59,13 +61,13 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teamDiscussions []*TeamDiscussion - resp, err := s.client.Do(ctx, req, &teamDiscussions) + resp, err := s.client.Do(req, &teamDiscussions) if err != nil { return nil, resp, err } @@ -76,7 +78,9 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { @@ -86,13 +90,13 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var teamDiscussions []*TeamDiscussion - resp, err := s.client.Do(ctx, req, &teamDiscussions) + resp, err := s.client.Do(req, &teamDiscussions) if err != nil { return nil, resp, err } @@ -103,18 +107,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -125,18 +131,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -147,18 +155,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions -func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) - req, err := s.client.NewRequest("POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -169,18 +179,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#create-a-discussion // //meta:operation POST /orgs/{org}/teams/{team_slug}/discussions -func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) - req, err := s.client.NewRequest("POST", u, discussion) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -192,18 +204,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} -func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -215,18 +229,20 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.13/rest/teams/discussions#update-a-discussion // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} -func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { +func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, body TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("PATCH", u, discussion) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - teamDiscussion := &TeamDiscussion{} - resp, err := s.client.Do(ctx, req, teamDiscussion) + var teamDiscussion *TeamDiscussion + resp, err := s.client.Do(req, &teamDiscussion) if err != nil { return nil, resp, err } @@ -237,31 +253,35 @@ 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // 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 +// Deprecated: This endpoint has been deprecated by GitHub. +// +// 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) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/teams_members.go b/vendor/github.com/google/go-github/v93/github/teams_members.go similarity index 66% rename from vendor/github.com/google/go-github/v69/github/teams_members.go rename to vendor/github.com/google/go-github/v93/github/teams_members.go index 059d993a3..75bbba0db 100644 --- a/vendor/github.com/google/go-github/v69/github/teams_members.go +++ b/vendor/github.com/google/go-github/v93/github/teams_members.go @@ -23,9 +23,9 @@ type TeamListTeamMembersOptions struct { // ListTeamMembersByID lists all of the users who are members of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-team-members // -//meta:operation GET /orgs/{org}/teams/{team_slug}/members +//meta:operation GET /organizations/{organization_id}/team/{team_id}/members func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/members", orgID, teamID) u, err := addOptions(u, opts) @@ -33,13 +33,13 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -50,7 +50,7 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in // ListTeamMembersBySlug lists all of the users who are members of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-team-members // //meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { @@ -60,13 +60,13 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var members []*User - resp, err := s.client.Do(ctx, req, &members) + resp, err := s.client.Do(req, &members) if err != nil { return nil, resp, err } @@ -77,18 +77,18 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri // GetTeamMembershipByID returns the membership status for a user in a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#get-team-membership-for-a-user // -//meta:operation GET /orgs/{org}/teams/{team_slug}/members +//meta:operation GET /organizations/{organization_id}/team/{team_id}/memberships/{username} func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -99,18 +99,18 @@ func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID // GetTeamMembershipBySlug returns the membership status for a user in a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#get-team-membership-for-a-user // //meta:operation GET /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) GetTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -118,9 +118,8 @@ func (s *TeamsService) GetTeamMembershipBySlug(ctx context.Context, org, slug, u return t, resp, nil } -// TeamAddTeamMembershipOptions specifies the optional -// parameters to the TeamsService.AddTeamMembership method. -type TeamAddTeamMembershipOptions struct { +// AddTeamMembershipRequest represents a request to add or update a user's membership in a team. +type AddTeamMembershipRequest struct { // Role specifies the role the user should have in the team. Possible // values are: // member - a normal member of the team @@ -129,24 +128,24 @@ type TeamAddTeamMembershipOptions struct { // maintainer, and edit the team’s name and description // // Default value is "member". - Role string `json:"role,omitempty"` + Role *string `json:"role,omitempty"` } // AddTeamMembershipByID adds or invites a user to a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // -//meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} -func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { +//meta:operation PUT /organizations/{organization_id}/team/{team_id}/memberships/{username} +func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, body AddTeamMembershipRequest) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -157,18 +156,18 @@ func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID // AddTeamMembershipBySlug adds or invites a user to a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#add-or-update-team-membership-for-a-user // //meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} -func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { +func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, body AddTeamMembershipRequest) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, nil, err } - t := new(Membership) - resp, err := s.client.Do(ctx, req, t) + var t *Membership + resp, err := s.client.Do(req, &t) if err != nil { return nil, resp, err } @@ -179,41 +178,41 @@ func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, u // RemoveTeamMembershipByID removes a user from a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#remove-team-membership-for-a-user // -//meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} +//meta:operation DELETE /organizations/{organization_id}/team/{team_id}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RemoveTeamMembershipBySlug removes a user from a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#remove-team-membership-for-a-user // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // ListPendingTeamInvitationsByID gets pending invitation list of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-pending-team-invitations // -//meta:operation GET /orgs/{org}/teams/{team_slug}/invitations +//meta:operation GET /organizations/{organization_id}/team/{team_id}/invitations func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/invitations", orgID, teamID) u, err := addOptions(u, opts) @@ -221,13 +220,13 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } @@ -238,7 +237,7 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID // ListPendingTeamInvitationsBySlug get pending invitation list of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members?apiVersion=2022-11-28#list-pending-team-invitations // //meta:operation GET /orgs/{org}/teams/{team_slug}/invitations func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Invitation, *Response, error) { @@ -248,13 +247,13 @@ func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pendingInvitations []*Invitation - resp, err := s.client.Do(ctx, req, &pendingInvitations) + resp, err := s.client.Do(req, &pendingInvitations) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/timestamp.go b/vendor/github.com/google/go-github/v93/github/timestamp.go similarity index 99% rename from vendor/github.com/google/go-github/v69/github/timestamp.go rename to vendor/github.com/google/go-github/v93/github/timestamp.go index 71660193b..a26077da2 100644 --- a/vendor/github.com/google/go-github/v69/github/timestamp.go +++ b/vendor/github.com/google/go-github/v93/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/v93/github/url.go b/vendor/github.com/google/go-github/v93/github/url.go new file mode 100644 index 000000000..f0411dccc --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/url.go @@ -0,0 +1,33 @@ +// 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 ( + "errors" + "fmt" + "net/url" + "strings" +) + +// parseURL parses the given string as a URL and ensures that the path ends +// with a slash. If the input string is empty, it returns an error. If the URL +// cannot be parsed, it returns the parsing error. +func parseURL(s string) (*url.URL, error) { + if s == "" { + return nil, errors.New("url cannot be empty") + } + + u, err := url.Parse(s) + if err != nil { + return nil, fmt.Errorf("invalid url: %w", err) + } + + if !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + } + + return u, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/users.go b/vendor/github.com/google/go-github/v93/github/users.go similarity index 67% rename from vendor/github.com/google/go-github/v69/github/users.go rename to vendor/github.com/google/go-github/v93/github/users.go index 28db59c5e..e5b92a158 100644 --- a/vendor/github.com/google/go-github/v69/github/users.go +++ b/vendor/github.com/google/go-github/v93/github/users.go @@ -13,13 +13,14 @@ import ( // UsersService handles communication with the user related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/rest/users/ +// GitHub API docs: https://docs.github.com/rest/users?apiVersion=2022-11-28 type UsersService service // User represents a GitHub user. type User struct { Login *string `json:"login,omitempty"` ID *int64 `json:"id,omitempty"` + UserViewType *string `json:"user_view_type,omitempty"` NodeID *string `json:"node_id,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -29,6 +30,7 @@ type User struct { Blog *string `json:"blog,omitempty"` Location *string `json:"location,omitempty"` Email *string `json:"email,omitempty"` + NotificationEmail *string `json:"notification_email,omitempty"` Hireable *bool `json:"hireable,omitempty"` Bio *string `json:"bio,omitempty"` TwitterUsername *string `json:"twitter_username,omitempty"` @@ -48,6 +50,7 @@ type User struct { Collaborators *int `json:"collaborators,omitempty"` TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` Plan *Plan `json:"plan,omitempty"` + BusinessPlus *bool `json:"business_plus,omitempty"` LdapDn *string `json:"ldap_dn,omitempty"` // API URLs @@ -63,13 +66,17 @@ type User struct { SubscriptionsURL *string `json:"subscriptions_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search?apiVersion=2022-11-28#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` - // 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 identify the permissions that a user has on a given + // repository. + // This is only populated when calling [RepositoriesService.ListCollaborators]. + Permissions *RepositoryPermissions `json:"permissions,omitempty"` + + // RoleName identifies the role that a user has on a given repository. + // This is only populated when calling [RepositoriesService.ListCollaborators]. + 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 @@ -78,6 +85,32 @@ type User struct { // InheritedFrom identifies the team that a user inherited their organization role // from. This is only populated when calling the ListUsersAssignedToOrgRole method. InheritedFrom []*Team `json:"inherited_from,omitempty"` + + // Role identifies the role that a user has on a given team. + // Its possible values are: "member", "maintainer". + // This is only populated when calling the + // [TeamsService.ListTeamMembersBySlug] or [TeamsService.ListTeamMembersByID] + // methods. + Role *string `json:"role,omitempty"` + + // Inherited identifies whether a user inherited their team role from a child + // team. + // This is only populated when calling the + // [TeamsService.ListTeamMembersBySlug] or [TeamsService.ListTeamMembersByID] + // methods. + Inherited *bool `json:"inherited,omitempty"` +} + +// UserUpdateRequest represents the request body for updating a user. +type UserUpdateRequest struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + Blog *string `json:"blog,omitempty"` + TwitterUsername *string `json:"twitter_username,omitempty"` + Company *string `json:"company,omitempty"` + Location *string `json:"location,omitempty"` + Hireable *bool `json:"hireable,omitempty"` + Bio *string `json:"bio,omitempty"` } func (u User) String() string { @@ -87,8 +120,9 @@ func (u User) String() string { // Get fetches a user. Passing the empty string will fetch the authenticated // 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 +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user // //meta:operation GET /user //meta:operation GET /users/{username} @@ -99,13 +133,13 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, } else { u = "user" } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) + var uResp *User + resp, err := s.client.Do(req, &uResp) if err != nil { return nil, resp, err } @@ -115,18 +149,18 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, // GetByID fetches a user. // -// GitHub API docs: https://docs.github.com/rest/users/users#get-a-user-using-their-id +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-a-user-using-their-id // //meta:operation GET /user/{account_id} func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { - u := fmt.Sprintf("user/%d", id) - req, err := s.client.NewRequest("GET", u, nil) + u := fmt.Sprintf("user/%v", id) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - user := new(User) - resp, err := s.client.Do(ctx, req, user) + var user *User + resp, err := s.client.Do(req, &user) if err != nil { return nil, resp, err } @@ -134,20 +168,20 @@ func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, return user, resp, nil } -// Edit the authenticated user. +// Update the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/users#update-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#update-the-authenticated-user // //meta:operation PATCH /user -func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { +func (s *UsersService) Update(ctx context.Context, body UserUpdateRequest) (*User, *Response, error) { u := "user" - req, err := s.client.NewRequest("PATCH", u, user) + req, err := s.client.NewRequest(ctx, "PATCH", u, body) if err != nil { return nil, nil, err } - uResp := new(User) - resp, err := s.client.Do(ctx, req, uResp) + var uResp *User + resp, err := s.client.Do(req, &uResp) if err != nil { return nil, resp, err } @@ -180,7 +214,7 @@ type UserContext struct { // GetHovercard fetches contextual information about user. It requires authentication // via Basic Auth or via OAuth with the repo scope. // -// GitHub API docs: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#get-contextual-information-for-a-user // //meta:operation GET /users/{username}/hovercard func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *HovercardOptions) (*Hovercard, *Response, error) { @@ -190,13 +224,13 @@ func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *Hove return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - hc := new(Hovercard) - resp, err := s.client.Do(ctx, req, hc) + var hc *Hovercard + resp, err := s.client.Do(req, &hc) if err != nil { return nil, resp, err } @@ -207,20 +241,16 @@ 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. // // To paginate through all users, populate 'Since' with the ID of the last user. // -// GitHub API docs: https://docs.github.com/rest/users/users#list-users +// GitHub API docs: https://docs.github.com/rest/users/users?apiVersion=2022-11-28#list-users // //meta:operation GET /users func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*User, *Response, error) { @@ -229,13 +259,13 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -246,7 +276,7 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U // ListInvitations lists all currently-open repository invitations for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#list-repository-invitations-for-the-authenticated-user // //meta:operation GET /user/repository_invitations func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { @@ -255,13 +285,13 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } invites := []*RepositoryInvitation{} - resp, err := s.client.Do(ctx, req, &invites) + resp, err := s.client.Do(req, &invites) if err != nil { return nil, resp, err } @@ -272,31 +302,31 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( // AcceptInvitation accepts the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#accept-a-repository-invitation // //meta:operation PATCH /user/repository_invitations/{invitation_id} func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("PATCH", u, nil) + req, err := s.client.NewRequest(ctx, "PATCH", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DeclineInvitation declines the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations?apiVersion=2022-11-28#decline-a-repository-invitation // //meta:operation DELETE /user/repository_invitations/{invitation_id} func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_administration.go b/vendor/github.com/google/go-github/v93/github/users_administration.go similarity index 60% rename from vendor/github.com/google/go-github/v69/github/users_administration.go rename to vendor/github.com/google/go-github/v93/github/users_administration.go index c0aa3b649..95bc4b657 100644 --- a/vendor/github.com/google/go-github/v69/github/users_administration.go +++ b/vendor/github.com/google/go-github/v93/github/users_administration.go @@ -12,69 +12,77 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := fmt.Sprintf("users/%v/site_admin", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/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) { u := fmt.Sprintf("users/%v/site_admin", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } -// UserSuspendOptions represents the reason a user is being suspended. -type UserSuspendOptions struct { +// SuspendUserRequest represents a request to suspend a user. +type SuspendUserRequest struct { Reason *string `json:"reason,omitempty"` } // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended -func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { +func (s *UsersService) Suspend(ctx context.Context, user string, body SuspendUserRequest) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) - req, err := s.client.NewRequest("PUT", u, opts) + req, err := s.client.NewRequest(ctx, "PUT", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) +} + +// UnsuspendUserRequest represents a request to unsuspend a user. +type UnsuspendUserRequest struct { + // Reason is the reason the user is being unsuspended, which is logged in the audit log. + // If it is not provided, it defaults to "Unsuspended via API by SITE_ADMINISTRATOR", + // where SITE_ADMINISTRATOR is the person who performed the action. + Reason *string `json:"reason,omitempty"` } // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.22/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended -func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { +func (s *UsersService) Unsuspend(ctx context.Context, user string, body UnsuspendUserRequest) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, body) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_attestations.go b/vendor/github.com/google/go-github/v93/github/users_attestations.go similarity index 81% rename from vendor/github.com/google/go-github/v69/github/users_attestations.go rename to vendor/github.com/google/go-github/v93/github/users_attestations.go index 18f60298d..23200cad3 100644 --- a/vendor/github.com/google/go-github/v69/github/users_attestations.go +++ b/vendor/github.com/google/go-github/v93/github/users_attestations.go @@ -14,24 +14,24 @@ import ( // with a given subject digest that are associated with repositories // owned by a user. // -// GitHub API docs: https://docs.github.com/rest/users/attestations#list-attestations +// GitHub API docs: https://docs.github.com/rest/users/attestations?apiVersion=2022-11-28#list-attestations // //meta:operation GET /users/{username}/attestations/{subject_digest} func (s *UsersService) ListAttestations(ctx context.Context, user, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { - var u = fmt.Sprintf("users/%v/attestations/%v", user, subjectDigest) + u := fmt.Sprintf("users/%v/attestations/%v", user, subjectDigest) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var attestations *AttestationsResponse - res, err := s.client.Do(ctx, req, &attestations) + res, err := s.client.Do(req, &attestations) if err != nil { return nil, res, err } diff --git a/vendor/github.com/google/go-github/v69/github/users_blocking.go b/vendor/github.com/google/go-github/v93/github/users_blocking.go similarity index 65% rename from vendor/github.com/google/go-github/v69/github/users_blocking.go rename to vendor/github.com/google/go-github/v93/github/users_blocking.go index 3f2af38f6..9fa4da631 100644 --- a/vendor/github.com/google/go-github/v69/github/users_blocking.go +++ b/vendor/github.com/google/go-github/v93/github/users_blocking.go @@ -12,7 +12,7 @@ import ( // ListBlockedUsers lists all the blocked users by the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#list-users-blocked-by-the-authenticated-user // //meta:operation GET /user/blocks func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) ([]*User, *Response, error) { @@ -22,16 +22,15 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User - resp, err := s.client.Do(ctx, req, &blockedUsers) + resp, err := s.client.Do(req, &blockedUsers) if err != nil { return nil, resp, err } @@ -41,59 +40,56 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) // IsBlocked reports whether specified user is blocked by the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#check-if-a-user-is-blocked-by-the-authenticated-user // //meta:operation GET /user/blocks/{username} func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { 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) + resp, err := s.client.Do(req, nil) isBlocked, err := parseBoolResponse(err) return isBlocked, resp, err } // BlockUser blocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#block-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#block-a-user // //meta:operation PUT /user/blocks/{username} func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } // UnblockUser unblocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/blocking#unblock-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking?apiVersion=2022-11-28#unblock-a-user // //meta:operation DELETE /user/blocks/{username} func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { 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) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_emails.go b/vendor/github.com/google/go-github/v93/github/users_emails.go similarity index 53% rename from vendor/github.com/google/go-github/v69/github/users_emails.go rename to vendor/github.com/google/go-github/v93/github/users_emails.go index 3d0e1bfaa..77cde73dc 100644 --- a/vendor/github.com/google/go-github/v69/github/users_emails.go +++ b/vendor/github.com/google/go-github/v93/github/users_emails.go @@ -17,7 +17,7 @@ type UserEmail struct { // ListEmails lists all email addresses for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#list-email-addresses-for-the-authenticated-user // //meta:operation GET /user/emails func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*UserEmail, *Response, error) { @@ -27,13 +27,39 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var emails []*UserEmail - resp, err := s.client.Do(ctx, req, &emails) + resp, err := s.client.Do(req, &emails) + if err != nil { + return nil, resp, err + } + + return emails, resp, nil +} + +// ListPublicEmails lists public email addresses for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#list-public-email-addresses-for-the-authenticated-user +// +//meta:operation GET /user/public_emails +func (s *UsersService) ListPublicEmails(ctx context.Context, opts *ListOptions) ([]*UserEmail, *Response, error) { + u := "user/public_emails" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var emails []*UserEmail + resp, err := s.client.Do(req, &emails) if err != nil { return nil, resp, err } @@ -43,18 +69,18 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us // AddEmails adds email addresses of the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#add-an-email-address-for-the-authenticated-user // //meta:operation POST /user/emails -func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { +func (s *UsersService) AddEmails(ctx context.Context, body []string) ([]*UserEmail, *Response, error) { u := "user/emails" - req, err := s.client.NewRequest("POST", u, emails) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } var e []*UserEmail - resp, err := s.client.Do(ctx, req, &e) + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } @@ -64,23 +90,23 @@ func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserE // DeleteEmails deletes email addresses from authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/emails#delete-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#delete-an-email-address-for-the-authenticated-user // //meta:operation DELETE /user/emails func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) { u := "user/emails" - req, err := s.client.NewRequest("DELETE", u, emails) + req, err := s.client.NewRequest(ctx, "DELETE", u, emails) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // SetEmailVisibility sets the visibility for the primary email address of the authenticated user. // `visibility` can be "private" or "public". // -// GitHub API docs: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails?apiVersion=2022-11-28#set-primary-email-visibility-for-the-authenticated-user // //meta:operation PATCH /user/email/visibility func (s *UsersService) SetEmailVisibility(ctx context.Context, visibility string) ([]*UserEmail, *Response, error) { @@ -90,13 +116,13 @@ func (s *UsersService) SetEmailVisibility(ctx context.Context, visibility string Visibility: &visibility, } - req, err := s.client.NewRequest("PATCH", u, updateVisibilityReq) + req, err := s.client.NewRequest(ctx, "PATCH", u, updateVisibilityReq) if err != nil { return nil, nil, err } var e []*UserEmail - resp, err := s.client.Do(ctx, req, &e) + resp, err := s.client.Do(req, &e) if err != nil { return nil, resp, err } diff --git a/vendor/github.com/google/go-github/v69/github/users_followers.go b/vendor/github.com/google/go-github/v93/github/users_followers.go similarity index 78% rename from vendor/github.com/google/go-github/v69/github/users_followers.go rename to vendor/github.com/google/go-github/v93/github/users_followers.go index ec6f531ea..4543cb8ec 100644 --- a/vendor/github.com/google/go-github/v69/github/users_followers.go +++ b/vendor/github.com/google/go-github/v93/github/users_followers.go @@ -13,8 +13,9 @@ import ( // ListFollowers lists the followers for a user. Passing the empty string will // 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 +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-followers-of-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-followers-of-the-authenticated-user // //meta:operation GET /user/followers //meta:operation GET /users/{username}/followers @@ -30,13 +31,13 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -47,8 +48,9 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis // ListFollowing lists the people that a user is following. Passing the empty // 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 +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-the-people-a-user-follows +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#list-the-people-the-authenticated-user-follows // //meta:operation GET /user/following //meta:operation GET /users/{username}/following @@ -64,13 +66,13 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var users []*User - resp, err := s.client.Do(ctx, req, &users) + resp, err := s.client.Do(req, &users) if err != nil { return nil, resp, err } @@ -81,8 +83,9 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis // IsFollowing checks if "user" is following "target". Passing the empty // 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 +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#check-if-a-person-is-followed-by-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#check-if-a-user-follows-another-user // //meta:operation GET /user/following/{username} //meta:operation GET /users/{username}/following/{target_user} @@ -94,42 +97,42 @@ func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bo u = fmt.Sprintf("user/following/%v", target) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return false, nil, err } - resp, err := s.client.Do(ctx, req, nil) + resp, err := s.client.Do(req, nil) following, err := parseBoolResponse(err) return following, resp, err } // Follow will cause the authenticated user to follow the specified user. // -// GitHub API docs: https://docs.github.com/rest/users/followers#follow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#follow-a-user // //meta:operation PUT /user/following/{username} func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("PUT", u, nil) + req, err := s.client.NewRequest(ctx, "PUT", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // Unfollow will cause the authenticated user to unfollow the specified user. // -// GitHub API docs: https://docs.github.com/rest/users/followers#unfollow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#unfollow-a-user // //meta:operation DELETE /user/following/{username} func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v93/github/users_gpg_keys.go similarity index 77% rename from vendor/github.com/google/go-github/v69/github/users_gpg_keys.go rename to vendor/github.com/google/go-github/v93/github/users_gpg_keys.go index 2f296a1ef..f22ab81b2 100644 --- a/vendor/github.com/google/go-github/v69/github/users_gpg_keys.go +++ b/vendor/github.com/google/go-github/v93/github/users_gpg_keys.go @@ -44,8 +44,9 @@ type GPGEmail struct { // string will fetch keys for the authenticated user. It requires authentication // 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 +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#list-gpg-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#list-gpg-keys-for-the-authenticated-user // //meta:operation GET /user/gpg_keys //meta:operation GET /users/{username}/gpg_keys @@ -61,13 +62,13 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*GPGKey - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -78,18 +79,18 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO // GetGPGKey gets extended details for a single GPG key. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#get-a-gpg-key-for-the-authenticated-user // //meta:operation GET /user/gpg_keys/{gpg_key_id} func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) + var key *GPGKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -100,20 +101,20 @@ func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Respo // CreateGPGKey creates a GPG key. It requires authentication via Basic Auth // or OAuth with at least write:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#create-a-gpg-key-for-the-authenticated-user // //meta:operation POST /user/gpg_keys func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { gpgKey := &struct { ArmoredPublicKey string `json:"armored_public_key"` }{ArmoredPublicKey: armoredPublicKey} - req, err := s.client.NewRequest("POST", "user/gpg_keys", gpgKey) + req, err := s.client.NewRequest(ctx, "POST", "user/gpg_keys", gpgKey) if err != nil { return nil, nil, err } - key := &GPGKey{} - resp, err := s.client.Do(ctx, req, key) + var key *GPGKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -124,15 +125,15 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string // DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or // via OAuth with at least admin:gpg_key scope. // -// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys?apiVersion=2022-11-28#delete-a-gpg-key-for-the-authenticated-user // //meta:operation DELETE /user/gpg_keys/{gpg_key_id} func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_keys.go b/vendor/github.com/google/go-github/v93/github/users_keys.go similarity index 61% rename from vendor/github.com/google/go-github/v69/github/users_keys.go rename to vendor/github.com/google/go-github/v93/github/users_keys.go index 4d42986ed..a7a54b44e 100644 --- a/vendor/github.com/google/go-github/v69/github/users_keys.go +++ b/vendor/github.com/google/go-github/v93/github/users_keys.go @@ -17,6 +17,7 @@ type Key struct { URL *string `json:"url,omitempty"` Title *string `json:"title,omitempty"` ReadOnly *bool `json:"read_only,omitempty"` + Enabled *bool `json:"enabled,omitempty"` Verified *bool `json:"verified,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` AddedBy *string `json:"added_by,omitempty"` @@ -27,11 +28,19 @@ func (k Key) String() string { return Stringify(k) } +// CreateUserKeyRequest represents a request to create a public SSH key for the +// authenticated user. +type CreateUserKeyRequest struct { + Title *string `json:"title,omitempty"` + Key string `json:"key"` +} + // ListKeys lists the verified public keys for a user. Passing the empty // 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 +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#list-public-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#list-public-ssh-keys-for-the-authenticated-user // //meta:operation GET /user/keys //meta:operation GET /users/{username}/keys @@ -47,13 +56,13 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*Key - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -63,19 +72,19 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti // GetKey fetches a single public key. // -// GitHub API docs: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#get-a-public-ssh-key-for-the-authenticated-user // //meta:operation GET /user/keys/{key_id} func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(Key) - resp, err := s.client.Do(ctx, req, key) + var key *Key + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -85,19 +94,19 @@ func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, e // CreateKey adds a public key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#create-a-public-ssh-key-for-the-authenticated-user // //meta:operation POST /user/keys -func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { +func (s *UsersService) CreateKey(ctx context.Context, body CreateUserKeyRequest) (*Key, *Response, error) { u := "user/keys" - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - k := new(Key) - resp, err := s.client.Do(ctx, req, k) + var k *Key + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -107,16 +116,16 @@ func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response // DeleteKey deletes a public key. // -// GitHub API docs: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys?apiVersion=2022-11-28#delete-a-public-ssh-key-for-the-authenticated-user // //meta:operation DELETE /user/keys/{key_id} func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v69/github/users_packages.go b/vendor/github.com/google/go-github/v93/github/users_packages.go similarity index 59% rename from vendor/github.com/google/go-github/v69/github/users_packages.go rename to vendor/github.com/google/go-github/v93/github/users_packages.go index 3ccf68a16..5fa3596ac 100644 --- a/vendor/github.com/google/go-github/v69/github/users_packages.go +++ b/vendor/github.com/google/go-github/v93/github/users_packages.go @@ -8,13 +8,15 @@ package github import ( "context" "fmt" + "net/url" ) // ListPackages lists the packages for a user. Passing the empty string for "user" will // 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 +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#list-packages-for-the-authenticated-users-namespace // //meta:operation GET /user/packages //meta:operation GET /users/{username}/packages @@ -30,13 +32,13 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var packages []*Package - resp, err := s.client.Do(ctx, req, &packages) + resp, err := s.client.Do(req, &packages) if err != nil { return nil, resp, err } @@ -47,26 +49,29 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack // GetPackage gets a package by name for a user. Passing the empty string for "user" will // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name} //meta:operation GET /users/{username}/packages/{package_type}/{package_name} func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packageName string) (*Package, *Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, packageName) + u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, url.PathEscape(packageName)) } else { - u = fmt.Sprintf("user/packages/%v/%v", packageType, packageName) + u = fmt.Sprintf("user/packages/%v/%v", packageType, url.PathEscape(packageName)) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var pack *Package - resp, err := s.client.Do(ctx, req, &pack) + resp, err := s.client.Do(req, &pack) if err != nil { return nil, resp, err } @@ -77,78 +82,110 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag // DeletePackage deletes a package from a user. Passing the empty string for "user" will // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-for-the-authenticated-user // //meta:operation DELETE /user/packages/{package_type}/{package_name} //meta:operation DELETE /users/{username}/packages/{package_type}/{package_name} func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, packageName) + u = fmt.Sprintf("users/%v/packages/%v/%v", user, packageType, url.PathEscape(packageName)) } else { - u = fmt.Sprintf("user/packages/%v/%v", packageType, packageName) + u = fmt.Sprintf("user/packages/%v/%v", packageType, url.PathEscape(packageName)) } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // RestorePackage restores a package to a user. Passing the empty string for "user" will // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-for-the-authenticated-user // //meta:operation POST /user/packages/{package_type}/{package_name}/restore //meta:operation POST /users/{username}/packages/{package_type}/{package_name}/restore func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/restore", user, packageType, packageName) + u = fmt.Sprintf("users/%v/packages/%v/%v/restore", user, packageType, url.PathEscape(packageName)) } else { - u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, packageName) + u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, url.PathEscape(packageName)) } - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) +} + +// 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 } -// PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will -// get versions for the authenticated user. +// 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#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, url.PathEscape(packageName)) u, err := addOptions(u, opts) if err != nil { return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var versions []*PackageVersion - resp, err := s.client.Do(ctx, req, &versions) + resp, err := s.client.Do(req, &versions) + if err != nil { + return nil, resp, err + } + + return versions, resp, nil +} + +// ListUserPackageVersions returns package versions for a public package owned by a specified user. +// +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#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, url.PathEscape(packageName)) + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var versions []*PackageVersion + resp, err := s.client.Do(req, &versions) if err != nil { return nil, resp, err } @@ -159,26 +196,29 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#get-a-package-version-for-the-authenticated-user // //meta:operation GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} //meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, packageName, packageVersionID) + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, url.PathEscape(packageName), packageVersionID) } else { - u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) + u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, url.PathEscape(packageName), packageVersionID) } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var version *PackageVersion - resp, err := s.client.Do(ctx, req, &version) + resp, err := s.client.Do(req, &version) if err != nil { return nil, resp, err } @@ -189,47 +229,53 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, // PackageDeleteVersion deletes a package version for a user. Passing the empty string for "user" will // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-a-package-version-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#delete-package-version-for-a-user // //meta:operation DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} //meta:operation DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, packageName, packageVersionID) + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v", user, packageType, url.PathEscape(packageName), packageVersionID) } else { - u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, packageName, packageVersionID) + u = fmt.Sprintf("user/packages/%v/%v/versions/%v", packageType, url.PathEscape(packageName), packageVersionID) } - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } // PackageRestoreVersion restores a package version to a user. Passing the empty string for "user" will // 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 +// Note: the package name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-a-package-version-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/packages/packages?apiVersion=2022-11-28#restore-package-version-for-a-user // //meta:operation POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore //meta:operation POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *UsersService) PackageRestoreVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { - u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v/restore", user, packageType, packageName, packageVersionID) + u = fmt.Sprintf("users/%v/packages/%v/%v/versions/%v/restore", user, packageType, url.PathEscape(packageName), packageVersionID) } else { - u = fmt.Sprintf("user/packages/%v/%v/versions/%v/restore", packageType, packageName, packageVersionID) + u = fmt.Sprintf("user/packages/%v/%v/versions/%v/restore", packageType, url.PathEscape(packageName), packageVersionID) } - req, err := s.client.NewRequest("POST", u, nil) + req, err := s.client.NewRequest(ctx, "POST", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-github/v93/github/users_social_accounts.go b/vendor/github.com/google/go-github/v93/github/users_social_accounts.go new file mode 100644 index 000000000..ebef40265 --- /dev/null +++ b/vendor/github.com/google/go-github/v93/github/users_social_accounts.go @@ -0,0 +1,110 @@ +// 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" +) + +// SocialAccount represents a social account linked to a user. +type SocialAccount struct { + Provider *string `json:"provider,omitempty"` + 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?apiVersion=2022-11-28#list-social-accounts-for-the-authenticated-user +// +//meta:operation GET /user/social_accounts +func (s *UsersService) ListSocialAccounts(ctx context.Context, opts *ListOptions) ([]*SocialAccount, *Response, error) { + u := "user/social_accounts" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var socialAccounts []*SocialAccount + resp, err := s.client.Do(req, &socialAccounts) + if err != nil { + return nil, resp, err + } + + return socialAccounts, resp, nil +} + +// AddSocialAccounts adds social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#add-social-accounts-for-the-authenticated-user +// +//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(ctx, "POST", u, &socialAccountsRequest{AccountURLs: accountURLs}) + if err != nil { + return nil, nil, err + } + + var accounts []*SocialAccount + resp, err := s.client.Do(req, &accounts) + if err != nil { + return nil, resp, err + } + + return accounts, resp, nil +} + +// DeleteSocialAccounts deletes social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#delete-social-accounts-for-the-authenticated-user +// +//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(ctx, "DELETE", u, &socialAccountsRequest{AccountURLs: accountURLs}) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListUserSocialAccounts lists all social accounts for a user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts?apiVersion=2022-11-28#list-social-accounts-for-a-user +// +//meta:operation GET /users/{username}/social_accounts +func (s *UsersService) ListUserSocialAccounts(ctx context.Context, username string, opts *ListOptions) ([]*SocialAccount, *Response, error) { + u := fmt.Sprintf("users/%v/social_accounts", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, "GET", u, nil) + if err != nil { + return nil, nil, err + } + + var addedAccounts []*SocialAccount + resp, err := s.client.Do(req, &addedAccounts) + if err != nil { + return nil, resp, err + } + + return addedAccounts, resp, nil +} diff --git a/vendor/github.com/google/go-github/v69/github/users_ssh_signing_keys.go b/vendor/github.com/google/go-github/v93/github/users_ssh_signing_keys.go similarity index 71% rename from vendor/github.com/google/go-github/v69/github/users_ssh_signing_keys.go rename to vendor/github.com/google/go-github/v93/github/users_ssh_signing_keys.go index fcc930be6..8df9ac5dc 100644 --- a/vendor/github.com/google/go-github/v69/github/users_ssh_signing_keys.go +++ b/vendor/github.com/google/go-github/v93/github/users_ssh_signing_keys.go @@ -22,11 +22,19 @@ func (k SSHSigningKey) String() string { return Stringify(k) } +// CreateSSHSigningKeyRequest represents a request to create an SSH signing key +// for the authenticated user. +type CreateSSHSigningKeyRequest struct { + Title *string `json:"title,omitempty"` + Key string `json:"key"` +} + // ListSSHSigningKeys lists the SSH signing keys for a user. Passing an empty // 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 +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-a-user +// +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#list-ssh-signing-keys-for-the-authenticated-user // //meta:operation GET /user/ssh_signing_keys //meta:operation GET /users/{username}/ssh_signing_keys @@ -42,13 +50,13 @@ func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts return nil, nil, err } - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } var keys []*SSHSigningKey - resp, err := s.client.Do(ctx, req, &keys) + resp, err := s.client.Do(req, &keys) if err != nil { return nil, resp, err } @@ -58,19 +66,19 @@ func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts // GetSSHSigningKey fetches a single SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#get-an-ssh-signing-key-for-the-authenticated-user // //meta:operation GET /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSigningKey, *Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) - req, err := s.client.NewRequest("GET", u, nil) + req, err := s.client.NewRequest(ctx, "GET", u, nil) if err != nil { return nil, nil, err } - key := new(SSHSigningKey) - resp, err := s.client.Do(ctx, req, key) + var key *SSHSigningKey + resp, err := s.client.Do(req, &key) if err != nil { return nil, resp, err } @@ -80,19 +88,19 @@ func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSign // CreateSSHSigningKey adds a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#create-a-ssh-signing-key-for-the-authenticated-user // //meta:operation POST /user/ssh_signing_keys -func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHSigningKey, *Response, error) { +func (s *UsersService) CreateSSHSigningKey(ctx context.Context, body CreateSSHSigningKeyRequest) (*SSHSigningKey, *Response, error) { u := "user/ssh_signing_keys" - req, err := s.client.NewRequest("POST", u, key) + req, err := s.client.NewRequest(ctx, "POST", u, body) if err != nil { return nil, nil, err } - k := new(SSHSigningKey) - resp, err := s.client.Do(ctx, req, k) + var k *SSHSigningKey + resp, err := s.client.Do(req, &k) if err != nil { return nil, resp, err } @@ -102,16 +110,16 @@ func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHS // DeleteSSHSigningKey deletes a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys?apiVersion=2022-11-28#delete-an-ssh-signing-key-for-the-authenticated-user // //meta:operation DELETE /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) DeleteSSHSigningKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) + req, err := s.client.NewRequest(ctx, "DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(ctx, req, nil) + return s.client.Do(req, nil) } diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go index 91198f819..c93695403 100644 --- a/vendor/github.com/google/go-querystring/query/encode.go +++ b/vendor/github.com/google/go-querystring/query/encode.go @@ -6,22 +6,21 @@ // // As a simple example: // -// type Options struct { -// Query string `url:"q"` -// ShowAll bool `url:"all"` -// Page int `url:"page"` -// } +// type Options struct { +// Query string `url:"q"` +// ShowAll bool `url:"all"` +// Page int `url:"page"` +// } // -// opt := Options{ "foo", true, 2 } -// v, _ := query.Values(opt) -// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" +// opt := Options{ "foo", true, 2 } +// v, _ := query.Values(opt) +// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" // // The exact mapping between Go values and url.Values is described in the // documentation for the Values() function. package query import ( - "bytes" "fmt" "net/url" "reflect" @@ -47,8 +46,8 @@ type Encoder interface { // // Each exported struct field is encoded as a URL parameter unless // -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option +// - the field's tag is "-", or +// - the field is empty and its tag specifies the "omitempty" option // // The empty values are false, 0, any nil pointer or interface value, any array // slice, map, or string of length zero, and any type (such as time.Time) that @@ -59,19 +58,19 @@ type Encoder interface { // field's tag value is the key name, followed by an optional comma and // options. For example: // -// // Field is ignored by this package. -// Field int `url:"-"` +// // Field is ignored by this package. +// Field int `url:"-"` // -// // Field appears as URL parameter "myName". -// Field int `url:"myName"` +// // Field appears as URL parameter "myName". +// Field int `url:"myName"` // -// // Field appears as URL parameter "myName" and the field is omitted if -// // its value is empty -// Field int `url:"myName,omitempty"` +// // Field appears as URL parameter "myName" and the field is omitted if +// // its value is empty +// Field int `url:"myName,omitempty"` // -// // Field appears as URL parameter "Field" (the default), but the field -// // is skipped if empty. Note the leading comma. -// Field int `url:",omitempty"` +// // Field appears as URL parameter "Field" (the default), but the field +// // is skipped if empty. Note the leading comma. +// Field int `url:",omitempty"` // // For encoding individual field values, the following type-dependent rules // apply: @@ -88,8 +87,8 @@ type Encoder interface { // "url" tag) will use the value of the "layout" tag as a layout passed to // time.Format. For example: // -// // Encode a time.Time as YYYY-MM-DD -// Field time.Time `layout:"2006-01-02"` +// // Encode a time.Time as YYYY-MM-DD +// Field time.Time `layout:"2006-01-02"` // // Slice and Array values default to encoding as multiple URL values of the // same name. Including the "comma" option signals that the field should be @@ -103,9 +102,9 @@ type Encoder interface { // from the "url" tag) will use the value of the "del" tag as the delimiter. // For example: // -// // Encode a slice of bools as ints ("1" for true, "0" for false), -// // separated by exclamation points "!". -// Field []bool `url:",int" del:"!"` +// // Encode a slice of bools as ints ("1" for true, "0" for false), +// // separated by exclamation points "!". +// Field []bool `url:",int" del:"!"` // // Anonymous struct fields are usually encoded as if their inner exported // fields were fields in the outer struct, subject to the standard Go @@ -114,10 +113,10 @@ type Encoder interface { // // Non-nil pointer values are encoded as the value pointed to. // -// Nested structs are encoded including parent fields in value names for -// scoping. e.g: +// Nested structs have their fields processed recursively and are encoded +// including parent fields in value names for scoping. For example, // -// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" +// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" // // All other values are encoded using their default string representation. // @@ -125,6 +124,11 @@ type Encoder interface { // as multiple URL values of the same name. func Values(v interface{}) (url.Values, error) { values := make(url.Values) + + if v == nil { + return values, nil + } + val := reflect.ValueOf(v) for val.Kind() == reflect.Ptr { if val.IsNil() { @@ -133,10 +137,6 @@ func Values(v interface{}) (url.Values, error) { val = val.Elem() } - if v == nil { - return values, nil - } - if val.Kind() != reflect.Struct { return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind()) } @@ -209,6 +209,11 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { } if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { + if sv.Len() == 0 { + // skip if slice or array is empty + continue + } + var del string if opts.Contains("comma") { del = "," @@ -223,7 +228,7 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { } if del != "" { - s := new(bytes.Buffer) + s := new(strings.Builder) first := true for i := 0; i < sv.Len(); i++ { if first { diff --git a/vendor/modules.txt b/vendor/modules.txt index 597099189..c9c614db7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -421,11 +421,11 @@ github.com/golang/snappy # github.com/google/go-github/v64 v64.0.0 ## explicit; go 1.21 github.com/google/go-github/v64/github -# github.com/google/go-github/v69 v69.2.0 -## explicit; go 1.22.0 -github.com/google/go-github/v69/github -# github.com/google/go-querystring v1.1.0 -## explicit; go 1.10 +# github.com/google/go-github/v93 v93.0.0 +## explicit; go 1.26.0 +github.com/google/go-github/v93/github +# github.com/google/go-querystring v1.2.0 +## explicit; go 1.13 github.com/google/go-querystring/query # github.com/google/uuid v1.6.0 ## explicit From ed31d46fbee2ad421da08870da9c453ad62a47af Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Sat, 7 Nov 2026 16:56:20 +0000 Subject: [PATCH 2/3] Make go-github pointer type arguments explicit for vet Co-authored-by: c1-squire-dev[bot] --- pkg/connector/app_privatekey_test.go | 4 +- pkg/connector/app_test.go | 14 +-- .../enterprise_installations_test.go | 2 +- pkg/connector/invitation_test.go | 64 +++++------ pkg/connector/org.go | 4 +- pkg/connector/repository.go | 4 +- pkg/connector/repository_test.go | 6 +- pkg/connector/team.go | 2 +- pkg/connector/usage_event_feed.go | 6 +- pkg/connector/usage_event_feed_test.go | 100 +++++++++--------- test/mocks/github.go | 8 +- 11 files changed, 107 insertions(+), 107 deletions(-) diff --git a/pkg/connector/app_privatekey_test.go b/pkg/connector/app_privatekey_test.go index 5d791aba5..c4b0b0de4 100644 --- a/pkg/connector/app_privatekey_test.go +++ b/pkg/connector/app_privatekey_test.go @@ -53,8 +53,8 @@ func TestLoadPrivateKeyFromString(t *testing.T) { realNewlines := string(pemBytes) shapes := map[string]string{ - "real newlines": realNewlines, - "real CRLF": strings.ReplaceAll(realNewlines, "\n", "\r\n"), + "real newlines": realNewlines, + "real CRLF": strings.ReplaceAll(realNewlines, "\n", "\r\n"), "backslash-n escaped, as the docs instruct": strings.ReplaceAll(realNewlines, "\n", `\n`), "backslash-n escaped, trailing space": strings.ReplaceAll(realNewlines, "\n", `\n`) + " ", "backslash-r-backslash-n escaped (CRLF file)": strings.ReplaceAll(realNewlines, "\n", `\r\n`), diff --git a/pkg/connector/app_test.go b/pkg/connector/app_test.go index a2186dff6..dd5a92b0a 100644 --- a/pkg/connector/app_test.go +++ b/pkg/connector/app_test.go @@ -14,13 +14,13 @@ func TestAppResource(t *testing.T) { ctx := context.Background() installation := &github.Installation{ - ID: github.Ptr(int64(42)), - AppID: github.Ptr(int64(7)), - AppSlug: github.Ptr("octo-app"), - TargetType: github.Ptr("Organization"), - RepositorySelection: github.Ptr("all"), - HTMLURL: github.Ptr("https://github.com/organizations/acme/settings/installations/42"), - Account: &github.User{Login: github.Ptr("acme")}, + ID: github.Ptr[int64](int64(42)), + AppID: github.Ptr[int64](int64(7)), + AppSlug: github.Ptr[string]("octo-app"), + TargetType: github.Ptr[string]("Organization"), + RepositorySelection: github.Ptr[string]("all"), + HTMLURL: github.Ptr[string]("https://github.com/organizations/acme/settings/installations/42"), + Account: &github.User{Login: github.Ptr[string]("acme")}, } parent := &v2.ResourceId{ResourceType: resourceTypeOrg.Id, Resource: "1"} diff --git a/pkg/connector/enterprise_installations_test.go b/pkg/connector/enterprise_installations_test.go index f580df7f3..3895c3faa 100644 --- a/pkg/connector/enterprise_installations_test.go +++ b/pkg/connector/enterprise_installations_test.go @@ -38,7 +38,7 @@ func newGitHubAPITestClientAt(t *testing.T, handler http.Handler, basePath strin require.NoError(t, err) baseURL = baseURL.JoinPath(basePath) - client, err := github.NewClient(github.WithHTTPClient(srv.Client()), github.WithURLs(github.Ptr(baseURL.String()), nil)) + client, err := github.NewClient(github.WithHTTPClient(srv.Client()), github.WithURLs(github.Ptr[string](baseURL.String()), nil)) require.NoError(t, err) return client diff --git a/pkg/connector/invitation_test.go b/pkg/connector/invitation_test.go index f8afa1e75..da1e25ea1 100644 --- a/pkg/connector/invitation_test.go +++ b/pkg/connector/invitation_test.go @@ -57,8 +57,8 @@ func orgByIDHandler() mock.MockBackendOption { mocks.GetOrganizationById, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write(mock.MustMarshal(github.Organization{ - ID: github.Ptr(invitationTestOrgID), - Login: github.Ptr(invitationTestOrgLogin), + ID: github.Ptr[int64](invitationTestOrgID), + Login: github.Ptr[string](invitationTestOrgLogin), })) }), ) @@ -86,26 +86,26 @@ func TestInvitationListPagination(t *testing.T) { pendingPage1 := []*github.Invitation{ { - ID: github.Ptr(int64(1001)), - Login: github.Ptr("alice"), - Email: github.Ptr("alice@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(1001)), + Login: github.Ptr[string]("alice"), + Email: github.Ptr[string]("alice@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, }, { - ID: github.Ptr(int64(1002)), - Login: github.Ptr("bob"), - Email: github.Ptr("bob@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(1002)), + Login: github.Ptr[string]("bob"), + Email: github.Ptr[string]("bob@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated2}, }, } pendingPage2 := []*github.Invitation{ { - ID: github.Ptr(int64(1003)), - Login: github.Ptr("carol"), - Email: github.Ptr("carol@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(1003)), + Login: github.Ptr[string]("carol"), + Email: github.Ptr[string]("carol@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated3}, }, } @@ -116,39 +116,39 @@ func TestInvitationListPagination(t *testing.T) { // for failures that aren't expirations. failedPage1 := []*github.Invitation{ { - ID: github.Ptr(int64(2001)), - Email: github.Ptr("dave-expired@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(2001)), + Email: github.Ptr[string]("dave-expired@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, FailedAt: &github.Timestamp{Time: expiredFailedAt1}, - FailedReason: github.Ptr("Invitation expired. User did not accept this invite for 7 days"), + FailedReason: github.Ptr[string]("Invitation expired. User did not accept this invite for 7 days"), }, { - ID: github.Ptr(int64(2002)), - Email: github.Ptr("eve-inactive@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(2002)), + Email: github.Ptr[string]("eve-inactive@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, FailedAt: &github.Timestamp{Time: expiredFailedAt1}, - FailedReason: github.Ptr("user_was_inactive"), + FailedReason: github.Ptr[string]("user_was_inactive"), }, } failedPage2 := []*github.Invitation{ { - ID: github.Ptr(int64(2003)), - Email: github.Ptr("frank-expired@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, - CreatedAt: &github.Timestamp{Time: pendingCreated2}, - FailedAt: &github.Timestamp{Time: expiredFailedAt2}, + ID: github.Ptr[int64](int64(2003)), + Email: github.Ptr[string]("frank-expired@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, + CreatedAt: &github.Timestamp{Time: pendingCreated2}, + FailedAt: &github.Timestamp{Time: expiredFailedAt2}, // Uppercase variant locks in case-insensitive matching. - FailedReason: github.Ptr("INVITATION EXPIRED"), + FailedReason: github.Ptr[string]("INVITATION EXPIRED"), }, { - ID: github.Ptr(int64(2004)), - Email: github.Ptr("grace-unexpected@example.com"), - Inviter: &github.User{Login: github.Ptr("admin")}, + ID: github.Ptr[int64](int64(2004)), + Email: github.Ptr[string]("grace-unexpected@example.com"), + Inviter: &github.User{Login: github.Ptr[string]("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated2}, FailedAt: &github.Timestamp{Time: expiredFailedAt2}, - FailedReason: github.Ptr("unexpected_failure"), + FailedReason: github.Ptr[string]("unexpected_failure"), }, } diff --git a/pkg/connector/org.go b/pkg/connector/org.go index 331840182..e30a543e2 100644 --- a/pkg/connector/org.go +++ b/pkg/connector/org.go @@ -344,7 +344,7 @@ func (o *orgResourceType) Grant(ctx context.Context, principal *v2.Resource, en } // User is a member but grant is for admin, so make them an admin. - _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr(orgRoleAdmin)}) + _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr[string](orgRoleAdmin)}) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to make user an admin") } @@ -406,7 +406,7 @@ func (o *orgResourceType) Revoke(ctx context.Context, grant *v2.Grant) (annotati return nil, nil } - _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr(orgRoleMember)}) + _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr[string](orgRoleMember)}) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to revoke org admin from user") } diff --git a/pkg/connector/repository.go b/pkg/connector/repository.go index 443470de7..1d4aedd01 100644 --- a/pkg/connector/repository.go +++ b/pkg/connector/repository.go @@ -470,7 +470,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour repo.GetOwner().GetLogin(), repo.GetName(), user.GetLogin(), - github.AddCollaboratorRequest{Permission: github.Ptr(permission)}, + github.AddCollaboratorRequest{Permission: github.Ptr[string](permission)}, ) if er != nil { @@ -487,7 +487,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour } resp, err = o.client.Teams.AddTeamRepoBySlug(ctx, org.GetLogin(), team.GetSlug(), repo.GetOwner().GetLogin(), repo.GetName(), github.AddTeamRepoRequest{ - Permission: github.Ptr(permission), + Permission: github.Ptr[string](permission), }) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to add team to repository") diff --git a/pkg/connector/repository_test.go b/pkg/connector/repository_test.go index 488953943..1c088dea1 100644 --- a/pkg/connector/repository_test.go +++ b/pkg/connector/repository_test.go @@ -26,13 +26,13 @@ func TestCollaboratorPermissions(t *testing.T) { {name: "missing permissions"}, { name: "false flags do not grant access", - permissions: &github.RepositoryPermissions{Pull: github.Ptr(false)}, + permissions: &github.RepositoryPermissions{Pull: github.Ptr[bool](false)}, }, { name: "all GitHub flags retain their entitlement names", permissions: &github.RepositoryPermissions{ - Pull: github.Ptr(true), Triage: github.Ptr(true), Push: github.Ptr(true), - Maintain: github.Ptr(true), Admin: github.Ptr(true), + Pull: github.Ptr[bool](true), Triage: github.Ptr[bool](true), Push: github.Ptr[bool](true), + Maintain: github.Ptr[bool](true), Admin: github.Ptr[bool](true), }, want: []string{repoPermissionPull, repoPermissionTriage, repoPermissionPush, repoPermissionMaintain, repoPermissionAdmin}, }, diff --git a/pkg/connector/team.go b/pkg/connector/team.go index 981c07312..7b969aebe 100644 --- a/pkg/connector/team.go +++ b/pkg/connector/team.go @@ -311,7 +311,7 @@ func (o *teamResourceType) Grant(ctx context.Context, principal *v2.Resource, en orgId, teamId, user.GetLogin(), - github.AddTeamMembershipRequest{Role: github.Ptr(permission)}, + github.AddTeamMembershipRequest{Role: github.Ptr[string](permission)}, ) if er != nil { diff --git a/pkg/connector/usage_event_feed.go b/pkg/connector/usage_event_feed.go index 89301158b..d4565dfe3 100644 --- a/pkg/connector/usage_event_feed.go +++ b/pkg/connector/usage_event_feed.go @@ -148,12 +148,12 @@ func (f *usageEventFeed) ListEvents( orgName := cursor.Orgs[cursor.OrgIndex] opts := &github.GetAuditLogOptions{ - Order: github.Ptr("desc"), + Order: github.Ptr[string]("desc"), // "web" excludes raw git-protocol events (push/fetch/clone), // which dominate audit-log volume without losing members who are // otherwise covered by their web/API activity. - Include: github.Ptr("web"), - Phrase: github.Ptr(sincePhrase), + Include: github.Ptr[string]("web"), + Phrase: github.Ptr[string](sincePhrase), ListCursorOptions: github.ListCursorOptions{ PerPage: maxPageSize, }, diff --git a/pkg/connector/usage_event_feed_test.go b/pkg/connector/usage_event_feed_test.go index ab02661f4..dcdddcee6 100644 --- a/pkg/connector/usage_event_feed_test.go +++ b/pkg/connector/usage_event_feed_test.go @@ -27,9 +27,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "valid entry", entry: &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: true, @@ -37,8 +37,8 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing actor id", entry: &github.AuditEntry{ - Actor: github.Ptr("octocat"), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: false, @@ -46,8 +46,8 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing org id is still attributable", entry: &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), Timestamp: &github.Timestamp{Time: ts}, }, ok: true, @@ -55,18 +55,18 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing timestamp", entry: &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), }, ok: false, }, { name: "bot actor by login suffix", entry: &github.AuditEntry{ - Actor: github.Ptr("dependabot[bot]"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("dependabot[bot]"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: false, @@ -74,9 +74,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "bot actor by actor_is_bot field", entry: &github.AuditEntry{ - Actor: github.Ptr("some-app-installation"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("some-app-installation"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, AdditionalFields: map[string]interface{}{"actor_is_bot": true}, }, @@ -85,9 +85,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "actor_is_bot false overrides a non-matching suffix check", entry: &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, AdditionalFields: map[string]interface{}{"actor_is_bot": false}, }, @@ -116,12 +116,12 @@ func TestUsageEventFromAuditEntry_IdFallback(t *testing.T) { t.Run("uses the real document id when present", func(t *testing.T) { entry := &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, - DocumentID: github.Ptr("real-doc-id"), - Action: github.Ptr("repo.create"), + DocumentID: github.Ptr[string]("real-doc-id"), + Action: github.Ptr[string]("repo.create"), } evt, ok := usageEventFromAuditEntry(entry) require.True(t, ok) @@ -130,11 +130,11 @@ func TestUsageEventFromAuditEntry_IdFallback(t *testing.T) { t.Run("synthesizes a stable id when the document id is missing", func(t *testing.T) { entry := &github.AuditEntry{ - Actor: github.Ptr("octocat"), - ActorID: github.Ptr(int64(123)), - OrgID: github.Ptr(int64(456)), + Actor: github.Ptr[string]("octocat"), + ActorID: github.Ptr[int64](int64(123)), + OrgID: github.Ptr[int64](int64(456)), Timestamp: &github.Timestamp{Time: ts}, - Action: github.Ptr("repo.create"), + Action: github.Ptr[string]("repo.create"), } evt, ok := usageEventFromAuditEntry(entry) require.True(t, ok) @@ -147,7 +147,7 @@ func TestUsageEventFeed_ListEvents_GracefulDegradation(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -168,7 +168,7 @@ func TestUsageEventFeed_ListEvents_SkipsOrgOn404(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -189,7 +189,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnServerError(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -210,7 +210,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnRateLimit(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -238,13 +238,13 @@ func TestUsageEventFeed_ListEvents_FiltersToSinceBoundary(t *testing.T) { // Entries in descending order, as requested (Order: "desc"). entries := []*github.AuditEntry{ - {Actor: github.Ptr("alice"), ActorID: github.Ptr(int64(1)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer1}}, - {Actor: github.Ptr("bob"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer2}}, - {Actor: github.Ptr("carol"), ActorID: github.Ptr(int64(3)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: older}}, + {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer1}}, + {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer2}}, + {Actor: github.Ptr[string]("carol"), ActorID: github.Ptr[int64](int64(3)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: older}}, } httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatch(mock.GetOrgsAuditLogByOrg, entries), ) @@ -261,7 +261,7 @@ func TestUsageEventFeed_ListEvents_ZeroEarliestEventFallsBackToDefaultLookback(t var gotPhrase string httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -293,15 +293,15 @@ func TestUsageEventFeed_ListEvents_ContinuesPastAnAllFilteredPage(t *testing.T) // Page 1 is entirely bot activity - every entry gets filtered out by // usageEventFromAuditEntry, so no event is ever appended on this page. page1 := []*github.AuditEntry{ - {Actor: github.Ptr("dependabot[bot]"), ActorID: github.Ptr(int64(1)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("dependabot[bot]"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } page2 := []*github.AuditEntry{ - {Actor: github.Ptr("octocat"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } calls := 0 httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -334,15 +334,15 @@ func TestUsageEventFeed_ListEvents_ReturnsTightestRateLimit(t *testing.T) { newer := since.Add(1 * time.Hour) page1 := []*github.AuditEntry{ - {Actor: github.Ptr("octocat"), ActorID: github.Ptr(int64(1)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } page2 := []*github.AuditEntry{ - {Actor: github.Ptr("alice"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } calls := 0 httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -387,18 +387,18 @@ func TestUsageEventFeed_ListEvents_AdvancesAcrossMultipleOrgs(t *testing.T) { entriesByOrg := map[string][]*github.AuditEntry{ "octo-org-a": { - {Actor: github.Ptr("alice"), ActorID: github.Ptr(int64(1)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, }, "octo-org-b": { - {Actor: github.Ptr("bob"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, }, } var seenOrgs []string httpClient := mock.NewMockedHTTPClient( mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{ - {Login: github.Ptr("octo-org-a")}, - {Login: github.Ptr("octo-org-b")}, + {Login: github.Ptr[string]("octo-org-a")}, + {Login: github.Ptr[string]("octo-org-b")}, }), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, @@ -454,7 +454,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedCursor(t *testing.T) { gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr("bob"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), @@ -497,7 +497,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedAfterCursor(t *testing.T) gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr("bob"), ActorID: github.Ptr(int64(2)), OrgID: github.Ptr(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), @@ -538,7 +538,7 @@ func TestUsageEventFeed_ListEvents_RecoversFromOutOfBoundsCursor(t *testing.T) { gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr("octocat"), ActorID: github.Ptr(int64(1)), OrgID: github.Ptr(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), diff --git a/test/mocks/github.go b/test/mocks/github.go index 3746b2fd8..91f949f6d 100644 --- a/test/mocks/github.go +++ b/test/mocks/github.go @@ -116,7 +116,7 @@ func (mgh MockGitHub) Seed() ( ID: &userId, Login: &userIdStr, Email: &email, - Permissions: &github.RepositoryPermissions{Pull: github.Ptr(true)}, + Permissions: &github.RepositoryPermissions{Pull: github.Ptr[bool](true)}, } githubRepository := github.Repository{ ID: &repositoryId, @@ -416,8 +416,8 @@ func (mgh MockGitHub) getMembers( func userToMembership(user *github.User) github.Membership { return github.Membership{ User: user, - Role: github.Ptr("admin"), - State: github.Ptr("active"), + Role: github.Ptr[string]("admin"), + State: github.Ptr[string]("active"), } } @@ -791,7 +791,7 @@ func (mgh *MockGitHub) AddUserToOrgRole(roleID int64, userID int64) { // what GitHub returns to credentials without org-owner visibility. func (mgh *MockGitHub) SetOrgDefaultRepoPermission(orgID int64, permission string) { org := mgh.organizations[orgID] - org.DefaultRepoPermission = github.Ptr(permission) + org.DefaultRepoPermission = github.Ptr[string](permission) mgh.organizations[orgID] = org } From 2650d134e977e3ee9f72919c78727f52c70a341c Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Sat, 7 Nov 2026 17:26:52 +0000 Subject: [PATCH 3/3] Use Go pointer expressions in place of GitHub helpers Replace calls marked for inlining by go-github v93 with the standard new(value) syntax supported by the connector toolchain. Co-authored-by: c1-squire-dev[bot] --- pkg/connector/app_test.go | 14 +-- .../enterprise_installations_test.go | 2 +- pkg/connector/invitation_test.go | 60 +++++------ pkg/connector/org.go | 4 +- pkg/connector/repository.go | 4 +- pkg/connector/repository_test.go | 6 +- pkg/connector/team.go | 2 +- pkg/connector/usage_event_feed.go | 6 +- pkg/connector/usage_event_feed_test.go | 100 +++++++++--------- test/mocks/github.go | 8 +- 10 files changed, 103 insertions(+), 103 deletions(-) diff --git a/pkg/connector/app_test.go b/pkg/connector/app_test.go index dd5a92b0a..193681cd5 100644 --- a/pkg/connector/app_test.go +++ b/pkg/connector/app_test.go @@ -14,13 +14,13 @@ func TestAppResource(t *testing.T) { ctx := context.Background() installation := &github.Installation{ - ID: github.Ptr[int64](int64(42)), - AppID: github.Ptr[int64](int64(7)), - AppSlug: github.Ptr[string]("octo-app"), - TargetType: github.Ptr[string]("Organization"), - RepositorySelection: github.Ptr[string]("all"), - HTMLURL: github.Ptr[string]("https://github.com/organizations/acme/settings/installations/42"), - Account: &github.User{Login: github.Ptr[string]("acme")}, + ID: new(int64(42)), + AppID: new(int64(7)), + AppSlug: new("octo-app"), + TargetType: new("Organization"), + RepositorySelection: new("all"), + HTMLURL: new("https://github.com/organizations/acme/settings/installations/42"), + Account: &github.User{Login: new("acme")}, } parent := &v2.ResourceId{ResourceType: resourceTypeOrg.Id, Resource: "1"} diff --git a/pkg/connector/enterprise_installations_test.go b/pkg/connector/enterprise_installations_test.go index 3895c3faa..1a54387c8 100644 --- a/pkg/connector/enterprise_installations_test.go +++ b/pkg/connector/enterprise_installations_test.go @@ -38,7 +38,7 @@ func newGitHubAPITestClientAt(t *testing.T, handler http.Handler, basePath strin require.NoError(t, err) baseURL = baseURL.JoinPath(basePath) - client, err := github.NewClient(github.WithHTTPClient(srv.Client()), github.WithURLs(github.Ptr[string](baseURL.String()), nil)) + client, err := github.NewClient(github.WithHTTPClient(srv.Client()), github.WithURLs(new(baseURL.String()), nil)) require.NoError(t, err) return client diff --git a/pkg/connector/invitation_test.go b/pkg/connector/invitation_test.go index da1e25ea1..357d00dce 100644 --- a/pkg/connector/invitation_test.go +++ b/pkg/connector/invitation_test.go @@ -57,8 +57,8 @@ func orgByIDHandler() mock.MockBackendOption { mocks.GetOrganizationById, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write(mock.MustMarshal(github.Organization{ - ID: github.Ptr[int64](invitationTestOrgID), - Login: github.Ptr[string](invitationTestOrgLogin), + ID: new(invitationTestOrgID), + Login: new(invitationTestOrgLogin), })) }), ) @@ -86,26 +86,26 @@ func TestInvitationListPagination(t *testing.T) { pendingPage1 := []*github.Invitation{ { - ID: github.Ptr[int64](int64(1001)), - Login: github.Ptr[string]("alice"), - Email: github.Ptr[string]("alice@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(1001)), + Login: new("alice"), + Email: new("alice@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, }, { - ID: github.Ptr[int64](int64(1002)), - Login: github.Ptr[string]("bob"), - Email: github.Ptr[string]("bob@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(1002)), + Login: new("bob"), + Email: new("bob@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated2}, }, } pendingPage2 := []*github.Invitation{ { - ID: github.Ptr[int64](int64(1003)), - Login: github.Ptr[string]("carol"), - Email: github.Ptr[string]("carol@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(1003)), + Login: new("carol"), + Email: new("carol@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated3}, }, } @@ -116,39 +116,39 @@ func TestInvitationListPagination(t *testing.T) { // for failures that aren't expirations. failedPage1 := []*github.Invitation{ { - ID: github.Ptr[int64](int64(2001)), - Email: github.Ptr[string]("dave-expired@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(2001)), + Email: new("dave-expired@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, FailedAt: &github.Timestamp{Time: expiredFailedAt1}, - FailedReason: github.Ptr[string]("Invitation expired. User did not accept this invite for 7 days"), + FailedReason: new("Invitation expired. User did not accept this invite for 7 days"), }, { - ID: github.Ptr[int64](int64(2002)), - Email: github.Ptr[string]("eve-inactive@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(2002)), + Email: new("eve-inactive@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated1}, FailedAt: &github.Timestamp{Time: expiredFailedAt1}, - FailedReason: github.Ptr[string]("user_was_inactive"), + FailedReason: new("user_was_inactive"), }, } failedPage2 := []*github.Invitation{ { - ID: github.Ptr[int64](int64(2003)), - Email: github.Ptr[string]("frank-expired@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(2003)), + Email: new("frank-expired@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated2}, FailedAt: &github.Timestamp{Time: expiredFailedAt2}, // Uppercase variant locks in case-insensitive matching. - FailedReason: github.Ptr[string]("INVITATION EXPIRED"), + FailedReason: new("INVITATION EXPIRED"), }, { - ID: github.Ptr[int64](int64(2004)), - Email: github.Ptr[string]("grace-unexpected@example.com"), - Inviter: &github.User{Login: github.Ptr[string]("admin")}, + ID: new(int64(2004)), + Email: new("grace-unexpected@example.com"), + Inviter: &github.User{Login: new("admin")}, CreatedAt: &github.Timestamp{Time: pendingCreated2}, FailedAt: &github.Timestamp{Time: expiredFailedAt2}, - FailedReason: github.Ptr[string]("unexpected_failure"), + FailedReason: new("unexpected_failure"), }, } diff --git a/pkg/connector/org.go b/pkg/connector/org.go index e30a543e2..59dc44b60 100644 --- a/pkg/connector/org.go +++ b/pkg/connector/org.go @@ -344,7 +344,7 @@ func (o *orgResourceType) Grant(ctx context.Context, principal *v2.Resource, en } // User is a member but grant is for admin, so make them an admin. - _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr[string](orgRoleAdmin)}) + _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: new(orgRoleAdmin)}) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to make user an admin") } @@ -406,7 +406,7 @@ func (o *orgResourceType) Revoke(ctx context.Context, grant *v2.Grant) (annotati return nil, nil } - _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: github.Ptr[string](orgRoleMember)}) + _, resp, err = o.client.Organizations.EditOrgMembership(ctx, user.GetLogin(), orgName, &github.Membership{Role: new(orgRoleMember)}) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to revoke org admin from user") } diff --git a/pkg/connector/repository.go b/pkg/connector/repository.go index 1d4aedd01..84182754c 100644 --- a/pkg/connector/repository.go +++ b/pkg/connector/repository.go @@ -470,7 +470,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour repo.GetOwner().GetLogin(), repo.GetName(), user.GetLogin(), - github.AddCollaboratorRequest{Permission: github.Ptr[string](permission)}, + github.AddCollaboratorRequest{Permission: new(permission)}, ) if er != nil { @@ -487,7 +487,7 @@ func (o *repositoryResourceType) Grant(ctx context.Context, principal *v2.Resour } resp, err = o.client.Teams.AddTeamRepoBySlug(ctx, org.GetLogin(), team.GetSlug(), repo.GetOwner().GetLogin(), repo.GetName(), github.AddTeamRepoRequest{ - Permission: github.Ptr[string](permission), + Permission: new(permission), }) if err != nil { return nil, wrapGitHubError(err, resp, "github-connector: failed to add team to repository") diff --git a/pkg/connector/repository_test.go b/pkg/connector/repository_test.go index 1c088dea1..18460ee64 100644 --- a/pkg/connector/repository_test.go +++ b/pkg/connector/repository_test.go @@ -26,13 +26,13 @@ func TestCollaboratorPermissions(t *testing.T) { {name: "missing permissions"}, { name: "false flags do not grant access", - permissions: &github.RepositoryPermissions{Pull: github.Ptr[bool](false)}, + permissions: &github.RepositoryPermissions{Pull: new(false)}, }, { name: "all GitHub flags retain their entitlement names", permissions: &github.RepositoryPermissions{ - Pull: github.Ptr[bool](true), Triage: github.Ptr[bool](true), Push: github.Ptr[bool](true), - Maintain: github.Ptr[bool](true), Admin: github.Ptr[bool](true), + Pull: new(true), Triage: new(true), Push: new(true), + Maintain: new(true), Admin: new(true), }, want: []string{repoPermissionPull, repoPermissionTriage, repoPermissionPush, repoPermissionMaintain, repoPermissionAdmin}, }, diff --git a/pkg/connector/team.go b/pkg/connector/team.go index 7b969aebe..df6ea650d 100644 --- a/pkg/connector/team.go +++ b/pkg/connector/team.go @@ -311,7 +311,7 @@ func (o *teamResourceType) Grant(ctx context.Context, principal *v2.Resource, en orgId, teamId, user.GetLogin(), - github.AddTeamMembershipRequest{Role: github.Ptr[string](permission)}, + github.AddTeamMembershipRequest{Role: new(permission)}, ) if er != nil { diff --git a/pkg/connector/usage_event_feed.go b/pkg/connector/usage_event_feed.go index d4565dfe3..226c5b477 100644 --- a/pkg/connector/usage_event_feed.go +++ b/pkg/connector/usage_event_feed.go @@ -148,12 +148,12 @@ func (f *usageEventFeed) ListEvents( orgName := cursor.Orgs[cursor.OrgIndex] opts := &github.GetAuditLogOptions{ - Order: github.Ptr[string]("desc"), + Order: new("desc"), // "web" excludes raw git-protocol events (push/fetch/clone), // which dominate audit-log volume without losing members who are // otherwise covered by their web/API activity. - Include: github.Ptr[string]("web"), - Phrase: github.Ptr[string](sincePhrase), + Include: new("web"), + Phrase: new(sincePhrase), ListCursorOptions: github.ListCursorOptions{ PerPage: maxPageSize, }, diff --git a/pkg/connector/usage_event_feed_test.go b/pkg/connector/usage_event_feed_test.go index dcdddcee6..be2eba331 100644 --- a/pkg/connector/usage_event_feed_test.go +++ b/pkg/connector/usage_event_feed_test.go @@ -27,9 +27,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "valid entry", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: true, @@ -37,8 +37,8 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing actor id", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: false, @@ -46,8 +46,8 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing org id is still attributable", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), + Actor: new("octocat"), + ActorID: new(int64(123)), Timestamp: &github.Timestamp{Time: ts}, }, ok: true, @@ -55,18 +55,18 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "missing timestamp", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), }, ok: false, }, { name: "bot actor by login suffix", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("dependabot[bot]"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("dependabot[bot]"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, }, ok: false, @@ -74,9 +74,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "bot actor by actor_is_bot field", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("some-app-installation"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("some-app-installation"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, AdditionalFields: map[string]interface{}{"actor_is_bot": true}, }, @@ -85,9 +85,9 @@ func TestUsageEventFromAuditEntry(t *testing.T) { { name: "actor_is_bot false overrides a non-matching suffix check", entry: &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, AdditionalFields: map[string]interface{}{"actor_is_bot": false}, }, @@ -116,12 +116,12 @@ func TestUsageEventFromAuditEntry_IdFallback(t *testing.T) { t.Run("uses the real document id when present", func(t *testing.T) { entry := &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, - DocumentID: github.Ptr[string]("real-doc-id"), - Action: github.Ptr[string]("repo.create"), + DocumentID: new("real-doc-id"), + Action: new("repo.create"), } evt, ok := usageEventFromAuditEntry(entry) require.True(t, ok) @@ -130,11 +130,11 @@ func TestUsageEventFromAuditEntry_IdFallback(t *testing.T) { t.Run("synthesizes a stable id when the document id is missing", func(t *testing.T) { entry := &github.AuditEntry{ - Actor: github.Ptr[string]("octocat"), - ActorID: github.Ptr[int64](int64(123)), - OrgID: github.Ptr[int64](int64(456)), + Actor: new("octocat"), + ActorID: new(int64(123)), + OrgID: new(int64(456)), Timestamp: &github.Timestamp{Time: ts}, - Action: github.Ptr[string]("repo.create"), + Action: new("repo.create"), } evt, ok := usageEventFromAuditEntry(entry) require.True(t, ok) @@ -147,7 +147,7 @@ func TestUsageEventFeed_ListEvents_GracefulDegradation(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -168,7 +168,7 @@ func TestUsageEventFeed_ListEvents_SkipsOrgOn404(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -189,7 +189,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnServerError(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -210,7 +210,7 @@ func TestUsageEventFeed_ListEvents_AbortsOnRateLimit(t *testing.T) { ctx := context.Background() httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -238,13 +238,13 @@ func TestUsageEventFeed_ListEvents_FiltersToSinceBoundary(t *testing.T) { // Entries in descending order, as requested (Order: "desc"). entries := []*github.AuditEntry{ - {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer1}}, - {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer2}}, - {Actor: github.Ptr[string]("carol"), ActorID: github.Ptr[int64](int64(3)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: older}}, + {Actor: new("alice"), ActorID: new(int64(1)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer1}}, + {Actor: new("bob"), ActorID: new(int64(2)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer2}}, + {Actor: new("carol"), ActorID: new(int64(3)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: older}}, } httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatch(mock.GetOrgsAuditLogByOrg, entries), ) @@ -261,7 +261,7 @@ func TestUsageEventFeed_ListEvents_ZeroEarliestEventFallsBackToDefaultLookback(t var gotPhrase string httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -293,15 +293,15 @@ func TestUsageEventFeed_ListEvents_ContinuesPastAnAllFilteredPage(t *testing.T) // Page 1 is entirely bot activity - every entry gets filtered out by // usageEventFromAuditEntry, so no event is ever appended on this page. page1 := []*github.AuditEntry{ - {Actor: github.Ptr[string]("dependabot[bot]"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("dependabot[bot]"), ActorID: new(int64(1)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } page2 := []*github.AuditEntry{ - {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("octocat"), ActorID: new(int64(2)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } calls := 0 httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -334,15 +334,15 @@ func TestUsageEventFeed_ListEvents_ReturnsTightestRateLimit(t *testing.T) { newer := since.Add(1 * time.Hour) page1 := []*github.AuditEntry{ - {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("octocat"), ActorID: new(int64(1)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } page2 := []*github.AuditEntry{ - {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("alice"), ActorID: new(int64(2)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, } calls := 0 httpClient := mock.NewMockedHTTPClient( - mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: github.Ptr[string]("octo-org")}}), + mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{{Login: new("octo-org")}}), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -387,18 +387,18 @@ func TestUsageEventFeed_ListEvents_AdvancesAcrossMultipleOrgs(t *testing.T) { entriesByOrg := map[string][]*github.AuditEntry{ "octo-org-a": { - {Actor: github.Ptr[string]("alice"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("alice"), ActorID: new(int64(1)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, }, "octo-org-b": { - {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("bob"), ActorID: new(int64(2)), OrgID: new(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, }, } var seenOrgs []string httpClient := mock.NewMockedHTTPClient( mock.WithRequestMatch(mock.GetUserOrgs, []*github.Organization{ - {Login: github.Ptr[string]("octo-org-a")}, - {Login: github.Ptr[string]("octo-org-b")}, + {Login: new("octo-org-a")}, + {Login: new("octo-org-b")}, }), mock.WithRequestMatchHandler( mock.GetOrgsAuditLogByOrg, @@ -454,7 +454,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedCursor(t *testing.T) { gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("bob"), ActorID: new(int64(2)), OrgID: new(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), @@ -497,7 +497,7 @@ func TestUsageEventFeed_ListEvents_ResumesFromPersistedAfterCursor(t *testing.T) gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr[string]("bob"), ActorID: github.Ptr[int64](int64(2)), OrgID: github.Ptr[int64](int64(8)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("bob"), ActorID: new(int64(2)), OrgID: new(int64(8)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), @@ -538,7 +538,7 @@ func TestUsageEventFeed_ListEvents_RecoversFromOutOfBoundsCursor(t *testing.T) { gotPage = r.URL.Query().Get("page") w.Header().Set("Content-Type", "application/json") _, _ = w.Write(mock.MustMarshal([]*github.AuditEntry{ - {Actor: github.Ptr[string]("octocat"), ActorID: github.Ptr[int64](int64(1)), OrgID: github.Ptr[int64](int64(9)), Timestamp: &github.Timestamp{Time: newer}}, + {Actor: new("octocat"), ActorID: new(int64(1)), OrgID: new(int64(9)), Timestamp: &github.Timestamp{Time: newer}}, })) }), ), diff --git a/test/mocks/github.go b/test/mocks/github.go index 91f949f6d..5757536d3 100644 --- a/test/mocks/github.go +++ b/test/mocks/github.go @@ -116,7 +116,7 @@ func (mgh MockGitHub) Seed() ( ID: &userId, Login: &userIdStr, Email: &email, - Permissions: &github.RepositoryPermissions{Pull: github.Ptr[bool](true)}, + Permissions: &github.RepositoryPermissions{Pull: new(true)}, } githubRepository := github.Repository{ ID: &repositoryId, @@ -416,8 +416,8 @@ func (mgh MockGitHub) getMembers( func userToMembership(user *github.User) github.Membership { return github.Membership{ User: user, - Role: github.Ptr[string]("admin"), - State: github.Ptr[string]("active"), + Role: new("admin"), + State: new("active"), } } @@ -791,7 +791,7 @@ func (mgh *MockGitHub) AddUserToOrgRole(roleID int64, userID int64) { // what GitHub returns to credentials without org-owner visibility. func (mgh *MockGitHub) SetOrgDefaultRepoPermission(orgID int64, permission string) { org := mgh.organizations[orgID] - org.DefaultRepoPermission = github.Ptr[string](permission) + org.DefaultRepoPermission = new(permission) mgh.organizations[orgID] = org }