diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a14f7ef024..b8fe296c57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -221,3 +221,22 @@ This may come in handy when debugging both acceptance and manual testing. ] } ``` + +## Updating go-github + +If done frequently enough this process is generally smooth. Occasionaly there will be a breaking change, see our release doc for [details](./RELEASE.md) but for the most part you can take the following steps to update this foundational library. + +1. Run `go get github.com/google/go-github/v#@v#.#.#` where # is replaced by the actual version. We also want to specify the version not just the release version (in case there was patching) + +2. Next make sure to replace the references in all of the files, you can do this manually or run the script below: + + - For instance we are upgrading from `v77` to `v79` (making sure that we ignore the `vendor` directory, we'll get to that later) + ``` + find . -name "*.go" -not -path "./vendor/*" -exec sed -i '' 's|github.com/google/go-github/v77|github.com/google/go-github/v79|g' {} \; + ``` + +3. Run `go mod tidy` + +4. Run `go mod vendor` + +6. Run `make build && make lint && make test` to validate the changes \ No newline at end of file diff --git a/README.md b/README.md index eea29e7268..197c6a6bf0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This project is used to manipulate GitHub resources (repositories, teams, files, ## Requirements - [Terraform](https://www.terraform.io/downloads.html) 0.10.x -- [Go](https://golang.org/doc/install) 1.19.x (to build the provider plugin) +- [Go](https://golang.org/doc/install) 1.24.x (to build the provider plugin) ## Usage diff --git a/github/config.go b/github/config.go index d09f1df71f..03cf1925cc 100644 --- a/github/config.go +++ b/github/config.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" "github.com/shurcooL/githubv4" "golang.org/x/oauth2" diff --git a/github/data_source_github_actions_environment_secrets.go b/github/data_source_github_actions_environment_secrets.go index 932d102bb6..289666cebf 100644 --- a/github/data_source_github_actions_environment_secrets.go +++ b/github/data_source_github_actions_environment_secrets.go @@ -5,7 +5,7 @@ import ( "fmt" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_actions_environment_variables.go b/github/data_source_github_actions_environment_variables.go index 19f835957b..deb5dbbc3c 100644 --- a/github/data_source_github_actions_environment_variables.go +++ b/github/data_source_github_actions_environment_variables.go @@ -5,7 +5,7 @@ import ( "fmt" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_actions_organization_secrets.go b/github/data_source_github_actions_organization_secrets.go index 4763ae26f8..74028df2fb 100644 --- a/github/data_source_github_actions_organization_secrets.go +++ b/github/data_source_github_actions_organization_secrets.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_actions_organization_variables.go b/github/data_source_github_actions_organization_variables.go index 2a57377d4b..6c19922ec2 100644 --- a/github/data_source_github_actions_organization_variables.go +++ b/github/data_source_github_actions_organization_variables.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_actions_secrets.go b/github/data_source_github_actions_secrets.go index b89df14c3b..4a2f847c6c 100644 --- a/github/data_source_github_actions_secrets.go +++ b/github/data_source_github_actions_secrets.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_actions_variables.go b/github/data_source_github_actions_variables.go index 97e660f3d8..67ee46134e 100644 --- a/github/data_source_github_actions_variables.go +++ b/github/data_source_github_actions_variables.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_app_token_test.go b/github/data_source_github_app_token_test.go index 6fa7e17da8..d9bd625e6a 100644 --- a/github/data_source_github_app_token_test.go +++ b/github/data_source_github_app_token_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" ) diff --git a/github/data_source_github_branch.go b/github/data_source_github_branch.go index 9176529ece..776a8091b5 100644 --- a/github/data_source_github_branch.go +++ b/github/data_source_github_branch.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_codespaces_organization_secrets.go b/github/data_source_github_codespaces_organization_secrets.go index 0355a5ecd8..aa63770f52 100644 --- a/github/data_source_github_codespaces_organization_secrets.go +++ b/github/data_source_github_codespaces_organization_secrets.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_codespaces_secrets.go b/github/data_source_github_codespaces_secrets.go index 060cf37c76..ff3052242d 100644 --- a/github/data_source_github_codespaces_secrets.go +++ b/github/data_source_github_codespaces_secrets.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_codespaces_user_secrets.go b/github/data_source_github_codespaces_user_secrets.go index c271cfdba1..b322e93aca 100644 --- a/github/data_source_github_codespaces_user_secrets.go +++ b/github/data_source_github_codespaces_user_secrets.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_collaborators.go b/github/data_source_github_collaborators.go index f31bad19fa..eebfad0d27 100644 --- a/github/data_source_github_collaborators.go +++ b/github/data_source_github_collaborators.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/data_source_github_dependabot_organization_secrets.go b/github/data_source_github_dependabot_organization_secrets.go index e226ce556a..f373e1a389 100644 --- a/github/data_source_github_dependabot_organization_secrets.go +++ b/github/data_source_github_dependabot_organization_secrets.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_dependabot_secrets.go b/github/data_source_github_dependabot_secrets.go index 817b3f65d3..44af9ca452 100644 --- a/github/data_source_github_dependabot_secrets.go +++ b/github/data_source_github_dependabot_secrets.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_external_groups.go b/github/data_source_github_external_groups.go index 03f98d4685..b6738aeb3c 100644 --- a/github/data_source_github_external_groups.go +++ b/github/data_source_github_external_groups.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization.go b/github/data_source_github_organization.go index d62fab700f..98ecb8bc6a 100644 --- a/github/data_source_github_organization.go +++ b/github/data_source_github_organization.go @@ -3,7 +3,7 @@ package github import ( "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/shurcooL/githubv4" ) diff --git a/github/data_source_github_organization_custom_role.go b/github/data_source_github_organization_custom_role.go index 21357ec593..c0d6c1a15d 100644 --- a/github/data_source_github_organization_custom_role.go +++ b/github/data_source_github_organization_custom_role.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization_projects.go b/github/data_source_github_organization_projects.go new file mode 100644 index 0000000000..fa66907bb3 --- /dev/null +++ b/github/data_source_github_organization_projects.go @@ -0,0 +1,205 @@ +package github + +import ( + "context" + "fmt" + + "github.com/google/go-github/v79/github" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func dataSourceGithubOrganizationProjects() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGithubOrganizationProjectsRead, + + Schema: map[string]*schema.Schema{ + "organization": { + Type: schema.TypeString, + Required: true, + Description: "The organization name.", + }, + "projects": { + Type: schema.TypeList, + Computed: true, + Description: "List of Projects V2 for the organization.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the project.", + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + Description: "The node ID of the project.", + }, + "number": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of the project.", + }, + "title": { + Type: schema.TypeString, + Computed: true, + Description: "The title of the project.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "The description of the project.", + }, + "short_description": { + Type: schema.TypeString, + Computed: true, + Description: "The short description of the project.", + }, + "public": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the project is public.", + }, + "url": { + Type: schema.TypeString, + Computed: true, + Description: "The URL of the project.", + }, + "html_url": { + Type: schema.TypeString, + Computed: true, + Description: "The HTML URL of the project.", + }, + "owner": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the project owner.", + }, + "creator": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the project creator.", + }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was created.", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was last updated.", + }, + "closed_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was closed (if applicable).", + }, + "deleted_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was deleted (if applicable).", + }, + "deleted_by": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the user who deleted the project (if applicable).", + }, + "state": { + Type: schema.TypeString, + Computed: true, + Description: "The state of the project (open or closed).", + }, + }, + }, + }, + }, + } +} + +func dataSourceGithubOrganizationProjectsRead(d *schema.ResourceData, meta any) error { + client := meta.(*Owner).v3client + ctx := context.Background() + + orgName := d.Get("organization").(string) + + var allProjects []*github.ProjectV2 + var opts *github.ListProjectsOptions + + for { + if opts == nil { + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)}, + } + } + + projects, resp, err := client.Projects.ListOrganizationProjects(ctx, orgName, opts) + if err != nil { + return fmt.Errorf("error listing organization Projects V2: %w", err) + } + + allProjects = append(allProjects, projects...) + + if resp.After == "" { + break + } + + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{ + PerPage: github.Ptr(100), + After: github.Ptr(resp.After), + }, + } + } + + d.SetId(orgName) + + projectsData := make([]map[string]any, 0, len(allProjects)) + + for _, project := range allProjects { + projectData := map[string]any{ + "id": project.GetID(), + "node_id": project.GetNodeID(), + "number": project.GetNumber(), + "title": project.GetTitle(), + "description": project.GetDescription(), + "short_description": project.GetShortDescription(), + "public": project.GetPublic(), + "url": project.GetURL(), + "html_url": project.GetHTMLURL(), + "created_at": project.GetCreatedAt().Format("2006-01-02T15:04:05Z"), + "updated_at": project.GetUpdatedAt().Format("2006-01-02T15:04:05Z"), + } + + if project.GetClosedAt() != (github.Timestamp{}) { + projectData["closed_at"] = project.GetClosedAt().Format("2006-01-02T15:04:05Z") + } + + if project.GetDeletedAt() != (github.Timestamp{}) { + projectData["deleted_at"] = project.GetDeletedAt().Format("2006-01-02T15:04:05Z") + } + + if project.GetState() != "" { + projectData["state"] = project.GetState() + } + + if project.GetOwner() != nil { + projectData["owner"] = project.GetOwner().GetLogin() + } + + if project.GetCreator() != nil { + projectData["creator"] = project.GetCreator().GetLogin() + } + + if project.GetDeletedBy() != nil { + projectData["deleted_by"] = project.GetDeletedBy().GetLogin() + } + + projectsData = append(projectsData, projectData) + } + + if err := d.Set("projects", projectsData); err != nil { + return fmt.Errorf("error setting projects: %w", err) + } + + return nil +} diff --git a/github/data_source_github_organization_projects_test.go b/github/data_source_github_organization_projects_test.go new file mode 100644 index 0000000000..1b54c60c87 --- /dev/null +++ b/github/data_source_github_organization_projects_test.go @@ -0,0 +1,88 @@ +package github + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccGithubOrganizationProjectsDataSource(t *testing.T) { + t.Run("queries organization projects", func(t *testing.T) { + config := fmt.Sprintf(` + data "github_organization_projects" "test" { + organization = "%s" + } + `, testOrganization) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.#"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + testCase(t, anonymous) + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) + + t.Run("validates projects attributes", func(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + config := fmt.Sprintf(` + data "github_organization_projects" "test" { + organization = "%s" + } + `, testOrganization) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.#"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.id"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.node_id"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.number"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.title"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.url"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.created_at"), + resource.TestCheckResourceAttrSet("data.github_organization_projects.test", "projects.0.updated_at"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + _ = randomID // Prevent unused variable error + }) +} diff --git a/github/data_source_github_organization_repository_role.go b/github/data_source_github_organization_repository_role.go index 26aabb6d78..374bb6556c 100644 --- a/github/data_source_github_organization_repository_role.go +++ b/github/data_source_github_organization_repository_role.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization_role_teams.go b/github/data_source_github_organization_role_teams.go index a781f7617a..81eac36279 100644 --- a/github/data_source_github_organization_role_teams.go +++ b/github/data_source_github_organization_role_teams.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization_role_users.go b/github/data_source_github_organization_role_users.go index 543e02467f..9e7051269d 100644 --- a/github/data_source_github_organization_role_users.go +++ b/github/data_source_github_organization_role_users.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization_security_managers.go b/github/data_source_github_organization_security_managers.go index 705a7fa4e0..5090c6ee62 100644 --- a/github/data_source_github_organization_security_managers.go +++ b/github/data_source_github_organization_security_managers.go @@ -51,7 +51,13 @@ func dataSourceGithubOrganizationSecurityManagersRead(d *schema.ResourceData, me allTeams := make([]any, 0) - teams, _, err := client.Organizations.ListSecurityManagerTeams(ctx, orgName) + // Get the security manager role ID first + smRole, err := getSecurityManagerRole(client, ctx, orgName) + if err != nil { + return err + } + + teams, _, err := client.Organizations.ListTeamsAssignedToOrgRole(ctx, orgName, smRole.GetID(), nil) if err != nil { return err } diff --git a/github/data_source_github_organization_team_sync_groups.go b/github/data_source_github_organization_team_sync_groups.go index b142ad90e7..8e094f0363 100644 --- a/github/data_source_github_organization_team_sync_groups.go +++ b/github/data_source_github_organization_team_sync_groups.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_organization_teams.go b/github/data_source_github_organization_teams.go index 1012d89c2d..66f3aec7ce 100644 --- a/github/data_source_github_organization_teams.go +++ b/github/data_source_github_organization_teams.go @@ -4,7 +4,7 @@ import ( "context" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/shurcooL/githubv4" diff --git a/github/data_source_github_organization_webhooks.go b/github/data_source_github_organization_webhooks.go index 7f1320507c..23992ff970 100644 --- a/github/data_source_github_organization_webhooks.go +++ b/github/data_source_github_organization_webhooks.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_project_fields.go b/github/data_source_github_project_fields.go new file mode 100644 index 0000000000..0d46ecac01 --- /dev/null +++ b/github/data_source_github_project_fields.go @@ -0,0 +1,224 @@ +package github + +import ( + "context" + "fmt" + + "github.com/google/go-github/v79/github" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func dataSourceGithubProjectFields() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGithubProjectFieldsRead, + + Schema: map[string]*schema.Schema{ + "organization": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"username"}, + Description: "The organization name (for organization-owned projects).", + }, + "username": { + Type: schema.TypeString, + Optional: true, + ConflictsWith: []string{"organization"}, + Description: "The username (for user-owned projects).", + }, + "project_number": { + Type: schema.TypeInt, + Required: true, + Description: "The project number.", + }, + "fields": { + Type: schema.TypeList, + Computed: true, + Description: "List of fields for the project.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the field.", + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + Description: "The node ID of the field.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The name of the field.", + }, + "data_type": { + Type: schema.TypeString, + Computed: true, + Description: "The data type of the field (text, number, date, single_select, iteration).", + }, + "project_url": { + Type: schema.TypeString, + Computed: true, + Description: "The URL of the project this field belongs to.", + }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the field was created.", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the field was last updated.", + }, + "options": { + Type: schema.TypeList, + Computed: true, + Description: "Options for single_select fields.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "The ID of the option.", + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: "The name of the option.", + }, + "name_html": { + Type: schema.TypeString, + Computed: true, + Description: "The HTML-formatted name of the option.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "The description of the option.", + }, + "description_html": { + Type: schema.TypeString, + Computed: true, + Description: "The HTML-formatted description of the option.", + }, + "color": { + Type: schema.TypeString, + Computed: true, + Description: "The color of the option.", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func dataSourceGithubProjectFieldsRead(d *schema.ResourceData, meta any) error { + client := meta.(*Owner).v3client + ctx := context.Background() + + projectNumber := d.Get("project_number").(int) + organization := d.Get("organization").(string) + username := d.Get("username").(string) + + if organization == "" && username == "" { + return fmt.Errorf("either organization or username must be specified") + } + + var allFields []*github.ProjectV2Field + var opts *github.ListProjectsOptions + var err error + + for { + if opts == nil { + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)}, + } + } + + var fields []*github.ProjectV2Field + var resp *github.Response + + if organization != "" { + fields, resp, err = client.Projects.ListOrganizationProjectFields(ctx, organization, projectNumber, opts) + } else { + fields, resp, err = client.Projects.ListUserProjectFields(ctx, username, projectNumber, opts) + } + + if err != nil { + return fmt.Errorf("error listing project fields: %w", err) + } + + allFields = append(allFields, fields...) + + if resp.After == "" { + break + } + + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{ + PerPage: github.Ptr(100), + After: github.Ptr(resp.After), + }, + } + } + + // Set ID as organization/username:project_number + var resourceID string + if organization != "" { + resourceID = fmt.Sprintf("%s:%d", organization, projectNumber) + } else { + resourceID = fmt.Sprintf("%s:%d", username, projectNumber) + } + d.SetId(resourceID) + + fieldsData := make([]map[string]any, 0, len(allFields)) + + for _, field := range allFields { + fieldData := map[string]any{ + "id": field.GetID(), + "node_id": field.GetNodeID(), + "name": field.GetName(), + "data_type": field.GetDataType(), + "project_url": field.GetProjectURL(), + "created_at": field.GetCreatedAt().Format("2006-01-02T15:04:05Z"), + "updated_at": field.GetUpdatedAt().Format("2006-01-02T15:04:05Z"), + } + + // Add options for single_select fields + if len(field.Options) > 0 { + optionsData := make([]map[string]any, 0, len(field.Options)) + for _, option := range field.Options { + optionData := map[string]any{ + "id": option.GetID(), + "color": option.GetColor(), + } + + // Handle name field - it may be nil + if option.Name != nil { + optionData["name"] = *option.Name + } + + // Handle description field - it may be nil + if option.Description != nil { + optionData["description"] = *option.Description + } + + optionsData = append(optionsData, optionData) + } + fieldData["options"] = optionsData + } + + fieldsData = append(fieldsData, fieldData) + } + + if err := d.Set("fields", fieldsData); err != nil { + return fmt.Errorf("error setting fields: %w", err) + } + + return nil +} diff --git a/github/data_source_github_project_fields_test.go b/github/data_source_github_project_fields_test.go new file mode 100644 index 0000000000..146199f783 --- /dev/null +++ b/github/data_source_github_project_fields_test.go @@ -0,0 +1,147 @@ +package github + +import ( + "fmt" + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccGithubProjectFieldsDataSource(t *testing.T) { + t.Run("queries organization project fields", func(t *testing.T) { + config := fmt.Sprintf(` + data "github_project_fields" "test" { + project_number = 1 + organization = "%s" + } + `, testOrganization) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.#"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + testCase(t, anonymous) + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) + + t.Run("queries user project fields", func(t *testing.T) { + config := fmt.Sprintf(` + data "github_project_fields" "test" { + project_number = 1 + username = "%s" + } + `, testOwner) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.#"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + }) + + t.Run("validates project fields attributes", func(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + config := fmt.Sprintf(` + data "github_project_fields" "test" { + project_number = 1 + organization = "%s" + } + `, testOrganization) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.#"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.id"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.node_id"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.name"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.data_type"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.created_at"), + resource.TestCheckResourceAttrSet("data.github_project_fields.test", "fields.0.updated_at"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + _ = randomID // Prevent unused variable error + }) + + t.Run("validates conflicting arguments", func(t *testing.T) { + config := fmt.Sprintf(` + data "github_project_fields" "test" { + project_number = 1 + organization = "%s" + username = "%s" + } + `, testOrganization, testOwner) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + ExpectError: regexp.MustCompile("\"organization\": conflicts with username"), + }, + }, + }) + } + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) +} diff --git a/github/data_source_github_ref.go b/github/data_source_github_ref.go index 814b0dd84d..f83c590f92 100644 --- a/github/data_source_github_ref.go +++ b/github/data_source_github_ref.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_release.go b/github/data_source_github_release.go index 02f6019daa..43b21d44ee 100644 --- a/github/data_source_github_release.go +++ b/github/data_source_github_release.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repositories.go b/github/data_source_github_repositories.go index a22f0a1f00..c1055155e3 100644 --- a/github/data_source_github_repositories.go +++ b/github/data_source_github_repositories.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/data_source_github_repository.go b/github/data_source_github_repository.go index 94e40d0c3b..318f443617 100644 --- a/github/data_source_github_repository.go +++ b/github/data_source_github_repository.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_autolink_references.go b/github/data_source_github_repository_autolink_references.go index 27d72d808e..f40cb0a5ef 100644 --- a/github/data_source_github_repository_autolink_references.go +++ b/github/data_source_github_repository_autolink_references.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_branches.go b/github/data_source_github_repository_branches.go index 5f78f90c53..6d5698a954 100644 --- a/github/data_source_github_repository_branches.go +++ b/github/data_source_github_repository_branches.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_custom_properties.go b/github/data_source_github_repository_custom_properties.go index b826a61a98..59d7d65e08 100644 --- a/github/data_source_github_repository_custom_properties.go +++ b/github/data_source_github_repository_custom_properties.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_deploy_keys.go b/github/data_source_github_repository_deploy_keys.go index 05efb71c90..bce920daab 100644 --- a/github/data_source_github_repository_deploy_keys.go +++ b/github/data_source_github_repository_deploy_keys.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_environments.go b/github/data_source_github_repository_environments.go index 6a33095b72..8bc85d9b68 100644 --- a/github/data_source_github_repository_environments.go +++ b/github/data_source_github_repository_environments.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_file.go b/github/data_source_github_repository_file.go index 361587d192..c0c2fadb8a 100644 --- a/github/data_source_github_repository_file.go +++ b/github/data_source_github_repository_file.go @@ -9,7 +9,7 @@ import ( "net/url" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_file_test.go b/github/data_source_github_repository_file_test.go index 87de418d12..188f85f9bf 100644 --- a/github/data_source_github_repository_file_test.go +++ b/github/data_source_github_repository_file_test.go @@ -9,7 +9,7 @@ import ( "net/url" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/stretchr/testify/assert" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" diff --git a/github/data_source_github_repository_pull_requests.go b/github/data_source_github_repository_pull_requests.go index f5b3582ddd..3c33d567c6 100644 --- a/github/data_source_github_repository_pull_requests.go +++ b/github/data_source_github_repository_pull_requests.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/data_source_github_repository_teams.go b/github/data_source_github_repository_teams.go index cf7d66aa31..7908234597 100644 --- a/github/data_source_github_repository_teams.go +++ b/github/data_source_github_repository_teams.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_repository_webhooks.go b/github/data_source_github_repository_webhooks.go index c134a2127c..d74dce40a4 100644 --- a/github/data_source_github_repository_webhooks.go +++ b/github/data_source_github_repository_webhooks.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/data_source_github_team.go b/github/data_source_github_team.go index f569f4ee9d..7bcb81d15b 100644 --- a/github/data_source_github_team.go +++ b/github/data_source_github_team.go @@ -4,7 +4,7 @@ import ( "context" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/shurcooL/githubv4" @@ -176,7 +176,7 @@ func dataSourceGithubTeamRead(d *schema.ResourceData, meta any) error { repositories_detailed = make([]any, 0, resultsPerPage) // removed this from the loop for { - repository, resp, err := client.Teams.ListTeamReposByID(ctx, orgId, team.GetID(), &options.ListOptions) + repository, resp, err := client.Teams.ListTeamReposBySlug(ctx, meta.(*Owner).name, team.GetSlug(), &options.ListOptions) if err != nil { return err } diff --git a/github/data_source_github_user_projects.go b/github/data_source_github_user_projects.go new file mode 100644 index 0000000000..b09cac7a11 --- /dev/null +++ b/github/data_source_github_user_projects.go @@ -0,0 +1,205 @@ +package github + +import ( + "context" + "fmt" + + "github.com/google/go-github/v79/github" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func dataSourceGithubUserProjects() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGithubUserProjectsRead, + + Schema: map[string]*schema.Schema{ + "username": { + Type: schema.TypeString, + Required: true, + Description: "The username.", + }, + "projects": { + Type: schema.TypeList, + Computed: true, + Description: "List of Projects V2 for the user.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the project.", + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + Description: "The node ID of the project.", + }, + "number": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of the project.", + }, + "title": { + Type: schema.TypeString, + Computed: true, + Description: "The title of the project.", + }, + "description": { + Type: schema.TypeString, + Computed: true, + Description: "The description of the project.", + }, + "short_description": { + Type: schema.TypeString, + Computed: true, + Description: "The short description of the project.", + }, + "public": { + Type: schema.TypeBool, + Computed: true, + Description: "Whether the project is public.", + }, + "url": { + Type: schema.TypeString, + Computed: true, + Description: "The URL of the project.", + }, + "html_url": { + Type: schema.TypeString, + Computed: true, + Description: "The HTML URL of the project.", + }, + "owner": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the project owner.", + }, + "creator": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the project creator.", + }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was created.", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was last updated.", + }, + "closed_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was closed (if applicable).", + }, + "deleted_at": { + Type: schema.TypeString, + Computed: true, + Description: "The timestamp when the project was deleted (if applicable).", + }, + "deleted_by": { + Type: schema.TypeString, + Computed: true, + Description: "The login of the user who deleted the project (if applicable).", + }, + "state": { + Type: schema.TypeString, + Computed: true, + Description: "The state of the project (open or closed).", + }, + }, + }, + }, + }, + } +} + +func dataSourceGithubUserProjectsRead(d *schema.ResourceData, meta any) error { + client := meta.(*Owner).v3client + ctx := context.Background() + + username := d.Get("username").(string) + + var allProjects []*github.ProjectV2 + var opts *github.ListProjectsOptions + + for { + if opts == nil { + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{PerPage: github.Ptr(100)}, + } + } + + projects, resp, err := client.Projects.ListUserProjects(ctx, username, opts) + if err != nil { + return fmt.Errorf("error listing user Projects V2: %w", err) + } + + allProjects = append(allProjects, projects...) + + if resp.After == "" { + break + } + + opts = &github.ListProjectsOptions{ + ListProjectsPaginationOptions: github.ListProjectsPaginationOptions{ + PerPage: github.Ptr(100), + After: github.Ptr(resp.After), + }, + } + } + + d.SetId(username) + + projectsData := make([]map[string]any, 0, len(allProjects)) + + for _, project := range allProjects { + projectData := map[string]any{ + "id": project.GetID(), + "node_id": project.GetNodeID(), + "number": project.GetNumber(), + "title": project.GetTitle(), + "description": project.GetDescription(), + "short_description": project.GetShortDescription(), + "public": project.GetPublic(), + "url": project.GetURL(), + "html_url": project.GetHTMLURL(), + "created_at": project.GetCreatedAt().Format("2006-01-02T15:04:05Z"), + "updated_at": project.GetUpdatedAt().Format("2006-01-02T15:04:05Z"), + } + + if project.GetClosedAt() != (github.Timestamp{}) { + projectData["closed_at"] = project.GetClosedAt().Format("2006-01-02T15:04:05Z") + } + + if project.GetDeletedAt() != (github.Timestamp{}) { + projectData["deleted_at"] = project.GetDeletedAt().Format("2006-01-02T15:04:05Z") + } + + if project.GetState() != "" { + projectData["state"] = project.GetState() + } + + if project.GetOwner() != nil { + projectData["owner"] = project.GetOwner().GetLogin() + } + + if project.GetCreator() != nil { + projectData["creator"] = project.GetCreator().GetLogin() + } + + if project.GetDeletedBy() != nil { + projectData["deleted_by"] = project.GetDeletedBy().GetLogin() + } + + projectsData = append(projectsData, projectData) + } + + if err := d.Set("projects", projectsData); err != nil { + return fmt.Errorf("error setting projects: %w", err) + } + + return nil +} diff --git a/github/data_source_github_user_projects_test.go b/github/data_source_github_user_projects_test.go new file mode 100644 index 0000000000..c66b86e54f --- /dev/null +++ b/github/data_source_github_user_projects_test.go @@ -0,0 +1,88 @@ +package github + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccGithubUserProjectsDataSource(t *testing.T) { + t.Run("queries user projects", func(t *testing.T) { + config := fmt.Sprintf(` + data "github_user_projects" "test" { + username = "%s" + } + `, testOwner) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.#"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + testCase(t, anonymous) + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) + + t.Run("validates projects attributes", func(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + config := fmt.Sprintf(` + data "github_user_projects" "test" { + username = "%s" + } + `, testOwner) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.#"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.id"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.node_id"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.number"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.title"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.url"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.created_at"), + resource.TestCheckResourceAttrSet("data.github_user_projects.test", "projects.0.updated_at"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + _ = randomID // Prevent unused variable error + }) +} diff --git a/github/provider.go b/github/provider.go index fac0fafa83..58c6fca8f6 100644 --- a/github/provider.go +++ b/github/provider.go @@ -168,7 +168,6 @@ func Provider() *schema.Provider { "github_organization_block": resourceOrganizationBlock(), "github_organization_custom_role": resourceGithubOrganizationCustomRole(), "github_organization_custom_properties": resourceGithubOrganizationCustomProperties(), - "github_organization_project": resourceGithubOrganizationProject(), "github_organization_repository_role": resourceGithubOrganizationRepositoryRole(), "github_organization_role": resourceGithubOrganizationRole(), "github_organization_role_team": resourceGithubOrganizationRoleTeam(), @@ -178,8 +177,7 @@ func Provider() *schema.Provider { "github_organization_security_manager": resourceGithubOrganizationSecurityManager(), "github_organization_settings": resourceGithubOrganizationSettings(), "github_organization_webhook": resourceGithubOrganizationWebhook(), - "github_project_card": resourceGithubProjectCard(), - "github_project_column": resourceGithubProjectColumn(), + "github_project_item": resourceGithubProjectItem(), "github_release": resourceGithubRelease(), "github_repository": resourceGithubRepository(), "github_repository_autolink_reference": resourceGithubRepositoryAutolinkReference(), @@ -193,7 +191,6 @@ func Provider() *schema.Provider { "github_repository_environment_deployment_policy": resourceGithubRepositoryEnvironmentDeploymentPolicy(), "github_repository_file": resourceGithubRepositoryFile(), "github_repository_milestone": resourceGithubRepositoryMilestone(), - "github_repository_project": resourceGithubRepositoryProject(), "github_repository_pull_request": resourceGithubRepositoryPullRequest(), "github_repository_ruleset": resourceGithubRepositoryRuleset(), "github_repository_topics": resourceGithubRepositoryTopics(), @@ -286,6 +283,9 @@ func Provider() *schema.Provider { "github_user_external_identity": dataSourceGithubUserExternalIdentity(), "github_users": dataSourceGithubUsers(), "github_enterprise": dataSourceGithubEnterprise(), + "github_organization_projects": dataSourceGithubOrganizationProjects(), + "github_user_projects": dataSourceGithubUserProjects(), + "github_project_fields": dataSourceGithubProjectFields(), }, } diff --git a/github/repository_utils.go b/github/repository_utils.go index 89e31a5067..f03833120c 100644 --- a/github/repository_utils.go +++ b/github/repository_utils.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" ) // checkRepositoryBranchExists tests if a branch exists in a repository. diff --git a/github/resource_github_actions_environment_secret.go b/github/resource_github_actions_environment_secret.go index d556faeb0d..24158f7578 100644 --- a/github/resource_github_actions_environment_secret.go +++ b/github/resource_github_actions_environment_secret.go @@ -8,7 +8,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_actions_environment_variable.go b/github/resource_github_actions_environment_variable.go index a055c0a01c..c91cff3763 100644 --- a/github/resource_github_actions_environment_variable.go +++ b/github/resource_github_actions_environment_variable.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_actions_environment_variable_test.go b/github/resource_github_actions_environment_variable_test.go index ca954b91ae..834d32558e 100644 --- a/github/resource_github_actions_environment_variable_test.go +++ b/github/resource_github_actions_environment_variable_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" diff --git a/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go b/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go index a137cfe33d..29287f9d91 100644 --- a/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go +++ b/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_actions_organization_permissions.go b/github/resource_github_actions_organization_permissions.go index c12654f35e..57efe8f7fb 100644 --- a/github/resource_github_actions_organization_permissions.go +++ b/github/resource_github_actions_organization_permissions.go @@ -5,7 +5,7 @@ import ( "errors" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -147,7 +147,7 @@ func resourceGithubActionsOrganizationPermissionsCreateOrUpdate(d *schema.Resour allowedActions := d.Get("allowed_actions").(string) enabledRepositories := d.Get("enabled_repositories").(string) - _, _, err = client.Actions.EditActionsPermissions(ctx, + _, _, err = client.Actions.UpdateActionsPermissions(ctx, orgName, github.ActionsPermissions{ AllowedActions: &allowedActions, @@ -161,7 +161,7 @@ func resourceGithubActionsOrganizationPermissionsCreateOrUpdate(d *schema.Resour actionsAllowedData := resourceGithubActionsOrganizationAllowedObject(d) if actionsAllowedData != nil { log.Printf("[DEBUG] Allowed actions config is set") - _, _, err = client.Actions.EditActionsAllowed(ctx, + _, _, err = client.Actions.UpdateActionsAllowed(ctx, orgName, *actionsAllowedData) if err != nil { @@ -294,11 +294,11 @@ func resourceGithubActionsOrganizationPermissionsDelete(d *schema.ResourceData, } // This will nullify any allowedActions elements - _, _, err = client.Actions.EditActionsPermissions(ctx, + _, _, err = client.Actions.UpdateActionsPermissions(ctx, orgName, github.ActionsPermissions{ - AllowedActions: github.String("all"), - EnabledRepositories: github.String("all"), + AllowedActions: github.Ptr("all"), + EnabledRepositories: github.Ptr("all"), }) if err != nil { return err diff --git a/github/resource_github_actions_organization_secret.go b/github/resource_github_actions_organization_secret.go index 9601ba5aab..f8dc3d7394 100644 --- a/github/resource_github_actions_organization_secret.go +++ b/github/resource_github_actions_organization_secret.go @@ -8,7 +8,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_actions_organization_secret_repositories.go b/github/resource_github_actions_organization_secret_repositories.go index 54ac615092..e799dfd48c 100644 --- a/github/resource_github_actions_organization_secret_repositories.go +++ b/github/resource_github_actions_organization_secret_repositories.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_actions_organization_secret_repository.go b/github/resource_github_actions_organization_secret_repository.go index 9cea4e6a72..f85334d4fe 100644 --- a/github/resource_github_actions_organization_secret_repository.go +++ b/github/resource_github_actions_organization_secret_repository.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_actions_organization_variable.go b/github/resource_github_actions_organization_variable.go index 7249837906..497f52d8b6 100644 --- a/github/resource_github_actions_organization_variable.go +++ b/github/resource_github_actions_organization_variable.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_actions_repository_access_level.go b/github/resource_github_actions_repository_access_level.go index e9cbcb9b98..dd4ccfabf5 100644 --- a/github/resource_github_actions_repository_access_level.go +++ b/github/resource_github_actions_repository_access_level.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -46,7 +46,7 @@ func resourceGithubActionsRepositoryAccessLevelCreateOrUpdate(d *schema.Resource accessLevel := d.Get("access_level").(string) actionAccessLevel := github.RepositoryActionsAccessLevel{ - AccessLevel: github.String(accessLevel), + AccessLevel: github.Ptr(accessLevel), } _, err := client.Repositories.EditActionsAccessLevel(ctx, owner, repoName, actionAccessLevel) @@ -81,7 +81,7 @@ func resourceGithubActionsRepositoryAccessLevelDelete(d *schema.ResourceData, me ctx := context.WithValue(context.Background(), ctxId, repoName) actionAccessLevel := github.RepositoryActionsAccessLevel{ - AccessLevel: github.String("none"), + AccessLevel: github.Ptr("none"), } _, err := client.Repositories.EditActionsAccessLevel(ctx, owner, repoName, actionAccessLevel) diff --git a/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go b/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go index e92cdb1c5f..f097ecf1c4 100644 --- a/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go +++ b/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -117,7 +117,7 @@ func resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDelete( owner := meta.(*Owner).name customOIDCSubjectClaimTemplate := &github.OIDCSubjectClaimCustomTemplate{ - UseDefault: github.Bool(true), + UseDefault: github.Ptr(true), } ctx := context.Background() diff --git a/github/resource_github_actions_repository_permissions.go b/github/resource_github_actions_repository_permissions.go index 01ae5f0b9c..17f6e9121b 100644 --- a/github/resource_github_actions_repository_permissions.go +++ b/github/resource_github_actions_repository_permissions.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -125,7 +125,7 @@ func resourceGithubActionsRepositoryPermissionsCreateOrUpdate(d *schema.Resource repoActionPermissions.AllowedActions = &allowedActions } - _, _, err := client.Repositories.EditActionsPermissions(ctx, + _, _, err := client.Repositories.UpdateActionsPermissions(ctx, owner, repoName, repoActionPermissions, @@ -222,11 +222,11 @@ func resourceGithubActionsRepositoryPermissionsDelete(d *schema.ResourceData, me // Reset the repo to "default" settings repoActionPermissions := github.ActionsPermissionsRepository{ - AllowedActions: github.String("all"), - Enabled: github.Bool(true), + AllowedActions: github.Ptr("all"), + Enabled: github.Ptr(true), } - _, _, err := client.Repositories.EditActionsPermissions(ctx, + _, _, err := client.Repositories.UpdateActionsPermissions(ctx, owner, repoName, repoActionPermissions, diff --git a/github/resource_github_actions_runner_group.go b/github/resource_github_actions_runner_group.go index b53b2817e1..1ff7c8e65c 100644 --- a/github/resource_github_actions_runner_group.go +++ b/github/resource_github_actions_runner_group.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_actions_secret.go b/github/resource_github_actions_secret.go index 4e1346e0de..8b3dd601a6 100644 --- a/github/resource_github_actions_secret.go +++ b/github/resource_github_actions_secret.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "golang.org/x/crypto/nacl/box" ) diff --git a/github/resource_github_actions_variable.go b/github/resource_github_actions_variable.go index a40f6baceb..077bc31471 100644 --- a/github/resource_github_actions_variable.go +++ b/github/resource_github_actions_variable.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_app_installation_repositories.go b/github/resource_github_app_installation_repositories.go index 8521f04602..bf28d9f46e 100644 --- a/github/resource_github_app_installation_repositories.go +++ b/github/resource_github_app_installation_repositories.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_app_installation_repository.go b/github/resource_github_app_installation_repository.go index edd9f17f5b..f28f492499 100644 --- a/github/resource_github_app_installation_repository.go +++ b/github/resource_github_app_installation_repository.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_branch.go b/github/resource_github_branch.go index 47314dd9ed..06001701c6 100644 --- a/github/resource_github_branch.go +++ b/github/resource_github_branch.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -98,9 +98,9 @@ func resourceGithubBranchCreate(d *schema.ResourceData, meta any) error { } sourceBranchSHA := d.Get("source_sha").(string) - _, _, err := client.Git.CreateRef(ctx, orgName, repoName, &github.Reference{ - Ref: &branchRefName, - Object: &github.GitObject{SHA: &sourceBranchSHA}, + _, _, err := client.Git.CreateRef(ctx, orgName, repoName, github.CreateRef{ + Ref: branchRefName, + SHA: sourceBranchSHA, }) // If the branch already exists, rather than erroring out just continue on to importing the branch // This avoids the case where a repo with gitignore_template and branch are being created at the same time crashing terraform diff --git a/github/resource_github_branch_default.go b/github/resource_github_branch_default.go index 465ef00f13..17db166c73 100644 --- a/github/resource_github_branch_default.go +++ b/github/resource_github_branch_default.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_branch_protection_v3.go b/github/resource_github_branch_protection_v3.go index 5d5cc11d1f..6146c51a5a 100644 --- a/github/resource_github_branch_protection_v3.go +++ b/github/resource_github_branch_protection_v3.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_branch_protection_v3_utils.go b/github/resource_github_branch_protection_v3_utils.go index 8393e77a2b..4da15f89fb 100644 --- a/github/resource_github_branch_protection_v3_utils.go +++ b/github/resource_github_branch_protection_v3_utils.go @@ -8,14 +8,14 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func buildProtectionRequest(d *schema.ResourceData) (*github.ProtectionRequest, error) { req := &github.ProtectionRequest{ EnforceAdmins: d.Get("enforce_admins").(bool), - RequiredConversationResolution: github.Bool(d.Get("require_conversation_resolution").(bool)), + RequiredConversationResolution: github.Ptr(d.Get("require_conversation_resolution").(bool)), } rsc, err := expandRequiredStatusChecks(d) diff --git a/github/resource_github_codespaces_organization_secret.go b/github/resource_github_codespaces_organization_secret.go index a79cd76a51..3af2c93b4f 100644 --- a/github/resource_github_codespaces_organization_secret.go +++ b/github/resource_github_codespaces_organization_secret.go @@ -8,7 +8,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_codespaces_organization_secret_repositories.go b/github/resource_github_codespaces_organization_secret_repositories.go index 830c01979b..27ef900116 100644 --- a/github/resource_github_codespaces_organization_secret_repositories.go +++ b/github/resource_github_codespaces_organization_secret_repositories.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_codespaces_secret.go b/github/resource_github_codespaces_secret.go index 94615b6e24..699a7e46b7 100644 --- a/github/resource_github_codespaces_secret.go +++ b/github/resource_github_codespaces_secret.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_codespaces_user_secret.go b/github/resource_github_codespaces_user_secret.go index 91762f29e8..12532bf70c 100644 --- a/github/resource_github_codespaces_user_secret.go +++ b/github/resource_github_codespaces_user_secret.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_dependabot_organization_secret.go b/github/resource_github_dependabot_organization_secret.go index d98f6edc0c..58ac133af0 100644 --- a/github/resource_github_dependabot_organization_secret.go +++ b/github/resource_github_dependabot_organization_secret.go @@ -8,7 +8,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_dependabot_organization_secret_repositories.go b/github/resource_github_dependabot_organization_secret_repositories.go index 480afda870..e2c52db69d 100644 --- a/github/resource_github_dependabot_organization_secret_repositories.go +++ b/github/resource_github_dependabot_organization_secret_repositories.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_dependabot_secret.go b/github/resource_github_dependabot_secret.go index 2fcf5f0a98..ff370e12aa 100644 --- a/github/resource_github_dependabot_secret.go +++ b/github/resource_github_dependabot_secret.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "golang.org/x/crypto/nacl/box" ) diff --git a/github/resource_github_emu_group_mapping.go b/github/resource_github_emu_group_mapping.go index e6002311a4..98351c69f2 100644 --- a/github/resource_github_emu_group_mapping.go +++ b/github/resource_github_emu_group_mapping.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_enterprise_actions_permissions.go b/github/resource_github_enterprise_actions_permissions.go index 1f701fa7f0..6f530b9044 100644 --- a/github/resource_github_enterprise_actions_permissions.go +++ b/github/resource_github_enterprise_actions_permissions.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -149,7 +149,7 @@ func resourceGithubActionsEnterprisePermissionsCreateOrUpdate(d *schema.Resource allowedActions := d.Get("allowed_actions").(string) enabledOrganizations := d.Get("enabled_organizations").(string) - _, _, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, + _, _, err := client.Actions.UpdateActionsPermissionsInEnterprise(ctx, enterpriseId, github.ActionsPermissionsEnterprise{ AllowedActions: &allowedActions, @@ -164,7 +164,7 @@ func resourceGithubActionsEnterprisePermissionsCreateOrUpdate(d *schema.Resource if err != nil { return err } - _, _, err = client.Actions.EditActionsAllowedInEnterprise(ctx, + _, _, err = client.Actions.UpdateActionsAllowedInEnterprise(ctx, enterpriseId, *actionsAllowedData) if err != nil { @@ -277,11 +277,11 @@ func resourceGithubActionsEnterprisePermissionsDelete(d *schema.ResourceData, me ctx := context.WithValue(context.Background(), ctxId, d.Id()) // This will nullify any allowedActions elements - _, _, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, + _, _, err := client.Actions.UpdateActionsPermissionsInEnterprise(ctx, d.Get("enterprise_slug").(string), github.ActionsPermissionsEnterprise{ - AllowedActions: github.String("all"), - EnabledOrganizations: github.String("all"), + AllowedActions: github.Ptr("all"), + EnabledOrganizations: github.Ptr("all"), }) if err != nil { return err diff --git a/github/resource_github_enterprise_actions_runner_group.go b/github/resource_github_enterprise_actions_runner_group.go index 143eb6851f..9ecf6706b3 100644 --- a/github/resource_github_enterprise_actions_runner_group.go +++ b/github/resource_github_enterprise_actions_runner_group.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_enterprise_actions_workflow_permissions.go b/github/resource_github_enterprise_actions_workflow_permissions.go index 451a088977..719f1eaf02 100644 --- a/github/resource_github_enterprise_actions_workflow_permissions.go +++ b/github/resource_github_enterprise_actions_workflow_permissions.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -54,15 +54,15 @@ func resourceGithubEnterpriseActionsWorkflowPermissionsCreateOrUpdate(d *schema. workflowPerms := github.DefaultWorkflowPermissionEnterprise{} if v, ok := d.GetOk("default_workflow_permissions"); ok { - workflowPerms.DefaultWorkflowPermissions = github.String(v.(string)) + workflowPerms.DefaultWorkflowPermissions = github.Ptr(v.(string)) } if v, ok := d.GetOk("can_approve_pull_request_reviews"); ok { - workflowPerms.CanApprovePullRequestReviews = github.Bool(v.(bool)) + workflowPerms.CanApprovePullRequestReviews = github.Ptr(v.(bool)) } log.Printf("[DEBUG] Updating workflow permissions for enterprise: %s", enterpriseSlug) - _, _, err := client.Actions.EditDefaultWorkflowPermissionsInEnterprise(ctx, enterpriseSlug, workflowPerms) + _, _, err := client.Actions.UpdateDefaultWorkflowPermissionsInEnterprise(ctx, enterpriseSlug, workflowPerms) if err != nil { return err } @@ -104,11 +104,11 @@ func resourceGithubEnterpriseActionsWorkflowPermissionsDelete(d *schema.Resource // Reset to safe defaults workflowPerms := github.DefaultWorkflowPermissionEnterprise{ - DefaultWorkflowPermissions: github.String("read"), - CanApprovePullRequestReviews: github.Bool(false), + DefaultWorkflowPermissions: github.Ptr("read"), + CanApprovePullRequestReviews: github.Ptr(false), } - _, _, err := client.Actions.EditDefaultWorkflowPermissionsInEnterprise(ctx, enterpriseSlug, workflowPerms) + _, _, err := client.Actions.UpdateDefaultWorkflowPermissionsInEnterprise(ctx, enterpriseSlug, workflowPerms) if err != nil { return err } diff --git a/github/resource_github_enterprise_organization.go b/github/resource_github_enterprise_organization.go index 8dac8f9134..cd0ff69678 100644 --- a/github/resource_github_enterprise_organization.go +++ b/github/resource_github_enterprise_organization.go @@ -7,7 +7,7 @@ import ( "log" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/shurcooL/githubv4" ) @@ -124,8 +124,8 @@ func resourceGithubEnterpriseOrganizationCreate(data *schema.ResourceData, meta context.Background(), data.Get("name").(string), &github.Organization{ - Description: github.String(description), - Name: github.String(displayName), + Description: github.Ptr(description), + Name: github.Ptr(displayName), }, ) return err @@ -301,7 +301,7 @@ func updateDescription(ctx context.Context, data *schema.ResourceData, v3 *githu ctx, orgName, &github.Organization{ - Description: github.String(data.Get("description").(string)), + Description: github.Ptr(data.Get("description").(string)), }, ) return err @@ -318,7 +318,7 @@ func updateDisplayName(ctx context.Context, data *schema.ResourceData, v4 *githu ctx, orgName, &github.Organization{ - Name: github.String(data.Get("display_name").(string)), + Name: github.Ptr(data.Get("display_name").(string)), }, ) return err @@ -372,7 +372,7 @@ func removeUser(ctx context.Context, v3 *github.Client, v4 *githubv4.Client, use return err } - membership.Role = github.String("member") + membership.Role = github.Ptr("member") _, _, err = v3.Organizations.EditOrgMembership(ctx, user, orgName, membership) return err } diff --git a/github/resource_github_enterprise_security_analysis_settings.go b/github/resource_github_enterprise_security_analysis_settings.go index c2ad3b2b2d..fee69659c7 100644 --- a/github/resource_github_enterprise_security_analysis_settings.go +++ b/github/resource_github_enterprise_security_analysis_settings.go @@ -4,7 +4,7 @@ import ( "context" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -69,23 +69,23 @@ func resourceGithubEnterpriseSecurityAnalysisSettingsCreateOrUpdate(d *schema.Re settings := &github.EnterpriseSecurityAnalysisSettings{} if v, ok := d.GetOk("advanced_security_enabled_for_new_repositories"); ok { - settings.AdvancedSecurityEnabledForNewRepositories = github.Bool(v.(bool)) + settings.AdvancedSecurityEnabledForNewRepositories = github.Ptr(v.(bool)) } if v, ok := d.GetOk("secret_scanning_enabled_for_new_repositories"); ok { - settings.SecretScanningEnabledForNewRepositories = github.Bool(v.(bool)) + settings.SecretScanningEnabledForNewRepositories = github.Ptr(v.(bool)) } if v, ok := d.GetOk("secret_scanning_push_protection_enabled_for_new_repositories"); ok { - settings.SecretScanningPushProtectionEnabledForNewRepositories = github.Bool(v.(bool)) + settings.SecretScanningPushProtectionEnabledForNewRepositories = github.Ptr(v.(bool)) } if v, ok := d.GetOk("secret_scanning_push_protection_custom_link"); ok { - settings.SecretScanningPushProtectionCustomLink = github.String(v.(string)) + settings.SecretScanningPushProtectionCustomLink = github.Ptr(v.(string)) } if v, ok := d.GetOk("secret_scanning_validity_checks_enabled"); ok { - settings.SecretScanningValidityChecksEnabled = github.Bool(v.(bool)) + settings.SecretScanningValidityChecksEnabled = github.Ptr(v.(bool)) } log.Printf("[DEBUG] Updating security analysis settings for enterprise: %s", enterpriseSlug) @@ -140,11 +140,11 @@ func resourceGithubEnterpriseSecurityAnalysisSettingsDelete(d *schema.ResourceDa // Reset to safe defaults (all disabled) settings := &github.EnterpriseSecurityAnalysisSettings{ - AdvancedSecurityEnabledForNewRepositories: github.Bool(false), - SecretScanningEnabledForNewRepositories: github.Bool(false), - SecretScanningPushProtectionEnabledForNewRepositories: github.Bool(false), - SecretScanningPushProtectionCustomLink: github.String(""), - SecretScanningValidityChecksEnabled: github.Bool(false), + AdvancedSecurityEnabledForNewRepositories: github.Ptr(false), + SecretScanningEnabledForNewRepositories: github.Ptr(false), + SecretScanningPushProtectionEnabledForNewRepositories: github.Ptr(false), + SecretScanningPushProtectionCustomLink: github.Ptr(""), + SecretScanningValidityChecksEnabled: github.Ptr(false), } _, err := client.Enterprise.UpdateCodeSecurityAndAnalysis(ctx, enterpriseSlug, settings) diff --git a/github/resource_github_etag_unit_test.go b/github/resource_github_etag_unit_test.go index 267f40f485..2f048de46f 100644 --- a/github/resource_github_etag_unit_test.go +++ b/github/resource_github_etag_unit_test.go @@ -80,7 +80,6 @@ func TestEtagSchemaConsistency(t *testing.T) { "github_issue_label": resourceGithubIssueLabel(), "github_repository_webhook": resourceGithubRepositoryWebhook(), "github_repository_deployment_branch_policy": resourceGithubRepositoryDeploymentBranchPolicy(), - "github_repository_project": resourceGithubRepositoryProject(), } for resourceName, resource := range resourcesWithEtag { diff --git a/github/resource_github_issue.go b/github/resource_github_issue.go index a3f07a1660..b6d926dbd2 100644 --- a/github/resource_github_issue.go +++ b/github/resource_github_issue.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -84,11 +84,11 @@ func resourceGithubIssueCreateOrUpdate(d *schema.ResourceData, meta any) error { milestone := d.Get("milestone_number").(int) req := &github.IssueRequest{ - Title: github.String(title), + Title: github.Ptr(title), } if v, ok := d.GetOk("body"); ok { - req.Body = github.String(v.(string)) + req.Body = github.Ptr(v.(string)) } labels := expandStringList(d.Get("labels").(*schema.Set).List()) @@ -219,7 +219,7 @@ func resourceGithubIssueDelete(d *schema.ResourceData, meta any) error { log.Printf("[DEBUG] Deleting issue by closing: %d (%s/%s)", number, orgName, repoName) - request := &github.IssueRequest{State: github.String("closed")} + request := &github.IssueRequest{State: github.Ptr("closed")} _, _, err := client.Issues.Edit(ctx, orgName, repoName, number, request) diff --git a/github/resource_github_issue_label.go b/github/resource_github_issue_label.go index 57176fd555..37b9cc0256 100644 --- a/github/resource_github_issue_label.go +++ b/github/resource_github_issue_label.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -78,8 +78,8 @@ func resourceGithubIssueLabelCreateOrUpdate(d *schema.ResourceData, meta any) er color := d.Get("color").(string) label := &github.Label{ - Name: github.String(name), - Color: github.String(color), + Name: github.Ptr(name), + Color: github.Ptr(color), } ctx := context.Background() if !d.IsNewResource() { @@ -106,7 +106,7 @@ func resourceGithubIssueLabelCreateOrUpdate(d *schema.ResourceData, meta any) er } if existing != nil { - label.Description = github.String(d.Get("description").(string)) + label.Description = github.Ptr(d.Get("description").(string)) // Pull out the original name. If we already have a resource, this is the // parsed ID. If not, it's the value given to the resource. @@ -128,7 +128,7 @@ func resourceGithubIssueLabelCreateOrUpdate(d *schema.ResourceData, meta any) er } } else { if v, ok := d.GetOk("description"); ok { - label.Description = github.String(v.(string)) + label.Description = github.Ptr(v.(string)) } _, _, err := client.Issues.CreateLabel(ctx, diff --git a/github/resource_github_issue_labels.go b/github/resource_github_issue_labels.go index fb58fee506..0dc585be62 100644 --- a/github/resource_github_issue_labels.go +++ b/github/resource_github_issue_labels.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -121,9 +121,9 @@ func resourceGithubIssueLabelsCreateOrUpdate(d *schema.ResourceData, meta any) e log.Printf("[DEBUG] Updating GitHub issue label %s/%s/%s", owner, repository, name) _, _, err := client.Issues.EditLabel(ctx, owner, repository, name, &github.Label{ - Name: github.String(name), - Description: github.String(description), - Color: github.String(color), + Name: github.Ptr(name), + Description: github.Ptr(description), + Color: github.Ptr(color), }) if err != nil { return err @@ -150,9 +150,9 @@ func resourceGithubIssueLabelsCreateOrUpdate(d *schema.ResourceData, meta any) e log.Printf("[DEBUG] Creating GitHub issue label %s/%s/%s", owner, repository, name) _, _, err := client.Issues.CreateLabel(ctx, owner, repository, &github.Label{ - Name: github.String(name), - Description: github.String(labelData["description"].(string)), - Color: github.String(labelData["color"].(string)), + Name: github.Ptr(name), + Description: github.Ptr(labelData["description"].(string)), + Color: github.Ptr(labelData["color"].(string)), }) if err != nil { return err diff --git a/github/resource_github_issue_labels_test.go b/github/resource_github_issue_labels_test.go index b45f8f2b04..8c80b7ec9a 100644 --- a/github/resource_github_issue_labels_test.go +++ b/github/resource_github_issue_labels_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -157,7 +157,7 @@ func testAccGithubIssueLabelsAddLabel(repository, label string) error { orgName := testAccProvider.Meta().(*Owner).name ctx := context.TODO() - _, _, err := client.Issues.CreateLabel(ctx, orgName, repository, &github.Label{Name: github.String(label)}) + _, _, err := client.Issues.CreateLabel(ctx, orgName, repository, &github.Label{Name: github.Ptr(label)}) return err } diff --git a/github/resource_github_membership.go b/github/resource_github_membership.go index 0f508ed10a..743f3ed0ab 100644 --- a/github/resource_github_membership.go +++ b/github/resource_github_membership.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -69,7 +69,7 @@ func resourceGithubMembershipCreateOrUpdate(d *schema.ResourceData, meta any) er username, orgName, &github.Membership{ - Role: github.String(roleName), + Role: github.Ptr(roleName), }, ) if err != nil { @@ -169,7 +169,7 @@ func resourceGithubMembershipDelete(d *schema.ResourceData, meta any) error { } _, _, err = client.Organizations.EditOrgMembership(ctx, username, orgName, &github.Membership{ - Role: github.String(downgradeTo), + Role: github.Ptr(downgradeTo), }) } else { log.Printf("[INFO] Revoking '%s' membership for '%s'", orgName, username) diff --git a/github/resource_github_membership_test.go b/github/resource_github_membership_test.go index e107363cb3..7e79f5d61f 100644 --- a/github/resource_github_membership_test.go +++ b/github/resource_github_membership_test.go @@ -6,7 +6,7 @@ import ( "fmt" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) diff --git a/github/resource_github_organization_custom_properties.go b/github/resource_github_organization_custom_properties.go index a20b5d4ef1..197a8f1f18 100644 --- a/github/resource_github_organization_custom_properties.go +++ b/github/resource_github_organization_custom_properties.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_organization_custom_role.go b/github/resource_github_organization_custom_role.go index 40a42d318a..f1c8cb5fa4 100644 --- a/github/resource_github_organization_custom_role.go +++ b/github/resource_github_organization_custom_role.go @@ -6,7 +6,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -67,9 +67,9 @@ func resourceGithubOrganizationCustomRoleCreate(d *schema.ResourceData, meta any } role, _, err := client.Organizations.CreateCustomRepoRole(ctx, orgName, &github.CreateOrUpdateCustomRepoRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, }) if err != nil { @@ -153,9 +153,9 @@ func resourceGithubOrganizationCustomRoleUpdate(d *schema.ResourceData, meta any } update := &github.CreateOrUpdateCustomRepoRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, } diff --git a/github/resource_github_organization_project.go b/github/resource_github_organization_project.go deleted file mode 100644 index 7577223761..0000000000 --- a/github/resource_github_organization_project.go +++ /dev/null @@ -1,174 +0,0 @@ -package github - -import ( - "context" - "errors" - "fmt" - "log" - "net/http" - "strconv" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func resourceGithubOrganizationProject() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", - - Create: resourceGithubOrganizationProjectCreate, - Read: resourceGithubOrganizationProjectRead, - Update: resourceGithubOrganizationProjectUpdate, - Delete: resourceGithubOrganizationProjectDelete, - Importer: &schema.ResourceImporter{ - StateContext: schema.ImportStatePassthroughContext, - }, - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "The name of the project.", - }, - "body": { - Type: schema.TypeString, - Optional: true, - Description: "The body of the project.", - }, - "url": { - Type: schema.TypeString, - Computed: true, - Description: "URL of the project.", - }, - "etag": { - Type: schema.TypeString, - Computed: true, - }, - }, - } -} - -func resourceGithubOrganizationProjectCreate(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - client := meta.(*Owner).v3client - orgName := meta.(*Owner).name - name := d.Get("name").(string) - body := d.Get("body").(string) - ctx := context.Background() - - project, _, err := client.Organizations.CreateProject(ctx, - orgName, - &github.ProjectOptions{ - Name: &name, - Body: &body, - }, - ) - if err != nil { - return err - } - d.SetId(strconv.FormatInt(project.GetID(), 10)) - - return resourceGithubOrganizationProjectRead(d, meta) -} - -func resourceGithubOrganizationProjectRead(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - client := meta.(*Owner).v3client - orgName := meta.(*Owner).name - - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return err - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - if !d.IsNewResource() { - ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) - } - - project, resp, err := client.Projects.GetProject(ctx, projectID) - if err != nil { - ghErr := &github.ErrorResponse{} - if errors.As(err, &ghErr) { - if ghErr.Response.StatusCode == http.StatusNotModified { - return nil - } - if ghErr.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing organization project %s/%s from state because it no longer exists in GitHub", - orgName, d.Id()) - d.SetId("") - return nil - } - } - return err - } - - if err = d.Set("etag", resp.Header.Get("ETag")); err != nil { - return err - } - if err = d.Set("name", project.GetName()); err != nil { - return err - } - if err = d.Set("body", project.GetBody()); err != nil { - return err - } - if err = d.Set("url", fmt.Sprintf("https://github.com/orgs/%s/projects/%d", - orgName, project.GetNumber())); err != nil { - return err - } - - return nil -} - -func resourceGithubOrganizationProjectUpdate(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - client := meta.(*Owner).v3client - - name := d.Get("name").(string) - body := d.Get("body").(string) - - options := github.ProjectOptions{ - Name: &name, - Body: &body, - } - - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return err - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - if _, _, err := client.Projects.UpdateProject(ctx, projectID, &options); err != nil { - return err - } - - return resourceGithubOrganizationProjectRead(d, meta) -} - -func resourceGithubOrganizationProjectDelete(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - client := meta.(*Owner).v3client - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return err - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - _, err = client.Projects.DeleteProject(ctx, projectID) - return err -} diff --git a/github/resource_github_organization_project_test.go b/github/resource_github_organization_project_test.go deleted file mode 100644 index e8a4170a62..0000000000 --- a/github/resource_github_organization_project_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package github - -import ( - "context" - "fmt" - "strconv" - "strings" - "testing" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccGithubOrganizationProject_basic(t *testing.T) { - t.Skip("Skipping test as the GitHub REST API no longer supports classic projects") - - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var project github.Project - - rn := "github_organization_project.test" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccGithubOrganizationProjectDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubOrganizationProjectConfig, - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubOrganizationProjectExists(rn, &project), - testAccCheckGithubOrganizationProjectAttributes(&project, &testAccGithubOrganizationProjectExpectedAttributes{ - Name: "test-project", - Body: "this is a test project", - }), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccGithubOrganizationProjectDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Owner).v3client - - for _, rs := range s.RootModule().Resources { - if rs.Type != "github_organization_project" { - continue - } - - projectID, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return err - } - - project, res, err := conn.Projects.GetProject(context.TODO(), projectID) - if err == nil { - if project != nil && - project.GetID() == projectID { - return fmt.Errorf("organization project still exists") - } - } - if res.StatusCode != 404 { - return err - } - return nil - } - return nil -} - -func testAccCheckGithubOrganizationProjectExists(n string, project *github.Project) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("not Found: %s", n) - } - - projectID, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return err - } - - conn := testAccProvider.Meta().(*Owner).v3client - gotProject, _, err := conn.Projects.GetProject(context.TODO(), projectID) - if err != nil { - return err - } - *project = *gotProject - return nil - } -} - -type testAccGithubOrganizationProjectExpectedAttributes struct { - Name string - Body string -} - -func testAccCheckGithubOrganizationProjectAttributes(project *github.Project, want *testAccGithubOrganizationProjectExpectedAttributes) resource.TestCheckFunc { - return func(s *terraform.State) error { - if name := project.GetName(); name != want.Name { - return fmt.Errorf("got project %q; want %q", name, want.Name) - } - if body := project.GetBody(); body != want.Body { - return fmt.Errorf("got project %q; want %q", body, want.Body) - } - if URL := project.GetURL(); !strings.HasPrefix(URL, "https://") { - return fmt.Errorf("got http URL %q; want to start with 'https://'", URL) - } - - return nil - } -} - -const testAccGithubOrganizationProjectConfig = ` -resource "github_organization_project" "test" { - name = "test-project" - body = "this is a test project" -} -` diff --git a/github/resource_github_organization_repository_role.go b/github/resource_github_organization_repository_role.go index 94922d0495..416684dc6b 100644 --- a/github/resource_github_organization_repository_role.go +++ b/github/resource_github_organization_repository_role.go @@ -6,7 +6,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -71,9 +71,9 @@ func resourceGithubOrganizationRepositoryRoleCreate(d *schema.ResourceData, meta } role, _, err := client.Organizations.CreateCustomRepoRole(ctx, orgName, &github.CreateOrUpdateCustomRepoRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, }) if err != nil { @@ -172,9 +172,9 @@ func resourceGithubOrganizationRepositoryRoleUpdate(d *schema.ResourceData, meta } update := &github.CreateOrUpdateCustomRepoRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, } diff --git a/github/resource_github_organization_role.go b/github/resource_github_organization_role.go index 104b49253f..eb769157d0 100644 --- a/github/resource_github_organization_role.go +++ b/github/resource_github_organization_role.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -75,9 +75,9 @@ func resourceGithubOrganizationRoleCreate(d *schema.ResourceData, meta any) erro } role, _, err := client.Organizations.CreateCustomOrgRole(ctx, orgName, &github.CreateOrUpdateOrgRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, }) if err != nil { @@ -157,9 +157,9 @@ func resourceGithubOrganizationRoleUpdate(d *schema.ResourceData, meta any) erro } update := &github.CreateOrUpdateOrgRoleOptions{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - BaseRole: github.String(d.Get("base_role").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + BaseRole: github.Ptr(d.Get("base_role").(string)), Permissions: permissionsStr, } diff --git a/github/resource_github_organization_role_team.go b/github/resource_github_organization_role_team.go index b1ea1601e3..413a35027d 100644 --- a/github/resource_github_organization_role_team.go +++ b/github/resource_github_organization_role_team.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_organization_role_team_assignment.go b/github/resource_github_organization_role_team_assignment.go index a42263f4b7..cd0d99e491 100644 --- a/github/resource_github_organization_role_team_assignment.go +++ b/github/resource_github_organization_role_team_assignment.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_organization_role_user.go b/github/resource_github_organization_role_user.go index 5ef9147619..632c7304f5 100644 --- a/github/resource_github_organization_role_user.go +++ b/github/resource_github_organization_role_user.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_organization_ruleset.go b/github/resource_github_organization_ruleset.go index 3ce856d7dc..aa93af68e9 100644 --- a/github/resource_github_organization_ruleset.go +++ b/github/resource_github_organization_ruleset.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -588,42 +588,41 @@ func resourceGithubOrganizationRuleset() *schema.Resource { func resourceGithubOrganizationRulesetCreate(d *schema.ResourceData, meta any) error { client := meta.(*Owner).v3client - owner := meta.(*Owner).name - - rulesetReq := resourceGithubRulesetObject(d, owner) + rulesetReq := resourceGithubRulesetObject(d, meta.(*Owner).name) + org := meta.(*Owner).name ctx := context.Background() - var ruleset *github.Ruleset + var ruleset *github.RepositoryRuleset var err error - ruleset, _, err = client.Organizations.CreateOrganizationRuleset(ctx, owner, rulesetReq) + ruleset, _, err = client.Organizations.CreateRepositoryRuleset(ctx, org, *rulesetReq) if err != nil { return err } d.SetId(strconv.FormatInt(*ruleset.ID, 10)) + return resourceGithubOrganizationRulesetRead(d, meta) } func resourceGithubOrganizationRulesetRead(d *schema.ResourceData, meta any) error { client := meta.(*Owner).v3client - owner := meta.(*Owner).name - + org := meta.(*Owner).name rulesetID, err := strconv.ParseInt(d.Id(), 10, 64) if err != nil { return unconvertibleIdErr(d.Id(), err) } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) + ctx := context.WithValue(context.Background(), ctxId, rulesetID) if !d.IsNewResource() { ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) } - var ruleset *github.Ruleset + var ruleset *github.RepositoryRuleset var resp *github.Response - ruleset, resp, err = client.Organizations.GetOrganizationRuleset(ctx, owner, rulesetID) + ruleset, resp, err = client.Organizations.GetRepositoryRuleset(ctx, org, rulesetID) if err != nil { ghErr := &github.ErrorResponse{} if errors.As(err, &ghErr) { @@ -631,14 +630,28 @@ func resourceGithubOrganizationRulesetRead(d *schema.ResourceData, meta any) err return nil } if ghErr.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing ruleset %s: %d from state because it no longer exists in GitHub", - owner, rulesetID) + log.Printf("[INFO] Removing organization ruleset %s: %d from state because it no longer exists in GitHub", + org, rulesetID) d.SetId("") return nil } } } + if ruleset == nil { + log.Printf("[INFO] Removing organization ruleset %s: %d from state because it no longer exists in GitHub (empty response)", + org, rulesetID) + d.SetId("") + return nil + } + + if ruleset == nil { + log.Printf("[INFO] Removing organization ruleset %s: %d from state because it no longer exists in GitHub (empty response)", + org, rulesetID) + d.SetId("") + return nil + } + _ = d.Set("etag", resp.Header.Get("ETag")) _ = d.Set("name", ruleset.Name) _ = d.Set("target", ruleset.GetTarget()) @@ -655,18 +668,19 @@ func resourceGithubOrganizationRulesetRead(d *schema.ResourceData, meta any) err func resourceGithubOrganizationRulesetUpdate(d *schema.ResourceData, meta any) error { client := meta.(*Owner).v3client - owner := meta.(*Owner).name - - rulesetReq := resourceGithubRulesetObject(d, owner) + rulesetReq := resourceGithubRulesetObject(d, meta.(*Owner).name) + org := meta.(*Owner).name rulesetID, err := strconv.ParseInt(d.Id(), 10, 64) if err != nil { return unconvertibleIdErr(d.Id(), err) } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) + ctx := context.WithValue(context.Background(), ctxId, rulesetID) + + var ruleset *github.RepositoryRuleset - ruleset, _, err := client.Organizations.UpdateOrganizationRuleset(ctx, owner, rulesetID, rulesetReq) + ruleset, _, err = client.Organizations.UpdateRepositoryRuleset(ctx, org, rulesetID, *rulesetReq) if err != nil { return err } @@ -677,16 +691,16 @@ func resourceGithubOrganizationRulesetUpdate(d *schema.ResourceData, meta any) e func resourceGithubOrganizationRulesetDelete(d *schema.ResourceData, meta any) error { client := meta.(*Owner).v3client - owner := meta.(*Owner).name + org := meta.(*Owner).name rulesetID, err := strconv.ParseInt(d.Id(), 10, 64) if err != nil { return unconvertibleIdErr(d.Id(), err) } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) + ctx := context.WithValue(context.Background(), ctxId, rulesetID) - log.Printf("[DEBUG] Deleting organization ruleset: %s: %d", owner, rulesetID) - _, err = client.Organizations.DeleteOrganizationRuleset(ctx, owner, rulesetID) + log.Printf("[DEBUG] Deleting organization ruleset: %s: %d", org, rulesetID) + _, err = client.Organizations.DeleteRepositoryRuleset(ctx, org, rulesetID) return err } @@ -701,10 +715,10 @@ func resourceGithubOrganizationRulesetImport(d *schema.ResourceData, meta any) ( log.Printf("[DEBUG] Importing organization ruleset with ID: %d", rulesetID) client := meta.(*Owner).v3client - owner := meta.(*Owner).name + org := meta.(*Owner).name ctx := context.Background() - ruleset, _, err := client.Organizations.GetOrganizationRuleset(ctx, owner, rulesetID) + ruleset, _, err := client.Organizations.GetRepositoryRuleset(ctx, org, rulesetID) if ruleset == nil || err != nil { return []*schema.ResourceData{d}, err } diff --git a/github/resource_github_organization_ruleset_test.go b/github/resource_github_organization_ruleset_test.go index dcb999b514..de6bd6e979 100644 --- a/github/resource_github_organization_ruleset_test.go +++ b/github/resource_github_organization_ruleset_test.go @@ -118,17 +118,17 @@ func TestGithubOrganizationRulesets(t *testing.T) { "1234", ), resource.TestCheckResourceAttr( - "github_repository_ruleset.test", + "github_organization_ruleset.test", "rules.0.required_code_scanning.0.required_code_scanning_tool.0.alerts_threshold", "errors", ), resource.TestCheckResourceAttr( - "github_repository_ruleset.test", + "github_organization_ruleset.test", "rules.0.required_code_scanning.0.required_code_scanning_tool.0.security_alerts_threshold", "high_or_higher", ), resource.TestCheckResourceAttr( - "github_repository_ruleset.test", + "github_organization_ruleset.test", "rules.0.required_code_scanning.0.required_code_scanning_tool.0.tool", "CodeQL", ), @@ -597,22 +597,40 @@ func TestOrganizationPushRulesetSupport(t *testing.T) { // Test expand functionality (organization rulesets use org=true) expandedRules := expandRules(input, true) - if len(expandedRules) != 4 { - t.Fatalf("Expected 4 expanded rules for organization push ruleset, got %d", len(expandedRules)) + if expandedRules == nil { + t.Fatal("Expected expanded rules to not be nil") } // Verify we have all expected push rule types - ruleTypes := make(map[string]bool) - for _, rule := range expandedRules { - ruleTypes[rule.Type] = true + ruleCount := 0 + if expandedRules.FilePathRestriction != nil { + ruleCount++ + if len(expandedRules.FilePathRestriction.RestrictedFilePaths) != 3 { + t.Errorf("Expected 3 restricted file paths, got %d", len(expandedRules.FilePathRestriction.RestrictedFilePaths)) + } } - - expectedPushRules := []string{"file_path_restriction", "max_file_size", "max_file_path_length", "file_extension_restriction"} - for _, expectedType := range expectedPushRules { - if !ruleTypes[expectedType] { - t.Errorf("Expected organization push rule type %s not found in expanded rules", expectedType) + if expandedRules.MaxFileSize != nil { + ruleCount++ + if expandedRules.MaxFileSize.MaxFileSize != 100 { + t.Errorf("Expected max file size to be 100, got %d", expandedRules.MaxFileSize.MaxFileSize) } } + if expandedRules.MaxFilePathLength != nil { + ruleCount++ + if expandedRules.MaxFilePathLength.MaxFilePathLength != 250 { + t.Errorf("Expected max file path length to be 250, got %d", expandedRules.MaxFilePathLength.MaxFilePathLength) + } + } + if expandedRules.FileExtensionRestriction != nil { + ruleCount++ + if len(expandedRules.FileExtensionRestriction.RestrictedFileExtensions) != 4 { + t.Errorf("Expected 4 restricted file extensions, got %d", len(expandedRules.FileExtensionRestriction.RestrictedFileExtensions)) + } + } + + if ruleCount != 4 { + t.Fatalf("Expected 4 expanded rules for organization push ruleset, got %d", ruleCount) + } // Test flatten functionality (organization rulesets use org=true) flattenedResult := flattenRules(expandedRules, true) diff --git a/github/resource_github_organization_security_manager.go b/github/resource_github_organization_security_manager.go index 0771171ec0..c1e5d4c67e 100644 --- a/github/resource_github_organization_security_manager.go +++ b/github/resource_github_organization_security_manager.go @@ -3,13 +3,38 @@ package github import ( "context" "errors" + "fmt" "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) +// findTeamByIDInSecurityManager lists teams and finds one by ID (fallback for deprecated GetTeamByID). +func findTeamByIDInSecurityManager(ctx context.Context, client *github.Client, orgName string, teamID int64) (*github.Team, error) { + opts := &github.ListOptions{PerPage: 100} + for { + teams, resp, err := client.Teams.ListTeams(ctx, orgName, opts) + if err != nil { + return nil, fmt.Errorf("error listing teams: %w", err) + } + + for _, team := range teams { + if team.GetID() == teamID { + return team, nil + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + + return nil, fmt.Errorf("team with ID %d not found in organization %s", teamID, orgName) +} + func resourceGithubOrganizationSecurityManager() *schema.Resource { return &schema.Resource{ Create: resourceGithubOrganizationSecurityManagerCreate, @@ -140,7 +165,6 @@ func resourceGithubOrganizationSecurityManagerUpdate(d *schema.ResourceData, met return err } - orgId := meta.(*Owner).id orgName := meta.(*Owner).name teamId, err := strconv.ParseInt(d.Id(), 10, 64) if err != nil { @@ -150,7 +174,8 @@ func resourceGithubOrganizationSecurityManagerUpdate(d *schema.ResourceData, met client := meta.(*Owner).v3client ctx := context.WithValue(context.Background(), ctxId, d.Id()) - team, _, err := client.Teams.GetTeamByID(ctx, orgId, teamId) + // Find team by ID using listing (since GetTeamByID is deprecated) + team, err := findTeamByIDInSecurityManager(ctx, client, orgName, teamId) if err != nil { return err } diff --git a/github/resource_github_organization_settings.go b/github/resource_github_organization_settings.go index abad2c9ad2..67f1e805cf 100644 --- a/github/resource_github_organization_settings.go +++ b/github/resource_github_organization_settings.go @@ -5,7 +5,7 @@ import ( "log" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -182,88 +182,88 @@ func resourceGithubOrganizationSettingsCreateOrUpdate(d *schema.ResourceData, me org := meta.(*Owner).name settings := github.Organization{ - BillingEmail: github.String(d.Get("billing_email").(string)), - Company: github.String(d.Get("company").(string)), - Email: github.String(d.Get("email").(string)), - TwitterUsername: github.String(d.Get("twitter_username").(string)), - Location: github.String(d.Get("location").(string)), - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - HasOrganizationProjects: github.Bool(d.Get("has_organization_projects").(bool)), - HasRepositoryProjects: github.Bool(d.Get("has_repository_projects").(bool)), - DefaultRepoPermission: github.String(d.Get("default_repository_permission").(string)), - MembersCanCreateRepos: github.Bool(d.Get("members_can_create_repositories").(bool)), - MembersCanCreatePrivateRepos: github.Bool(d.Get("members_can_create_private_repositories").(bool)), - MembersCanCreatePublicRepos: github.Bool(d.Get("members_can_create_public_repositories").(bool)), - MembersCanCreatePages: github.Bool(d.Get("members_can_create_pages").(bool)), - MembersCanCreatePublicPages: github.Bool(d.Get("members_can_create_public_pages").(bool)), - MembersCanCreatePrivatePages: github.Bool(d.Get("members_can_create_private_pages").(bool)), - MembersCanForkPrivateRepos: github.Bool(d.Get("members_can_fork_private_repositories").(bool)), - WebCommitSignoffRequired: github.Bool(d.Get("web_commit_signoff_required").(bool)), - Blog: github.String(d.Get("blog").(string)), - AdvancedSecurityEnabledForNewRepos: github.Bool(d.Get("advanced_security_enabled_for_new_repositories").(bool)), - DependabotAlertsEnabledForNewRepos: github.Bool(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), - DependencyGraphEnabledForNewRepos: github.Bool(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), - SecretScanningEnabledForNewRepos: github.Bool(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), + BillingEmail: github.Ptr(d.Get("billing_email").(string)), + Company: github.Ptr(d.Get("company").(string)), + Email: github.Ptr(d.Get("email").(string)), + TwitterUsername: github.Ptr(d.Get("twitter_username").(string)), + Location: github.Ptr(d.Get("location").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + HasOrganizationProjects: github.Ptr(d.Get("has_organization_projects").(bool)), + HasRepositoryProjects: github.Ptr(d.Get("has_repository_projects").(bool)), + DefaultRepoPermission: github.Ptr(d.Get("default_repository_permission").(string)), + MembersCanCreateRepos: github.Ptr(d.Get("members_can_create_repositories").(bool)), + MembersCanCreatePrivateRepos: github.Ptr(d.Get("members_can_create_private_repositories").(bool)), + MembersCanCreatePublicRepos: github.Ptr(d.Get("members_can_create_public_repositories").(bool)), + MembersCanCreatePages: github.Ptr(d.Get("members_can_create_pages").(bool)), + MembersCanCreatePublicPages: github.Ptr(d.Get("members_can_create_public_pages").(bool)), + MembersCanCreatePrivatePages: github.Ptr(d.Get("members_can_create_private_pages").(bool)), + MembersCanForkPrivateRepos: github.Ptr(d.Get("members_can_fork_private_repositories").(bool)), + WebCommitSignoffRequired: github.Ptr(d.Get("web_commit_signoff_required").(bool)), + Blog: github.Ptr(d.Get("blog").(string)), + AdvancedSecurityEnabledForNewRepos: github.Ptr(d.Get("advanced_security_enabled_for_new_repositories").(bool)), + DependabotAlertsEnabledForNewRepos: github.Ptr(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), + DependencyGraphEnabledForNewRepos: github.Ptr(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), + SecretScanningEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), } enterpriseSettings := github.Organization{ - BillingEmail: github.String(d.Get("billing_email").(string)), - Company: github.String(d.Get("company").(string)), - Email: github.String(d.Get("email").(string)), - TwitterUsername: github.String(d.Get("twitter_username").(string)), - Location: github.String(d.Get("location").(string)), - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - HasOrganizationProjects: github.Bool(d.Get("has_organization_projects").(bool)), - HasRepositoryProjects: github.Bool(d.Get("has_repository_projects").(bool)), - DefaultRepoPermission: github.String(d.Get("default_repository_permission").(string)), - MembersCanCreateRepos: github.Bool(d.Get("members_can_create_repositories").(bool)), - MembersCanCreateInternalRepos: github.Bool(d.Get("members_can_create_internal_repositories").(bool)), - MembersCanCreatePrivateRepos: github.Bool(d.Get("members_can_create_private_repositories").(bool)), - MembersCanCreatePublicRepos: github.Bool(d.Get("members_can_create_public_repositories").(bool)), - MembersCanCreatePages: github.Bool(d.Get("members_can_create_pages").(bool)), - MembersCanCreatePublicPages: github.Bool(d.Get("members_can_create_public_pages").(bool)), - MembersCanCreatePrivatePages: github.Bool(d.Get("members_can_create_private_pages").(bool)), - MembersCanForkPrivateRepos: github.Bool(d.Get("members_can_fork_private_repositories").(bool)), - WebCommitSignoffRequired: github.Bool(d.Get("web_commit_signoff_required").(bool)), - Blog: github.String(d.Get("blog").(string)), - AdvancedSecurityEnabledForNewRepos: github.Bool(d.Get("advanced_security_enabled_for_new_repositories").(bool)), - DependabotAlertsEnabledForNewRepos: github.Bool(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), - DependencyGraphEnabledForNewRepos: github.Bool(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), - SecretScanningEnabledForNewRepos: github.Bool(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), + BillingEmail: github.Ptr(d.Get("billing_email").(string)), + Company: github.Ptr(d.Get("company").(string)), + Email: github.Ptr(d.Get("email").(string)), + TwitterUsername: github.Ptr(d.Get("twitter_username").(string)), + Location: github.Ptr(d.Get("location").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + HasOrganizationProjects: github.Ptr(d.Get("has_organization_projects").(bool)), + HasRepositoryProjects: github.Ptr(d.Get("has_repository_projects").(bool)), + DefaultRepoPermission: github.Ptr(d.Get("default_repository_permission").(string)), + MembersCanCreateRepos: github.Ptr(d.Get("members_can_create_repositories").(bool)), + MembersCanCreateInternalRepos: github.Ptr(d.Get("members_can_create_internal_repositories").(bool)), + MembersCanCreatePrivateRepos: github.Ptr(d.Get("members_can_create_private_repositories").(bool)), + MembersCanCreatePublicRepos: github.Ptr(d.Get("members_can_create_public_repositories").(bool)), + MembersCanCreatePages: github.Ptr(d.Get("members_can_create_pages").(bool)), + MembersCanCreatePublicPages: github.Ptr(d.Get("members_can_create_public_pages").(bool)), + MembersCanCreatePrivatePages: github.Ptr(d.Get("members_can_create_private_pages").(bool)), + MembersCanForkPrivateRepos: github.Ptr(d.Get("members_can_fork_private_repositories").(bool)), + WebCommitSignoffRequired: github.Ptr(d.Get("web_commit_signoff_required").(bool)), + Blog: github.Ptr(d.Get("blog").(string)), + AdvancedSecurityEnabledForNewRepos: github.Ptr(d.Get("advanced_security_enabled_for_new_repositories").(bool)), + DependabotAlertsEnabledForNewRepos: github.Ptr(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), + DependencyGraphEnabledForNewRepos: github.Ptr(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), + SecretScanningEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), } enterpriseSettingsNoFork := github.Organization{ - BillingEmail: github.String(d.Get("billing_email").(string)), - Company: github.String(d.Get("company").(string)), - Email: github.String(d.Get("email").(string)), - TwitterUsername: github.String(d.Get("twitter_username").(string)), - Location: github.String(d.Get("location").(string)), - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - HasOrganizationProjects: github.Bool(d.Get("has_organization_projects").(bool)), - HasRepositoryProjects: github.Bool(d.Get("has_repository_projects").(bool)), - DefaultRepoPermission: github.String(d.Get("default_repository_permission").(string)), - MembersCanCreateRepos: github.Bool(d.Get("members_can_create_repositories").(bool)), - MembersCanCreateInternalRepos: github.Bool(d.Get("members_can_create_internal_repositories").(bool)), - MembersCanCreatePrivateRepos: github.Bool(d.Get("members_can_create_private_repositories").(bool)), - MembersCanCreatePublicRepos: github.Bool(d.Get("members_can_create_public_repositories").(bool)), - MembersCanCreatePages: github.Bool(d.Get("members_can_create_pages").(bool)), - MembersCanCreatePublicPages: github.Bool(d.Get("members_can_create_public_pages").(bool)), - MembersCanCreatePrivatePages: github.Bool(d.Get("members_can_create_private_pages").(bool)), - WebCommitSignoffRequired: github.Bool(d.Get("web_commit_signoff_required").(bool)), - Blog: github.String(d.Get("blog").(string)), - AdvancedSecurityEnabledForNewRepos: github.Bool(d.Get("advanced_security_enabled_for_new_repositories").(bool)), - DependabotAlertsEnabledForNewRepos: github.Bool(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), - DependencyGraphEnabledForNewRepos: github.Bool(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), - SecretScanningEnabledForNewRepos: github.Bool(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), + BillingEmail: github.Ptr(d.Get("billing_email").(string)), + Company: github.Ptr(d.Get("company").(string)), + Email: github.Ptr(d.Get("email").(string)), + TwitterUsername: github.Ptr(d.Get("twitter_username").(string)), + Location: github.Ptr(d.Get("location").(string)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + HasOrganizationProjects: github.Ptr(d.Get("has_organization_projects").(bool)), + HasRepositoryProjects: github.Ptr(d.Get("has_repository_projects").(bool)), + DefaultRepoPermission: github.Ptr(d.Get("default_repository_permission").(string)), + MembersCanCreateRepos: github.Ptr(d.Get("members_can_create_repositories").(bool)), + MembersCanCreateInternalRepos: github.Ptr(d.Get("members_can_create_internal_repositories").(bool)), + MembersCanCreatePrivateRepos: github.Ptr(d.Get("members_can_create_private_repositories").(bool)), + MembersCanCreatePublicRepos: github.Ptr(d.Get("members_can_create_public_repositories").(bool)), + MembersCanCreatePages: github.Ptr(d.Get("members_can_create_pages").(bool)), + MembersCanCreatePublicPages: github.Ptr(d.Get("members_can_create_public_pages").(bool)), + MembersCanCreatePrivatePages: github.Ptr(d.Get("members_can_create_private_pages").(bool)), + WebCommitSignoffRequired: github.Ptr(d.Get("web_commit_signoff_required").(bool)), + Blog: github.Ptr(d.Get("blog").(string)), + AdvancedSecurityEnabledForNewRepos: github.Ptr(d.Get("advanced_security_enabled_for_new_repositories").(bool)), + DependabotAlertsEnabledForNewRepos: github.Ptr(d.Get("dependabot_alerts_enabled_for_new_repositories").(bool)), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(d.Get("dependabot_security_updates_enabled_for_new_repositories").(bool)), + DependencyGraphEnabledForNewRepos: github.Ptr(d.Get("dependency_graph_enabled_for_new_repositories").(bool)), + SecretScanningEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_enabled_for_new_repositories").(bool)), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(d.Get("secret_scanning_push_protection_enabled_for_new_repositories").(bool)), } orgPlan, _, err := client.Organizations.Edit(ctx, org, nil) @@ -406,88 +406,88 @@ func resourceGithubOrganizationSettingsDelete(d *schema.ResourceData, meta any) // This will set org settings to default values settings := github.Organization{ - BillingEmail: github.String("email@example.com"), - Company: github.String(""), - Email: github.String(""), - TwitterUsername: github.String(""), - Location: github.String(""), - Name: github.String(""), - Description: github.String(""), - HasOrganizationProjects: github.Bool(true), - HasRepositoryProjects: github.Bool(true), - DefaultRepoPermission: github.String("read"), - MembersCanCreateRepos: github.Bool(true), - MembersCanCreatePrivateRepos: github.Bool(true), - MembersCanCreatePublicRepos: github.Bool(true), - MembersCanCreatePages: github.Bool(false), - MembersCanCreatePublicPages: github.Bool(true), - MembersCanCreatePrivatePages: github.Bool(true), - MembersCanForkPrivateRepos: github.Bool(false), - WebCommitSignoffRequired: github.Bool(false), - Blog: github.String(""), - AdvancedSecurityEnabledForNewRepos: github.Bool(false), - DependabotAlertsEnabledForNewRepos: github.Bool(false), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(false), - DependencyGraphEnabledForNewRepos: github.Bool(false), - SecretScanningEnabledForNewRepos: github.Bool(false), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(false), + BillingEmail: github.Ptr("email@example.com"), + Company: github.Ptr(""), + Email: github.Ptr(""), + TwitterUsername: github.Ptr(""), + Location: github.Ptr(""), + Name: github.Ptr(""), + Description: github.Ptr(""), + HasOrganizationProjects: github.Ptr(true), + HasRepositoryProjects: github.Ptr(true), + DefaultRepoPermission: github.Ptr("read"), + MembersCanCreateRepos: github.Ptr(true), + MembersCanCreatePrivateRepos: github.Ptr(true), + MembersCanCreatePublicRepos: github.Ptr(true), + MembersCanCreatePages: github.Ptr(false), + MembersCanCreatePublicPages: github.Ptr(true), + MembersCanCreatePrivatePages: github.Ptr(true), + MembersCanForkPrivateRepos: github.Ptr(false), + WebCommitSignoffRequired: github.Ptr(false), + Blog: github.Ptr(""), + AdvancedSecurityEnabledForNewRepos: github.Ptr(false), + DependabotAlertsEnabledForNewRepos: github.Ptr(false), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(false), + DependencyGraphEnabledForNewRepos: github.Ptr(false), + SecretScanningEnabledForNewRepos: github.Ptr(false), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(false), } enterpriseSettings := github.Organization{ - BillingEmail: github.String("email@example.com"), - Company: github.String(""), - Email: github.String(""), - TwitterUsername: github.String(""), - Location: github.String(""), - Name: github.String(""), - Description: github.String(""), - HasOrganizationProjects: github.Bool(true), - HasRepositoryProjects: github.Bool(true), - DefaultRepoPermission: github.String("read"), - MembersCanCreateRepos: github.Bool(true), - MembersCanCreatePrivateRepos: github.Bool(true), - MembersCanCreateInternalRepos: github.Bool(true), - MembersCanCreatePublicRepos: github.Bool(true), - MembersCanCreatePages: github.Bool(false), - MembersCanCreatePublicPages: github.Bool(true), - MembersCanCreatePrivatePages: github.Bool(true), - MembersCanForkPrivateRepos: github.Bool(false), - WebCommitSignoffRequired: github.Bool(false), - Blog: github.String(""), - AdvancedSecurityEnabledForNewRepos: github.Bool(false), - DependabotAlertsEnabledForNewRepos: github.Bool(false), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(false), - DependencyGraphEnabledForNewRepos: github.Bool(false), - SecretScanningEnabledForNewRepos: github.Bool(false), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(false), + BillingEmail: github.Ptr("email@example.com"), + Company: github.Ptr(""), + Email: github.Ptr(""), + TwitterUsername: github.Ptr(""), + Location: github.Ptr(""), + Name: github.Ptr(""), + Description: github.Ptr(""), + HasOrganizationProjects: github.Ptr(true), + HasRepositoryProjects: github.Ptr(true), + DefaultRepoPermission: github.Ptr("read"), + MembersCanCreateRepos: github.Ptr(true), + MembersCanCreatePrivateRepos: github.Ptr(true), + MembersCanCreateInternalRepos: github.Ptr(true), + MembersCanCreatePublicRepos: github.Ptr(true), + MembersCanCreatePages: github.Ptr(false), + MembersCanCreatePublicPages: github.Ptr(true), + MembersCanCreatePrivatePages: github.Ptr(true), + MembersCanForkPrivateRepos: github.Ptr(false), + WebCommitSignoffRequired: github.Ptr(false), + Blog: github.Ptr(""), + AdvancedSecurityEnabledForNewRepos: github.Ptr(false), + DependabotAlertsEnabledForNewRepos: github.Ptr(false), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(false), + DependencyGraphEnabledForNewRepos: github.Ptr(false), + SecretScanningEnabledForNewRepos: github.Ptr(false), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(false), } enterpriseSettingsNoFork := github.Organization{ - BillingEmail: github.String("email@example.com"), - Company: github.String(""), - Email: github.String(""), - TwitterUsername: github.String(""), - Location: github.String(""), - Name: github.String(""), - Description: github.String(""), - HasOrganizationProjects: github.Bool(true), - HasRepositoryProjects: github.Bool(true), - DefaultRepoPermission: github.String("read"), - MembersCanCreateRepos: github.Bool(true), - MembersCanCreatePrivateRepos: github.Bool(true), - MembersCanCreateInternalRepos: github.Bool(true), - MembersCanCreatePublicRepos: github.Bool(true), - MembersCanCreatePages: github.Bool(false), - MembersCanCreatePublicPages: github.Bool(true), - MembersCanCreatePrivatePages: github.Bool(true), - WebCommitSignoffRequired: github.Bool(false), - Blog: github.String(""), - AdvancedSecurityEnabledForNewRepos: github.Bool(false), - DependabotAlertsEnabledForNewRepos: github.Bool(false), - DependabotSecurityUpdatesEnabledForNewRepos: github.Bool(false), - DependencyGraphEnabledForNewRepos: github.Bool(false), - SecretScanningEnabledForNewRepos: github.Bool(false), - SecretScanningPushProtectionEnabledForNewRepos: github.Bool(false), + BillingEmail: github.Ptr("email@example.com"), + Company: github.Ptr(""), + Email: github.Ptr(""), + TwitterUsername: github.Ptr(""), + Location: github.Ptr(""), + Name: github.Ptr(""), + Description: github.Ptr(""), + HasOrganizationProjects: github.Ptr(true), + HasRepositoryProjects: github.Ptr(true), + DefaultRepoPermission: github.Ptr("read"), + MembersCanCreateRepos: github.Ptr(true), + MembersCanCreatePrivateRepos: github.Ptr(true), + MembersCanCreateInternalRepos: github.Ptr(true), + MembersCanCreatePublicRepos: github.Ptr(true), + MembersCanCreatePages: github.Ptr(false), + MembersCanCreatePublicPages: github.Ptr(true), + MembersCanCreatePrivatePages: github.Ptr(true), + WebCommitSignoffRequired: github.Ptr(false), + Blog: github.Ptr(""), + AdvancedSecurityEnabledForNewRepos: github.Ptr(false), + DependabotAlertsEnabledForNewRepos: github.Ptr(false), + DependabotSecurityUpdatesEnabledForNewRepos: github.Ptr(false), + DependencyGraphEnabledForNewRepos: github.Ptr(false), + SecretScanningEnabledForNewRepos: github.Ptr(false), + SecretScanningPushProtectionEnabledForNewRepos: github.Ptr(false), } log.Printf("[DEBUG] Reverting Organization Settings to default values: %s", org) diff --git a/github/resource_github_organization_webhook.go b/github/resource_github_organization_webhook.go index dc43d7a5d3..f224e154d4 100644 --- a/github/resource_github_organization_webhook.go +++ b/github/resource_github_organization_webhook.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -60,9 +60,9 @@ func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hoo } hook := &github.Hook{ - URL: github.String(d.Get("url").(string)), + URL: github.Ptr(d.Get("url").(string)), Events: events, - Active: github.Bool(d.Get("active").(bool)), + Active: github.Ptr(d.Get("active").(bool)), } config := d.Get("configuration").([]any) @@ -161,7 +161,7 @@ func resourceGithubOrganizationWebhookRead(d *schema.ResourceData, meta any) err currentSecret := d.Get("configuration").([]any)[0].(map[string]any)["secret"] if hook.Config.Secret != nil { - hook.Config.Secret = github.String(currentSecret.(string)) + hook.Config.Secret = github.Ptr(currentSecret.(string)) } } @@ -219,28 +219,28 @@ func resourceGithubOrganizationWebhookDelete(d *schema.ResourceData, meta any) e func webhookConfigFromInterface(config map[string]any) *github.HookConfig { hookConfig := &github.HookConfig{} if config["url"] != nil { - hookConfig.URL = github.String(config["url"].(string)) + hookConfig.URL = github.Ptr(config["url"].(string)) } if config["content_type"] != nil { - hookConfig.ContentType = github.String(config["content_type"].(string)) + hookConfig.ContentType = github.Ptr(config["content_type"].(string)) } if config["insecure_ssl"] != nil { if insecureSsl, ok := config["insecure_ssl"].(bool); ok { if insecureSsl { - hookConfig.InsecureSSL = github.String("1") + hookConfig.InsecureSSL = github.Ptr("1") } else { - hookConfig.InsecureSSL = github.String("0") + hookConfig.InsecureSSL = github.Ptr("0") } } else { if config["insecure_ssl"] == "1" || config["insecure_ssl"] == "true" { - hookConfig.InsecureSSL = github.String("1") + hookConfig.InsecureSSL = github.Ptr("1") } else { - hookConfig.InsecureSSL = github.String("0") + hookConfig.InsecureSSL = github.Ptr("0") } } } if config["secret"] != nil { - hookConfig.Secret = github.String(config["secret"].(string)) + hookConfig.Secret = github.Ptr(config["secret"].(string)) } return hookConfig } diff --git a/github/resource_github_project_card.go b/github/resource_github_project_card.go deleted file mode 100644 index af3b12252f..0000000000 --- a/github/resource_github_project_card.go +++ /dev/null @@ -1,208 +0,0 @@ -package github - -import ( - "context" - "errors" - "fmt" - "log" - "net/http" - "strconv" - "strings" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func resourceGithubProjectCard() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", - - Create: resourceGithubProjectCardCreate, - Read: resourceGithubProjectCardRead, - Update: resourceGithubProjectCardUpdate, - Delete: resourceGithubProjectCardDelete, - Importer: &schema.ResourceImporter{ - State: resourceGithubProjectCardImport, - }, - Schema: map[string]*schema.Schema{ - "column_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The ID of the project column.", - }, - "note": { - Type: schema.TypeString, - Optional: true, - Description: "The note contents of the card. Markdown supported.", - }, - "content_id": { - Type: schema.TypeInt, - Optional: true, - Description: "'github_issue.issue_id'.", - }, - "content_type": { - Type: schema.TypeString, - Optional: true, - Description: "Must be either 'Issue' or 'PullRequest'.", - }, - "etag": { - Type: schema.TypeString, - Computed: true, - }, - "card_id": { - Type: schema.TypeInt, - Computed: true, - Description: "The ID of the card.", - }, - }, - } -} - -func resourceGithubProjectCardCreate(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - columnIDStr := d.Get("column_id").(string) - columnID, err := strconv.ParseInt(columnIDStr, 10, 64) - if err != nil { - return unconvertibleIdErr(columnIDStr, err) - } - - log.Printf("[DEBUG] Creating project card note in column ID: %d", columnID) - client := meta.(*Owner).v3client - options := github.ProjectCardOptions{} - - note := d.Get("note").(string) - if len(note) > 0 { - options.Note = note - } else { - contentID := d.Get("content_id").(int) - if contentID > 0 { - options.ContentID = int64(contentID) - } - - options.ContentType = d.Get("content_type").(string) - if options.ContentType != "Issue" && options.ContentType != "PullRequest" { - return fmt.Errorf("content_type must be set to either Issue or PullRequest") - } - } - ctx := context.Background() - card, _, err := client.Projects.CreateProjectCard(ctx, columnID, &options) - if err != nil { - return err - } - - if err = d.Set("card_id", card.GetID()); err != nil { - return err - } - d.SetId(card.GetNodeID()) - - return resourceGithubProjectCardRead(d, meta) -} - -func resourceGithubProjectCardRead(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - nodeID := d.Id() - cardID := d.Get("card_id").(int) - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - if !d.IsNewResource() { - ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) - } - - log.Printf("[DEBUG] Reading project card: %s", nodeID) - card, _, err := client.Projects.GetProjectCard(ctx, int64(cardID)) - if err != nil { - err := &github.ErrorResponse{} - if errors.As(err, &err) { - if err.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing project card %s from state because it no longer exists in GitHub", d.Id()) - d.SetId("") - return nil - } - } - return err - } - - // FIXME: Remove URL parsing if a better option becomes available - columnURL := card.GetColumnURL() - columnIDStr := strings.TrimPrefix(columnURL, client.BaseURL.String()+`projects/columns/`) - - if err = d.Set("note", card.GetNote()); err != nil { - return err - } - if err = d.Set("column_id", columnIDStr); err != nil { - return err - } - if err = d.Set("card_id", card.GetID()); err != nil { - return err - } - - return nil -} - -func resourceGithubProjectCardUpdate(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - cardID := d.Get("card_id").(int) - - log.Printf("[DEBUG] Updating project Card: %s", d.Id()) - options := github.ProjectCardOptions{} - - note := d.Get("note").(string) - if len(note) > 0 { - options.Note = note - } else { - contentID := d.Get("content_id").(int) - if contentID > 0 { - options.ContentID = int64(contentID) - } - - options.ContentType = d.Get("content_type").(string) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - _, _, err := client.Projects.UpdateProjectCard(ctx, int64(cardID), &options) - if err != nil { - return err - } - - return resourceGithubProjectCardRead(d, meta) -} - -func resourceGithubProjectCardDelete(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - log.Printf("[DEBUG] Deleting project Card: %s", d.Id()) - cardID := d.Get("card_id").(int) - _, err := client.Projects.DeleteProjectCard(ctx, int64(cardID)) - if err != nil { - return err - } - - return nil -} - -func resourceGithubProjectCardImport(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { - cardIDStr := d.Id() - cardID, err := strconv.ParseInt(cardIDStr, 10, 64) - if err != nil { - return []*schema.ResourceData{d}, unconvertibleIdErr(cardIDStr, err) - } - - log.Printf("[DEBUG] Importing project card with card ID: %d", cardID) - client := meta.(*Owner).v3client - ctx := context.Background() - card, _, err := client.Projects.GetProjectCard(ctx, cardID) - if card == nil || err != nil { - return []*schema.ResourceData{d}, err - } - - d.SetId(card.GetNodeID()) - if err = d.Set("card_id", cardID); err != nil { - return []*schema.ResourceData{d}, err - } - - return []*schema.ResourceData{d}, nil -} diff --git a/github/resource_github_project_card_test.go b/github/resource_github_project_card_test.go deleted file mode 100644 index facbd1a703..0000000000 --- a/github/resource_github_project_card_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package github - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccGithubProjectCard(t *testing.T) { - t.Skip("Skipping test as the GitHub REST API no longer supports classic projects") - - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - - t.Run("creates a project card using a note", func(t *testing.T) { - config := fmt.Sprintf(` - - resource "github_organization_project" "project" { - name = "tf-acc-%s" - body = "This is an organization project." - } - - resource "github_project_column" "column" { - project_id = github_organization_project.project.id - name = "Backlog" - } - - resource "github_project_card" "card" { - column_id = github_project_column.column.column_id - note = "## Unaccepted 👇" - } - - `, randomID) - - check := resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet( - "github_project_card.card", "note", - ), - ) - - testCase := func(t *testing.T, mode string) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { skipUnlessMode(t, mode) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: config, - Check: check, - }, - }, - }) - } - - t.Run("with an anonymous account", func(t *testing.T) { - t.Skip("anonymous account not supported for this operation") - }) - - t.Run("with an individual account", func(t *testing.T) { - t.Skip("individual account not supported for this operation") - }) - - t.Run("with an organization account", func(t *testing.T) { - testCase(t, organization) - }) - }) - - t.Run("creates a project card using an issue", func(t *testing.T) { - config := fmt.Sprintf(` - - resource "github_repository" "test" { - name = "tf-acc-test-%s" - has_projects = true - has_issues = true - } - - resource "github_issue" "test" { - repository = github_repository.test.id - title = "Test issue title" - body = "Test issue body" - } - - resource "github_repository_project" "test" { - name = "test" - repository = github_repository.test.name - body = "this is a test project" - } - - resource "github_project_column" "test" { - project_id = github_repository_project.test.id - name = "Backlog" - } - - resource "github_project_card" "test" { - column_id = github_project_column.test.column_id - content_id = github_issue.test.issue_id - content_type = "Issue" - } - - `, randomID) - - check := resource.ComposeTestCheckFunc( - func(state *terraform.State) error { - issue := state.RootModule().Resources["github_issue.test"].Primary - card := state.RootModule().Resources["github_project_card.test"].Primary - - issueID := issue.Attributes["issue_id"] - cardID := card.Attributes["content_id"] - if cardID != issueID { - return fmt.Errorf("card content_id %s not the same as issue id %s", - cardID, issueID) - } - return nil - }, - ) - - testCase := func(t *testing.T, mode string) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { skipUnlessMode(t, mode) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: config, - Check: check, - }, - }, - }) - } - - t.Run("with an anonymous account", func(t *testing.T) { - t.Skip("anonymous account not supported for this operation") - }) - - t.Run("with an individual account", func(t *testing.T) { - testCase(t, individual) - }) - - t.Run("with an organization account", func(t *testing.T) { - testCase(t, organization) - }) - }) -} diff --git a/github/resource_github_project_column.go b/github/resource_github_project_column.go deleted file mode 100644 index 6b3ee4365c..0000000000 --- a/github/resource_github_project_column.go +++ /dev/null @@ -1,159 +0,0 @@ -package github - -import ( - "context" - "errors" - "log" - "net/http" - "strconv" - "strings" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func resourceGithubProjectColumn() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", - - Create: resourceGithubProjectColumnCreate, - Read: resourceGithubProjectColumnRead, - Update: resourceGithubProjectColumnUpdate, - Delete: resourceGithubProjectColumnDelete, - Importer: &schema.ResourceImporter{ - StateContext: schema.ImportStatePassthroughContext, - }, - - Schema: map[string]*schema.Schema{ - "project_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The ID of an existing project that the column will be created in.", - }, - "name": { - Type: schema.TypeString, - Required: true, - Description: "The name of the column.", - }, - "column_id": { - Type: schema.TypeInt, - Computed: true, - Description: "The ID of the column.", - }, - "etag": { - Type: schema.TypeString, - Computed: true, - }, - }, - } -} - -func resourceGithubProjectColumnCreate(d *schema.ResourceData, meta any) error { - err := checkOrganization(meta) - if err != nil { - return err - } - - client := meta.(*Owner).v3client - - options := github.ProjectColumnOptions{ - Name: d.Get("name").(string), - } - - projectIDStr := d.Get("project_id").(string) - projectID, err := strconv.ParseInt(projectIDStr, 10, 64) - if err != nil { - return unconvertibleIdErr(projectIDStr, err) - } - ctx := context.Background() - - column, _, err := client.Projects.CreateProjectColumn(ctx, - projectID, - &options, - ) - if err != nil { - return err - } - - d.SetId(strconv.FormatInt(column.GetID(), 10)) - if err = d.Set("column_id", column.GetID()); err != nil { - return err - } - - return resourceGithubProjectColumnRead(d, meta) -} - -func resourceGithubProjectColumnRead(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - columnID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - if !d.IsNewResource() { - ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) - } - - column, _, err := client.Projects.GetProjectColumn(ctx, columnID) - if err != nil { - err := &github.ErrorResponse{} - if errors.As(err, &err) { - if err.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing project column %s from state because it no longer exists in GitHub", d.Id()) - d.SetId("") - return nil - } - } - return err - } - - projectURL := column.GetProjectURL() - projectID := strings.TrimPrefix(projectURL, client.BaseURL.String()+`projects/`) - - if err = d.Set("name", column.GetName()); err != nil { - return err - } - if err = d.Set("project_id", projectID); err != nil { - return err - } - if err = d.Set("column_id", column.GetID()); err != nil { - return err - } - return nil -} - -func resourceGithubProjectColumnUpdate(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - options := github.ProjectColumnOptions{ - Name: d.Get("name").(string), - } - - columnID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - _, _, err = client.Projects.UpdateProjectColumn(ctx, columnID, &options) - if err != nil { - return err - } - - return resourceGithubProjectColumnRead(d, meta) -} - -func resourceGithubProjectColumnDelete(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - columnID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - _, err = client.Projects.DeleteProjectColumn(ctx, columnID) - return err -} diff --git a/github/resource_github_project_column_test.go b/github/resource_github_project_column_test.go deleted file mode 100644 index 0b3f86bcb7..0000000000 --- a/github/resource_github_project_column_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package github - -import ( - "context" - "fmt" - "strconv" - "testing" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" -) - -func TestAccGithubProjectColumn_basic(t *testing.T) { - t.Skip("Skipping test as the GitHub REST API no longer supports classic projects") - - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var column github.ProjectColumn - - rn := "github_project_column.column" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccGithubProjectColumnDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubProjectColumnConfig("new column name"), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubProjectColumnExists(rn, &column), - testAccCheckGithubProjectColumnAttributes(&column, &testAccGithubProjectColumnExpectedAttributes{ - Name: "new column name", - }), - ), - }, - { - Config: testAccGithubProjectColumnConfig("updated column name"), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubProjectColumnExists(rn, &column), - testAccCheckGithubProjectColumnAttributes(&column, &testAccGithubProjectColumnExpectedAttributes{ - Name: "updated column name", - }), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccGithubProjectColumnDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Owner).v3client - - for _, rs := range s.RootModule().Resources { - if rs.Type != "github_project_column" { - continue - } - - columnID, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return err - } - - column, res, err := conn.Projects.GetProjectColumn(context.TODO(), columnID) - if err == nil { - if column != nil && - column.GetID() == columnID { - return fmt.Errorf("project column still exists") - } - } - if res.StatusCode != 404 { - return err - } - } - return nil -} - -func testAccCheckGithubProjectColumnExists(n string, project *github.ProjectColumn) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("not found: %s", n) - } - - columnID, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return err - } - - conn := testAccProvider.Meta().(*Owner).v3client - gotColumn, _, err := conn.Projects.GetProjectColumn(context.TODO(), columnID) - if err != nil { - return err - } - *project = *gotColumn - return nil - } -} - -type testAccGithubProjectColumnExpectedAttributes struct { - Name string -} - -func testAccCheckGithubProjectColumnAttributes(column *github.ProjectColumn, want *testAccGithubProjectColumnExpectedAttributes) resource.TestCheckFunc { - return func(s *terraform.State) error { - if name := column.GetName(); name != want.Name { - return fmt.Errorf("got project column %q; want %q", name, want.Name) - } - - return nil - } -} - -func testAccGithubProjectColumnConfig(columnName string) string { - return fmt.Sprintf(` -resource "github_organization_project" "test" { - name = "test-project" - body = "this is a test project" -} - -resource "github_project_column" "column" { - project_id = "${github_organization_project.test.id}" - name = "%s" -} -`, columnName) -} diff --git a/github/resource_github_project_item.go b/github/resource_github_project_item.go new file mode 100644 index 0000000000..eddfd42571 --- /dev/null +++ b/github/resource_github_project_item.go @@ -0,0 +1,266 @@ +package github + +import ( + "context" + "errors" + "fmt" + "log" + "net/http" + "strconv" + "strings" + + "github.com/google/go-github/v79/github" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func resourceGithubProjectItem() *schema.Resource { + return &schema.Resource{ + Create: resourceGithubProjectItemCreate, + Read: resourceGithubProjectItemRead, + Update: resourceGithubProjectItemUpdate, + Delete: resourceGithubProjectItemDelete, + Importer: &schema.ResourceImporter{ + State: resourceGithubProjectItemImport, + }, + Schema: map[string]*schema.Schema{ + "project_number": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + Description: "The number of the project (Projects V2).", + }, + "content_id": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + Description: "The ID of the issue or pull request to add to the project.", + }, + "content_type": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: func(val any, key string) (warns []string, errs []error) { + v := val.(string) + if v != "Issue" && v != "PullRequest" { + errs = append(errs, fmt.Errorf("%q must be either 'Issue' or 'PullRequest', got: %s", key, v)) + } + return warns, errs + }, + Description: "Must be either 'Issue' or 'PullRequest'.", + }, + "archived": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Whether the item is archived.", + }, + "node_id": { + Type: schema.TypeString, + Computed: true, + Description: "The node ID of the project item.", + }, + "item_id": { + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the project item.", + }, + "etag": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceGithubProjectItemCreate(d *schema.ResourceData, meta any) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + projectNumber := d.Get("project_number").(int) + contentID := int64(d.Get("content_id").(int)) + contentType := d.Get("content_type").(string) + + options := &github.AddProjectItemOptions{ + Type: contentType, + ID: contentID, + } + + ctx := context.Background() + log.Printf("[DEBUG] Adding %s %d to project %d", contentType, contentID, projectNumber) + + item, _, err := client.Projects.AddOrganizationProjectItem(ctx, orgName, projectNumber, options) + if err != nil { + return err + } + + d.SetId(strconv.FormatInt(item.GetID(), 10)) + if err = d.Set("item_id", item.GetID()); err != nil { + return err + } + if err = d.Set("node_id", item.GetNodeID()); err != nil { + return err + } + + // If archived is set to true, update the item + if d.Get("archived").(bool) { + updateOpts := &github.UpdateProjectItemOptions{ + Archived: github.Ptr(true), + } + _, _, err = client.Projects.UpdateOrganizationProjectItem(ctx, orgName, projectNumber, item.GetID(), updateOpts) + if err != nil { + return err + } + } + + return resourceGithubProjectItemRead(d, meta) +} + +func resourceGithubProjectItemRead(d *schema.ResourceData, meta any) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + projectNumber := d.Get("project_number").(int) + + itemID, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return unconvertibleIdErr(d.Id(), err) + } + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + if !d.IsNewResource() { + ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) + } + + log.Printf("[DEBUG] Reading project item: %d", itemID) + item, resp, err := client.Projects.GetOrganizationProjectItem(ctx, orgName, projectNumber, itemID, nil) + if err != nil { + ghErr := &github.ErrorResponse{} + if errors.As(err, &ghErr) { + if ghErr.Response.StatusCode == http.StatusNotModified { + return nil + } + if ghErr.Response.StatusCode == http.StatusNotFound { + log.Printf("[INFO] Removing project item %s from state because it no longer exists in GitHub", d.Id()) + d.SetId("") + return nil + } + } + return err + } + + if err = d.Set("etag", resp.Header.Get("ETag")); err != nil { + return err + } + if err = d.Set("item_id", item.GetID()); err != nil { + return err + } + if err = d.Set("node_id", item.GetNodeID()); err != nil { + return err + } + if err = d.Set("content_type", item.GetContentType()); err != nil { + return err + } + archived := item.ArchivedAt != nil + + if err = d.Set("archived", archived); err != nil { + return err + } + + return nil +} + +func resourceGithubProjectItemUpdate(d *schema.ResourceData, meta any) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + projectNumber := d.Get("project_number").(int) + + itemID, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return unconvertibleIdErr(d.Id(), err) + } + + log.Printf("[DEBUG] Updating project item: %d", itemID) + + // Only archived status can be updated for project items + if d.HasChange("archived") { + archived := d.Get("archived").(bool) + options := &github.UpdateProjectItemOptions{ + Archived: &archived, + } + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + _, _, err := client.Projects.UpdateOrganizationProjectItem(ctx, orgName, projectNumber, itemID, options) + if err != nil { + return err + } + } + + return resourceGithubProjectItemRead(d, meta) +} + +func resourceGithubProjectItemDelete(d *schema.ResourceData, meta any) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + projectNumber := d.Get("project_number").(int) + + itemID, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return unconvertibleIdErr(d.Id(), err) + } + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + + log.Printf("[DEBUG] Deleting project item: %d", itemID) + _, err = client.Projects.DeleteOrganizationProjectItem(ctx, orgName, projectNumber, itemID) + if err != nil { + return err + } + + return nil +} + +func resourceGithubProjectItemImport(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { + // For project items, we need: org/project_number/item_id + parts := strings.Split(d.Id(), "/") + if len(parts) != 3 { + return nil, fmt.Errorf("invalid ID format: expected 'org/project_number/item_id', got '%s'", d.Id()) + } + + projectNumber, err := strconv.Atoi(parts[1]) + if err != nil { + return nil, fmt.Errorf("invalid project number: %w", err) + } + + itemIDStr := parts[2] + itemID, err := strconv.ParseInt(itemIDStr, 10, 64) + if err != nil { + return nil, fmt.Errorf("invalid item ID: %w", err) + } + + // Set the computed ID to just the item ID + d.SetId(itemIDStr) + if err = d.Set("project_number", projectNumber); err != nil { + return []*schema.ResourceData{d}, err + } + + log.Printf("[DEBUG] Imported project item %d from project %d", itemID, projectNumber) + return []*schema.ResourceData{d}, nil +} diff --git a/github/resource_github_project_item_test.go b/github/resource_github_project_item_test.go new file mode 100644 index 0000000000..0019fd88b4 --- /dev/null +++ b/github/resource_github_project_item_test.go @@ -0,0 +1,147 @@ +package github + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccGithubProjectItem(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("creates a project item using an issue", func(t *testing.T) { + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + has_issues = true + } + + resource "github_issue" "test" { + repository = github_repository.test.name + title = "Test issue title" + body = "Test issue body" + } + + resource "github_organization_project" "test" { + name = "tf-acc-%s" + body = "This is a test project." + } + + resource "github_project_item" "test" { + project_number = github_organization_project.test.project_number + content_id = github_issue.test.issue_id + content_type = "Issue" + } + + `, randomID, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "github_project_item.test", "item_id", + ), + resource.TestCheckResourceAttrSet( + "github_project_item.test", "node_id", + ), + resource.TestCheckResourceAttr( + "github_project_item.test", "content_type", "Issue", + ), + resource.TestCheckResourceAttr( + "github_project_item.test", "archived", "false", + ), + func(s *terraform.State) error { + item := s.RootModule().Resources["github_project_item.test"] + issue := s.RootModule().Resources["github_issue.test"] + + itemContentID := item.Primary.Attributes["content_id"] + issueID := issue.Primary.Attributes["issue_id"] + if itemContentID != issueID { + return fmt.Errorf("project item content_id %s not the same as issue id %s", + itemContentID, issueID) + } + return nil + }, + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) + + t.Run("creates an archived project item", func(t *testing.T) { + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + has_issues = true + } + + resource "github_issue" "test" { + repository = github_repository.test.name + title = "Test issue title" + body = "Test issue body" + } + + resource "github_organization_project" "test" { + name = "tf-acc-%s" + body = "This is a test project." + } + + resource "github_project_item" "test" { + project_number = github_organization_project.test.project_number + content_id = github_issue.test.issue_id + content_type = "Issue" + archived = true + } + + `, randomID, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_project_item.test", "archived", "true", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) +} diff --git a/github/resource_github_release.go b/github/resource_github_release.go index 83a1b0fb52..dbed1c9efd 100644 --- a/github/resource_github_release.go +++ b/github/resource_github_release.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -153,23 +153,23 @@ func resourceGithubReleaseCreateUpdate(d *schema.ResourceData, meta any) error { generateReleaseNotes := d.Get("generate_release_notes").(bool) req := &github.RepositoryRelease{ - TagName: github.String(tagName), - TargetCommitish: github.String(targetCommitish), - Draft: github.Bool(draft), - Prerelease: github.Bool(prerelease), - GenerateReleaseNotes: github.Bool(generateReleaseNotes), + TagName: github.Ptr(tagName), + TargetCommitish: github.Ptr(targetCommitish), + Draft: github.Ptr(draft), + Prerelease: github.Ptr(prerelease), + GenerateReleaseNotes: github.Ptr(generateReleaseNotes), } if v, ok := d.GetOk("body"); ok { - req.Body = github.String(v.(string)) + req.Body = github.Ptr(v.(string)) } if v, ok := d.GetOk("name"); ok { - req.Name = github.String(v.(string)) + req.Name = github.Ptr(v.(string)) } if v, ok := d.GetOk("discussion_category_name"); ok { - req.DiscussionCategoryName = github.String(v.(string)) + req.DiscussionCategoryName = github.Ptr(v.(string)) } var release *github.RepositoryRelease diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index b477fb78cc..e2a720d231 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -9,7 +9,7 @@ import ( "regexp" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -482,17 +482,17 @@ func calculateSecurityAndAnalysis(d *schema.ResourceData) *github.SecurityAndAna if ok, status := tryGetSecurityAndAnalysisSettingStatus(lookup, "advanced_security"); ok { securityAndAnalysis.AdvancedSecurity = &github.AdvancedSecurity{ - Status: github.String(status), + Status: github.Ptr(status), } } if ok, status := tryGetSecurityAndAnalysisSettingStatus(lookup, "secret_scanning"); ok { securityAndAnalysis.SecretScanning = &github.SecretScanning{ - Status: github.String(status), + Status: github.Ptr(status), } } if ok, status := tryGetSecurityAndAnalysisSettingStatus(lookup, "secret_scanning_push_protection"); ok { securityAndAnalysis.SecretScanningPushProtection = &github.SecretScanningPushProtection{ - Status: github.String(status), + Status: github.Ptr(status), } } @@ -501,28 +501,28 @@ func calculateSecurityAndAnalysis(d *schema.ResourceData) *github.SecurityAndAna func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository { repository := &github.Repository{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - Homepage: github.String(d.Get("homepage_url").(string)), - Visibility: github.String(calculateVisibility(d)), - HasDownloads: github.Bool(d.Get("has_downloads").(bool)), - HasIssues: github.Bool(d.Get("has_issues").(bool)), - HasDiscussions: github.Bool(d.Get("has_discussions").(bool)), - HasProjects: github.Bool(d.Get("has_projects").(bool)), - HasWiki: github.Bool(d.Get("has_wiki").(bool)), - IsTemplate: github.Bool(d.Get("is_template").(bool)), - AllowMergeCommit: github.Bool(d.Get("allow_merge_commit").(bool)), - AllowSquashMerge: github.Bool(d.Get("allow_squash_merge").(bool)), - AllowRebaseMerge: github.Bool(d.Get("allow_rebase_merge").(bool)), - AllowAutoMerge: github.Bool(d.Get("allow_auto_merge").(bool)), - DeleteBranchOnMerge: github.Bool(d.Get("delete_branch_on_merge").(bool)), - WebCommitSignoffRequired: github.Bool(d.Get("web_commit_signoff_required").(bool)), - AutoInit: github.Bool(d.Get("auto_init").(bool)), - LicenseTemplate: github.String(d.Get("license_template").(string)), - GitignoreTemplate: github.String(d.Get("gitignore_template").(string)), - Archived: github.Bool(d.Get("archived").(bool)), + Name: github.Ptr(d.Get("name").(string)), + Description: github.Ptr(d.Get("description").(string)), + Homepage: github.Ptr(d.Get("homepage_url").(string)), + Visibility: github.Ptr(calculateVisibility(d)), + HasDownloads: github.Ptr(d.Get("has_downloads").(bool)), + HasIssues: github.Ptr(d.Get("has_issues").(bool)), + HasDiscussions: github.Ptr(d.Get("has_discussions").(bool)), + HasProjects: github.Ptr(d.Get("has_projects").(bool)), + HasWiki: github.Ptr(d.Get("has_wiki").(bool)), + IsTemplate: github.Ptr(d.Get("is_template").(bool)), + AllowMergeCommit: github.Ptr(d.Get("allow_merge_commit").(bool)), + AllowSquashMerge: github.Ptr(d.Get("allow_squash_merge").(bool)), + AllowRebaseMerge: github.Ptr(d.Get("allow_rebase_merge").(bool)), + AllowAutoMerge: github.Ptr(d.Get("allow_auto_merge").(bool)), + DeleteBranchOnMerge: github.Ptr(d.Get("delete_branch_on_merge").(bool)), + WebCommitSignoffRequired: github.Ptr(d.Get("web_commit_signoff_required").(bool)), + AutoInit: github.Ptr(d.Get("auto_init").(bool)), + LicenseTemplate: github.Ptr(d.Get("license_template").(string)), + GitignoreTemplate: github.Ptr(d.Get("gitignore_template").(string)), + Archived: github.Ptr(d.Get("archived").(bool)), Topics: expandStringList(d.Get("topics").(*schema.Set).List()), - AllowUpdateBranch: github.Bool(d.Get("allow_update_branch").(bool)), + AllowUpdateBranch: github.Ptr(d.Get("allow_update_branch").(bool)), SecurityAndAnalysis: calculateSecurityAndAnalysis(d), } @@ -530,8 +530,8 @@ func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository { allowMergeCommit, ok := d.Get("allow_merge_commit").(bool) if ok { if allowMergeCommit { - repository.MergeCommitTitle = github.String(d.Get("merge_commit_title").(string)) - repository.MergeCommitMessage = github.String(d.Get("merge_commit_message").(string)) + repository.MergeCommitTitle = github.Ptr(d.Get("merge_commit_title").(string)) + repository.MergeCommitMessage = github.Ptr(d.Get("merge_commit_message").(string)) } } @@ -539,8 +539,8 @@ func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository { allowSquashMerge, ok := d.Get("allow_squash_merge").(bool) if ok { if allowSquashMerge { - repository.SquashMergeCommitTitle = github.String(d.Get("squash_merge_commit_title").(string)) - repository.SquashMergeCommitMessage = github.String(d.Get("squash_merge_commit_message").(string)) + repository.SquashMergeCommitTitle = github.Ptr(d.Get("squash_merge_commit_title").(string)) + repository.SquashMergeCommitMessage = github.Ptr(d.Get("squash_merge_commit_message").(string)) } } @@ -576,7 +576,7 @@ func resourceGithubRepositoryCreate(d *schema.ResourceData, meta any) error { } } - repoReq.Private = github.Bool(isPrivate) + repoReq.Private = github.Ptr(isPrivate) if template, ok := d.GetOk("template"); ok { templateConfigBlocks := template.([]any) @@ -594,9 +594,9 @@ func resourceGithubRepositoryCreate(d *schema.ResourceData, meta any) error { templateRepoReq := github.TemplateRepoRequest{ Name: &repoName, Owner: &owner, - Description: github.String(d.Get("description").(string)), - Private: github.Bool(isPrivate), - IncludeAllBranches: github.Bool(includeAllBranches), + Description: github.Ptr(d.Get("description").(string)), + Private: github.Ptr(isPrivate), + IncludeAllBranches: github.Ptr(includeAllBranches), } repo, _, err := client.Repositories.CreateFromTemplate(ctx, @@ -860,7 +860,7 @@ func resourceGithubRepositoryUpdate(d *schema.ResourceData, meta any) error { // compatibility we need to allow terraform configurations that set // `default_branch` to "main" when a repository is created. if d.HasChange("default_branch") && !d.IsNewResource() { - repoReq.DefaultBranch = github.String(d.Get("default_branch").(string)) + repoReq.DefaultBranch = github.Ptr(d.Get("default_branch").(string)) } repoName := d.Id() @@ -937,7 +937,7 @@ func resourceGithubRepositoryUpdate(d *schema.ResourceData, meta any) error { if d.HasChange("visibility") { o, n := d.GetChange("visibility") - repoReq.Visibility = github.String(n.(string)) + repoReq.Visibility = github.Ptr(n.(string)) log.Printf("[DEBUG] Updating repository visibility from %s to %s", o, n) _, resp, err := client.Repositories.Edit(ctx, owner, repoName, repoReq) if err != nil { @@ -951,7 +951,7 @@ func resourceGithubRepositoryUpdate(d *schema.ResourceData, meta any) error { if d.HasChange("private") { o, n := d.GetChange("private") - repoReq.Private = github.Bool(n.(bool)) + repoReq.Private = github.Ptr(n.(bool)) log.Printf("[DEBUG] Updating repository privacy from %v to %v", o, n) _, _, err = client.Repositories.Edit(ctx, owner, repoName, repoReq) if err != nil { @@ -1001,17 +1001,17 @@ func expandPages(input []any) *github.Pages { } pages := input[0].(map[string]any) source := &github.PagesSource{ - Branch: github.String("main"), + Branch: github.Ptr("main"), } if len(pages["source"].([]any)) == 1 { if pagesSource, ok := pages["source"].([]any)[0].(map[string]any); ok { if v, ok := pagesSource["branch"].(string); ok { - source.Branch = github.String(v) + source.Branch = github.Ptr(v) } if v, ok := pagesSource["path"].(string); ok { // To set to the root directory "/", leave source.Path unset if v != "" && v != "/" { - source.Path = github.String(v) + source.Path = github.Ptr(v) } } } @@ -1019,7 +1019,7 @@ func expandPages(input []any) *github.Pages { var buildType *string if v, ok := pages["build_type"].(string); ok { - buildType = github.String(v) + buildType = github.Ptr(v) } return &github.Pages{Source: source, BuildType: buildType} @@ -1036,12 +1036,12 @@ func expandPagesUpdate(input []any) *github.PagesUpdate { // Only set the github.PagesUpdate CNAME field if the value is a non-empty string. // Leaving the CNAME field unset will remove the custom domain. if v, ok := pages["cname"].(string); ok && v != "" { - update.CNAME = github.String(v) + update.CNAME = github.Ptr(v) } // Only set the github.PagesUpdate BuildType field if the value is a non-empty string. if v, ok := pages["build_type"].(string); ok && v != "" { - update.BuildType = github.String(v) + update.BuildType = github.Ptr(v) } // To update the GitHub Pages source, the github.PagesUpdate Source field diff --git a/github/resource_github_repository_autolink_reference.go b/github/resource_github_repository_autolink_reference.go index b819ed62e0..e73cbe1a7b 100644 --- a/github/resource_github_repository_autolink_reference.go +++ b/github/resource_github_repository_autolink_reference.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_repository_collaborator.go b/github/resource_github_repository_collaborator.go index 387617d1b7..3dbe5d1bf8 100644 --- a/github/resource_github_repository_collaborator.go +++ b/github/resource_github_repository_collaborator.go @@ -8,7 +8,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_repository_collaborators.go b/github/resource_github_repository_collaborators.go index 3b2bf597b7..a9343625ce 100644 --- a/github/resource_github_repository_collaborators.go +++ b/github/resource_github_repository_collaborators.go @@ -8,7 +8,7 @@ import ( "sort" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -407,7 +407,6 @@ func matchUserCollaboratorsAndInvites(repoName string, want []any, hasUsers []us func matchTeamCollaborators(repoName string, want []any, has []teamCollaborator, meta any) error { client := meta.(*Owner).v3client - orgID := meta.(*Owner).id owner := meta.(*Owner).name ctx := context.Background() @@ -429,9 +428,9 @@ func matchTeamCollaborators(repoName string, want []any, has []teamCollaborator, if wantPerm == "" { // user should NOT have permission remove = append(remove, hasTeam) } else if wantPerm != hasTeam.permission { // permission should be updated - log.Printf("[DEBUG] Updating team %d permission from %s to %s for repo: %s.", hasTeam.teamID, hasTeam.permission, wantPerm, repoName) - _, err := client.Teams.AddTeamRepoByID( - ctx, orgID, hasTeam.teamID, owner, repoName, &github.TeamAddTeamRepoOptions{ + log.Printf("[DEBUG] Updating team %s permission from %s to %s for repo: %s.", hasTeam.teamSlug, hasTeam.permission, wantPerm, repoName) + _, err := client.Teams.AddTeamRepoBySlug( + ctx, owner, hasTeam.teamSlug, owner, repoName, &github.TeamAddTeamRepoOptions{ Permission: wantPerm, }, ) @@ -444,6 +443,10 @@ func matchTeamCollaborators(repoName string, want []any, has []teamCollaborator, for _, t := range want { teamData := t.(map[string]any) teamIDString := teamData["team_id"].(string) + teamSlug, err := getTeamSlug(teamIDString, meta) + if err != nil { + return err + } teamID, err := getTeamID(teamIDString, meta) if err != nil { return err @@ -460,9 +463,9 @@ func matchTeamCollaborators(repoName string, want []any, has []teamCollaborator, } permission := teamData["permission"].(string) // team needs to be added - log.Printf("[DEBUG] Adding team %s with permission %s for repo: %s.", teamIDString, permission, repoName) - _, err = client.Teams.AddTeamRepoByID( - ctx, orgID, teamID, owner, repoName, &github.TeamAddTeamRepoOptions{ + log.Printf("[DEBUG] Adding team %s with permission %s for repo: %s.", teamSlug, permission, repoName) + _, err = client.Teams.AddTeamRepoBySlug( + ctx, owner, teamSlug, owner, repoName, &github.TeamAddTeamRepoOptions{ Permission: permission, }, ) @@ -472,10 +475,10 @@ func matchTeamCollaborators(repoName string, want []any, has []teamCollaborator, } for _, team := range remove { - log.Printf("[DEBUG] Removing team %d from repo: %s.", team.teamID, repoName) - _, err := client.Teams.RemoveTeamRepoByID(ctx, orgID, team.teamID, owner, repoName) + log.Printf("[DEBUG] Removing team %s from repo: %s.", team.teamSlug, repoName) + _, err := client.Teams.RemoveTeamRepoBySlug(ctx, owner, team.teamSlug, owner, repoName) if err != nil { - err = handleArchivedRepoDelete(err, "team repository access", fmt.Sprintf("team %d", team.teamID), owner, repoName) + err = handleArchivedRepoDelete(err, "team repository access", fmt.Sprintf("team %s", team.teamSlug), owner, repoName) if err != nil { return err } diff --git a/github/resource_github_repository_collaborators_test.go b/github/resource_github_repository_collaborators_test.go index 61d52aa548..e0eb8948c9 100644 --- a/github/resource_github_repository_collaborators_test.go +++ b/github/resource_github_repository_collaborators_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" diff --git a/github/resource_github_repository_custom_property.go b/github/resource_github_repository_custom_property.go index 2acae05cc3..199a96caca 100644 --- a/github/resource_github_repository_custom_property.go +++ b/github/resource_github_repository_custom_property.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_repository_deploy_key.go b/github/resource_github_repository_deploy_key.go index 944eaa6054..e69547fb9f 100644 --- a/github/resource_github_repository_deploy_key.go +++ b/github/resource_github_repository_deploy_key.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -69,9 +69,9 @@ func resourceGithubRepositoryDeployKeyCreate(d *schema.ResourceData, meta any) e ctx := context.Background() resultKey, _, err := client.Repositories.CreateKey(ctx, owner, repoName, &github.Key{ - Key: github.String(key), - Title: github.String(title), - ReadOnly: github.Bool(readOnly), + Key: github.Ptr(key), + Title: github.Ptr(title), + ReadOnly: github.Ptr(readOnly), }) if err != nil { return err diff --git a/github/resource_github_repository_deployment_branch_policy.go b/github/resource_github_repository_deployment_branch_policy.go index 82d0c5c07c..4c6fbafcae 100644 --- a/github/resource_github_repository_deployment_branch_policy.go +++ b/github/resource_github_repository_deployment_branch_policy.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -86,7 +86,7 @@ func resourceGithubRepositoryDeploymentBranchPolicyCreate(d *schema.ResourceData environmentName := d.Get("environment_name").(string) name := d.Get("name").(string) - policy, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, owner, repoName, environmentName, &github.DeploymentBranchPolicyRequest{Name: &name, Type: github.String("branch")}) + policy, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, owner, repoName, environmentName, &github.DeploymentBranchPolicyRequest{Name: &name, Type: github.Ptr("branch")}) if err != nil { return err } diff --git a/github/resource_github_repository_environment.go b/github/resource_github_repository_environment.go index 6e8c0b7d46..b921d7a1ef 100644 --- a/github/resource_github_repository_environment.go +++ b/github/resource_github_repository_environment.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -245,27 +245,27 @@ func createUpdateEnvironmentData(d *schema.ResourceData) github.CreateUpdateEnvi data := github.CreateUpdateEnvironment{} if v, ok := d.GetOk("wait_timer"); ok { - data.WaitTimer = github.Int(v.(int)) + data.WaitTimer = github.Ptr(v.(int)) } - data.CanAdminsBypass = github.Bool(d.Get("can_admins_bypass").(bool)) + data.CanAdminsBypass = github.Ptr(d.Get("can_admins_bypass").(bool)) - data.PreventSelfReview = github.Bool(d.Get("prevent_self_review").(bool)) + data.PreventSelfReview = github.Ptr(d.Get("prevent_self_review").(bool)) if v, ok := d.GetOk("reviewers"); ok { envReviewers := make([]*github.EnvReviewers, 0) for _, team := range expandReviewers(v, "teams") { envReviewers = append(envReviewers, &github.EnvReviewers{ - Type: github.String("Team"), - ID: github.Int64(team), + Type: github.Ptr("Team"), + ID: github.Ptr(team), }) } for _, user := range expandReviewers(v, "users") { envReviewers = append(envReviewers, &github.EnvReviewers{ - Type: github.String("User"), - ID: github.Int64(user), + Type: github.Ptr("User"), + ID: github.Ptr(user), }) } @@ -275,8 +275,8 @@ func createUpdateEnvironmentData(d *schema.ResourceData) github.CreateUpdateEnvi if v, ok := d.GetOk("deployment_branch_policy"); ok { policy := v.([]any)[0].(map[string]any) data.DeploymentBranchPolicy = &github.BranchPolicy{ - ProtectedBranches: github.Bool(policy["protected_branches"].(bool)), - CustomBranchPolicies: github.Bool(policy["custom_branch_policies"].(bool)), + ProtectedBranches: github.Ptr(policy["protected_branches"].(bool)), + CustomBranchPolicies: github.Ptr(policy["custom_branch_policies"].(bool)), } } diff --git a/github/resource_github_repository_environment_deployment_policy.go b/github/resource_github_repository_environment_deployment_policy.go index cff33e46be..31aee27e45 100644 --- a/github/resource_github_repository_environment_deployment_policy.go +++ b/github/resource_github_repository_environment_deployment_policy.go @@ -9,7 +9,7 @@ import ( "net/url" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -66,13 +66,13 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyCreate(d *schema.Resourc var createData github.DeploymentBranchPolicyRequest if v, ok := d.GetOk("branch_pattern"); ok { createData = github.DeploymentBranchPolicyRequest{ - Name: github.String(v.(string)), - Type: github.String("branch"), + Name: github.Ptr(v.(string)), + Type: github.Ptr("branch"), } } else if v, ok := d.GetOk("tag_pattern"); ok { createData = github.DeploymentBranchPolicyRequest{ - Name: github.String(v.(string)), - Type: github.String("tag"), + Name: github.Ptr(v.(string)), + Type: github.Ptr("tag"), } } else { return fmt.Errorf("exactly one of %q and %q must be specified", "branch_pattern", "tag_pattern") @@ -153,7 +153,7 @@ func resourceGithubRepositoryEnvironmentDeploymentPolicyUpdate(d *schema.Resourc } updateData := github.DeploymentBranchPolicyRequest{ - Name: github.String(pattern), + Name: github.Ptr(pattern), } resultKey, _, err := client.Repositories.UpdateDeploymentBranchPolicy(ctx, owner, repoName, escapedEnvName, branchPolicyId, &updateData) diff --git a/github/resource_github_repository_file.go b/github/resource_github_repository_file.go index 46775f9c6b..dc11cdc333 100644 --- a/github/resource_github_repository_file.go +++ b/github/resource_github_repository_file.go @@ -9,7 +9,7 @@ import ( "net/url" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -149,11 +149,11 @@ func resourceGithubRepositoryFile() *schema.Resource { func resourceGithubRepositoryFileOptions(d *schema.ResourceData) (*github.RepositoryContentFileOptions, error) { opts := &github.RepositoryContentFileOptions{ - Content: []byte(*github.String(d.Get("content").(string))), + Content: []byte(d.Get("content").(string)), } if branch, ok := d.GetOk("branch"); ok { - opts.Branch = github.String(branch.(string)) + opts.Branch = github.Ptr(branch.(string)) } if commitMessage, hasCommitMessage := d.GetOk("commit_message"); hasCommitMessage { @@ -214,9 +214,9 @@ func resourceGithubRepositoryFileCreate(d *schema.ResourceData, meta any) error _ = d.Set("autocreate_branch_source_sha", *ref.Object.SHA) } sourceBranchSHA := d.Get("autocreate_branch_source_sha").(string) - if _, _, err := client.Git.CreateRef(ctx, owner, repo, &github.Reference{ - Ref: &branchRefName, - Object: &github.GitObject{SHA: &sourceBranchSHA}, + if _, _, err := client.Git.CreateRef(ctx, owner, repo, github.CreateRef{ + Ref: branchRefName, + SHA: sourceBranchSHA, }); err != nil { return err } @@ -411,9 +411,9 @@ func resourceGithubRepositoryFileUpdate(d *schema.ResourceData, meta any) error _ = d.Set("autocreate_branch_source_sha", *ref.Object.SHA) } sourceBranchSHA := d.Get("autocreate_branch_source_sha").(string) - if _, _, err := client.Git.CreateRef(ctx, owner, repo, &github.Reference{ - Ref: &branchRefName, - Object: &github.GitObject{SHA: &sourceBranchSHA}, + if _, _, err := client.Git.CreateRef(ctx, owner, repo, github.CreateRef{ + Ref: branchRefName, + SHA: sourceBranchSHA, }); err != nil { return err } @@ -484,9 +484,9 @@ func resourceGithubRepositoryFileDelete(d *schema.ResourceData, meta any) error _ = d.Set("autocreate_branch_source_sha", *ref.Object.SHA) } sourceBranchSHA := d.Get("autocreate_branch_source_sha").(string) - if _, _, err := client.Git.CreateRef(ctx, owner, repo, &github.Reference{ - Ref: &branchRefName, - Object: &github.GitObject{SHA: &sourceBranchSHA}, + if _, _, err := client.Git.CreateRef(ctx, owner, repo, github.CreateRef{ + Ref: branchRefName, + SHA: sourceBranchSHA, }); err != nil { return err } diff --git a/github/resource_github_repository_milestone.go b/github/resource_github_repository_milestone.go index b1ec2e2212..5efab539db 100644 --- a/github/resource_github_repository_milestone.go +++ b/github/resource_github_repository_milestone.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -101,11 +101,11 @@ func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta any) e repoName := d.Get("repository").(string) milestone := &github.Milestone{ - Title: github.String(d.Get("title").(string)), + Title: github.Ptr(d.Get("title").(string)), } if v, ok := d.GetOk("description"); ok && len(v.(string)) > 0 { - milestone.Description = github.String(v.(string)) + milestone.Description = github.Ptr(v.(string)) } if v, ok := d.GetOk("due_date"); ok && len(v.(string)) > 0 { dueDate, err := time.Parse(layoutISO, v.(string)) @@ -118,7 +118,7 @@ func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta any) e } } if v, ok := d.GetOk("state"); ok && len(v.(string)) > 0 { - milestone.State = github.String(v.(string)) + milestone.State = github.Ptr(v.(string)) } milestone, _, err := conn.Issues.CreateMilestone(ctx, owner, repoName, milestone) @@ -193,12 +193,12 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta any) e milestone := &github.Milestone{} if d.HasChanges("title") { _, n := d.GetChange("title") - milestone.Title = github.String(n.(string)) + milestone.Title = github.Ptr(n.(string)) } if d.HasChanges("description") { _, n := d.GetChange("description") - milestone.Description = github.String(n.(string)) + milestone.Description = github.Ptr(n.(string)) } if d.HasChanges("due_date") { @@ -215,7 +215,7 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta any) e if d.HasChanges("state") { _, n := d.GetChange("state") - milestone.State = github.String(n.(string)) + milestone.State = github.Ptr(n.(string)) } _, _, err = conn.Issues.EditMilestone(ctx, owner, repoName, number, milestone) diff --git a/github/resource_github_repository_project.go b/github/resource_github_repository_project.go deleted file mode 100644 index 2b3b13e789..0000000000 --- a/github/resource_github_repository_project.go +++ /dev/null @@ -1,180 +0,0 @@ -package github - -import ( - "context" - "errors" - "fmt" - "log" - "net/http" - "strconv" - "strings" - - "github.com/google/go-github/v67/github" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -func resourceGithubRepositoryProject() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", - - Create: resourceGithubRepositoryProjectCreate, - Read: resourceGithubRepositoryProjectRead, - Update: resourceGithubRepositoryProjectUpdate, - Delete: resourceGithubRepositoryProjectDelete, - Importer: &schema.ResourceImporter{ - State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { - parts := strings.Split(d.Id(), "/") - if len(parts) != 2 { - return nil, fmt.Errorf("invalid ID specified: supplied ID must be written as /") - } - if err := d.Set("repository", parts[0]); err != nil { - return nil, err - } - d.SetId(parts[1]) - return []*schema.ResourceData{d}, nil - }, - }, - - Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - Description: "The name of the project.", - }, - "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "The repository of the project.", - }, - "body": { - Type: schema.TypeString, - Optional: true, - Description: "The body of the project.", - }, - "url": { - Type: schema.TypeString, - Computed: true, - Description: "URL of the project", - }, - "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, - DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { - return true - }, - DiffSuppressOnRefresh: true, - }, - }, - } -} - -func resourceGithubRepositoryProjectCreate(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - owner := meta.(*Owner).name - repoName := d.Get("repository").(string) - name := d.Get("name").(string) - body := d.Get("body").(string) - - options := github.ProjectOptions{ - Name: &name, - Body: &body, - } - ctx := context.Background() - - project, _, err := client.Repositories.CreateProject(ctx, - owner, repoName, &options) - if err != nil { - return err - } - d.SetId(strconv.FormatInt(project.GetID(), 10)) - - return resourceGithubRepositoryProjectRead(d, meta) -} - -func resourceGithubRepositoryProjectRead(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - owner := meta.(*Owner).name - - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - if !d.IsNewResource() { - ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) - } - - project, resp, err := client.Projects.GetProject(ctx, projectID) - if err != nil { - ghErr := &github.ErrorResponse{} - if errors.As(err, &ghErr) { - if ghErr.Response.StatusCode == http.StatusNotModified { - return nil - } - if ghErr.Response.StatusCode == http.StatusNotFound { - log.Printf("[INFO] Removing repository project %s from state because it no longer exists in GitHub", - d.Id()) - d.SetId("") - return nil - } - } - return err - } - - if err = d.Set("etag", resp.Header.Get("ETag")); err != nil { - return err - } - if err = d.Set("name", project.GetName()); err != nil { - return err - } - if err = d.Set("body", project.GetBody()); err != nil { - return err - } - if err := d.Set("url", fmt.Sprintf("https://github.com/%s/%s/projects/%d", - owner, d.Get("repository"), project.GetNumber())); err != nil { - return err - } - - return nil -} - -func resourceGithubRepositoryProjectUpdate(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - name := d.Get("name").(string) - body := d.Get("body").(string) - - options := github.ProjectOptions{ - Name: &name, - Body: &body, - } - - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - _, _, err = client.Projects.UpdateProject(ctx, projectID, &options) - if err != nil { - return err - } - - return resourceGithubRepositoryProjectRead(d, meta) -} - -func resourceGithubRepositoryProjectDelete(d *schema.ResourceData, meta any) error { - client := meta.(*Owner).v3client - - projectID, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } - ctx := context.WithValue(context.Background(), ctxId, d.Id()) - - _, err = client.Projects.DeleteProject(ctx, projectID) - return err -} diff --git a/github/resource_github_repository_project_test.go b/github/resource_github_repository_project_test.go deleted file mode 100644 index 4911660fec..0000000000 --- a/github/resource_github_repository_project_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package github - -import ( - "fmt" - "regexp" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccGithubRepositoryProject(t *testing.T) { - t.Skip("Skipping test as the GitHub REST API no longer supports classic projects") - - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - - t.Run("creates a repository project", func(t *testing.T) { - config := fmt.Sprintf(` - - resource "github_repository" "test" { - name = "tf-acc-test-%s" - has_projects = true - } - - resource "github_repository_project" "test" { - name = "test" - repository = github_repository.test.name - body = "this is a test project" - } - `, randomID) - - check := resource.ComposeTestCheckFunc( - resource.TestMatchResourceAttr( - "github_repository_project.test", "url", - regexp.MustCompile(randomID+"/projects/1"), - ), - ) - - testCase := func(t *testing.T, mode string) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { skipUnlessMode(t, mode) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: config, - Check: check, - }, - }, - }) - } - - t.Run("with an anonymous account", func(t *testing.T) { - t.Skip("anonymous account not supported for this operation") - }) - - t.Run("with an individual account", func(t *testing.T) { - testCase(t, individual) - }) - - t.Run("with an organization account", func(t *testing.T) { - testCase(t, organization) - }) - }) -} diff --git a/github/resource_github_repository_pull_request.go b/github/resource_github_repository_pull_request.go index 6c33eca154..d18c61714d 100644 --- a/github/resource_github_repository_pull_request.go +++ b/github/resource_github_repository_pull_request.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -159,11 +159,11 @@ func resourceGithubRepositoryPullRequestCreate(d *schema.ResourceData, meta any) } pullRequest, _, err := client.PullRequests.Create(ctx, baseOwner, baseRepository, &github.NewPullRequest{ - Title: github.String(d.Get("title").(string)), - Head: github.String(head), - Base: github.String(d.Get("base_ref").(string)), - Body: github.String(d.Get("body").(string)), - MaintainerCanModify: github.Bool(d.Get("maintainer_can_modify").(bool)), + Title: github.Ptr(d.Get("title").(string)), + Head: github.Ptr(head), + Base: github.Ptr(d.Get("base_ref").(string)), + Body: github.Ptr(d.Get("body").(string)), + MaintainerCanModify: github.Ptr(d.Get("maintainer_can_modify").(bool)), }) if err != nil { return err @@ -273,14 +273,14 @@ func resourceGithubRepositoryPullRequestUpdate(d *schema.ResourceData, meta any) } update := &github.PullRequest{ - Title: github.String(d.Get("title").(string)), - Body: github.String(d.Get("body").(string)), - MaintainerCanModify: github.Bool(d.Get("maintainer_can_modify").(bool)), + Title: github.Ptr(d.Get("title").(string)), + Body: github.Ptr(d.Get("body").(string)), + MaintainerCanModify: github.Ptr(d.Get("maintainer_can_modify").(bool)), } if d.HasChange("base_ref") { update.Base = &github.PullRequestBranch{ - Ref: github.String(d.Get("base_ref").(string)), + Ref: github.Ptr(d.Get("base_ref").(string)), } } @@ -289,13 +289,13 @@ func resourceGithubRepositoryPullRequestUpdate(d *schema.ResourceData, meta any) return resourceGithubRepositoryPullRequestRead(d, meta) } - errs := []string{fmt.Sprintf("could not update the Pull Request: %v", err)} + errors := []string{fmt.Sprintf("could not update the Pull Request: %v", err)} if err := resourceGithubRepositoryPullRequestRead(d, meta); err != nil { - errs = append(errs, fmt.Sprintf("could not read the Pull Request after the failed update: %v", err)) + errors = append(errors, fmt.Sprintf("could not read the Pull Request after the failed update: %v", err)) } - return fmt.Errorf("%s", strings.Join(errs, ", ")) + return fmt.Errorf("%s", strings.Join(errors, ", ")) } func resourceGithubRepositoryPullRequestDelete(d *schema.ResourceData, meta any) error { @@ -316,7 +316,7 @@ func resourceGithubRepositoryPullRequestDelete(d *schema.ResourceData, meta any) return err } - update := &github.PullRequest{State: github.String("closed")} + update := &github.PullRequest{State: github.Ptr("closed")} if _, _, err = client.PullRequests.Edit(ctx, owner, repository, number, update); err != nil { return err } diff --git a/github/resource_github_repository_ruleset.go b/github/resource_github_repository_ruleset.go index 288f41122a..afd7d84827 100644 --- a/github/resource_github_repository_ruleset.go +++ b/github/resource_github_repository_ruleset.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -602,10 +602,10 @@ func resourceGithubRepositoryRulesetCreate(d *schema.ResourceData, meta any) err repoName := d.Get("repository").(string) ctx := context.Background() - var ruleset *github.Ruleset + var ruleset *github.RepositoryRuleset var err error - ruleset, _, err = client.Repositories.CreateRuleset(ctx, owner, repoName, rulesetReq) + ruleset, _, err = client.Repositories.CreateRuleset(ctx, owner, repoName, *rulesetReq) if err != nil { return err } @@ -630,7 +630,7 @@ func resourceGithubRepositoryRulesetRead(d *schema.ResourceData, meta any) error ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) } - var ruleset *github.Ruleset + var ruleset *github.RepositoryRuleset var resp *github.Response ruleset, resp, err = client.Repositories.GetRuleset(ctx, owner, repoName, rulesetID, false) @@ -684,15 +684,20 @@ func resourceGithubRepositoryRulesetUpdate(d *schema.ResourceData, meta any) err ctx := context.WithValue(context.Background(), ctxId, rulesetID) - var ruleset *github.Ruleset + var ruleset *github.RepositoryRuleset // Use UpdateRulesetNoBypassActor here instead of UpdateRuleset *if* bypass_actors has changed. // UpdateRuleset uses `omitempty` on BypassActors, causing empty arrays to be omitted from the JSON. // UpdateRulesetNoBypassActor always includes the field so that bypass actors can actually be removed. // See: https://github.com/google/go-github/blob/b6248e6f6aec019e75ba2c8e189bfe89f36b7d01/github/repos_rules.go#L196 if d.HasChange("bypass_actors") { - ruleset, _, err = client.Repositories.UpdateRulesetNoBypassActor(ctx, owner, repoName, rulesetID, rulesetReq) + // Clear bypass actors first, then update with new ruleset + _, err = client.Repositories.UpdateRulesetClearBypassActor(ctx, owner, repoName, rulesetID) + if err != nil { + return err + } + ruleset, _, err = client.Repositories.UpdateRuleset(ctx, owner, repoName, rulesetID, *rulesetReq) } else { - ruleset, _, err = client.Repositories.UpdateRuleset(ctx, owner, repoName, rulesetID, rulesetReq) + ruleset, _, err = client.Repositories.UpdateRuleset(ctx, owner, repoName, rulesetID, *rulesetReq) } if err != nil { return err diff --git a/github/resource_github_repository_ruleset_test.go b/github/resource_github_repository_ruleset_test.go index f299611286..f54a5b0768 100644 --- a/github/resource_github_repository_ruleset_test.go +++ b/github/resource_github_repository_ruleset_test.go @@ -431,7 +431,7 @@ func TestGithubRepositoryRulesets(t *testing.T) { restricted_file_paths = ["test.txt"] } max_file_size { - max_file_size = 1048576 + max_file_size = 100 } file_extension_restriction { restricted_file_extensions = ["*.zip"] diff --git a/github/resource_github_repository_topics.go b/github/resource_github_repository_topics.go index e4ef9a2558..848b491558 100644 --- a/github/resource_github_repository_topics.go +++ b/github/resource_github_repository_topics.go @@ -7,7 +7,7 @@ import ( "net/http" "regexp" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) diff --git a/github/resource_github_repository_webhook.go b/github/resource_github_repository_webhook.go index a09f388ad9..88e4c049d9 100644 --- a/github/resource_github_repository_webhook.go +++ b/github/resource_github_repository_webhook.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -174,7 +174,7 @@ func resourceGithubRepositoryWebhookRead(d *schema.ResourceData, meta any) error currentSecret := d.Get("configuration").([]any)[0].(map[string]any)["secret"] if hook.Config.Secret != nil { - hook.Config.Secret = github.String(currentSecret.(string)) + hook.Config.Secret = github.Ptr(currentSecret.(string)) } } diff --git a/github/resource_github_team.go b/github/resource_github_team.go index 482b9bc860..aab05f38aa 100644 --- a/github/resource_github_team.go +++ b/github/resource_github_team.go @@ -3,16 +3,41 @@ package github import ( "context" "errors" + "fmt" "log" "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/shurcooL/githubv4" ) +// findTeamByID lists teams and finds one by ID (fallback for deprecated GetTeamByID). +func findTeamByID(ctx context.Context, client *github.Client, orgName string, teamID int64) (*github.Team, error) { + opts := &github.ListOptions{PerPage: 100} + for { + teams, resp, err := client.Teams.ListTeams(ctx, orgName, opts) + if err != nil { + return nil, fmt.Errorf("error listing teams: %w", err) + } + + for _, team := range teams { + if team.GetID() == teamID { + return team, nil + } + } + + if resp.NextPage == 0 { + break + } + opts.Page = resp.NextPage + } + + return nil, fmt.Errorf("team with ID %d not found in organization %s", teamID, orgName) +} + func resourceGithubTeam() *schema.Resource { return &schema.Resource{ Create: resourceGithubTeamCreate, @@ -117,8 +142,8 @@ func resourceGithubTeamCreate(d *schema.ResourceData, meta any) error { newTeam := github.NewTeam{ Name: name, - Description: github.String(d.Get("description").(string)), - Privacy: github.String(d.Get("privacy").(string)), + Description: github.Ptr(d.Get("description").(string)), + Privacy: github.Ptr(d.Get("privacy").(string)), } if ldapDN := d.Get("ldap_dn").(string); ldapDN != "" { @@ -154,9 +179,9 @@ func resourceGithubTeamCreate(d *schema.ResourceData, meta any) error { on the parent team, the operation might still fail to set the parent team. */ if newTeam.ParentTeamID != nil && githubTeam.Parent == nil { - _, _, err := client.Teams.EditTeamByID(ctx, - *githubTeam.Organization.ID, - *githubTeam.ID, + _, _, err := client.Teams.EditTeamBySlug(ctx, + ownerName, + *githubTeam.Slug, newTeam, false) if err != nil { @@ -183,18 +208,36 @@ func resourceGithubTeamRead(d *schema.ResourceData, meta any) error { } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id + orgName := meta.(*Owner).name + + // Try to get team slug from state first (preferred method) + teamSlug := d.Get("slug").(string) - id, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } ctx := context.WithValue(context.Background(), ctxId, d.Id()) if !d.IsNewResource() { ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) } - team, resp, err := client.Teams.GetTeamByID(ctx, orgId, id) + var team *github.Team + var resp *github.Response + + if teamSlug != "" { + // Use team slug if available + team, resp, err = client.Teams.GetTeamBySlug(ctx, orgName, teamSlug) + } else { + // Fallback: parse team ID and find team by listing (less efficient) + id, parseErr := strconv.ParseInt(d.Id(), 10, 64) + if parseErr != nil { + return unconvertibleIdErr(d.Id(), parseErr) + } + + // List teams and find by ID + team, err = findTeamByID(ctx, client, orgName, id) + if err != nil { + return err + } + resp = nil // We don't have a response object from listing + } if err != nil { ghErr := &github.ErrorResponse{} if errors.As(err, &ghErr) { @@ -267,13 +310,12 @@ func resourceGithubTeamUpdate(d *schema.ResourceData, meta any) error { } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id var removeParentTeam bool editedTeam := github.NewTeam{ Name: d.Get("name").(string), - Description: github.String(d.Get("description").(string)), - Privacy: github.String(d.Get("privacy").(string)), + Description: github.Ptr(d.Get("description").(string)), + Privacy: github.Ptr(d.Get("privacy").(string)), } if parentTeamID, ok := d.GetOk("parent_team_id"); ok { teamId, err := getTeamID(parentTeamID.(string), meta) @@ -286,13 +328,29 @@ func resourceGithubTeamUpdate(d *schema.ResourceData, meta any) error { removeParentTeam = true } - teamId, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } + // Get team slug from state + teamSlug := d.Get("slug").(string) + ctx := context.WithValue(context.Background(), ctxId, d.Id()) - team, _, err := client.Teams.EditTeamByID(ctx, orgId, teamId, editedTeam, removeParentTeam) + var team *github.Team + if teamSlug != "" { + // Use team slug if available + team, _, err = client.Teams.EditTeamBySlug(ctx, meta.(*Owner).name, teamSlug, editedTeam, removeParentTeam) + } else { + // Fallback + teamId, parseErr := strconv.ParseInt(d.Id(), 10, 64) + if parseErr != nil { + return unconvertibleIdErr(d.Id(), parseErr) + } + + foundTeam, findErr := findTeamByID(ctx, client, meta.(*Owner).name, teamId) + if findErr != nil { + return findErr + } + + team, _, err = client.Teams.EditTeamBySlug(ctx, meta.(*Owner).name, foundTeam.GetSlug(), editedTeam, removeParentTeam) + } if err != nil { return err } @@ -300,7 +358,7 @@ func resourceGithubTeamUpdate(d *schema.ResourceData, meta any) error { if d.HasChange("ldap_dn") { ldapDN := d.Get("ldap_dn").(string) mapping := &github.TeamLDAPMapping{ - LDAPDN: github.String(ldapDN), + LDAPDN: github.Ptr(ldapDN), } _, _, err = client.Admin.UpdateTeamLDAPMapping(ctx, team.GetID(), mapping) if err != nil { @@ -319,15 +377,29 @@ func resourceGithubTeamDelete(d *schema.ResourceData, meta any) error { } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id + orgName := meta.(*Owner).name + + // Try to get team slug from state first + teamSlug := d.Get("slug").(string) - id, err := strconv.ParseInt(d.Id(), 10, 64) - if err != nil { - return unconvertibleIdErr(d.Id(), err) - } ctx := context.WithValue(context.Background(), ctxId, d.Id()) - _, err = client.Teams.DeleteTeamByID(ctx, orgId, id) + // Delete using slug if available, otherwise look up the slug by ID + if teamSlug != "" { + _, err = client.Teams.DeleteTeamBySlug(ctx, orgName, teamSlug) + } else { + // Fallback: find team slug by ID for legacy resources + id, parseErr := strconv.ParseInt(d.Id(), 10, 64) + if parseErr != nil { + return unconvertibleIdErr(d.Id(), parseErr) + } + team, findErr := findTeamByID(ctx, client, orgName, id) + if findErr != nil { + return findErr + } + _, err = client.Teams.DeleteTeamBySlug(ctx, orgName, *team.Slug) + } + /* When deleting a team and it failed, we need to check if it has already been deleted meanwhile. This could be the case when deleting nested teams via Terraform by looping through a module @@ -336,8 +408,15 @@ func resourceGithubTeamDelete(d *schema.ResourceData, meta any) error { GitHub automatically). So we're checking if it still exists and if not, simply remove it from TF state. */if err != nil { - // Fetch the team in order to see if it exists or not (http 404) - _, _, err = client.Teams.GetTeamByID(ctx, orgId, id) + // Check if the team still exists + if teamSlug != "" { + _, _, err = client.Teams.GetTeamBySlug(ctx, orgName, teamSlug) + } else { + // Fallback: find team by ID + id, _ := strconv.ParseInt(d.Id(), 10, 64) + _, checkErr := findTeamByID(ctx, client, orgName, id) + err = checkErr + } if err != nil { ghErr := &github.ErrorResponse{} if errors.As(err, &ghErr) { diff --git a/github/resource_github_team_members.go b/github/resource_github_team_members.go index 0f5a662d77..7813601944 100644 --- a/github/resource_github_team_members.go +++ b/github/resource_github_team_members.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/shurcooL/githubv4" ) diff --git a/github/resource_github_team_members_test.go b/github/resource_github_team_members_test.go index 95aa763a57..9fb54e0543 100644 --- a/github/resource_github_team_members_test.go +++ b/github/resource_github_team_members_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" diff --git a/github/resource_github_team_membership.go b/github/resource_github_team_membership.go index 601cb723c4..6db5ef2aa4 100644 --- a/github/resource_github_team_membership.go +++ b/github/resource_github_team_membership.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_team_membership_test.go b/github/resource_github_team_membership_test.go index 8e11c657c2..94fe19221c 100644 --- a/github/resource_github_team_membership_test.go +++ b/github/resource_github_team_membership_test.go @@ -7,7 +7,7 @@ import ( "strconv" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" diff --git a/github/resource_github_team_repository.go b/github/resource_github_team_repository.go index 210bbacd73..bb65ff10eb 100644 --- a/github/resource_github_team_repository.go +++ b/github/resource_github_team_repository.go @@ -8,7 +8,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -69,7 +69,8 @@ func resourceGithubTeamRepositoryCreate(d *schema.ResourceData, meta any) error } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id + orgName := meta.(*Owner).name + teamSlug := d.Get("slug").(string) // The given team id could be an id or a slug givenTeamId := d.Get("team_id").(string) @@ -78,14 +79,13 @@ func resourceGithubTeamRepositoryCreate(d *schema.ResourceData, meta any) error return err } - orgName := meta.(*Owner).name repoName := d.Get("repository").(string) permission := d.Get("permission").(string) ctx := context.Background() - _, err = client.Teams.AddTeamRepoByID(ctx, - orgId, - teamId, + _, err = client.Teams.AddTeamRepoBySlug(ctx, + orgName, + teamSlug, orgName, repoName, &github.TeamAddTeamRepoOptions{ @@ -108,23 +108,20 @@ func resourceGithubTeamRepositoryRead(d *schema.ResourceData, meta any) error { } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id + teamSlug := d.Get("slug").(string) teamIdString, repoName, err := parseTwoPartID(d.Id(), "team_id", "repository") if err != nil { return err } - teamId, err := getTeamID(teamIdString, meta) - if err != nil { - return err - } + orgName := meta.(*Owner).name ctx := context.WithValue(context.Background(), ctxId, d.Id()) if !d.IsNewResource() { ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) } - repo, resp, repoErr := client.Teams.IsTeamRepoByID(ctx, orgId, teamId, orgName, repoName) + repo, resp, repoErr := client.Teams.IsTeamRepoBySlug(ctx, orgName, teamSlug, orgName, repoName) if repoErr != nil { ghErr := &github.ErrorResponse{} if errors.As(repoErr, &ghErr) { @@ -168,7 +165,6 @@ func resourceGithubTeamRepositoryUpdate(d *schema.ResourceData, meta any) error } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id teamIdString, repoName, err := parseTwoPartID(d.Id(), "team_id", "repository") if err != nil { @@ -182,10 +178,14 @@ func resourceGithubTeamRepositoryUpdate(d *schema.ResourceData, meta any) error permission := d.Get("permission").(string) ctx := context.WithValue(context.Background(), ctxId, d.Id()) - // the go-github library's AddTeamRepo method uses the add/update endpoint from GitHub API - _, err = client.Teams.AddTeamRepoByID(ctx, - orgId, - teamId, + team, err := findTeamByID(ctx, client, orgName, teamId) + if err != nil { + return err + } + + _, err = client.Teams.AddTeamRepoBySlug(ctx, + orgName, + *team.Slug, orgName, repoName, &github.TeamAddTeamRepoOptions{ @@ -207,7 +207,6 @@ func resourceGithubTeamRepositoryDelete(d *schema.ResourceData, meta any) error } client := meta.(*Owner).v3client - orgId := meta.(*Owner).id teamIdString, repoName, err := parseTwoPartID(d.Id(), "team_id", "repository") if err != nil { @@ -220,7 +219,12 @@ func resourceGithubTeamRepositoryDelete(d *schema.ResourceData, meta any) error orgName := meta.(*Owner).name ctx := context.WithValue(context.Background(), ctxId, d.Id()) - resp, err := client.Teams.RemoveTeamRepoByID(ctx, orgId, teamId, orgName, repoName) + team, err := findTeamByID(ctx, client, orgName, teamId) + if err != nil { + return err + } + + resp, err := client.Teams.RemoveTeamRepoBySlug(ctx, orgName, *team.Slug, orgName, repoName) if resp.StatusCode == 404 { log.Printf("[DEBUG] Failed to find team %s to delete for repo: %s.", teamIdString, repoName) @@ -233,7 +237,7 @@ func resourceGithubTeamRepositoryDelete(d *schema.ResourceData, meta any) error log.Printf("[INFO] Repo name has changed %s -> %s. "+ "Try deleting team repository again.", repoName, newRepoName) - _, err := client.Teams.RemoveTeamRepoByID(ctx, orgId, teamId, orgName, newRepoName) + _, err := client.Teams.RemoveTeamRepoBySlug(ctx, orgName, *team.Slug, orgName, newRepoName) return handleArchivedRepoDelete(err, "team repository access", fmt.Sprintf("team %s", teamIdString), orgName, newRepoName) } } diff --git a/github/resource_github_team_settings.go b/github/resource_github_team_settings.go index 38841d3e80..682a985665 100644 --- a/github/resource_github_team_settings.go +++ b/github/resource_github_team_settings.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "strconv" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/shurcooL/githubv4" @@ -224,31 +223,14 @@ func resourceGithubTeamSettingsImport(d *schema.ResourceData, meta any) ([]*sche func resolveTeamIDs(idOrSlug string, meta *Owner, ctx context.Context) (nodeId, slug string, err error) { client := meta.v3client orgName := meta.name - orgId := meta.id - teamId, parseIntErr := strconv.ParseInt(idOrSlug, 10, 64) - if parseIntErr != nil { - // The given id not an integer, assume it is a team slug - team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, idOrSlug) - if slugErr != nil { - return "", "", errors.New(parseIntErr.Error() + slugErr.Error()) - } - return team.GetNodeID(), team.GetSlug(), nil - } else { - // The given id is an integer, assume it is a team id - team, _, teamIdErr := client.Teams.GetTeamByID(ctx, orgId, teamId) - if teamIdErr != nil { - // There isn't a team with the given ID, assume it is a teamslug - team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, idOrSlug) - if slugErr != nil { - return "", "", errors.New(teamIdErr.Error() + slugErr.Error()) - } - - return team.GetNodeID(), team.GetSlug(), nil - } - - return team.GetNodeID(), team.GetSlug(), nil + // Update: go-github v77+, team IDs are deprecated. This func now + // treats all inputs as team slugs. + team, _, err := client.Teams.GetTeamBySlug(ctx, orgName, idOrSlug) + if err != nil { + return "", "", fmt.Errorf("team '%s' not found in organization '%s': %w", idOrSlug, orgName, err) } + return team.GetNodeID(), team.GetSlug(), nil } type UpdateTeamReviewAssignmentInput struct { diff --git a/github/resource_github_team_sync_group_mapping.go b/github/resource_github_team_sync_group_mapping.go index eeba0e37f0..2a9ab7c59b 100644 --- a/github/resource_github_team_sync_group_mapping.go +++ b/github/resource_github_team_sync_group_mapping.go @@ -7,7 +7,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -201,9 +201,9 @@ func expandTeamSyncGroups(d *schema.ResourceData) *github.IDPGroupList { groupName := m["group_name"].(string) groupDescription := m["group_description"].(string) group := &github.IDPGroup{ - GroupID: github.String(groupID), - GroupName: github.String(groupName), - GroupDescription: github.String(groupDescription), + GroupID: github.Ptr(groupID), + GroupName: github.Ptr(groupName), + GroupDescription: github.Ptr(groupDescription), } groups = append(groups, group) } diff --git a/github/resource_github_team_sync_group_mapping_test.go b/github/resource_github_team_sync_group_mapping_test.go index 7ec58a5eed..e3a87b1f72 100644 --- a/github/resource_github_team_sync_group_mapping_test.go +++ b/github/resource_github_team_sync_group_mapping_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" diff --git a/github/resource_github_user_gpg_key.go b/github/resource_github_user_gpg_key.go index 6830ea4643..ad8cbdd4d0 100644 --- a/github/resource_github_user_gpg_key.go +++ b/github/resource_github_user_gpg_key.go @@ -7,7 +7,7 @@ import ( "net/http" "strconv" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/resource_github_user_ssh_key.go b/github/resource_github_user_ssh_key.go index 4850f60e96..d7ec78a506 100644 --- a/github/resource_github_user_ssh_key.go +++ b/github/resource_github_user_ssh_key.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -59,8 +59,8 @@ func resourceGithubUserSshKeyCreate(d *schema.ResourceData, meta any) error { ctx := context.Background() userKey, _, err := client.Users.CreateKey(ctx, &github.Key{ - Title: github.String(title), - Key: github.String(key), + Title: github.Ptr(title), + Key: github.Ptr(key), }) if err != nil { return err diff --git a/github/resource_github_workflow_repository_permissions.go b/github/resource_github_workflow_repository_permissions.go index e26a83c410..47f7920da3 100644 --- a/github/resource_github_workflow_repository_permissions.go +++ b/github/resource_github_workflow_repository_permissions.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -59,7 +59,7 @@ func resourceGithubWorkflowRepositoryPermissionsCreateOrUpdate(d *schema.Resourc CanApprovePullRequestReviews: &canApprovePullRequestReviews, } - _, _, err := client.Repositories.EditDefaultWorkflowPermissions(ctx, + _, _, err := client.Repositories.UpdateDefaultWorkflowPermissions(ctx, owner, repoName, repoWorkflowPermissions, @@ -106,11 +106,11 @@ func resourceGithubWorkflowRepositoryPermissionsDelete(d *schema.ResourceData, m // Reset the repo to "default" settings repoWorkflowPermissions := github.DefaultWorkflowPermissionRepository{ - DefaultWorkflowPermissions: github.String("read"), - CanApprovePullRequestReviews: github.Bool(false), + DefaultWorkflowPermissions: github.Ptr("read"), + CanApprovePullRequestReviews: github.Ptr(false), } - _, _, err := client.Repositories.EditDefaultWorkflowPermissions(ctx, + _, _, err := client.Repositories.UpdateDefaultWorkflowPermissions(ctx, owner, repoName, repoWorkflowPermissions, diff --git a/github/resource_organization_block.go b/github/resource_organization_block.go index 5487f5ec73..7d811cc04f 100644 --- a/github/resource_organization_block.go +++ b/github/resource_organization_block.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/github/respository_rules_utils.go b/github/respository_rules_utils.go index 7d3b3b33b1..086557373b 100644 --- a/github/respository_rules_utils.go +++ b/github/respository_rules_utils.go @@ -1,16 +1,42 @@ package github import ( - "encoding/json" - "log" "reflect" "sort" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func resourceGithubRulesetObject(d *schema.ResourceData, org string) *github.Ruleset { +// Helper function to safely convert interface{} to int, handling both int and float64. +func toInt(v any) int { + switch val := v.(type) { + case int: + return val + case float64: + return int(val) + case int64: + return int(val) + default: + return 0 + } +} + +// Helper function to safely convert interface{} to int64, handling both int and float64. +func toInt64(v any) int64 { + switch val := v.(type) { + case int: + return int64(val) + case int64: + return val + case float64: + return int64(val) + default: + return 0 + } +} + +func resourceGithubRulesetObject(d *schema.ResourceData, org string) *github.RepositoryRuleset { isOrgLevel := len(org) > 0 var source, sourceType string @@ -22,12 +48,16 @@ func resourceGithubRulesetObject(d *schema.ResourceData, org string) *github.Rul sourceType = "Repository" } - return &github.Ruleset{ + target := github.RulesetTarget(d.Get("target").(string)) + enforcement := github.RulesetEnforcement(d.Get("enforcement").(string)) + sourceTypeEnum := github.RulesetSourceType(sourceType) + + return &github.RepositoryRuleset{ Name: d.Get("name").(string), - Target: github.String(d.Get("target").(string)), + Target: &target, Source: source, - SourceType: &sourceType, - Enforcement: d.Get("enforcement").(string), + SourceType: &sourceTypeEnum, + Enforcement: enforcement, BypassActors: expandBypassActors(d.Get("bypass_actors").([]any)), Conditions: expandConditions(d.Get("conditions").([]any), isOrgLevel), Rules: expandRules(d.Get("rules").([]any), isOrgLevel), @@ -54,20 +84,23 @@ func expandBypassActors(input []any) []*github.BypassActor { for _, v := range input { inputMap := v.(map[string]any) actor := &github.BypassActor{} - if v, ok := inputMap["actor_id"].(int); ok { - if v == 0 { + if actorIDVal, ok := inputMap["actor_id"]; ok { + actorID := toInt(actorIDVal) + if actorID == 0 { actor.ActorID = nil } else { - actor.ActorID = github.Int64(int64(v)) + actor.ActorID = github.Ptr(int64(actorID)) } } if v, ok := inputMap["actor_type"].(string); ok { - actor.ActorType = &v + actorType := github.BypassActorType(v) + actor.ActorType = &actorType } if v, ok := inputMap["bypass_mode"].(string); ok { - actor.BypassMode = &v + bypassMode := github.BypassMode(v) + actor.BypassMode = &bypassMode } bypassActors = append(bypassActors, actor) } @@ -93,11 +126,11 @@ func flattenBypassActors(bypassActors []*github.BypassActor) []any { return actorsSlice } -func expandConditions(input []any, org bool) *github.RulesetConditions { +func expandConditions(input []any, org bool) *github.RepositoryRulesetConditions { if len(input) == 0 || input[0] == nil { return nil } - rulesetConditions := &github.RulesetConditions{} + rulesetConditions := &github.RepositoryRulesetConditions{} inputConditions := input[0].(map[string]any) // ref_name is available for both repo and org rulesets @@ -118,7 +151,7 @@ func expandConditions(input []any, org bool) *github.RulesetConditions { } } - rulesetConditions.RefName = &github.RulesetRefConditionParameters{ + rulesetConditions.RefName = &github.RepositoryRulesetRefConditionParameters{ Include: include, Exclude: exclude, } @@ -146,7 +179,7 @@ func expandConditions(input []any, org bool) *github.RulesetConditions { protected := inputRepositoryName["protected"].(bool) - rulesetConditions.RepositoryName = &github.RulesetRepositoryNamesConditionParameters{ + rulesetConditions.RepositoryName = &github.RepositoryRulesetRepositoryNamesConditionParameters{ Include: include, Exclude: exclude, Protected: &protected, @@ -156,18 +189,18 @@ func expandConditions(input []any, org bool) *github.RulesetConditions { for _, v := range v { if v != nil { - repositoryIDs = append(repositoryIDs, int64(v.(int))) + repositoryIDs = append(repositoryIDs, toInt64(v)) } } - rulesetConditions.RepositoryID = &github.RulesetRepositoryIDsConditionParameters{RepositoryIDs: repositoryIDs} + rulesetConditions.RepositoryID = &github.RepositoryRulesetRepositoryIDsConditionParameters{RepositoryIDs: repositoryIDs} } } return rulesetConditions } -func flattenConditions(conditions *github.RulesetConditions, org bool) []any { +func flattenConditions(conditions *github.RepositoryRulesetConditions, org bool) []any { if conditions == nil || conditions.RefName == nil { return []any{} } @@ -209,95 +242,53 @@ func flattenConditions(conditions *github.RulesetConditions, org bool) []any { return []any{conditionsMap} } -func expandRules(input []any, org bool) []*github.RepositoryRule { +func expandRules(input []any, org bool) *github.RepositoryRulesetRules { if len(input) == 0 || input[0] == nil { - return nil + return &github.RepositoryRulesetRules{} } rulesMap := input[0].(map[string]any) - rulesSlice := make([]*github.RepositoryRule, 0) + rulesetRules := &github.RepositoryRulesetRules{} - // First we expand rules without parameters + // Simple rules without parameters if v, ok := rulesMap["creation"].(bool); ok && v { - rulesSlice = append(rulesSlice, github.NewCreationRule()) - } - - if v, ok := rulesMap["update"].(bool); ok && v { - params := github.UpdateAllowsFetchAndMergeRuleParameters{} - if fetchAndMerge, ok := rulesMap["update"].(bool); ok && fetchAndMerge { - params.UpdateAllowsFetchAndMerge = true - } else { - params.UpdateAllowsFetchAndMerge = false - } - rulesSlice = append(rulesSlice, github.NewUpdateRule(¶ms)) + rulesetRules.Creation = &github.EmptyRuleParameters{} } if v, ok := rulesMap["deletion"].(bool); ok && v { - rulesSlice = append(rulesSlice, github.NewDeletionRule()) + rulesetRules.Deletion = &github.EmptyRuleParameters{} } if v, ok := rulesMap["required_linear_history"].(bool); ok && v { - rulesSlice = append(rulesSlice, github.NewRequiredLinearHistoryRule()) + rulesetRules.RequiredLinearHistory = &github.EmptyRuleParameters{} } if v, ok := rulesMap["required_signatures"].(bool); ok && v { - rulesSlice = append(rulesSlice, github.NewRequiredSignaturesRule()) + rulesetRules.RequiredSignatures = &github.EmptyRuleParameters{} } if v, ok := rulesMap["non_fast_forward"].(bool); ok && v { - rulesSlice = append(rulesSlice, github.NewNonFastForwardRule()) + rulesetRules.NonFastForward = &github.EmptyRuleParameters{} } - // Required deployments rule - if !org { - if v, ok := rulesMap["required_deployments"].([]any); ok && len(v) != 0 { - requiredDeploymentsMap := make(map[string]any) - // If the rule's block is present but has an empty environments list - if v[0] == nil { - requiredDeploymentsMap["required_deployment_environments"] = make([]any, 0) - } else { - requiredDeploymentsMap = v[0].(map[string]any) - } - envs := make([]string, 0) - for _, v := range requiredDeploymentsMap["required_deployment_environments"].([]any) { - envs = append(envs, v.(string)) - } - - params := &github.RequiredDeploymentEnvironmentsRuleParameters{ - RequiredDeploymentEnvironments: envs, - } - - rulesSlice = append(rulesSlice, github.NewRequiredDeploymentsRule(params)) + // Update rule with parameters + if v, ok := rulesMap["update"].(bool); ok && v { + updateParams := &github.UpdateRuleParameters{} + if updateMerge, ok := rulesMap["update_allows_fetch_and_merge"].(bool); ok { + updateParams.UpdateAllowsFetchAndMerge = updateMerge } + rulesetRules.Update = updateParams } - // Pattern parameter rules - for _, k := range []string{"commit_message_pattern", "commit_author_email_pattern", "committer_email_pattern", "branch_name_pattern", "tag_name_pattern"} { - if v, ok := rulesMap[k].([]any); ok && len(v) != 0 { - patternParametersMap := v[0].(map[string]any) - - name := patternParametersMap["name"].(string) - negate := patternParametersMap["negate"].(bool) - - params := &github.RulePatternParameters{ - Name: &name, - Negate: &negate, - Operator: patternParametersMap["operator"].(string), - Pattern: patternParametersMap["pattern"].(string), - } - - switch k { - case "commit_message_pattern": - rulesSlice = append(rulesSlice, github.NewCommitMessagePatternRule(params)) - case "commit_author_email_pattern": - rulesSlice = append(rulesSlice, github.NewCommitAuthorEmailPatternRule(params)) - case "committer_email_pattern": - rulesSlice = append(rulesSlice, github.NewCommitterEmailPatternRule(params)) - case "branch_name_pattern": - rulesSlice = append(rulesSlice, github.NewBranchNamePatternRule(params)) - case "tag_name_pattern": - rulesSlice = append(rulesSlice, github.NewTagNamePatternRule(params)) - } + // Required deployments rule + if v, ok := rulesMap["required_deployments"].([]any); ok && len(v) != 0 { + requiredDeploymentsMap := v[0].(map[string]any) + envs := make([]string, 0) + for _, env := range requiredDeploymentsMap["required_deployment_environments"].([]any) { + envs = append(envs, env.(string)) + } + rulesetRules.RequiredDeployments = &github.RequiredDeploymentsRuleParameters{ + RequiredDeploymentEnvironments: envs, } } @@ -308,47 +299,44 @@ func expandRules(input []any, org bool) []*github.RepositoryRule { DismissStaleReviewsOnPush: pullRequestMap["dismiss_stale_reviews_on_push"].(bool), RequireCodeOwnerReview: pullRequestMap["require_code_owner_review"].(bool), RequireLastPushApproval: pullRequestMap["require_last_push_approval"].(bool), - RequiredApprovingReviewCount: pullRequestMap["required_approving_review_count"].(int), + RequiredApprovingReviewCount: toInt(pullRequestMap["required_approving_review_count"]), RequiredReviewThreadResolution: pullRequestMap["required_review_thread_resolution"].(bool), } - - rulesSlice = append(rulesSlice, github.NewPullRequestRule(params)) + rulesetRules.PullRequest = params } // Merge queue rule if v, ok := rulesMap["merge_queue"].([]any); ok && len(v) != 0 { mergeQueueMap := v[0].(map[string]any) params := &github.MergeQueueRuleParameters{ - CheckResponseTimeoutMinutes: mergeQueueMap["check_response_timeout_minutes"].(int), - GroupingStrategy: mergeQueueMap["grouping_strategy"].(string), - MaxEntriesToBuild: mergeQueueMap["max_entries_to_build"].(int), - MaxEntriesToMerge: mergeQueueMap["max_entries_to_merge"].(int), - MergeMethod: mergeQueueMap["merge_method"].(string), - MinEntriesToMerge: mergeQueueMap["min_entries_to_merge"].(int), - MinEntriesToMergeWaitMinutes: mergeQueueMap["min_entries_to_merge_wait_minutes"].(int), + CheckResponseTimeoutMinutes: toInt(mergeQueueMap["check_response_timeout_minutes"]), + GroupingStrategy: github.MergeGroupingStrategy(mergeQueueMap["grouping_strategy"].(string)), + MaxEntriesToBuild: toInt(mergeQueueMap["max_entries_to_build"]), + MaxEntriesToMerge: toInt(mergeQueueMap["max_entries_to_merge"]), + MergeMethod: github.MergeQueueMergeMethod(mergeQueueMap["merge_method"].(string)), + MinEntriesToMerge: toInt(mergeQueueMap["min_entries_to_merge"]), + MinEntriesToMergeWaitMinutes: toInt(mergeQueueMap["min_entries_to_merge_wait_minutes"]), } - - rulesSlice = append(rulesSlice, github.NewMergeQueueRule(params)) + rulesetRules.MergeQueue = params } // Required status checks rule if v, ok := rulesMap["required_status_checks"].([]any); ok && len(v) != 0 { requiredStatusMap := v[0].(map[string]any) - requiredStatusChecks := make([]github.RuleRequiredStatusChecks, 0) + requiredStatusChecks := make([]*github.RuleStatusCheck, 0) if requiredStatusChecksInput, ok := requiredStatusMap["required_check"]; ok { - requiredStatusChecksSet := requiredStatusChecksInput.(*schema.Set) for _, checkMap := range requiredStatusChecksSet.List() { check := checkMap.(map[string]any) - integrationID := github.Int64(int64(check["integration_id"].(int))) + integrationID := toInt64(check["integration_id"]) - params := github.RuleRequiredStatusChecks{ + params := &github.RuleStatusCheck{ Context: check["context"].(string), } - if *integrationID != 0 { - params.IntegrationID = integrationID + if integrationID != 0 { + params.IntegrationID = github.Ptr(integrationID) } requiredStatusChecks = append(requiredStatusChecks, params) @@ -361,353 +349,364 @@ func expandRules(input []any, org bool) []*github.RepositoryRule { StrictRequiredStatusChecksPolicy: requiredStatusMap["strict_required_status_checks_policy"].(bool), DoNotEnforceOnCreate: &doNotEnforceOnCreate, } - rulesSlice = append(rulesSlice, github.NewRequiredStatusChecksRule(params)) + rulesetRules.RequiredStatusChecks = params } - // Required workflows to pass before merging rule - if v, ok := rulesMap["required_workflows"].([]any); ok && len(v) != 0 { - requiredWorkflowsMap := v[0].(map[string]any) - requiredWorkflows := make([]*github.RuleRequiredWorkflow, 0) - - if requiredWorkflowsInput, ok := requiredWorkflowsMap["required_workflow"]; ok { + // Pattern parameter rules + patternRules := map[string]*github.PatternRuleParameters{ + "commit_message_pattern": nil, + "commit_author_email_pattern": nil, + "committer_email_pattern": nil, + "branch_name_pattern": nil, + "tag_name_pattern": nil, + } - requiredWorkflowsSet := requiredWorkflowsInput.(*schema.Set) - for _, workflowMap := range requiredWorkflowsSet.List() { - workflow := workflowMap.(map[string]any) + for k := range patternRules { + if v, ok := rulesMap[k].([]any); ok && len(v) != 0 { + patternParametersMap := v[0].(map[string]any) - // Get all parameters - repositoryID := github.Int64(int64(workflow["repository_id"].(int))) - ref := github.String(workflow["ref"].(string)) + name := patternParametersMap["name"].(string) + negate := patternParametersMap["negate"].(bool) - params := &github.RuleRequiredWorkflow{ - RepositoryID: repositoryID, - Path: workflow["path"].(string), - Ref: ref, - } + params := &github.PatternRuleParameters{ + Name: &name, + Negate: &negate, + Operator: github.PatternRuleOperator(patternParametersMap["operator"].(string)), + Pattern: patternParametersMap["pattern"].(string), + } - requiredWorkflows = append(requiredWorkflows, params) + switch k { + case "commit_message_pattern": + rulesetRules.CommitMessagePattern = params + case "commit_author_email_pattern": + rulesetRules.CommitAuthorEmailPattern = params + case "committer_email_pattern": + rulesetRules.CommitterEmailPattern = params + case "branch_name_pattern": + rulesetRules.BranchNamePattern = params + case "tag_name_pattern": + rulesetRules.TagNamePattern = params } } + } - params := &github.RequiredWorkflowsRuleParameters{ - DoNotEnforceOnCreate: requiredWorkflowsMap["do_not_enforce_on_create"].(bool), - RequiredWorkflows: requiredWorkflows, + // Required workflows rule (org-only) + if org { + if v, ok := rulesMap["required_workflows"].([]any); ok && len(v) != 0 { + requiredWorkflowsMap := v[0].(map[string]any) + requiredWorkflows := make([]*github.RuleWorkflow, 0) + + if requiredWorkflowsInput, ok := requiredWorkflowsMap["required_workflow"]; ok { + requiredWorkflowsSet := requiredWorkflowsInput.(*schema.Set) + for _, workflowMap := range requiredWorkflowsSet.List() { + workflow := workflowMap.(map[string]any) + + params := &github.RuleWorkflow{ + RepositoryID: github.Ptr(toInt64(workflow["repository_id"])), + Path: workflow["path"].(string), + Ref: github.Ptr(workflow["ref"].(string)), + } + + requiredWorkflows = append(requiredWorkflows, params) + } + } + + doNotEnforceOnCreate := requiredWorkflowsMap["do_not_enforce_on_create"].(bool) + params := &github.WorkflowsRuleParameters{ + DoNotEnforceOnCreate: &doNotEnforceOnCreate, + Workflows: requiredWorkflows, + } + rulesetRules.Workflows = params } - rulesSlice = append(rulesSlice, github.NewRequiredWorkflowsRule(params)) } - // Required code scanning to pass before merging rule + // Required code scanning rule if v, ok := rulesMap["required_code_scanning"].([]any); ok && len(v) != 0 { requiredCodeScanningMap := v[0].(map[string]any) - requiredCodeScanningTools := make([]*github.RuleRequiredCodeScanningTool, 0) + requiredCodeScanningTools := make([]*github.RuleCodeScanningTool, 0) if requiredCodeScanningInput, ok := requiredCodeScanningMap["required_code_scanning_tool"]; ok { - requiredCodeScanningSet := requiredCodeScanningInput.(*schema.Set) for _, codeScanningMap := range requiredCodeScanningSet.List() { codeScanningTool := codeScanningMap.(map[string]any) - // Get all parameters - alertsThreshold := github.String(codeScanningTool["alerts_threshold"].(string)) - securityAlertsThreshold := github.String(codeScanningTool["security_alerts_threshold"].(string)) - tool := github.String(codeScanningTool["tool"].(string)) - - params := &github.RuleRequiredCodeScanningTool{ - AlertsThreshold: *alertsThreshold, - SecurityAlertsThreshold: *securityAlertsThreshold, - Tool: *tool, + params := &github.RuleCodeScanningTool{ + AlertsThreshold: github.CodeScanningAlertsThreshold(codeScanningTool["alerts_threshold"].(string)), + SecurityAlertsThreshold: github.CodeScanningSecurityAlertsThreshold(codeScanningTool["security_alerts_threshold"].(string)), + Tool: codeScanningTool["tool"].(string), } requiredCodeScanningTools = append(requiredCodeScanningTools, params) } } - params := &github.RequiredCodeScanningRuleParameters{ - RequiredCodeScanningTools: requiredCodeScanningTools, + params := &github.CodeScanningRuleParameters{ + CodeScanningTools: requiredCodeScanningTools, } - rulesSlice = append(rulesSlice, github.NewRequiredCodeScanningRule(params)) + rulesetRules.CodeScanning = params } - // file_path_restriction rule + // File path restriction rule if v, ok := rulesMap["file_path_restriction"].([]any); ok && len(v) != 0 { filePathRestrictionMap := v[0].(map[string]any) restrictedFilePaths := make([]string, 0) for _, path := range filePathRestrictionMap["restricted_file_paths"].([]any) { restrictedFilePaths = append(restrictedFilePaths, path.(string)) } - params := &github.RuleFileParameters{ - RestrictedFilePaths: &restrictedFilePaths, + params := &github.FilePathRestrictionRuleParameters{ + RestrictedFilePaths: restrictedFilePaths, } - rulesSlice = append(rulesSlice, github.NewFilePathRestrictionRule(params)) + rulesetRules.FilePathRestriction = params } - // max_file_size rule + // Max file size rule if v, ok := rulesMap["max_file_size"].([]any); ok && len(v) != 0 { maxFileSizeMap := v[0].(map[string]any) - maxFileSize := int64(maxFileSizeMap["max_file_size"].(int)) - params := &github.RuleMaxFileSizeParameters{ + maxFileSize := toInt64(maxFileSizeMap["max_file_size"]) + params := &github.MaxFileSizeRuleParameters{ MaxFileSize: maxFileSize, } - rulesSlice = append(rulesSlice, github.NewMaxFileSizeRule(params)) - + rulesetRules.MaxFileSize = params } - // max_file_path_length rule + // Max file path length rule if v, ok := rulesMap["max_file_path_length"].([]any); ok && len(v) != 0 { maxFilePathLengthMap := v[0].(map[string]any) - maxFilePathLength := maxFilePathLengthMap["max_file_path_length"].(int) - params := &github.RuleMaxFilePathLengthParameters{ + maxFilePathLength := toInt(maxFilePathLengthMap["max_file_path_length"]) + params := &github.MaxFilePathLengthRuleParameters{ MaxFilePathLength: maxFilePathLength, } - rulesSlice = append(rulesSlice, github.NewMaxFilePathLengthRule(params)) - + rulesetRules.MaxFilePathLength = params } - // file_extension_restriction rule + // File extension restriction rule if v, ok := rulesMap["file_extension_restriction"].([]any); ok && len(v) != 0 { fileExtensionRestrictionMap := v[0].(map[string]any) restrictedFileExtensions := make([]string, 0) - // Handle schema.TypeSet - extensionSet := fileExtensionRestrictionMap["restricted_file_extensions"].(*schema.Set) - for _, extension := range extensionSet.List() { - restrictedFileExtensions = append(restrictedFileExtensions, extension.(string)) - } - - if len(restrictedFileExtensions) > 0 { - params := &github.RuleFileExtensionRestrictionParameters{ - RestrictedFileExtensions: restrictedFileExtensions, + if extensionSet, ok := fileExtensionRestrictionMap["restricted_file_extensions"].(*schema.Set); ok { + for _, extension := range extensionSet.List() { + restrictedFileExtensions = append(restrictedFileExtensions, extension.(string)) } - rulesSlice = append(rulesSlice, github.NewFileExtensionRestrictionRule(params)) + } else if extensionList, ok := fileExtensionRestrictionMap["restricted_file_extensions"].([]any); ok { + for _, extension := range extensionList { + restrictedFileExtensions = append(restrictedFileExtensions, extension.(string)) + } + } + params := &github.FileExtensionRestrictionRuleParameters{ + RestrictedFileExtensions: restrictedFileExtensions, } + rulesetRules.FileExtensionRestriction = params } - return rulesSlice + return rulesetRules } -func flattenRules(rules []*github.RepositoryRule, org bool) []any { - if len(rules) == 0 || rules == nil { +func flattenRules(rules *github.RepositoryRulesetRules, org bool) []any { + if rules == nil { return []any{} } rulesMap := make(map[string]any) - for _, v := range rules { - switch v.Type { - case "creation", "deletion", "required_linear_history", "required_signatures", "non_fast_forward": - rulesMap[v.Type] = true - - case "update": - var params github.UpdateAllowsFetchAndMergeRuleParameters - if v.Parameters != nil { - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } - rulesMap["update_allows_fetch_and_merge"] = params.UpdateAllowsFetchAndMerge - } else { - rulesMap["update_allows_fetch_and_merge"] = false - } - rulesMap[v.Type] = true - case "commit_message_pattern", "commit_author_email_pattern", "committer_email_pattern", "branch_name_pattern", "tag_name_pattern": - var params github.RulePatternParameters - var name string - var negate bool + // Simple boolean rules - explicitly set all to false first, then override with true if present + rulesMap["creation"] = rules.Creation != nil + rulesMap["deletion"] = rules.Deletion != nil + rulesMap["required_linear_history"] = rules.RequiredLinearHistory != nil + rulesMap["required_signatures"] = rules.RequiredSignatures != nil + rulesMap["non_fast_forward"] = rules.NonFastForward != nil + + // Update rule with parameters + if rules.Update != nil { + rulesMap["update"] = true + rulesMap["update_allows_fetch_and_merge"] = rules.Update.UpdateAllowsFetchAndMerge + } else { + rulesMap["update"] = false + rulesMap["update_allows_fetch_and_merge"] = false + } // Required deployments rule + if rules.RequiredDeployments != nil { + requiredDeploymentsSlice := make([]map[string]any, 0) + requiredDeploymentsSlice = append(requiredDeploymentsSlice, map[string]any{ + "required_deployment_environments": rules.RequiredDeployments.RequiredDeploymentEnvironments, + }) + rulesMap["required_deployments"] = requiredDeploymentsSlice + } + + // Pull request rule + if rules.PullRequest != nil { + pullRequestSlice := make([]map[string]any, 0) + pullRequestSlice = append(pullRequestSlice, map[string]any{ + "dismiss_stale_reviews_on_push": rules.PullRequest.DismissStaleReviewsOnPush, + "require_code_owner_review": rules.PullRequest.RequireCodeOwnerReview, + "require_last_push_approval": rules.PullRequest.RequireLastPushApproval, + "required_approving_review_count": rules.PullRequest.RequiredApprovingReviewCount, + "required_review_thread_resolution": rules.PullRequest.RequiredReviewThreadResolution, + }) + rulesMap["pull_request"] = pullRequestSlice + } + + // Merge queue rule + if rules.MergeQueue != nil { + mergeQueueSlice := make([]map[string]any, 0) + mergeQueueSlice = append(mergeQueueSlice, map[string]any{ + "check_response_timeout_minutes": rules.MergeQueue.CheckResponseTimeoutMinutes, + "grouping_strategy": string(rules.MergeQueue.GroupingStrategy), + "max_entries_to_build": rules.MergeQueue.MaxEntriesToBuild, + "max_entries_to_merge": rules.MergeQueue.MaxEntriesToMerge, + "merge_method": string(rules.MergeQueue.MergeMethod), + "min_entries_to_merge": rules.MergeQueue.MinEntriesToMerge, + "min_entries_to_merge_wait_minutes": rules.MergeQueue.MinEntriesToMergeWaitMinutes, + }) + rulesMap["merge_queue"] = mergeQueueSlice + } - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } + // Required status checks rule + if rules.RequiredStatusChecks != nil { + requiredStatusSlice := make([]map[string]any, 0) + requiredChecks := make([]map[string]any, 0) - if params.Name != nil { - name = *params.Name + for _, check := range rules.RequiredStatusChecks.RequiredStatusChecks { + checkMap := map[string]any{ + "context": check.Context, } - if params.Negate != nil { - negate = *params.Negate + if check.IntegrationID != nil { + checkMap["integration_id"] = int(*check.IntegrationID) + } else { + checkMap["integration_id"] = 0 } + requiredChecks = append(requiredChecks, checkMap) + } - rule := make(map[string]any) - rule["name"] = name - rule["negate"] = negate - rule["operator"] = params.Operator - rule["pattern"] = params.Pattern - rulesMap[v.Type] = []map[string]any{rule} - - case "required_deployments": - if !org { - var params github.RequiredDeploymentEnvironmentsRuleParameters - - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } + statusChecksMap := map[string]any{ + "required_check": requiredChecks, + "strict_required_status_checks_policy": rules.RequiredStatusChecks.StrictRequiredStatusChecksPolicy, + } - rule := make(map[string]any) - rule["required_deployment_environments"] = params.RequiredDeploymentEnvironments - rulesMap[v.Type] = []map[string]any{rule} - } + if rules.RequiredStatusChecks.DoNotEnforceOnCreate != nil { + statusChecksMap["do_not_enforce_on_create"] = *rules.RequiredStatusChecks.DoNotEnforceOnCreate + } else { + statusChecksMap["do_not_enforce_on_create"] = false + } - case "pull_request": - var params github.PullRequestRuleParameters + requiredStatusSlice = append(requiredStatusSlice, statusChecksMap) + rulesMap["required_status_checks"] = requiredStatusSlice + } - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } + // Pattern parameter rules + patternRules := map[string]*github.PatternRuleParameters{ + "commit_message_pattern": rules.CommitMessagePattern, + "commit_author_email_pattern": rules.CommitAuthorEmailPattern, + "committer_email_pattern": rules.CommitterEmailPattern, + "branch_name_pattern": rules.BranchNamePattern, + "tag_name_pattern": rules.TagNamePattern, + } - rule := make(map[string]any) - rule["dismiss_stale_reviews_on_push"] = params.DismissStaleReviewsOnPush - rule["require_code_owner_review"] = params.RequireCodeOwnerReview - rule["require_last_push_approval"] = params.RequireLastPushApproval - rule["required_approving_review_count"] = params.RequiredApprovingReviewCount - rule["required_review_thread_resolution"] = params.RequiredReviewThreadResolution - rulesMap[v.Type] = []map[string]any{rule} - - case "required_status_checks": - var params github.RequiredStatusChecksRuleParameters - - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) + for k, v := range patternRules { + if v != nil { + patternSlice := make([]map[string]any, 0) + patternMap := map[string]any{ + "operator": string(v.Operator), + "pattern": v.Pattern, } - - requiredStatusChecksSlice := make([]map[string]any, 0) - for _, check := range params.RequiredStatusChecks { - integrationID := int64(0) - if check.IntegrationID != nil { - integrationID = *check.IntegrationID - } - requiredStatusChecksSlice = append(requiredStatusChecksSlice, map[string]any{ - "context": check.Context, - "integration_id": integrationID, - }) + if v.Name != nil { + patternMap["name"] = *v.Name } + if v.Negate != nil { + patternMap["negate"] = *v.Negate + } + patternSlice = append(patternSlice, patternMap) + rulesMap[k] = patternSlice + } + } - rule := make(map[string]any) - rule["required_check"] = requiredStatusChecksSlice - rule["strict_required_status_checks_policy"] = params.StrictRequiredStatusChecksPolicy - rule["do_not_enforce_on_create"] = params.DoNotEnforceOnCreate - rulesMap[v.Type] = []map[string]any{rule} - - case "workflows": - var params github.RequiredWorkflowsRuleParameters + // Required workflows rule (org-only) + if org && rules.Workflows != nil { + requiredWorkflowsSlice := make([]map[string]any, 0) + requiredWorkflows := make([]map[string]any, 0) - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) + for _, workflow := range rules.Workflows.Workflows { + workflowMap := map[string]any{ + "path": workflow.Path, } - - requiredWorkflowsSlice := make([]map[string]any, 0) - for _, check := range params.RequiredWorkflows { - requiredWorkflowsSlice = append(requiredWorkflowsSlice, map[string]any{ - "repository_id": check.RepositoryID, - "path": check.Path, - "ref": check.Ref, - }) + if workflow.RepositoryID != nil { + workflowMap["repository_id"] = int(*workflow.RepositoryID) + } + if workflow.Ref != nil { + workflowMap["ref"] = *workflow.Ref } + requiredWorkflows = append(requiredWorkflows, workflowMap) + } + + workflowsMap := map[string]any{ + "required_workflow": requiredWorkflows, + } + + if rules.Workflows.DoNotEnforceOnCreate != nil { + workflowsMap["do_not_enforce_on_create"] = *rules.Workflows.DoNotEnforceOnCreate + } else { + workflowsMap["do_not_enforce_on_create"] = false + } - rule := make(map[string]any) - rule["do_not_enforce_on_create"] = params.DoNotEnforceOnCreate - rule["required_workflow"] = requiredWorkflowsSlice - rulesMap["required_workflows"] = []map[string]any{rule} + requiredWorkflowsSlice = append(requiredWorkflowsSlice, workflowsMap) + rulesMap["required_workflows"] = requiredWorkflowsSlice + } - case "code_scanning": - var params github.RequiredCodeScanningRuleParameters + // Required code scanning rule + if rules.CodeScanning != nil { + requiredCodeScanningSlice := make([]map[string]any, 0) + requiredCodeScanningTools := make([]map[string]any, 0) - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) + for _, tool := range rules.CodeScanning.CodeScanningTools { + toolMap := map[string]any{ + "alerts_threshold": string(tool.AlertsThreshold), + "security_alerts_threshold": string(tool.SecurityAlertsThreshold), + "tool": tool.Tool, } + requiredCodeScanningTools = append(requiredCodeScanningTools, toolMap) + } - requiredCodeScanningSlice := make([]map[string]any, 0) - for _, check := range params.RequiredCodeScanningTools { - requiredCodeScanningSlice = append(requiredCodeScanningSlice, map[string]any{ - "alerts_threshold": check.AlertsThreshold, - "security_alerts_threshold": check.SecurityAlertsThreshold, - "tool": check.Tool, - }) - } + codeScanningMap := map[string]any{ + "required_code_scanning_tool": requiredCodeScanningTools, + } - rule := make(map[string]any) - rule["required_code_scanning_tool"] = requiredCodeScanningSlice - rulesMap["required_code_scanning"] = []map[string]any{rule} + requiredCodeScanningSlice = append(requiredCodeScanningSlice, codeScanningMap) + rulesMap["required_code_scanning"] = requiredCodeScanningSlice + } - case "merge_queue": - var params github.MergeQueueRuleParameters + // File path restriction rule + if rules.FilePathRestriction != nil { + filePathRestrictionSlice := make([]map[string]any, 0) + filePathRestrictionSlice = append(filePathRestrictionSlice, map[string]any{ + "restricted_file_paths": rules.FilePathRestriction.RestrictedFilePaths, + }) + rulesMap["file_path_restriction"] = filePathRestrictionSlice + } - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } + // Max file size rule + if rules.MaxFileSize != nil { + maxFileSizeSlice := make([]map[string]any, 0) + maxFileSizeSlice = append(maxFileSizeSlice, map[string]any{ + "max_file_size": rules.MaxFileSize.MaxFileSize, + }) + rulesMap["max_file_size"] = maxFileSizeSlice + } - rule := make(map[string]any) - rule["check_response_timeout_minutes"] = params.CheckResponseTimeoutMinutes - rule["grouping_strategy"] = params.GroupingStrategy - rule["max_entries_to_build"] = params.MaxEntriesToBuild - rule["max_entries_to_merge"] = params.MaxEntriesToMerge - rule["merge_method"] = params.MergeMethod - rule["min_entries_to_merge"] = params.MinEntriesToMerge - rule["min_entries_to_merge_wait_minutes"] = params.MinEntriesToMergeWaitMinutes - rulesMap[v.Type] = []map[string]any{rule} - - case "file_path_restriction": - var params github.RuleFileParameters - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } - rule := make(map[string]any) - rule["restricted_file_paths"] = params.GetRestrictedFilePaths() - rulesMap[v.Type] = []map[string]any{rule} - - case "max_file_size": - var params github.RuleMaxFileSizeParameters - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } - rule := make(map[string]any) - rule["max_file_size"] = params.MaxFileSize - rulesMap[v.Type] = []map[string]any{rule} - - case "max_file_path_length": - var params github.RuleMaxFilePathLengthParameters - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } - rule := make(map[string]any) - rule["max_file_path_length"] = params.MaxFilePathLength - rulesMap[v.Type] = []map[string]any{rule} - - case "file_extension_restriction": - var params github.RuleFileExtensionRestrictionParameters - err := json.Unmarshal(*v.Parameters, ¶ms) - if err != nil { - log.Printf("[INFO] Unexpected error unmarshalling rule %s with parameters: %v", - v.Type, v.Parameters) - } - rule := make(map[string]any) - rule["restricted_file_extensions"] = params.RestrictedFileExtensions - rulesMap[v.Type] = []map[string]any{rule} + // Max file path length rule + if rules.MaxFilePathLength != nil { + maxFilePathLengthSlice := make([]map[string]any, 0) + maxFilePathLengthSlice = append(maxFilePathLengthSlice, map[string]any{ + "max_file_path_length": rules.MaxFilePathLength.MaxFilePathLength, + }) + rulesMap["max_file_path_length"] = maxFilePathLengthSlice + } - default: - // Handle unknown rule types (like Copilot code review, etc.) gracefully - // Log the unknown rule type but don't cause Terraform to fail or see a diff - log.Printf("[DEBUG] Ignoring unknown repository rule type: %s. This rule was likely added outside of Terraform (e.g., via GitHub UI) and is not yet supported by the provider.", v.Type) - // Note: We intentionally don't add this to rulesMap to avoid causing diffs for rules that aren't managed by Terraform - } + // File extension restriction rule + if rules.FileExtensionRestriction != nil { + fileExtensionRestrictionSlice := make([]map[string]any, 0) + fileExtensionRestrictionSlice = append(fileExtensionRestrictionSlice, map[string]any{ + "restricted_file_extensions": rules.FileExtensionRestriction.RestrictedFileExtensions, + }) + rulesMap["file_extension_restriction"] = fileExtensionRestrictionSlice } return []any{rulesMap} diff --git a/github/respository_rules_utils_test.go b/github/respository_rules_utils_test.go index a56da0668e..205f0ea654 100644 --- a/github/respository_rules_utils_test.go +++ b/github/respository_rules_utils_test.go @@ -1,72 +1,59 @@ package github import ( - "encoding/json" "testing" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) -func TestFlattenRulesHandlesUnknownTypes(t *testing.T) { - // Create some test rules including an unknown type - unknownParams := map[string]any{ - "some_parameter": "some_value", - } - unknownParamsJSON, _ := json.Marshal(unknownParams) - unknownParamsRaw := json.RawMessage(unknownParamsJSON) - - rules := []*github.RepositoryRule{ - { - Type: "creation", - }, - { - Type: "unknown_copilot_rule", - Parameters: &unknownParamsRaw, - }, - { - Type: "deletion", - }, +func TestExpandRulesBasicRules(t *testing.T) { + // Test expanding basic boolean rules with RepositoryRulesetRules + rulesMap := map[string]any{ + "creation": true, + "deletion": true, + "required_linear_history": true, + "required_signatures": false, + "non_fast_forward": true, } - // This should not panic or fail, even with unknown rule types - result := flattenRules(rules, false) + input := []any{rulesMap} + result := expandRules(input, false) - if len(result) != 1 { - t.Fatalf("Expected 1 element in result, got %d", len(result)) + if result == nil { + t.Fatal("Expected result to not be nil") } - rulesMap := result[0].(map[string]any) + // Check boolean rules - they use EmptyRuleParameters and are nil when false + if result.Creation == nil { + t.Error("Expected Creation rule to be set") + } - // Should contain the known rules - if !rulesMap["creation"].(bool) { - t.Error("Expected creation rule to be true") + if result.Deletion == nil { + t.Error("Expected Deletion rule to be set") } - if !rulesMap["deletion"].(bool) { - t.Error("Expected deletion rule to be true") + if result.RequiredLinearHistory == nil { + t.Error("Expected RequiredLinearHistory rule to be set") } - // Should NOT contain the unknown rule type - if _, exists := rulesMap["unknown_copilot_rule"]; exists { - t.Error("Unknown rule type should not appear in flattened rules to avoid causing diffs") + if result.RequiredSignatures != nil { + t.Error("Expected RequiredSignatures rule to be nil (false)") } -} -func TestFlattenRulesHandlesMaxFileSize(t *testing.T) { - // Test that max_file_size rule is properly handled - maxFileSize := int64(1024000) - params := map[string]any{ - "max_file_size": maxFileSize, + if result.NonFastForward == nil { + t.Error("Expected NonFastForward rule to be set") } - paramsJSON, _ := json.Marshal(params) - paramsRaw := json.RawMessage(paramsJSON) +} - rules := []*github.RepositoryRule{ - { - Type: "max_file_size", - Parameters: ¶msRaw, - }, +func TestFlattenRulesBasicRules(t *testing.T) { + // Test flattening basic boolean rules with RepositoryRulesetRules + rules := &github.RepositoryRulesetRules{ + Creation: &github.EmptyRuleParameters{}, + Deletion: &github.EmptyRuleParameters{}, + RequiredLinearHistory: &github.EmptyRuleParameters{}, + RequiredSignatures: nil, // false means nil + NonFastForward: &github.EmptyRuleParameters{}, } result := flattenRules(rules, false) @@ -76,71 +63,63 @@ func TestFlattenRulesHandlesMaxFileSize(t *testing.T) { } rulesMap := result[0].(map[string]any) - maxFileSizeRules := rulesMap["max_file_size"].([]map[string]any) - if len(maxFileSizeRules) != 1 { - t.Fatalf("Expected 1 max_file_size rule, got %d", len(maxFileSizeRules)) + // Should contain the rules + if !rulesMap["creation"].(bool) { + t.Error("Expected creation rule to be true") } - if maxFileSizeRules[0]["max_file_size"] != maxFileSize { - t.Errorf("Expected max_file_size to be %d, got %v", maxFileSize, maxFileSizeRules[0]["max_file_size"]) + if !rulesMap["deletion"].(bool) { + t.Error("Expected deletion rule to be true") } -} -func TestFlattenRulesHandlesFileExtensionRestriction(t *testing.T) { - // Test that file_extension_restriction rule is properly handled - restrictedExtensions := []string{".exe", ".bat", ".com"} - params := map[string]any{ - "restricted_file_extensions": restrictedExtensions, + if !rulesMap["required_linear_history"].(bool) { + t.Error("Expected required_linear_history rule to be true") } - paramsJSON, _ := json.Marshal(params) - paramsRaw := json.RawMessage(paramsJSON) - rules := []*github.RepositoryRule{ - { - Type: "file_extension_restriction", - Parameters: ¶msRaw, - }, + if rulesMap["required_signatures"].(bool) { + t.Error("Expected required_signatures rule to be false") } - result := flattenRules(rules, false) + if !rulesMap["non_fast_forward"].(bool) { + t.Error("Expected non_fast_forward rule to be true") + } +} - if len(result) != 1 { - t.Fatalf("Expected 1 element in result, got %d", len(result)) +func TestExpandRulesMaxFilePathLength(t *testing.T) { + // Test that max_file_path_length rule is properly expanded + maxPathLength := 512 + + rulesMap := map[string]any{ + "max_file_path_length": []any{ + map[string]any{ + "max_file_path_length": maxPathLength, + }, + }, } - rulesMap := result[0].(map[string]any) - fileExtensionRules := rulesMap["file_extension_restriction"].([]map[string]any) + input := []any{rulesMap} + result := expandRules(input, false) - if len(fileExtensionRules) != 1 { - t.Fatalf("Expected 1 file_extension_restriction rule, got %d", len(fileExtensionRules)) + if result == nil { + t.Fatal("Expected result to not be nil") } - actualExtensions := fileExtensionRules[0]["restricted_file_extensions"].([]string) - if len(actualExtensions) != len(restrictedExtensions) { - t.Errorf("Expected %d restricted extensions, got %d", len(restrictedExtensions), len(actualExtensions)) + if result.MaxFilePathLength == nil { + t.Fatal("Expected MaxFilePathLength rule to be set") } - for i, ext := range restrictedExtensions { - if actualExtensions[i] != ext { - t.Errorf("Expected extension %s at index %d, got %s", ext, i, actualExtensions[i]) - } + if result.MaxFilePathLength.MaxFilePathLength != maxPathLength { + t.Errorf("Expected MaxFilePathLength to be %d, got %d", maxPathLength, result.MaxFilePathLength.MaxFilePathLength) } } -func TestFlattenRulesHandlesMaxFilePathLength(t *testing.T) { - // Test that max_file_path_length rule is properly handled +func TestFlattenRulesMaxFilePathLength(t *testing.T) { + // Test that max_file_path_length rule is properly flattened maxPathLength := 256 - params := map[string]any{ - "max_file_path_length": maxPathLength, - } - paramsJSON, _ := json.Marshal(params) - paramsRaw := json.RawMessage(paramsJSON) - - rules := []*github.RepositoryRule{ - { - Type: "max_file_path_length", - Parameters: ¶msRaw, + rules := &github.RepositoryRulesetRules{ + MaxFilePathLength: &github.MaxFilePathLengthRuleParameters{ + MaxFilePathLength: maxPathLength, }, } @@ -162,45 +141,6 @@ func TestFlattenRulesHandlesMaxFilePathLength(t *testing.T) { } } -func TestExpandRulesHandlesMaxFilePathLength(t *testing.T) { - // Test that max_file_path_length rule is properly expanded - maxPathLength := 512 - - rulesMap := map[string]any{ - "max_file_path_length": []any{ - map[string]any{ - "max_file_path_length": maxPathLength, - }, - }, - } - - input := []any{rulesMap} - result := expandRules(input, false) - - if len(result) != 1 { - t.Fatalf("Expected 1 rule in result, got %d", len(result)) - } - - rule := result[0] - if rule.Type != "max_file_path_length" { - t.Errorf("Expected rule type to be 'max_file_path_length', got %s", rule.Type) - } - - if rule.Parameters == nil { - t.Fatal("Expected rule parameters to be set") - } - - var params github.RuleMaxFilePathLengthParameters - err := json.Unmarshal(*rule.Parameters, ¶ms) - if err != nil { - t.Fatalf("Failed to unmarshal parameters: %v", err) - } - - if params.MaxFilePathLength != maxPathLength { - t.Errorf("Expected MaxFilePathLength to be %d, got %d", maxPathLength, params.MaxFilePathLength) - } -} - func TestRoundTripMaxFilePathLength(t *testing.T) { // Test that max_file_path_length rule survives expand -> flatten round trip maxPathLength := 1024 @@ -219,8 +159,8 @@ func TestRoundTripMaxFilePathLength(t *testing.T) { // Expand to GitHub API format expandedRules := expandRules(input, false) - if len(expandedRules) != 1 { - t.Fatalf("Expected 1 expanded rule, got %d", len(expandedRules)) + if expandedRules == nil { + t.Fatal("Expected expandedRules to not be nil") } // Flatten back to terraform format @@ -242,84 +182,104 @@ func TestRoundTripMaxFilePathLength(t *testing.T) { } } -func TestMaxFilePathLengthWithOtherRules(t *testing.T) { - // Test that max_file_path_length works correctly alongside other rules - maxPathLength := 200 +func TestExpandRulesMaxFileSize(t *testing.T) { + // Test that max_file_size rule is properly expanded + maxFileSize := int64(100) // 100 MB rulesMap := map[string]any{ - "creation": true, - "deletion": true, - "max_file_path_length": []any{ - map[string]any{ - "max_file_path_length": maxPathLength, - }, - }, "max_file_size": []any{ map[string]any{ - "max_file_size": 1, // 1MB + "max_file_size": float64(maxFileSize), }, }, } input := []any{rulesMap} + result := expandRules(input, false) - // Expand to GitHub API format - expandedRules := expandRules(input, false) + if result == nil { + t.Fatal("Expected result to not be nil") + } - if len(expandedRules) != 4 { - t.Fatalf("Expected 4 expanded rules, got %d", len(expandedRules)) + if result.MaxFileSize == nil { + t.Fatal("Expected MaxFileSize rule to be set") } - // Verify we have all expected rule types - ruleTypes := make(map[string]bool) - for _, rule := range expandedRules { - ruleTypes[rule.Type] = true + if result.MaxFileSize.MaxFileSize != maxFileSize { + t.Errorf("Expected MaxFileSize to be %d, got %d", maxFileSize, result.MaxFileSize.MaxFileSize) } +} - expectedTypes := []string{"creation", "deletion", "max_file_path_length", "max_file_size"} - for _, expectedType := range expectedTypes { - if !ruleTypes[expectedType] { - t.Errorf("Expected rule type %s not found in expanded rules", expectedType) - } +func TestFlattenRulesMaxFileSize(t *testing.T) { + // Test that max_file_size rule is properly flattened + maxFileSize := int64(100) // 100 MB + rules := &github.RepositoryRulesetRules{ + MaxFileSize: &github.MaxFileSizeRuleParameters{ + MaxFileSize: maxFileSize, + }, } - // Flatten back and verify - flattenedResult := flattenRules(expandedRules, false) - flattenedRulesMap := flattenedResult[0].(map[string]any) + result := flattenRules(rules, false) - // Check that all rules are preserved - if !flattenedRulesMap["creation"].(bool) { - t.Error("Expected creation rule to be true") + if len(result) != 1 { + t.Fatalf("Expected 1 element in result, got %d", len(result)) } - if !flattenedRulesMap["deletion"].(bool) { - t.Error("Expected deletion rule to be true") - } + rulesMap := result[0].(map[string]any) + maxFileSizeRules := rulesMap["max_file_size"].([]map[string]any) - maxFilePathLengthRules := flattenedRulesMap["max_file_path_length"].([]map[string]any) - if len(maxFilePathLengthRules) != 1 || maxFilePathLengthRules[0]["max_file_path_length"] != maxPathLength { - t.Errorf("Expected max_file_path_length rule with value %d", maxPathLength) + if len(maxFileSizeRules) != 1 { + t.Fatalf("Expected 1 max_file_size rule, got %d", len(maxFileSizeRules)) } - maxFileSizeRules := flattenedRulesMap["max_file_size"].([]map[string]any) - if len(maxFileSizeRules) != 1 || maxFileSizeRules[0]["max_file_size"] != int64(1) { - t.Error("Expected max_file_size rule with value 1") + if maxFileSizeRules[0]["max_file_size"] != maxFileSize { + t.Errorf("Expected max_file_size to be %d, got %v", maxFileSize, maxFileSizeRules[0]["max_file_size"]) } } -func TestMaxFilePathLengthErrorHandling(t *testing.T) { - // Test that malformed max_file_path_length parameters are handled gracefully - malformedParams := []byte(`{"invalid_field": "invalid_value"}`) - paramsRaw := json.RawMessage(malformedParams) +func TestExpandRulesFileExtensionRestriction(t *testing.T) { + // Test that file_extension_restriction rule is properly expanded + restrictedExtensions := []string{".exe", ".bat", ".com"} + + rulesMap := map[string]any{ + "file_extension_restriction": []any{ + map[string]any{ + "restricted_file_extensions": []any{".exe", ".bat", ".com"}, + }, + }, + } + + input := []any{rulesMap} + result := expandRules(input, false) + + if result == nil { + t.Fatal("Expected result to not be nil") + } - rules := []*github.RepositoryRule{ - { - Type: "max_file_path_length", - Parameters: ¶msRaw, + if result.FileExtensionRestriction == nil { + t.Fatal("Expected FileExtensionRestriction rule to be set") + } + + if len(result.FileExtensionRestriction.RestrictedFileExtensions) != len(restrictedExtensions) { + t.Errorf("Expected %d restricted extensions, got %d", len(restrictedExtensions), len(result.FileExtensionRestriction.RestrictedFileExtensions)) + } + + for i, ext := range restrictedExtensions { + if result.FileExtensionRestriction.RestrictedFileExtensions[i] != ext { + t.Errorf("Expected extension %s at index %d, got %s", ext, i, result.FileExtensionRestriction.RestrictedFileExtensions[i]) + } + } +} + +func TestFlattenRulesFileExtensionRestriction(t *testing.T) { + // Test that file_extension_restriction rule is properly flattened + restrictedExtensions := []string{".exe", ".bat", ".com"} + rules := &github.RepositoryRulesetRules{ + FileExtensionRestriction: &github.FileExtensionRestrictionRuleParameters{ + RestrictedFileExtensions: restrictedExtensions, }, } - // This should not panic, even with malformed parameters result := flattenRules(rules, false) if len(result) != 1 { @@ -327,16 +287,21 @@ func TestMaxFilePathLengthErrorHandling(t *testing.T) { } rulesMap := result[0].(map[string]any) - maxFilePathLengthRules, exists := rulesMap["max_file_path_length"] + fileExtensionRules := rulesMap["file_extension_restriction"].([]map[string]any) - if !exists { - t.Error("Expected max_file_path_length rule to be present even with malformed parameters") + if len(fileExtensionRules) != 1 { + t.Fatalf("Expected 1 file_extension_restriction rule, got %d", len(fileExtensionRules)) + } + + actualExtensions := fileExtensionRules[0]["restricted_file_extensions"].([]string) + if len(actualExtensions) != len(restrictedExtensions) { + t.Errorf("Expected %d restricted extensions, got %d", len(restrictedExtensions), len(actualExtensions)) } - // The rule should be present but may have default/zero values due to unmarshaling error - rules_slice := maxFilePathLengthRules.([]map[string]any) - if len(rules_slice) != 1 { - t.Errorf("Expected 1 max_file_path_length rule, got %d", len(rules_slice)) + for i, ext := range restrictedExtensions { + if actualExtensions[i] != ext { + t.Errorf("Expected extension %s at index %d, got %s", ext, i, actualExtensions[i]) + } } } @@ -370,21 +335,27 @@ func TestCompletePushRulesetSupport(t *testing.T) { // Expand to GitHub API format expandedRules := expandRules(input, false) - if len(expandedRules) != 4 { - t.Fatalf("Expected 4 expanded rules for complete push ruleset, got %d", len(expandedRules)) + if expandedRules == nil { + t.Fatal("Expected expandedRules to not be nil") } - // Verify we have all expected push rule types - ruleTypes := make(map[string]bool) - for _, rule := range expandedRules { - ruleTypes[rule.Type] = true + // Count how many rules we have + ruleCount := 0 + if expandedRules.FilePathRestriction != nil { + ruleCount++ + } + if expandedRules.MaxFileSize != nil { + ruleCount++ + } + if expandedRules.MaxFilePathLength != nil { + ruleCount++ + } + if expandedRules.FileExtensionRestriction != nil { + ruleCount++ } - expectedPushRules := []string{"file_path_restriction", "max_file_size", "max_file_path_length", "file_extension_restriction"} - for _, expectedType := range expectedPushRules { - if !ruleTypes[expectedType] { - t.Errorf("Expected push rule type %s not found in expanded rules", expectedType) - } + if ruleCount != 4 { + t.Fatalf("Expected 4 expanded rules for complete push ruleset, got %d", ruleCount) } // Flatten back to terraform format @@ -434,60 +405,3 @@ func TestCompletePushRulesetSupport(t *testing.T) { t.Errorf("Expected 3 restricted file extensions, got %d", len(restrictedExts)) } } - -func TestAllPushRulesWithUnknownRules(t *testing.T) { - // Test that push rules work correctly even when unknown rules are present - unknownParams := map[string]any{ - "some_copilot_parameter": "some_value", - } - unknownParamsJSON, _ := json.Marshal(unknownParams) - unknownParamsRaw := json.RawMessage(unknownParamsJSON) - - maxPathLengthParams := map[string]any{ - "max_file_path_length": 100, - } - maxPathLengthParamsJSON, _ := json.Marshal(maxPathLengthParams) - maxPathLengthParamsRaw := json.RawMessage(maxPathLengthParamsJSON) - - rules := []*github.RepositoryRule{ - { - Type: "max_file_path_length", - Parameters: &maxPathLengthParamsRaw, - }, - { - Type: "unknown_copilot_rule", - Parameters: &unknownParamsRaw, - }, - { - Type: "creation", - }, - } - - // This should not panic or fail, even with unknown rule types mixed in - result := flattenRules(rules, false) - - if len(result) != 1 { - t.Fatalf("Expected 1 element in result, got %d", len(result)) - } - - rulesMap := result[0].(map[string]any) - - // Should contain the known rules - if !rulesMap["creation"].(bool) { - t.Error("Expected creation rule to be true") - } - - maxFilePathLengthRules := rulesMap["max_file_path_length"].([]map[string]any) - if len(maxFilePathLengthRules) != 1 { - t.Fatalf("Expected 1 max_file_path_length rule, got %d", len(maxFilePathLengthRules)) - } - - if maxFilePathLengthRules[0]["max_file_path_length"] != 100 { - t.Errorf("Expected max_file_path_length to be 100, got %v", maxFilePathLengthRules[0]["max_file_path_length"]) - } - - // Should NOT contain the unknown rule type - if _, exists := rulesMap["unknown_copilot_rule"]; exists { - t.Error("Unknown rule type should not appear in flattened rules to avoid causing diffs") - } -} diff --git a/github/transport.go b/github/transport.go index 743c9e5de7..5d1d5348ad 100644 --- a/github/transport.go +++ b/github/transport.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" ) const ( diff --git a/github/transport_test.go b/github/transport_test.go index fab8242a29..7047b8c882 100644 --- a/github/transport_test.go +++ b/github/transport_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" ) func TestEtagTransport(t *testing.T) { @@ -48,7 +48,7 @@ func TestEtagTransport(t *testing.T) { } func githubApiMock(responseSequence []*mockResponse) *httptest.Server { - position := github.Int(0) + position := github.Ptr(0) return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.Header().Set("Server", "GitHub.com") @@ -106,7 +106,7 @@ func githubApiMock(responseSequence []*mockResponse) *httptest.Server { fmt.Fprintln(w, tc.ResponseBody) // Treat response as disposable - position = github.Int(i + 1) + position = github.Ptr(i + 1) })) } @@ -196,8 +196,8 @@ func TestRateLimitTransport_abuseLimit_post(t *testing.T) { ctx := context.WithValue(context.Background(), ctxId, t.Name()) r, _, err := client.Repositories.Create(ctx, "tada", &github.Repository{ - Name: github.String("radek-example-48"), - Description: github.String(""), + Name: github.Ptr("radek-example-48"), + Description: github.Ptr(""), }) if err != nil { t.Fatal(err) @@ -256,8 +256,8 @@ func TestRateLimitTransport_abuseLimit_post_error(t *testing.T) { ctx := context.WithValue(context.Background(), ctxId, t.Name()) _, _, err := client.Repositories.Create(ctx, "tada", &github.Repository{ - Name: github.String("radek-example-48"), - Description: github.String(""), + Name: github.Ptr("radek-example-48"), + Description: github.Ptr(""), }) if err == nil { t.Fatal("Expected 422 error, got nil") @@ -389,8 +389,8 @@ func TestRetryTransport_retry_post_error(t *testing.T) { ctx := context.WithValue(context.Background(), ctxId, t.Name()) _, _, err := client.Repositories.Create(ctx, "tada", &github.Repository{ - Name: github.String("radek-example-48"), - Description: github.String(""), + Name: github.Ptr("radek-example-48"), + Description: github.Ptr(""), }) if err == nil { t.Fatal("Expected error not to be nil") @@ -452,8 +452,8 @@ func TestRetryTransport_retry_post_success(t *testing.T) { ctx := context.WithValue(context.Background(), ctxId, t.Name()) _, _, err := client.Repositories.Create(ctx, "tada", &github.Repository{ - Name: github.String("radek-example-48"), - Description: github.String(""), + Name: github.Ptr("radek-example-48"), + Description: github.Ptr(""), }) if err != nil { t.Fatalf("Expected error to be nil, got %v", err) diff --git a/github/util.go b/github/util.go index 2389acd90c..06b7bb7899 100644 --- a/github/util.go +++ b/github/util.go @@ -13,7 +13,7 @@ import ( "strconv" "strings" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -194,30 +194,14 @@ func getTeamID(teamIDString string, meta any) (int64, error) { func getTeamSlug(teamIDString string, meta any) (string, error) { // Given a string that is either a team id or team slug, return the // team slug it is referring to. + // Update: go-github v77+, team IDs are deprecated. This func now + // treats all inputs as team slugs. ctx := context.Background() client := meta.(*Owner).v3client orgName := meta.(*Owner).name - orgId := meta.(*Owner).id - - teamId, parseIntErr := strconv.ParseInt(teamIDString, 10, 64) - if parseIntErr != nil { - // The given id not an integer, assume it is a team slug - team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString) - if slugErr != nil { - return "", errors.New(parseIntErr.Error() + slugErr.Error()) - } - return team.GetSlug(), nil - } - - // The given id is an integer, assume it is a team id - team, _, teamIdErr := client.Teams.GetTeamByID(ctx, orgId, teamId) - if teamIdErr != nil { - // There isn't a team with the given ID, assume it is a teamslug - team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString) - if slugErr != nil { - return "", errors.New(teamIdErr.Error() + slugErr.Error()) - } - return team.GetSlug(), nil + team, _, err := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString) + if err != nil { + return "", fmt.Errorf("team '%s' not found in organization '%s': %w", teamIDString, orgName, err) } return team.GetSlug(), nil } diff --git a/github/util_labels.go b/github/util_labels.go index 89b88f2754..32e2a35ba7 100644 --- a/github/util_labels.go +++ b/github/util_labels.go @@ -3,7 +3,7 @@ package github import ( "context" - "github.com/google/go-github/v67/github" + "github.com/google/go-github/v79/github" ) func flattenLabels(labels []*github.Label) []any { diff --git a/go.mod b/go.mod index 99e916eab8..168f8ff646 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/go-jose/go-jose/v3 v3.0.4 github.com/golangci/golangci-lint/v2 v2.6.0 - github.com/google/go-github/v67 v67.0.0 + github.com/google/go-github/v79 v79.0.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 diff --git a/go.sum b/go.sum index 6425b7921e..58247c544d 100644 --- a/go.sum +++ b/go.sum @@ -331,8 +331,8 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/go-cmp v0.5.9/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/v67 v67.0.0 h1:g11NDAmfaBaCO8qYdI9fsmbaRipHNWRIU/2YGvlh4rg= -github.com/google/go-github/v67 v67.0.0/go.mod h1:zH3K7BxjFndr9QSeFibx4lTKkYS3K9nDanoI1NjaOtY= +github.com/google/go-github/v79 v79.0.0 h1:MdodQojuFPBhmtwHiBcIGLw/e/wei2PvFX9ndxK0X4Y= +github.com/google/go-github/v79 v79.0.0/go.mod h1:OAFbNhq7fQwohojb06iIIQAB9CBGYLq999myfUFnrS4= 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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= diff --git a/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/dax.xml b/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/dax.xml index 1a3ffbc89f..2bb3a1aa7f 100644 --- a/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/dax.xml +++ b/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/dax.xml @@ -11,8 +11,8 @@ - - + + diff --git a/vendor/github.com/google/go-github/v67/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v67/github/actions_permissions_orgs.go deleted file mode 100644 index 2f555f2493..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/actions_required_workflows.go b/vendor/github.com/google/go-github/v67/github/actions_required_workflows.go deleted file mode 100644 index b89741a82a..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/billing.go b/vendor/github.com/google/go-github/v67/github/billing.go deleted file mode 100644 index 09b1a5d017..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/dependency_graph.go b/vendor/github.com/google/go-github/v67/github/dependency_graph.go deleted file mode 100644 index 86a1fe48b9..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/orgs_projects.go b/vendor/github.com/google/go-github/v67/github/orgs_projects.go deleted file mode 100644 index 454d8cf1c3..0000000000 --- a/vendor/github.com/google/go-github/v67/github/orgs_projects.go +++ /dev/null @@ -1,64 +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. - -package github - -import ( - "context" - "fmt" -) - -// ListProjects lists the projects for an organization. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#list-organization-projects -// -//meta:operation GET /orgs/{org}/projects -func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opts *ProjectListOptions) ([]*Project, *Response, error) { - u := fmt.Sprintf("orgs/%v/projects", 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 - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// CreateProject creates a GitHub Project for the specified organization. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#create-an-organization-project -// -//meta:operation POST /orgs/{org}/projects -func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opts *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("orgs/%v/projects", org) - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} diff --git a/vendor/github.com/google/go-github/v67/github/orgs_rules.go b/vendor/github.com/google/go-github/v67/github/orgs_rules.go deleted file mode 100644 index 37c06a7333..0000000000 --- a/vendor/github.com/google/go-github/v67/github/orgs_rules.go +++ /dev/null @@ -1,115 +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" -) - -// GetAllOrganizationRulesets gets all the 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) GetAllOrganizationRulesets(ctx context.Context, org string) ([]*Ruleset, *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 []*Ruleset - resp, err := s.client.Do(ctx, req, &rulesets) - if err != nil { - return nil, resp, err - } - - return rulesets, resp, nil -} - -// CreateOrganizationRuleset creates a 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) CreateOrganizationRuleset(ctx context.Context, org string, rs *Ruleset) (*Ruleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets", org) - - req, err := s.client.NewRequest("POST", u, rs) - if err != nil { - return nil, nil, err - } - - var ruleset *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// GetOrganizationRuleset gets a ruleset from 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) GetOrganizationRuleset(ctx context.Context, org string, rulesetID int64) (*Ruleset, *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 *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateOrganizationRuleset updates a ruleset from 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) UpdateOrganizationRuleset(ctx context.Context, org string, rulesetID int64, rs *Ruleset) (*Ruleset, *Response, error) { - u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) - - req, err := s.client.NewRequest("PUT", u, rs) - if err != nil { - return nil, nil, err - } - - var ruleset *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// DeleteOrganizationRuleset deletes a 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) DeleteOrganizationRuleset(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/v67/github/packages.go b/vendor/github.com/google/go-github/v67/github/packages.go deleted file mode 100644 index ef7df07405..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/projects.go b/vendor/github.com/google/go-github/v67/github/projects.go deleted file mode 100644 index c5c42f8939..0000000000 --- a/vendor/github.com/google/go-github/v67/github/projects.go +++ /dev/null @@ -1,634 +0,0 @@ -// Copyright 2016 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" -) - -// ProjectsService provides access to the projects functions in the -// GitHub API. -// -// GitHub API docs: https://docs.github.com/rest/projects -type ProjectsService service - -// Project represents a GitHub Project. -type Project struct { - ID *int64 `json:"id,omitempty"` - 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"` - Number *int `json:"number,omitempty"` - State *string `json:"state,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` - OrganizationPermission *string `json:"organization_permission,omitempty"` - Private *bool `json:"private,omitempty"` - - // The User object that generated the project. - Creator *User `json:"creator,omitempty"` -} - -func (p Project) String() string { - return Stringify(p) -} - -// GetProject gets a GitHub Project for a repo. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#get-a-project -// -//meta:operation GET /projects/{project_id} -func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} - -// ProjectOptions specifies the parameters to the -// RepositoriesService.CreateProject and -// ProjectsService.UpdateProject methods. -type ProjectOptions struct { - // The name of the project. (Required for creation; optional for update.) - Name *string `json:"name,omitempty"` - // The body of the project. (Optional.) - Body *string `json:"body,omitempty"` - - // The following field(s) are only applicable for update. - // They should be left with zero values for creation. - - // State of the project. Either "open" or "closed". (Optional.) - State *string `json:"state,omitempty"` - // The permission level that all members of the project's organization - // will have on this project. - // Setting the organization permission is only available - // for organization projects. (Optional.) - OrganizationPermission *string `json:"organization_permission,omitempty"` - // Sets visibility of the project within the organization. - // Setting visibility is only available - // for organization projects.(Optional.) - Private *bool `json:"private,omitempty"` -} - -// UpdateProject updates a repository project. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#update-a-project -// -//meta:operation PATCH /projects/{project_id} -func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("PATCH", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} - -// DeleteProject deletes a GitHub Project from a repository. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#delete-a-project -// -//meta:operation DELETE /projects/{project_id} -func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) { - u := fmt.Sprintf("projects/%v", id) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectColumn represents a column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/repos/projects/ -type ProjectColumn struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - URL *string `json:"url,omitempty"` - ProjectURL *string `json:"project_url,omitempty"` - CardsURL *string `json:"cards_url,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` -} - -// ListProjectColumns lists the columns of a GitHub Project for a repo. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#list-project-columns -// -//meta:operation GET /projects/{project_id}/columns -func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opts *ListOptions) ([]*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/%v/columns", projectID) - 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 headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - columns := []*ProjectColumn{} - resp, err := s.client.Do(ctx, req, &columns) - if err != nil { - return nil, resp, err - } - - return columns, resp, nil -} - -// GetProjectColumn gets a column of a GitHub Project for a repo. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#get-a-project-column -// -//meta:operation GET /projects/columns/{column_id} -func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/columns/%v", id) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// ProjectColumnOptions specifies the parameters to the -// ProjectsService.CreateProjectColumn and -// ProjectsService.UpdateProjectColumn methods. -type ProjectColumnOptions struct { - // The name of the project column. (Required for creation and update.) - Name string `json:"name"` -} - -// CreateProjectColumn creates a column for the specified (by number) project. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#create-a-project-column -// -//meta:operation POST /projects/{project_id}/columns -func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/%v/columns", projectID) - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// UpdateProjectColumn updates a column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#update-an-existing-project-column -// -//meta:operation PATCH /projects/columns/{column_id} -func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { - u := fmt.Sprintf("projects/columns/%v", columnID) - req, err := s.client.NewRequest("PATCH", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - column := &ProjectColumn{} - resp, err := s.client.Do(ctx, req, column) - if err != nil { - return nil, resp, err - } - - return column, resp, nil -} - -// DeleteProjectColumn deletes a column from a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#delete-a-project-column -// -//meta:operation DELETE /projects/columns/{column_id} -func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) { - u := fmt.Sprintf("projects/columns/%v", columnID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectColumnMoveOptions specifies the parameters to the -// ProjectsService.MoveProjectColumn method. -type ProjectColumnMoveOptions struct { - // Position can be one of "first", "last", or "after:", where - // is the ID of a column in the same project. (Required.) - Position string `json:"position"` -} - -// MoveProjectColumn moves a column within a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/columns#move-a-project-column -// -//meta:operation POST /projects/columns/{column_id}/moves -func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnMoveOptions) (*Response, error) { - u := fmt.Sprintf("projects/columns/%v/moves", columnID) - req, err := s.client.NewRequest("POST", u, opts) - 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) -} - -// ProjectCard represents a card in a column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards/#get-a-project-card -type ProjectCard struct { - URL *string `json:"url,omitempty"` - ColumnURL *string `json:"column_url,omitempty"` - ContentURL *string `json:"content_url,omitempty"` - ID *int64 `json:"id,omitempty"` - Note *string `json:"note,omitempty"` - Creator *User `json:"creator,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Archived *bool `json:"archived,omitempty"` - - // The following fields are only populated by Webhook events. - ColumnID *int64 `json:"column_id,omitempty"` - - // The following fields are only populated by Events API. - ProjectID *int64 `json:"project_id,omitempty"` - ProjectURL *string `json:"project_url,omitempty"` - ColumnName *string `json:"column_name,omitempty"` - PreviousColumnName *string `json:"previous_column_name,omitempty"` // Populated in "moved_columns_in_project" event deliveries. -} - -// ProjectCardListOptions specifies the optional parameters to the -// ProjectsService.ListProjectCards method. -type ProjectCardListOptions struct { - // ArchivedState is used to list all, archived, or not_archived project cards. - // Defaults to not_archived when you omit this parameter. - ArchivedState *string `url:"archived_state,omitempty"` - - ListOptions -} - -// ListProjectCards lists the cards in a column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#list-project-cards -// -//meta:operation GET /projects/columns/{column_id}/cards -func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opts *ProjectCardListOptions) ([]*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/%v/cards", columnID) - 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 headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - cards := []*ProjectCard{} - resp, err := s.client.Do(ctx, req, &cards) - if err != nil { - return nil, resp, err - } - - return cards, resp, nil -} - -// GetProjectCard gets a card in a column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#get-a-project-card -// -//meta:operation GET /projects/columns/cards/{card_id} -func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// ProjectCardOptions specifies the parameters to the -// ProjectsService.CreateProjectCard and -// ProjectsService.UpdateProjectCard methods. -type ProjectCardOptions struct { - // The note of the card. Note and ContentID are mutually exclusive. - Note string `json:"note,omitempty"` - // The ID (not Number) of the Issue to associate with this card. - // Note and ContentID are mutually exclusive. - ContentID int64 `json:"content_id,omitempty"` - // The type of content to associate with this card. Possible values are: "Issue" and "PullRequest". - ContentType string `json:"content_type,omitempty"` - // Use true to archive a project card. - // Specify false if you need to restore a previously archived project card. - Archived *bool `json:"archived,omitempty"` -} - -// CreateProjectCard creates a card in the specified column of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#create-a-project-card -// -//meta:operation POST /projects/columns/{column_id}/cards -func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/%v/cards", columnID) - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// UpdateProjectCard updates a card of a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#update-an-existing-project-card -// -//meta:operation PATCH /projects/columns/cards/{card_id} -func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("PATCH", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - card := &ProjectCard{} - resp, err := s.client.Do(ctx, req, card) - if err != nil { - return nil, resp, err - } - - return card, resp, nil -} - -// DeleteProjectCard deletes a card from a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#delete-a-project-card -// -//meta:operation DELETE /projects/columns/cards/{card_id} -func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v", cardID) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ProjectCardMoveOptions specifies the parameters to the -// ProjectsService.MoveProjectCard method. -type ProjectCardMoveOptions struct { - // Position can be one of "top", "bottom", or "after:", where - // is the ID of a card in the same project. - Position string `json:"position"` - // ColumnID is the ID of a column in the same project. Note that ColumnID - // is required when using Position "after:" when that card is in - // another column; otherwise it is optional. - ColumnID int64 `json:"column_id,omitempty"` -} - -// MoveProjectCard moves a card within a GitHub Project. -// -// GitHub API docs: https://docs.github.com/rest/projects/cards#move-a-project-card -// -//meta:operation POST /projects/columns/cards/{card_id}/moves -func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opts *ProjectCardMoveOptions) (*Response, error) { - u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) - req, err := s.client.NewRequest("POST", u, opts) - 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) -} - -// ProjectCollaboratorOptions specifies the optional parameters to the -// ProjectsService.AddProjectCollaborator method. -type ProjectCollaboratorOptions struct { - // Permission specifies the permission to grant to the collaborator. - // Possible values are: - // "read" - can read, but not write to or administer this project. - // "write" - can read and write, but not administer this project. - // "admin" - can read, write and administer this project. - // - // Default value is "write" - Permission *string `json:"permission,omitempty"` -} - -// AddProjectCollaborator adds a collaborator to an organization project and sets -// their permission level. You must be an organization owner or a project admin to add a collaborator. -// -// GitHub API docs: https://docs.github.com/rest/projects/collaborators#add-project-collaborator -// -//meta:operation PUT /projects/{project_id}/collaborators/{username} -func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opts *ProjectCollaboratorOptions) (*Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) - req, err := s.client.NewRequest("PUT", u, opts) - 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) -} - -// RemoveProjectCollaborator removes a collaborator from an organization project. -// You must be an organization owner or a project admin to remove a collaborator. -// -// GitHub API docs: https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator -// -//meta:operation DELETE /projects/{project_id}/collaborators/{username} -func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - return s.client.Do(ctx, req, nil) -} - -// ListCollaboratorOptions specifies the optional parameters to the -// ProjectsService.ListProjectCollaborators method. -type ListCollaboratorOptions struct { - // Affiliation specifies how collaborators should be filtered by their affiliation. - // Possible values are: - // "outside" - All outside collaborators of an organization-owned repository - // "direct" - All collaborators with permissions to an organization-owned repository, - // regardless of organization membership status - // "all" - All collaborators the authenticated user can see - // - // Default value is "all". - Affiliation *string `url:"affiliation,omitempty"` - - ListOptions -} - -// ListProjectCollaborators lists the collaborators for an organization project. For a project, -// the list of collaborators includes outside collaborators, organization members that are direct -// collaborators, organization members with access through team memberships, organization members -// with access through default organization permissions, and organization owners. You must be an -// organization owner or a project admin to list collaborators. -// -// GitHub API docs: https://docs.github.com/rest/projects/collaborators#list-project-collaborators -// -//meta:operation GET /projects/{project_id}/collaborators -func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opts *ListCollaboratorOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("projects/%v/collaborators", 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 - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var users []*User - resp, err := s.client.Do(ctx, req, &users) - if err != nil { - return nil, resp, err - } - - return users, resp, nil -} - -// ProjectPermissionLevel represents the permission level an organization -// member has for a given project. -type ProjectPermissionLevel struct { - // Possible values: "admin", "write", "read", "none" - Permission *string `json:"permission,omitempty"` - - User *User `json:"user,omitempty"` -} - -// ReviewProjectCollaboratorPermission returns the collaborator's permission level for an organization -// project. Possible values for the permission key: "admin", "write", "read", "none". -// You must be an organization owner or a project admin to review a user's permission level. -// -// GitHub API docs: https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user -// -//meta:operation GET /projects/{project_id}/collaborators/{username}/permission -func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) { - u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username) - 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", mediaTypeProjectsPreview) - - ppl := new(ProjectPermissionLevel) - resp, err := s.client.Do(ctx, req, ppl) - if err != nil { - return nil, resp, err - } - return ppl, resp, nil -} diff --git a/vendor/github.com/google/go-github/v67/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v67/github/repos_actions_permissions.go deleted file mode 100644 index 9abd32a783..0000000000 --- a/vendor/github.com/google/go-github/v67/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/v67/github/repos_projects.go b/vendor/github.com/google/go-github/v67/github/repos_projects.go deleted file mode 100644 index 9269d4e95c..0000000000 --- a/vendor/github.com/google/go-github/v67/github/repos_projects.go +++ /dev/null @@ -1,73 +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. - -package github - -import ( - "context" - "fmt" -) - -// ProjectListOptions specifies the optional parameters to the -// OrganizationsService.ListProjects and RepositoriesService.ListProjects methods. -type ProjectListOptions struct { - // Indicates the state of the projects to return. Can be either open, closed, or all. Default: open - State string `url:"state,omitempty"` - - ListOptions -} - -// ListProjects lists the projects for a repo. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#list-repository-projects -// -//meta:operation GET /repos/{owner}/{repo}/projects -func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opts *ProjectListOptions) ([]*Project, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/projects", 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 headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// CreateProject creates a GitHub Project for the specified repository. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-repository-project -// -//meta:operation POST /repos/{owner}/{repo}/projects -func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opts *ProjectOptions) (*Project, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} diff --git a/vendor/github.com/google/go-github/v67/github/repos_rules.go b/vendor/github.com/google/go-github/v67/github/repos_rules.go deleted file mode 100644 index b113553a24..0000000000 --- a/vendor/github.com/google/go-github/v67/github/repos_rules.go +++ /dev/null @@ -1,995 +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" - "fmt" -) - -// BypassActor represents the bypass actors from a ruleset. -type BypassActor struct { - ActorID *int64 `json:"actor_id,omitempty"` - // Possible values for ActorType are: RepositoryRole, Team, Integration, OrganizationAdmin - ActorType *string `json:"actor_type,omitempty"` - // Possible values for BypassMode are: always, pull_request - BypassMode *string `json:"bypass_mode,omitempty"` -} - -// RulesetLink represents a single link object from GitHub ruleset request _links. -type RulesetLink struct { - HRef *string `json:"href,omitempty"` -} - -// RulesetLinks represents the "_links" object in a Ruleset. -type RulesetLinks struct { - Self *RulesetLink `json:"self,omitempty"` -} - -// RulesetRefConditionParameters represents the conditions object for ref_names. -type RulesetRefConditionParameters struct { - Include []string `json:"include"` - Exclude []string `json:"exclude"` -} - -// RulesetRepositoryNamesConditionParameters represents the conditions object for repository_names. -type RulesetRepositoryNamesConditionParameters struct { - Include []string `json:"include"` - Exclude []string `json:"exclude"` - Protected *bool `json:"protected,omitempty"` -} - -// RulesetRepositoryIDsConditionParameters represents the conditions object for repository_ids. -type RulesetRepositoryIDsConditionParameters struct { - RepositoryIDs []int64 `json:"repository_ids,omitempty"` -} - -// RulesetRepositoryPropertyTargetParameters represents a repository_property name and values to be used for targeting. -type RulesetRepositoryPropertyTargetParameters struct { - Name string `json:"name"` - Values []string `json:"property_values"` - Source *string `json:"source,omitempty"` -} - -// RulesetRepositoryPropertyConditionParameters represents the conditions object for repository_property. -type RulesetRepositoryPropertyConditionParameters struct { - Include []RulesetRepositoryPropertyTargetParameters `json:"include"` - Exclude []RulesetRepositoryPropertyTargetParameters `json:"exclude"` -} - -// RulesetConditions represents the conditions object in a ruleset. -// Set either RepositoryName or RepositoryID or RepositoryProperty, not more than one. -type RulesetConditions struct { - RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` - RepositoryName *RulesetRepositoryNamesConditionParameters `json:"repository_name,omitempty"` - RepositoryID *RulesetRepositoryIDsConditionParameters `json:"repository_id,omitempty"` - RepositoryProperty *RulesetRepositoryPropertyConditionParameters `json:"repository_property,omitempty"` -} - -// RulePatternParameters represents the rule pattern parameters. -type RulePatternParameters struct { - Name *string `json:"name,omitempty"` - // If Negate is true, the rule will fail if the pattern matches. - Negate *bool `json:"negate,omitempty"` - // Possible values for Operator are: starts_with, ends_with, contains, regex - Operator string `json:"operator"` - Pattern string `json:"pattern"` -} - -// RuleFileParameters represents a list of file paths. -type RuleFileParameters struct { - RestrictedFilePaths *[]string `json:"restricted_file_paths"` -} - -// RuleMaxFilePathLengthParameters represents the max_file_path_length rule parameters. -type RuleMaxFilePathLengthParameters struct { - MaxFilePathLength int `json:"max_file_path_length"` -} - -// RuleFileExtensionRestrictionParameters represents the file_extension_restriction rule parameters. -type RuleFileExtensionRestrictionParameters struct { - RestrictedFileExtensions []string `json:"restricted_file_extensions"` -} - -// RuleMaxFileSizeParameters represents the max_file_size rule parameters. -type RuleMaxFileSizeParameters struct { - MaxFileSize int64 `json:"max_file_size"` -} - -// UpdateAllowsFetchAndMergeRuleParameters represents the update rule parameters. -type UpdateAllowsFetchAndMergeRuleParameters struct { - UpdateAllowsFetchAndMerge bool `json:"update_allows_fetch_and_merge"` -} - -// RequiredDeploymentEnvironmentsRuleParameters represents the required_deployments rule parameters. -type RequiredDeploymentEnvironmentsRuleParameters struct { - RequiredDeploymentEnvironments []string `json:"required_deployment_environments"` -} - -// PullRequestRuleParameters represents the pull_request rule parameters. -type PullRequestRuleParameters struct { - 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"` -} - -// RuleRequiredStatusChecks represents the RequiredStatusChecks for the RequiredStatusChecksRuleParameters object. -type RuleRequiredStatusChecks struct { - Context string `json:"context"` - IntegrationID *int64 `json:"integration_id,omitempty"` -} - -// MergeQueueRuleParameters represents the merge_queue rule parameters. -type MergeQueueRuleParameters struct { - CheckResponseTimeoutMinutes int `json:"check_response_timeout_minutes"` - // Possible values for GroupingStrategy are: ALLGREEN, HEADGREEN - GroupingStrategy string `json:"grouping_strategy"` - MaxEntriesToBuild int `json:"max_entries_to_build"` - MaxEntriesToMerge int `json:"max_entries_to_merge"` - // Possible values for MergeMethod are: MERGE, SQUASH, REBASE - MergeMethod string `json:"merge_method"` - MinEntriesToMerge int `json:"min_entries_to_merge"` - MinEntriesToMergeWaitMinutes int `json:"min_entries_to_merge_wait_minutes"` -} - -// RequiredStatusChecksRuleParameters represents the required_status_checks rule parameters. -type RequiredStatusChecksRuleParameters struct { - DoNotEnforceOnCreate *bool `json:"do_not_enforce_on_create,omitempty"` - RequiredStatusChecks []RuleRequiredStatusChecks `json:"required_status_checks"` - StrictRequiredStatusChecksPolicy bool `json:"strict_required_status_checks_policy"` -} - -// RuleRequiredWorkflow represents the Workflow for the RequireWorkflowsRuleParameters object. -type RuleRequiredWorkflow struct { - Path string `json:"path"` - Ref *string `json:"ref,omitempty"` - RepositoryID *int64 `json:"repository_id,omitempty"` - Sha *string `json:"sha,omitempty"` -} - -// RequiredWorkflowsRuleParameters represents the workflows rule parameters. -type RequiredWorkflowsRuleParameters struct { - DoNotEnforceOnCreate bool `json:"do_not_enforce_on_create,omitempty"` - RequiredWorkflows []*RuleRequiredWorkflow `json:"workflows"` -} - -// RuleRequiredCodeScanningTool represents a single required code-scanning tool for the RequiredCodeScanningParameters object. -type RuleRequiredCodeScanningTool struct { - AlertsThreshold string `json:"alerts_threshold"` - SecurityAlertsThreshold string `json:"security_alerts_threshold"` - Tool string `json:"tool"` -} - -// RequiredCodeScanningRuleParameters represents the code_scanning rule parameters. -type RequiredCodeScanningRuleParameters struct { - RequiredCodeScanningTools []*RuleRequiredCodeScanningTool `json:"code_scanning_tools"` -} - -// RepositoryRule represents a GitHub Rule. -type RepositoryRule struct { - Type string `json:"type"` - Parameters *json.RawMessage `json:"parameters,omitempty"` - RulesetSourceType string `json:"ruleset_source_type"` - RulesetSource string `json:"ruleset_source"` - RulesetID int64 `json:"ruleset_id"` -} - -// RepositoryRulesetEditedChanges represents the changes made to a repository ruleset. -type RepositoryRulesetEditedChanges struct { - Name *RepositoryRulesetEditedSource `json:"name,omitempty"` - Enforcement *RepositoryRulesetEditedSource `json:"enforcement,omitempty"` - Conditions *RepositoryRulesetEditedConditions `json:"conditions,omitempty"` - Rules *RepositoryRulesetEditedRules `json:"rules,omitempty"` -} - -// RepositoryRulesetEditedSource represents a source change for the ruleset. -type RepositoryRulesetEditedSource struct { - From *string `json:"from,omitempty"` -} - -// RepositoryRulesetEditedSources represents multiple source changes for the ruleset. -type RepositoryRulesetEditedSources struct { - From []string `json:"from,omitempty"` -} - -// RepositoryRulesetEditedConditions holds changes to conditions in a ruleset. -type RepositoryRulesetEditedConditions struct { - Added []*RepositoryRulesetRefCondition `json:"added,omitempty"` - Deleted []*RepositoryRulesetRefCondition `json:"deleted,omitempty"` - Updated []*RepositoryRulesetEditedUpdatedConditions `json:"updated,omitempty"` -} - -// RepositoryRulesetEditedRules holds changes to rules in a ruleset. -type RepositoryRulesetEditedRules struct { - Added []*RepositoryRulesetRule `json:"added,omitempty"` - Deleted []*RepositoryRulesetRule `json:"deleted,omitempty"` - Updated []*RepositoryRulesetUpdatedRules `json:"updated,omitempty"` -} - -// RepositoryRulesetRefCondition represents a reference condition for the ruleset. -type RepositoryRulesetRefCondition struct { - RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` -} - -// RepositoryRulesetEditedUpdatedConditions holds updates to conditions in a ruleset. -type RepositoryRulesetEditedUpdatedConditions struct { - Condition *RepositoryRulesetRefCondition `json:"condition,omitempty"` - Changes *RepositoryRulesetUpdatedConditionsEdited `json:"changes,omitempty"` -} - -// RepositoryRulesetUpdatedConditionsEdited holds the edited updates to conditions in a ruleset. -type RepositoryRulesetUpdatedConditionsEdited struct { - ConditionType *RepositoryRulesetEditedSource `json:"condition_type,omitempty"` - Target *RepositoryRulesetEditedSource `json:"target,omitempty"` - Include *RepositoryRulesetEditedSources `json:"include,omitempty"` - Exclude *RepositoryRulesetEditedSources `json:"exclude,omitempty"` -} - -// RepositoryRulesetUpdatedRules holds updates to rules in a ruleset. -type RepositoryRulesetUpdatedRules struct { - Rule *RepositoryRulesetRule `json:"rule,omitempty"` - Changes *RepositoryRulesetEditedRuleChanges `json:"changes,omitempty"` -} - -// RepositoryRulesetEditedRuleChanges holds changes made to a rule in a ruleset. -type RepositoryRulesetEditedRuleChanges struct { - Configuration *RepositoryRulesetEditedSources `json:"configuration,omitempty"` - RuleType *RepositoryRulesetEditedSources `json:"rule_type,omitempty"` - Pattern *RepositoryRulesetEditedSources `json:"pattern,omitempty"` -} - -// RepositoryRuleset represents the structure of a ruleset associated with a GitHub repository. -type RepositoryRuleset struct { - ID int64 `json:"id"` - Name string `json:"name"` - // Possible values for target: "branch", "tag", "push" - Target *string `json:"target,omitempty"` - // Possible values for source type: "Repository", "Organization" - SourceType *string `json:"source_type,omitempty"` - Source string `json:"source"` - // Possible values for enforcement: "disabled", "active", "evaluate" - Enforcement string `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors,omitempty"` - // Possible values for current user can bypass: "always", "pull_requests_only", "never" - CurrentUserCanBypass *string `json:"current_user_can_bypass,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Links *RepositoryRulesetLink `json:"_links,omitempty"` - Conditions json.RawMessage `json:"conditions,omitempty"` - Rules []*RepositoryRulesetRule `json:"rules,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` -} - -// RepositoryRulesetRule represents individual rules which are present in a repository's ruleset. -type RepositoryRulesetRule struct { - Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` - Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` - Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` - RequiredLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` - MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` - RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` - RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` - PullRequest *RepositoryRulesetPullRequestRule `json:"pull_request,omitempty"` - RequiredStatusChecks *RepositoryRulesetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` - NonFastForward *RepositoryRulesetRuleType `json:"non_fast_forward,omitempty"` - CommitMessagePattern *RepositoryRulesetPatternRule `json:"commit_message_pattern,omitempty"` - CommitAuthorEmailPattern *RepositoryRulesetPatternRule `json:"commit_author_email_pattern,omitempty"` - CommitterEmailPattern *RepositoryRulesetPatternRule `json:"committer_email_pattern,omitempty"` - BranchNamePattern *RepositoryRulesetPatternRule `json:"branch_name_pattern,omitempty"` - TagNamePattern *RepositoryRulesetPatternRule `json:"tag_name_pattern,omitempty"` - FilePathRestriction *RepositoryRulesetFilePathRestrictionRule `json:"file_path_restriction,omitempty"` - MaxFilePathLength *RepositoryRulesetMaxFilePathLengthRule `json:"max_file_path_length,omitempty"` - FileExtensionRestriction *RepositoryRulesetFileExtensionRestrictionRule `json:"file_extension_restriction,omitempty"` - MaxFileSize *RepositoryRulesetMaxFileSizeRule `json:"max_file_size,omitempty"` - Workflows *RepositoryRulesetWorkflowsRule `json:"workflows,omitempty"` - CodeScanning *RepositoryRulesetCodeScanningRule `json:"code_scanning,omitempty"` -} - -// RepositoryRulesetLink represents Links associated with a repository's rulesets. These links are used to provide more information about the ruleset. -type RepositoryRulesetLink struct { - Self *RulesetLink `json:"self,omitempty"` - HTML *RulesetLink `json:"html,omitempty"` -} - -// RepositoryRulesetRuleType represents the type of a ruleset rule. -type RepositoryRulesetRuleType struct { - Type string `json:"type"` -} - -// RepositoryRulesetUpdateRule defines an update rule for the repository. -type RepositoryRulesetUpdateRule struct { - // Type can be one of: "update". - Type string `json:"type"` - Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetMergeQueueRule defines a merge queue rule for the repository. -type RepositoryRulesetMergeQueueRule struct { - // Type can be one of: "merge_queue". - Type string `json:"type"` - Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetRequiredDeploymentsRule defines a rule for required deployments. -type RepositoryRulesetRequiredDeploymentsRule struct { - // Type can be one of: "required_deployments". - Type string `json:"type"` - Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetPullRequestRule defines a rule for pull requests. -type RepositoryRulesetPullRequestRule struct { - // Type can be one of: "pull_request". - - Type string `json:"type"` - Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetRequiredStatusChecksRule defines a rule for required status checks. -type RepositoryRulesetRequiredStatusChecksRule struct { - // Type can be one of: "required_status_checks". - - Type string `json:"type"` - Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetPatternRule defines a pattern rule for the repository. -type RepositoryRulesetPatternRule struct { - Type string `json:"type"` - Parameters *RulePatternParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetFilePathRestrictionRule defines a file path restriction rule for the repository. -type RepositoryRulesetFilePathRestrictionRule struct { - // Type can be one of: "file_path_restriction". - Type string `json:"type"` - Parameters *RuleFileParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetMaxFilePathLengthRule defines a maximum file path length rule for the repository. -type RepositoryRulesetMaxFilePathLengthRule struct { - // Type can be one of: "max_file_path_length". - - Type string `json:"type"` - Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetFileExtensionRestrictionRule defines a file extension restriction rule for the repository. -type RepositoryRulesetFileExtensionRestrictionRule struct { - // Type can be one of: "file_extension_restriction". - Type string `json:"type"` - Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetMaxFileSizeRule defines a maximum file size rule for the repository. -type RepositoryRulesetMaxFileSizeRule struct { - // Type can be one of: "max_file_size". - Type string `json:"type"` - Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetWorkflowsRule defines a workflow rule for the repository. -type RepositoryRulesetWorkflowsRule struct { - // Type can be one of: "workflows". - Type string `json:"type"` - Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` -} - -// RepositoryRulesetCodeScanningRule defines a code scanning rule for the repository. -type RepositoryRulesetCodeScanningRule struct { - // Type can be one of: "code_scanning". - Type string `json:"type"` - Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` -} - -// RuleCodeScanningParameters defines parameters for code scanning rules. -type RuleCodeScanningParameters struct { - CodeScanningTools []*CodeScanningTool `json:"code_scanning_tools,omitempty"` -} - -// CodeScanningTool defines a specific tool used for code scanning. -type CodeScanningTool struct { - AlertsThreshold string `json:"alerts_threshold"` - SecurityAlertsThreshold string `json:"security_alerts_threshold"` - Tool string `json:"tool"` -} - -// UnmarshalJSON implements the json.Unmarshaler interface. -// This helps us handle the fact that RepositoryRule parameter field can be of numerous types. -func (r *RepositoryRule) UnmarshalJSON(data []byte) error { - type rule RepositoryRule - var repositoryRule rule - if err := json.Unmarshal(data, &repositoryRule); err != nil { - return err - } - - r.RulesetID = repositoryRule.RulesetID - r.RulesetSourceType = repositoryRule.RulesetSourceType - r.RulesetSource = repositoryRule.RulesetSource - r.Type = repositoryRule.Type - - switch repositoryRule.Type { - case "creation", "deletion", "non_fast_forward", "required_linear_history", "required_signatures": - r.Parameters = nil - case "update": - if repositoryRule.Parameters == nil { - r.Parameters = nil - return nil - } - params := UpdateAllowsFetchAndMergeRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "merge_queue": - if repositoryRule.Parameters == nil { - r.Parameters = nil - return nil - } - params := MergeQueueRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "required_deployments": - params := RequiredDeploymentEnvironmentsRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "commit_message_pattern", "commit_author_email_pattern", "committer_email_pattern", "branch_name_pattern", "tag_name_pattern": - params := RulePatternParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "pull_request": - params := PullRequestRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "required_status_checks": - params := RequiredStatusChecksRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "workflows": - params := RequiredWorkflowsRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "file_path_restriction": - params := RuleFileParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "code_scanning": - params := RequiredCodeScanningRuleParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "max_file_path_length": - params := RuleMaxFilePathLengthParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "file_extension_restriction": - params := RuleFileExtensionRestrictionParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - case "max_file_size": - params := RuleMaxFileSizeParameters{} - if err := json.Unmarshal(*repositoryRule.Parameters, ¶ms); err != nil { - return err - } - bytes, _ := json.Marshal(params) - rawParams := json.RawMessage(bytes) - - r.Parameters = &rawParams - default: - r.Type = "" - r.Parameters = nil - return fmt.Errorf("RepositoryRule.Type %q is not yet implemented, unable to unmarshal (%#v)", repositoryRule.Type, repositoryRule) - } - - return nil -} - -// NewMergeQueueRule creates a rule to only allow merges via a merge queue. -func NewMergeQueueRule(params *MergeQueueRuleParameters) (rule *RepositoryRule) { - if params != nil { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "merge_queue", - Parameters: &rawParams, - } - } - return &RepositoryRule{ - Type: "merge_queue", - } -} - -// NewCreationRule creates a rule to only allow users with bypass permission to create matching refs. -func NewCreationRule() (rule *RepositoryRule) { - return &RepositoryRule{ - Type: "creation", - } -} - -// NewUpdateRule creates a rule to only allow users with bypass permission to update matching refs. -func NewUpdateRule(params *UpdateAllowsFetchAndMergeRuleParameters) (rule *RepositoryRule) { - if params != nil { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "update", - Parameters: &rawParams, - } - } - return &RepositoryRule{ - Type: "update", - } -} - -// NewDeletionRule creates a rule to only allow users with bypass permissions to delete matching refs. -func NewDeletionRule() (rule *RepositoryRule) { - return &RepositoryRule{ - Type: "deletion", - } -} - -// NewRequiredLinearHistoryRule creates a rule to prevent merge commits from being pushed to matching branches. -func NewRequiredLinearHistoryRule() (rule *RepositoryRule) { - return &RepositoryRule{ - Type: "required_linear_history", - } -} - -// NewRequiredDeploymentsRule creates a rule to require environments to be successfully deployed before they can be merged into the matching branches. -func NewRequiredDeploymentsRule(params *RequiredDeploymentEnvironmentsRuleParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "required_deployments", - Parameters: &rawParams, - } -} - -// NewRequiredSignaturesRule creates a rule a to require commits pushed to matching branches to have verified signatures. -func NewRequiredSignaturesRule() (rule *RepositoryRule) { - return &RepositoryRule{ - Type: "required_signatures", - } -} - -// NewPullRequestRule creates a rule to require all commits be made to a non-target branch and submitted via a pull request before they can be merged. -func NewPullRequestRule(params *PullRequestRuleParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "pull_request", - Parameters: &rawParams, - } -} - -// NewRequiredStatusChecksRule creates a rule to require which status checks must pass before branches can be merged into a branch rule. -func NewRequiredStatusChecksRule(params *RequiredStatusChecksRuleParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "required_status_checks", - Parameters: &rawParams, - } -} - -// NewNonFastForwardRule creates a rule as part to prevent users with push access from force pushing to matching branches. -func NewNonFastForwardRule() (rule *RepositoryRule) { - return &RepositoryRule{ - Type: "non_fast_forward", - } -} - -// NewCommitMessagePatternRule creates a rule to restrict commit message patterns being pushed to matching branches. -func NewCommitMessagePatternRule(params *RulePatternParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "commit_message_pattern", - Parameters: &rawParams, - } -} - -// NewCommitAuthorEmailPatternRule creates a rule to restrict commits with author email patterns being merged into matching branches. -func NewCommitAuthorEmailPatternRule(params *RulePatternParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "commit_author_email_pattern", - Parameters: &rawParams, - } -} - -// NewCommitterEmailPatternRule creates a rule to restrict commits with committer email patterns being merged into matching branches. -func NewCommitterEmailPatternRule(params *RulePatternParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "committer_email_pattern", - Parameters: &rawParams, - } -} - -// NewBranchNamePatternRule creates a rule to restrict branch patterns from being merged into matching branches. -func NewBranchNamePatternRule(params *RulePatternParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "branch_name_pattern", - Parameters: &rawParams, - } -} - -// NewTagNamePatternRule creates a rule to restrict tag patterns contained in non-target branches from being merged into matching branches. -func NewTagNamePatternRule(params *RulePatternParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "tag_name_pattern", - Parameters: &rawParams, - } -} - -// NewRequiredWorkflowsRule creates a rule to require which status checks must pass before branches can be merged into a branch rule. -func NewRequiredWorkflowsRule(params *RequiredWorkflowsRuleParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "workflows", - Parameters: &rawParams, - } -} - -// NewRequiredCodeScanningRule creates a rule to require which tools must provide code scanning results before the reference is updated. -func NewRequiredCodeScanningRule(params *RequiredCodeScanningRuleParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "code_scanning", - Parameters: &rawParams, - } -} - -// NewFilePathRestrictionRule creates a rule to restrict file paths from being pushed to. -func NewFilePathRestrictionRule(params *RuleFileParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "file_path_restriction", - Parameters: &rawParams, - } -} - -// NewMaxFilePathLengthRule creates a rule to restrict file paths longer than the limit from being pushed. -func NewMaxFilePathLengthRule(params *RuleMaxFilePathLengthParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "max_file_path_length", - Parameters: &rawParams, - } -} - -// NewFileExtensionRestrictionRule creates a rule to restrict file extensions from being pushed to a commit. -func NewFileExtensionRestrictionRule(params *RuleFileExtensionRestrictionParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "file_extension_restriction", - Parameters: &rawParams, - } -} - -// NewMaxFileSizeRule creates a rule to restrict file sizes from being pushed to a commit. -func NewMaxFileSizeRule(params *RuleMaxFileSizeParameters) (rule *RepositoryRule) { - bytes, _ := json.Marshal(params) - - rawParams := json.RawMessage(bytes) - - return &RepositoryRule{ - Type: "max_file_size", - Parameters: &rawParams, - } -} - -// Ruleset represents a GitHub ruleset object. -type Ruleset struct { - ID *int64 `json:"id,omitempty"` - Name string `json:"name"` - // Possible values for Target are branch, tag, push - Target *string `json:"target,omitempty"` - // Possible values for SourceType are: Repository, Organization - SourceType *string `json:"source_type,omitempty"` - Source string `json:"source"` - // Possible values for Enforcement are: disabled, active, evaluate - Enforcement string `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Links *RulesetLinks `json:"_links,omitempty"` - Conditions *RulesetConditions `json:"conditions,omitempty"` - Rules []*RepositoryRule `json:"rules,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` -} - -// 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"` - // Possible values for Target are branch, tag - Target *string `json:"target,omitempty"` - // Possible values for SourceType are: Repository, Organization - SourceType *string `json:"source_type,omitempty"` - Source string `json:"source"` - // Possible values for Enforcement are: disabled, active, evaluate - Enforcement string `json:"enforcement"` - BypassActors []*BypassActor `json:"bypass_actors"` - NodeID *string `json:"node_id,omitempty"` - Links *RulesetLinks `json:"_links,omitempty"` - Conditions *RulesetConditions `json:"conditions,omitempty"` - Rules []*RepositoryRule `json:"rules,omitempty"` -} - -// GetRulesForBranch gets all the 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) ([]*RepositoryRule, *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 []*RepositoryRule - resp, err := s.client.Do(ctx, req, &rules) - if err != nil { - return nil, resp, err - } - - return rules, resp, nil -} - -// GetAllRulesets gets all the rules that apply to the specified repository. -// If includesParents is true, rulesets configured at the organization 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) ([]*Ruleset, *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 []*Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// CreateRuleset creates a 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, rs *Ruleset) (*Ruleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) - - req, err := s.client.NewRequest("POST", u, rs) - if err != nil { - return nil, nil, err - } - - var ruleset *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// GetRuleset gets a ruleset for the specified repository. -// If includesParents is true, rulesets configured at the organization 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) (*Ruleset, *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 *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateRuleset updates a 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, rs *Ruleset) (*Ruleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - req, err := s.client.NewRequest("PUT", u, rs) - if err != nil { - return nil, nil, err - } - - var ruleset *Ruleset - resp, err := s.client.Do(ctx, req, &ruleset) - if err != nil { - return nil, resp, err - } - - return ruleset, resp, nil -} - -// UpdateRulesetNoBypassActor updates a ruleset for the specified repository. -// -// This function is necessary as the UpdateRuleset function does not marshal ByPassActor if passed as nil or 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) UpdateRulesetNoBypassActor(ctx context.Context, owner, repo string, rulesetID int64, rs *Ruleset) (*Ruleset, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) - - rsNoBypassActor := &rulesetNoOmitBypassActors{} - - if rs != nil { - rsNoBypassActor = &rulesetNoOmitBypassActors{ - ID: rs.ID, - Name: rs.Name, - Target: rs.Target, - SourceType: rs.SourceType, - Source: rs.Source, - Enforcement: rs.Enforcement, - BypassActors: rs.BypassActors, - NodeID: rs.NodeID, - Links: rs.Links, - Conditions: rs.Conditions, - Rules: rs.Rules, - } - } - - req, err := s.client.NewRequest("PUT", u, rsNoBypassActor) - if err != nil { - return nil, nil, err - } - - var ruleSet *Ruleset - resp, err := s.client.Do(ctx, req, &ruleSet) - if err != nil { - return nil, resp, err - } - - return ruleSet, resp, nil -} - -// DeleteRuleset deletes a 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/v67/github/users_projects.go b/vendor/github.com/google/go-github/v67/github/users_projects.go deleted file mode 100644 index 0ab57e5c23..0000000000 --- a/vendor/github.com/google/go-github/v67/github/users_projects.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 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" -) - -// ListProjects lists the projects for the specified user. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#list-user-projects -// -//meta:operation GET /users/{username}/projects -func (s *UsersService) ListProjects(ctx context.Context, user string, opts *ProjectListOptions) ([]*Project, *Response, error) { - u := fmt.Sprintf("users/%v/projects", user) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - var projects []*Project - resp, err := s.client.Do(ctx, req, &projects) - if err != nil { - return nil, resp, err - } - - return projects, resp, nil -} - -// CreateUserProjectOptions specifies the parameters to the UsersService.CreateProject method. -type CreateUserProjectOptions struct { - // The name of the project. (Required.) - Name string `json:"name"` - // The description of the project. (Optional.) - Body *string `json:"body,omitempty"` -} - -// CreateProject creates a GitHub Project for the current user. -// -// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-user-project -// -//meta:operation POST /user/projects -func (s *UsersService) CreateProject(ctx context.Context, opts *CreateUserProjectOptions) (*Project, *Response, error) { - u := "user/projects" - req, err := s.client.NewRequest("POST", u, opts) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeProjectsPreview) - - project := &Project{} - resp, err := s.client.Do(ctx, req, project) - if err != nil { - return nil, resp, err - } - - return project, resp, nil -} diff --git a/vendor/github.com/google/go-github/v67/AUTHORS b/vendor/github.com/google/go-github/v79/AUTHORS similarity index 95% rename from vendor/github.com/google/go-github/v67/AUTHORS rename to vendor/github.com/google/go-github/v79/AUTHORS index bbbdc74b2d..bf789bef05 100644 --- a/vendor/github.com/google/go-github/v67/AUTHORS +++ b/vendor/github.com/google/go-github/v79/AUTHORS @@ -18,7 +18,9 @@ Abhinav Gupta abhishek Abhishek Sharma Abhishek Veeramalla +Abinand P aboy +Adam Guthrie Adam Kohring Aditya Mahendrakar adrienzieba @@ -40,15 +42,18 @@ Alex Su Alex Unger Alexander Harkness Alexey Alekhin +Alexis Couvreur Alexis Gauthiez 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 @@ -109,6 +114,7 @@ Carlos Tadeu Panato Junior Casey ChandanChainani chandresh-pancholi +Changyong Um Charles Fenwick Elliott Charlie Yan Chmouel Boudjnah @@ -125,6 +131,7 @@ Christoph Jerolimov Christoph Sassenberg CI Monk Clemens W +Colby Williams Colin Misare Craig Gumbley Craig Peterson @@ -177,6 +184,7 @@ Erwan Finot erwinvaneyk Evan Anderson Evan Elias +Eyal Kapon Fabian Holler Fabrice Fatema-Moaiyadi @@ -213,6 +221,7 @@ haya14busa haya14busa Henrik Lundström Hiroki Ito +hnkƶ Hubot Jr Huy Tr huydx @@ -238,7 +247,9 @@ James Turley Jamie West Jan Guth Jan Kosecki +Jan Niklas Dittmar Jan Å vábík +Jason Brill Jason Field Javier Campanini Jef LeCompte @@ -263,6 +274,7 @@ Jordan Sussman Jorge Ferrero Jorge Gómez Reus Joshua Bezaleel Abednego +Joshua French João Cerqueira JP Phillips jpbelanger-mtl @@ -320,6 +332,7 @@ Léo Salé M. Ryan Rigdon Magnus Kulke Maksim Zhylinski +Manuel Bergler Marc Binder Marcelo Carlos Mark Tareshawty @@ -348,6 +361,7 @@ Michael Tiller MichaÅ‚ Glapa Michelangelo Morrillo Miguel Elias dos Santos +Mike Ball Mike Chen Miles Crabill Mishin Nikolai @@ -398,6 +412,8 @@ Patrick Marabeas Patrik Nordlén Pavel Dvoinos Pavel Shtanko +Pavlos Tzianos +Pedja Muatovic Pete Wagner Petr Shevtsov Pierce McEntagart @@ -414,6 +430,7 @@ Rackspace US, Inc. Radek Simko RadliÅ„ski Ignacy Rafael Aramizu Gomes +Raisa Kabir Rajat Jindal Rajendra arora Rajkumar @@ -434,12 +451,14 @@ Richard de Vries Rob Figueiredo Rohit Upadhyay Rojan Dinc +Roman Wu Roming22 Ronak Jain Ronan Pelliard Ross Gustafson Ruben Vereecken Rufina Talalaeva +Rupok Ghosh Russell Boley Ryan Leung Ryan Lower @@ -454,6 +473,7 @@ Sam Minnée Sandeep Sukhani Sander Knape Sander van Harmelen +sanjay s Sanket Payghan Sarah Funkhouser Sarasa Kisaragi @@ -461,6 +481,7 @@ Sasha Melentyev Sean Wang Sebastian Mandrean Sebastian Mæland Pedersen +sellskin Sergei Popinevskii Sergey Romanov Sergio Garcia @@ -473,6 +494,7 @@ Shawn Smith Shibasis Patel Sho Okada Shrikrishna Singh +Silas Alberti Simon Davis sona-tar soniachikh @@ -480,6 +502,7 @@ SoundCloud, Ltd. Sridhar Mocherla SriVignessh Pss Stefan Sedich +Steve Hipwell Steve Teuber Stian Eikeland Suhaib Mujahid @@ -498,12 +521,14 @@ Theo Henson Theofilos Petsios Thomas Aidan Curran Thomas Bruyelle +Tim Tim Rogers Timothy O'Brien Timothée Peignier Tingluo Huang tkhandel Tobias Gesellchen +Tom Bamford Tom Payne Tomasz Adam Skrzypczak tomfeigin @@ -518,6 +543,7 @@ Victor Vrantchan Victory Osikwemhe vikkyomkar Vivek +Vivek Kumar Sahu Vlad Ungureanu Wasim Thabraze Weslei Juan Moser Pereira @@ -541,6 +567,7 @@ Yusuke Kuoka Zach Latta Ze Peng zhouhaibing089 +zyfy29 六开箱 缘生 蒋航 diff --git a/vendor/github.com/google/go-github/v67/LICENSE b/vendor/github.com/google/go-github/v79/LICENSE similarity index 100% rename from vendor/github.com/google/go-github/v67/LICENSE rename to vendor/github.com/google/go-github/v79/LICENSE diff --git a/vendor/github.com/google/go-github/v67/github/actions.go b/vendor/github.com/google/go-github/v79/github/actions.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/actions.go rename to vendor/github.com/google/go-github/v79/github/actions.go diff --git a/vendor/github.com/google/go-github/v67/github/actions_artifacts.go b/vendor/github.com/google/go-github/v79/github/actions_artifacts.go similarity index 69% rename from vendor/github.com/google/go-github/v67/github/actions_artifacts.go rename to vendor/github.com/google/go-github/v79/github/actions_artifacts.go index e05a9a8402..4185a15037 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_artifacts.go +++ b/vendor/github.com/google/go-github/v79/github/actions_artifacts.go @@ -29,17 +29,21 @@ type ArtifactWorkflowRun struct { // // GitHub API docs: https://docs.github.com/rest/actions/artifacts 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. @@ -60,6 +64,21 @@ 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,omitempty"` +} + // ListArtifacts lists all artifacts that belong to a repository. // // GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository @@ -142,6 +161,14 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar 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 { + return s.downloadArtifactWithRateLimit(ctx, u, maxRedirects) + } + + return s.downloadArtifactWithoutRateLimit(ctx, u, maxRedirects) +} + +func (s *ActionsService) downloadArtifactWithoutRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err @@ -149,7 +176,7 @@ func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo strin 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")) @@ -160,6 +187,26 @@ func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo strin return parsedURL, newResponse(resp), nil } +func (s *ActionsService) downloadArtifactWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + if err != nil { + return nil, resp, err + } + defer resp.Body.Close() + + // If we didn't receive a valid Location in a 302 response + if url == nil { + return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status) + } + + return url, resp, nil +} + // DeleteArtifact deletes a workflow run artifact. // // GitHub API docs: https://docs.github.com/rest/actions/artifacts#delete-an-artifact diff --git a/vendor/github.com/google/go-github/v67/github/actions_cache.go b/vendor/github.com/google/go-github/v79/github/actions_cache.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/actions_cache.go rename to vendor/github.com/google/go-github/v79/github/actions_cache.go diff --git a/vendor/github.com/google/go-github/v79/github/actions_hosted_runners.go b/vendor/github.com/google/go-github/v79/github/actions_hosted_runners.go new file mode 100644 index 0000000000..207b755fc3 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/actions_hosted_runners.go @@ -0,0 +1,379 @@ +// 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"` + 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + runners := &HostedRunners{} + resp, err := s.client.Do(ctx, req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil +} + +// HostedRunnerImage represents the image of GitHub-hosted runners. +// To list all available images, use GET /actions/hosted-runners/images/github-owned or GET /actions/hosted-runners/images/partner. +type HostedRunnerImage struct { + ID string `json:"id"` + Source string `json:"source"` + Version string `json:"version"` +} + +// HostedRunnerRequest specifies body parameters to Hosted Runner configuration. +type HostedRunnerRequest struct { + Name string `json:"name,omitempty"` + Image HostedRunnerImage `json:"image,omitempty"` + RunnerGroupID int64 `json:"runner_group_id,omitempty"` + Size string `json:"size,omitempty"` + MaximumRunners int64 `json:"maximum_runners,omitempty"` + EnableStaticIP bool `json:"enable_static_ip,omitempty"` + ImageVersion string `json:"image_version,omitempty"` +} + +// validateCreateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure +// that all required fields are properly set and that no invalid fields are present for hosted runner create request. +// +// If any of these conditions are violated, an appropriate error message is returned. +// Otherwise, nil is returned, indicating the request is valid. +func validateCreateHostedRunnerRequest(request *HostedRunnerRequest) error { + if request == nil { + return errors.New("request is required for creating a hosted runner") + } + if request.Size == "" { + return errors.New("size is required for creating a hosted runner") + } + if request.Image == (HostedRunnerImage{}) { + return errors.New("image is required for creating a hosted runner") + } + if request.Name == "" { + return errors.New("name is required for creating a hosted runner") + } + if request.RunnerGroupID == 0 { + return errors.New("runner group ID is required for creating a hosted runner") + } + if request.ImageVersion != "" { + return errors.New("imageVersion should not be set directly; use the Image struct to specify image details") + } + return nil +} + +// CreateHostedRunner creates a GitHub-hosted runner for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#create-a-github-hosted-runner-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/hosted-runners +func (s *ActionsService) CreateHostedRunner(ctx context.Context, org string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(request); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/actions/hosted-runners", org) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, req, hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunnerImages := new(HostedRunnerImages) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunnerImages := new(HostedRunnerImages) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + publicIPLimits := new(HostedRunnerPublicIPLimits) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + machineSpecs := new(HostedRunnerMachineSpecs) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + platforms := new(HostedRunnerPlatforms) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, req, hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} + +// validateUpdateHostedRunnerRequest validates the provided HostedRunnerRequest to ensure +// that no disallowed updates are made for a hosted runner update request. +// +// If any of these conditions are violated, an appropriate error message is returned. +// Otherwise, nil is returned, indicating the request is valid for an update. +func validateUpdateHostedRunnerRequest(request *HostedRunnerRequest) error { + if request.Size != "" { + return errors.New("size cannot be updated, API does not support updating size") + } + if request.Image != (HostedRunnerImage{}) { + return errors.New("image struct should not be set directly; use the ImageVersion to specify version details") + } + return nil +} + +// UpdateHostedRunner updates a GitHub-hosted runner for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/hosted-runners#update-a-github-hosted-runner-for-an-organization +// +//meta:operation PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id} +func (s *ActionsService) UpdateHostedRunner(ctx context.Context, org string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/actions/hosted-runners/%v", org, runnerID) + req, err := s.client.NewRequest("PATCH", u, updateReq) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, 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#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("DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, req, hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/actions_oidc.go b/vendor/github.com/google/go-github/v79/github/actions_oidc.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/actions_oidc.go rename to vendor/github.com/google/go-github/v79/github/actions_oidc.go diff --git a/vendor/github.com/google/go-github/v67/github/actions_permissions_enterprise.go b/vendor/github.com/google/go-github/v79/github/actions_permissions_enterprise.go similarity index 53% rename from vendor/github.com/google/go-github/v67/github/actions_permissions_enterprise.go rename to vendor/github.com/google/go-github/v79/github/actions_permissions_enterprise.go index a6a85aa32a..326230d649 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_permissions_enterprise.go +++ b/vendor/github.com/google/go-github/v79/github/actions_permissions_enterprise.go @@ -37,6 +37,15 @@ type DefaultWorkflowPermissionEnterprise struct { 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,omitempty"` +} + +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#get-github-actions-permissions-for-an-enterprise @@ -59,12 +68,12 @@ func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, return permissions, resp, nil } -// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. +// UpdateActionsPermissionsInEnterprise sets the permissions policy in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions -func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { +func (s *ActionsService) UpdateActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) if err != nil { @@ -193,12 +202,12 @@ func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, ente return actionsAllowed, resp, nil } -// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. +// UpdateActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions -func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *ActionsService) UpdateActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsAllowed) if err != nil { @@ -236,12 +245,12 @@ func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.C return permissions, resp, nil } -// EditDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. +// UpdateDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise // //meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow -func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) req, err := s.client.NewRequest("PUT", u, permissions) if err != nil { @@ -256,3 +265,150 @@ func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context. 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + arp := new(ArtifactPeriod) + resp, err := s.client.Do(ctx, 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#set-artifact-and-log-retention-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInEnterprise(ctx context.Context, enterprise string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/artifact-and-log-retention", enterprise) + req, err := s.client.NewRequest("PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(SelfHostRunnerPermissionsEnterprise) + resp, err := s.client.Do(ctx, 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#set-self-hosted-runners-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnerPermissionsInEnterprise(ctx context.Context, enterprise string, permissions SelfHostRunnerPermissionsEnterprise) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/self-hosted-runners", enterprise) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, 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#set-private-repo-fork-pr-workflow-settings-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInEnterprise(ctx context.Context, enterprise string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-workflows-private-repos", enterprise) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// GetEnterpriseForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateEnterpriseForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-fork-pr-contributor-approval-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateEnterpriseForkPRContributorApprovalPermissions(ctx context.Context, enterprise string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/fork-pr-contributor-approval", enterprise) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v79/github/actions_permissions_orgs.go b/vendor/github.com/google/go-github/v79/github/actions_permissions_orgs.go new file mode 100644 index 0000000000..626e399830 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/actions_permissions_orgs.go @@ -0,0 +1,523 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsPermissions represents a policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions +type ActionsPermissions struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` +} + +func (a ActionsPermissions) String() string { + return Stringify(a) +} + +// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. +type ActionsEnabledOnOrgRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ActionsAllowed represents selected actions that are allowed. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions +type ActionsAllowed struct { + GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` + VerifiedAllowed *bool `json:"verified_allowed,omitempty"` + PatternsAllowed []string `json:"patterns_allowed,omitempty"` +} + +func (a ActionsAllowed) String() string { + return Stringify(a) +} + +// 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"` +} + +// 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,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 +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions +func (s *ActionsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + req, err := s.client.NewRequest("PUT", u, actionsPermissions) + if err != nil { + 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 +} + +// UpdateActionsAllowed sets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions +func (s *ActionsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + req, err := s.client.NewRequest("PUT", u, actionsAllowed) + if err != nil { + 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 +} + +// UpdateDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) UpdateDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + 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 +} + +// GetArtifactAndLogRetentionPeriodInOrganization gets the artifact and log retention period for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + arp := new(ArtifactPeriod) + resp, err := s.client.Do(ctx, 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#set-artifact-and-log-retention-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/artifact-and-log-retention +func (s *ActionsService) UpdateArtifactAndLogRetentionPeriodInOrganization(ctx context.Context, org string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/artifact-and-log-retention", org) + req, err := s.client.NewRequest("PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + settings := new(SelfHostedRunnersSettingsOrganization) + resp, err := s.client.Do(ctx, 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#set-self-hosted-runners-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/self-hosted-runners +func (s *ActionsService) UpdateSelfHostedRunnersSettingsInOrganization(ctx context.Context, org string, opt SelfHostedRunnersSettingsOrganizationOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/self-hosted-runners", org) + + req, err := s.client.NewRequest("PUT", u, opt) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + settings := new(SelfHostedRunnersAllowedRepos) + resp, err := s.client.Do(ctx, 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#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("PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("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 +} + +// 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, 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#set-private-repo-fork-pr-workflow-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-workflows-private-repos +func (s *ActionsService) UpdatePrivateRepoForkPRWorkflowSettingsInOrganization(ctx context.Context, org string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-workflows-private-repos", org) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// GetOrganizationForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateOrganizationForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-fork-pr-contributor-approval-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateOrganizationForkPRContributorApprovalPermissions(ctx context.Context, org string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/fork-pr-contributor-approval", org) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v67/github/actions_runner_groups.go b/vendor/github.com/google/go-github/v79/github/actions_runner_groups.go similarity index 97% rename from vendor/github.com/google/go-github/v67/github/actions_runner_groups.go rename to vendor/github.com/google/go-github/v79/github/actions_runner_groups.go index b2ee32f614..dc54a84853 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_runner_groups.go +++ b/vendor/github.com/google/go-github/v79/github/actions_runner_groups.go @@ -18,6 +18,8 @@ type RunnerGroup struct { Default *bool `json:"default,omitempty"` SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` RunnersURL *string `json:"runners_url,omitempty"` + HostedRunnersURL *string `json:"hosted_runners_url,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` Inherited *bool `json:"inherited,omitempty"` AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` @@ -45,6 +47,8 @@ type CreateRunnerGroupRequest struct { RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. SelectedWorkflows []string `json:"selected_workflows,omitempty"` + // The identifier of a hosted compute network configuration. + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // UpdateRunnerGroupRequest represents a request to update a Runner group for an organization. @@ -54,6 +58,7 @@ type UpdateRunnerGroupRequest struct { AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` SelectedWorkflows []string `json:"selected_workflows,omitempty"` + NetworkConfigurationID *string `json:"network_configuration_id,omitempty"` } // SetRepoAccessRunnerGroupRequest represents a request to replace the list of repositories diff --git a/vendor/github.com/google/go-github/v67/github/actions_runners.go b/vendor/github.com/google/go-github/v79/github/actions_runners.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/actions_runners.go rename to vendor/github.com/google/go-github/v79/github/actions_runners.go diff --git a/vendor/github.com/google/go-github/v67/github/actions_secrets.go b/vendor/github.com/google/go-github/v79/github/actions_secrets.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/actions_secrets.go rename to vendor/github.com/google/go-github/v79/github/actions_secrets.go index ec519838ea..f03d3fd191 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_secrets.go +++ b/vendor/github.com/google/go-github/v79/github/actions_secrets.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" "strconv" ) @@ -23,8 +24,8 @@ type PublicKey struct { // 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"` + KeyID any `json:"key_id"` + Key *string `json:"key"` } if err := json.Unmarshal(data, &pk); err != nil { @@ -39,7 +40,7 @@ func (p *PublicKey) UnmarshalJSON(data []byte) error { case string: p.KeyID = &v case float64: - p.KeyID = String(strconv.FormatFloat(v, 'f', -1, 64)) + p.KeyID = Ptr(strconv.FormatFloat(v, 'f', -1, 64)) default: return fmt.Errorf("unable to unmarshal %T as a string", v) } @@ -246,6 +247,10 @@ func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *Enc // //meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) } @@ -256,6 +261,10 @@ func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, re // //meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) return s.putSecret(ctx, url, eSecret) } @@ -266,6 +275,10 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // //meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) return s.putSecret(ctx, url, eSecret) } @@ -383,6 +396,10 @@ func (s *ActionsService) addSelectedRepoToSecret(ctx context.Context, url string // //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) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, url) } @@ -402,6 +419,10 @@ func (s *ActionsService) removeSelectedRepoFromSecret(ctx context.Context, url s // //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) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + 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/v67/github/actions_variables.go b/vendor/github.com/google/go-github/v79/github/actions_variables.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/actions_variables.go rename to vendor/github.com/google/go-github/v79/github/actions_variables.go index bca46b6df6..b192ba703e 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_variables.go +++ b/vendor/github.com/google/go-github/v79/github/actions_variables.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -186,6 +187,10 @@ func (s *ActionsService) patchVariable(ctx context.Context, url string, variable // //meta:operation PATCH /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, variable.Name) return s.patchVariable(ctx, url, variable) } @@ -196,6 +201,10 @@ func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo str // //meta:operation PATCH /orgs/{org}/actions/variables/{name} func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, variable.Name) return s.patchVariable(ctx, url, variable) } @@ -206,6 +215,10 @@ func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, vari // //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) { + if variable == nil { + return nil, errors.New("variable must be provided") + } + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name) return s.patchVariable(ctx, url, variable) } @@ -317,6 +330,13 @@ func (s *ActionsService) addSelectedRepoToVariable(ctx context.Context, url stri // //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") + } + url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToVariable(ctx, url) } @@ -336,6 +356,13 @@ func (s *ActionsService) removeSelectedRepoFromVariable(ctx context.Context, url // //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") + } + 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/v67/github/actions_workflow_jobs.go b/vendor/github.com/google/go-github/v79/github/actions_workflow_jobs.go similarity index 84% rename from vendor/github.com/google/go-github/v67/github/actions_workflow_jobs.go rename to vendor/github.com/google/go-github/v79/github/actions_workflow_jobs.go index 84bbe5aa46..dabc809170 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_workflow_jobs.go +++ b/vendor/github.com/google/go-github/v79/github/actions_workflow_jobs.go @@ -74,7 +74,7 @@ type ListWorkflowJobsOptions struct { // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/jobs", owner, repo, runID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -100,7 +100,7 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // //meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, repo string, runID, attemptNumber int64, opts *ListOptions) (*Jobs, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) + u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -150,6 +150,14 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str 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 { + return s.getWorkflowJobLogsWithRateLimit(ctx, u, maxRedirects) + } + + return s.getWorkflowJobLogsWithoutRateLimit(ctx, u, maxRedirects) +} + +func (s *ActionsService) getWorkflowJobLogsWithoutRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err @@ -157,9 +165,29 @@ func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo str 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")) return parsedURL, newResponse(resp), err } + +func (s *ActionsService) getWorkflowJobLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + if err != nil { + return nil, resp, err + } + defer resp.Body.Close() + + // If we didn't receive a valid Location in a 302 response + if url == nil { + return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status) + } + + return url, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v79/github/actions_workflow_runs.go similarity index 80% rename from vendor/github.com/google/go-github/v67/github/actions_workflow_runs.go rename to vendor/github.com/google/go-github/v79/github/actions_workflow_runs.go index 122ea1d0e2..7b13a23ef4 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v79/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"` @@ -163,7 +164,7 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowID) return s.listWorkflowRuns(ctx, u, opts) } @@ -173,7 +174,7 @@ func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo s // //meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName) + u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/runs", owner, repo, workflowFileName) return s.listWorkflowRuns(ctx, u, opts) } @@ -183,7 +184,7 @@ func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, // //meta:operation GET /repos/{owner}/{repo}/actions/runs func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo) + u := fmt.Sprintf("repos/%v/%v/actions/runs", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -204,6 +205,7 @@ 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 // @@ -226,6 +228,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 // @@ -252,13 +255,22 @@ 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 // //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 { + return s.getWorkflowRunAttemptLogsWithRateLimit(ctx, u, maxRedirects) + } + + return s.getWorkflowRunAttemptLogsWithoutRateLimit(ctx, u, maxRedirects) +} + +func (s *ActionsService) getWorkflowRunAttemptLogsWithoutRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err @@ -266,14 +278,35 @@ func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, r 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")) return parsedURL, newResponse(resp), err } +func (s *ActionsService) getWorkflowRunAttemptLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + if err != nil { + return nil, resp, err + } + defer resp.Body.Close() + + // If we didn't receive a valid Location in a 302 response + if url == nil { + return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status) + } + + return url, resp, nil +} + // RerunWorkflowByID re-runs a workflow by ID. +// 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 // @@ -290,6 +323,7 @@ func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo stri } // 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 // @@ -307,6 +341,8 @@ func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo st // 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 // //meta:operation POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun @@ -322,6 +358,7 @@ func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, j } // 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 // @@ -338,6 +375,7 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo } // 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 // @@ -345,6 +383,14 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo 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 { + return s.getWorkflowRunLogsWithRateLimit(ctx, u, maxRedirects) + } + + return s.getWorkflowRunLogsWithoutRateLimit(ctx, u, maxRedirects) +} + +func (s *ActionsService) getWorkflowRunLogsWithoutRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err @@ -352,14 +398,35 @@ func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo str 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")) return parsedURL, newResponse(resp), err } +func (s *ActionsService) getWorkflowRunLogsWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + if err != nil { + return nil, resp, err + } + defer resp.Body.Close() + + // If we didn't receive a valid Location in a 302 response + if url == nil { + return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status) + } + + return url, resp, nil +} + // 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 // @@ -376,6 +443,7 @@ func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo stri } // 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 // @@ -392,6 +460,7 @@ func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo } // 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 // @@ -414,6 +483,7 @@ 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 // @@ -436,6 +506,7 @@ 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 // @@ -458,6 +529,7 @@ 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 // diff --git a/vendor/github.com/google/go-github/v67/github/actions_workflows.go b/vendor/github.com/google/go-github/v79/github/actions_workflows.go similarity index 86% rename from vendor/github.com/google/go-github/v67/github/actions_workflows.go rename to vendor/github.com/google/go-github/v79/github/actions_workflows.go index 0214e6abff..e0bcde3511 100644 --- a/vendor/github.com/google/go-github/v67/github/actions_workflows.go +++ b/vendor/github.com/google/go-github/v79/github/actions_workflows.go @@ -53,7 +53,37 @@ type CreateWorkflowDispatchEventRequest struct { // Inputs represents input keys and values configured in the workflow file. // The maximum number of properties is 10. // 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"` +} + +// 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. @@ -62,7 +92,7 @@ type CreateWorkflowDispatchEventRequest struct { // //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 diff --git a/vendor/github.com/google/go-github/v67/github/activity.go b/vendor/github.com/google/go-github/v79/github/activity.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/activity.go rename to vendor/github.com/google/go-github/v79/github/activity.go diff --git a/vendor/github.com/google/go-github/v67/github/activity_events.go b/vendor/github.com/google/go-github/v79/github/activity_events.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/activity_events.go rename to vendor/github.com/google/go-github/v79/github/activity_events.go diff --git a/vendor/github.com/google/go-github/v67/github/activity_notifications.go b/vendor/github.com/google/go-github/v79/github/activity_notifications.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/activity_notifications.go rename to vendor/github.com/google/go-github/v79/github/activity_notifications.go diff --git a/vendor/github.com/google/go-github/v67/github/activity_star.go b/vendor/github.com/google/go-github/v79/github/activity_star.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/activity_star.go rename to vendor/github.com/google/go-github/v79/github/activity_star.go index cebdacf76a..bc68dfef2d 100644 --- a/vendor/github.com/google/go-github/v67/github/activity_star.go +++ b/vendor/github.com/google/go-github/v79/github/activity_star.go @@ -29,7 +29,7 @@ type Stargazer struct { // //meta:operation GET /repos/{owner}/{repo}/stargazers func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/stargazers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -40,8 +40,7 @@ func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string 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) @@ -60,7 +59,7 @@ type ActivityListStarredOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort repositories. Possible values are: asc, desc. - // Default is "asc" when sort is "full_name", otherwise default is "desc". + // Default is "asc" when sort is "full_name"; otherwise, default is "desc". Direction string `url:"direction,omitempty"` ListOptions @@ -91,8 +90,7 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac 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 diff --git a/vendor/github.com/google/go-github/v67/github/activity_watching.go b/vendor/github.com/google/go-github/v79/github/activity_watching.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/activity_watching.go rename to vendor/github.com/google/go-github/v79/github/activity_watching.go index 348590057b..6142917786 100644 --- a/vendor/github.com/google/go-github/v67/github/activity_watching.go +++ b/vendor/github.com/google/go-github/v79/github/activity_watching.go @@ -31,7 +31,7 @@ type Subscription struct { // //meta:operation GET /repos/{owner}/{repo}/subscribers func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscribers", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -93,7 +93,7 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // //meta:operation GET /repos/{owner}/{repo}/subscription func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -122,7 +122,7 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // //meta:operation PUT /repos/{owner}/{repo}/subscription func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("PUT", u, subscription) if err != nil { @@ -148,7 +148,7 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // //meta:operation DELETE /repos/{owner}/{repo}/subscription func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) + u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/admin.go b/vendor/github.com/google/go-github/v79/github/admin.go similarity index 97% rename from vendor/github.com/google/go-github/v67/github/admin.go rename to vendor/github.com/google/go-github/v79/github/admin.go index adf55d6414..6a7cf91813 100644 --- a/vendor/github.com/google/go-github/v67/github/admin.go +++ b/vendor/github.com/google/go-github/v79/github/admin.go @@ -82,7 +82,7 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { @@ -103,7 +103,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team // //meta:operation PATCH /admin/ldap/teams/{team_id}/mapping func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { diff --git a/vendor/github.com/google/go-github/v67/github/admin_orgs.go b/vendor/github.com/google/go-github/v79/github/admin_orgs.go similarity index 88% rename from vendor/github.com/google/go-github/v67/github/admin_orgs.go rename to vendor/github.com/google/go-github/v79/github/admin_orgs.go index 8b50756b0d..f360a01f0e 100644 --- a/vendor/github.com/google/go-github/v67/github/admin_orgs.go +++ b/vendor/github.com/google/go-github/v79/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.18/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) { @@ -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.18/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.18/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { diff --git a/vendor/github.com/google/go-github/v67/github/admin_stats.go b/vendor/github.com/google/go-github/v79/github/admin_stats.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/admin_stats.go rename to vendor/github.com/google/go-github/v79/github/admin_stats.go index f012d7984c..e2a8d9fd40 100644 --- a/vendor/github.com/google/go-github/v67/github/admin_stats.go +++ b/vendor/github.com/google/go-github/v79/github/admin_stats.go @@ -118,13 +118,13 @@ func (s GistStats) String() string { return Stringify(s) } -// PullStats represents the number of total, merged, mergable and unmergeable +// PullStats represents the number of total, merged, mergeable and unmergeable // pull-requests. type PullStats struct { - TotalPulls *int `json:"total_pulls,omitempty"` - MergedPulls *int `json:"merged_pulls,omitempty"` - MergablePulls *int `json:"mergeable_pulls,omitempty"` - UnmergablePulls *int `json:"unmergeable_pulls,omitempty"` + TotalPulls *int `json:"total_pulls,omitempty"` + MergedPulls *int `json:"merged_pulls,omitempty"` + MergeablePulls *int `json:"mergeable_pulls,omitempty"` + UnmergeablePulls *int `json:"unmergeable_pulls,omitempty"` } func (s PullStats) String() string { @@ -152,7 +152,7 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { diff --git a/vendor/github.com/google/go-github/v67/github/admin_users.go b/vendor/github.com/google/go-github/v79/github/admin_users.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/admin_users.go rename to vendor/github.com/google/go-github/v79/github/admin_users.go index 6877cef460..86166f7e92 100644 --- a/vendor/github.com/google/go-github/v67/github/admin_users.go +++ b/vendor/github.com/google/go-github/v79/github/admin_users.go @@ -20,7 +20,7 @@ type CreateUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { @@ -42,7 +42,7 @@ func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { @@ -95,11 +95,11 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("POST", u, opts) if err != nil { @@ -117,11 +117,11 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { - u := fmt.Sprintf("admin/users/%s/authorizations", username) + u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/apps.go b/vendor/github.com/google/go-github/v79/github/apps.go similarity index 89% rename from vendor/github.com/google/go-github/v67/github/apps.go rename to vendor/github.com/google/go-github/v79/github/apps.go index 4757dedfaa..e1bede6471 100644 --- a/vendor/github.com/google/go-github/v67/github/apps.go +++ b/vendor/github.com/google/go-github/v79/github/apps.go @@ -56,6 +56,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. @@ -80,29 +82,47 @@ type InstallationPermissions struct { Actions *string `json:"actions,omitempty"` ActionsVariables *string `json:"actions_variables,omitempty"` Administration *string `json:"administration,omitempty"` + Attestations *string `json:"attestations,omitempty"` Blocking *string `json:"blocking,omitempty"` Checks *string `json:"checks,omitempty"` Codespaces *string `json:"codespaces,omitempty"` CodespacesLifecycleAdmin *string `json:"codespaces_lifecycle_admin,omitempty"` CodespacesMetadata *string `json:"codespaces_metadata,omitempty"` CodespacesSecrets *string `json:"codespaces_secrets,omitempty"` + CodespacesUserSecrets *string `json:"codespaces_user_secrets,omitempty"` Contents *string `json:"contents,omitempty"` ContentReferences *string `json:"content_references,omitempty"` + CopilotMessages *string `json:"copilot_messages,omitempty"` DependabotSecrets *string `json:"dependabot_secrets,omitempty"` Deployments *string `json:"deployments,omitempty"` Discussions *string `json:"discussions,omitempty"` Emails *string `json:"emails,omitempty"` Environments *string `json:"environments,omitempty"` Followers *string `json:"followers,omitempty"` + Gists *string `json:"gists,omitempty"` + GitSigningSSHPublicKeys *string `json:"git_signing_ssh_public_keys,omitempty"` + GPGKeys *string `json:"gpg_keys,omitempty"` + InteractionLimits *string `json:"interaction_limits,omitempty"` Issues *string `json:"issues,omitempty"` + Keys *string `json:"keys,omitempty"` Metadata *string `json:"metadata,omitempty"` Members *string `json:"members,omitempty"` MergeQueues *string `json:"merge_queues,omitempty"` + OrganizationActionsVariables *string `json:"organization_actions_variables,omitempty"` OrganizationAdministration *string `json:"organization_administration,omitempty"` + OrganizationAnnouncementBanners *string `json:"organization_announcement_banners,omitempty"` + OrganizationAPIInsights *string `json:"organization_api_insights,omitempty"` + OrganizationCodespaces *string `json:"organization_codespaces,omitempty"` + OrganizationCodespacesSecrets *string `json:"organization_codespaces_secrets,omitempty"` + OrganizationCodespacesSettings *string `json:"organization_codespaces_settings,omitempty"` + OrganizationCopilotSeatManagement *string `json:"organization_copilot_seat_management,omitempty"` OrganizationCustomProperties *string `json:"organization_custom_properties,omitempty"` OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"` OrganizationCustomOrgRoles *string `json:"organization_custom_org_roles,omitempty"` + OrganizationDependabotSecrets *string `json:"organization_dependabot_secrets,omitempty"` + OrganizationEvents *string `json:"organization_events,omitempty"` OrganizationHooks *string `json:"organization_hooks,omitempty"` + OrganizationKnowledgeBases *string `json:"organization_knowledge_bases,omitempty"` OrganizationPackages *string `json:"organization_packages,omitempty"` OrganizationPersonalAccessTokens *string `json:"organization_personal_access_tokens,omitempty"` OrganizationPersonalAccessTokenRequests *string `json:"organization_personal_access_token_requests,omitempty"` @@ -114,6 +134,8 @@ type InstallationPermissions struct { OrganizationUserBlocking *string `json:"organization_user_blocking,omitempty"` Packages *string `json:"packages,omitempty"` Pages *string `json:"pages,omitempty"` + Plan *string `json:"plan,omitempty"` + Profile *string `json:"profile,omitempty"` PullRequests *string `json:"pull_requests,omitempty"` RepositoryAdvisories *string `json:"repository_advisories,omitempty"` RepositoryCustomProperties *string `json:"repository_custom_properties,omitempty"` @@ -124,9 +146,12 @@ type InstallationPermissions struct { SecretScanningAlerts *string `json:"secret_scanning_alerts,omitempty"` SecurityEvents *string `json:"security_events,omitempty"` SingleFile *string `json:"single_file,omitempty"` + Starring *string `json:"starring,omitempty"` Statuses *string `json:"statuses,omitempty"` TeamDiscussions *string `json:"team_discussions,omitempty"` + UserEvents *string `json:"user_events,omitempty"` VulnerabilityAlerts *string `json:"vulnerability_alerts,omitempty"` + Watching *string `json:"watching,omitempty"` Workflows *string `json:"workflows,omitempty"` } @@ -143,6 +168,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"` @@ -402,13 +428,12 @@ func (s *AppsService) CreateInstallationTokenListRepos(ctx context.Context, id i //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: String(title), Body: String(body)} + payload := &Attachment{Title: Ptr(title), Body: Ptr(body)} req, err := s.client.NewRequest("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{} @@ -444,7 +469,7 @@ func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, rep // //meta:operation GET /repositories/{repository_id}/installation func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { - return s.getInstallation(ctx, fmt.Sprintf("repositories/%d/installation", id)) + return s.getInstallation(ctx, fmt.Sprintf("repositories/%v/installation", id)) } // FindUserInstallation finds the user's installation information. diff --git a/vendor/github.com/google/go-github/v67/github/apps_hooks.go b/vendor/github.com/google/go-github/v79/github/apps_hooks.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/apps_hooks.go rename to vendor/github.com/google/go-github/v79/github/apps_hooks.go diff --git a/vendor/github.com/google/go-github/v67/github/apps_hooks_deliveries.go b/vendor/github.com/google/go-github/v79/github/apps_hooks_deliveries.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/apps_hooks_deliveries.go rename to vendor/github.com/google/go-github/v79/github/apps_hooks_deliveries.go diff --git a/vendor/github.com/google/go-github/v67/github/apps_installation.go b/vendor/github.com/google/go-github/v79/github/apps_installation.go similarity index 87% rename from vendor/github.com/google/go-github/v67/github/apps_installation.go rename to vendor/github.com/google/go-github/v79/github/apps_installation.go index d430511d07..57d6b4e76e 100644 --- a/vendor/github.com/google/go-github/v67/github/apps_installation.go +++ b/vendor/github.com/google/go-github/v79/github/apps_installation.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "strings" ) // ListRepositories represents the response from the list repos endpoints. @@ -33,14 +32,6 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe 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) @@ -69,14 +60,6 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt 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) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/apps_manifest.go b/vendor/github.com/google/go-github/v79/github/apps_manifest.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/apps_manifest.go rename to vendor/github.com/google/go-github/v79/github/apps_manifest.go index 5b6ff9af41..fdd8d7b1e7 100644 --- a/vendor/github.com/google/go-github/v67/github/apps_manifest.go +++ b/vendor/github.com/google/go-github/v79/github/apps_manifest.go @@ -35,7 +35,7 @@ type AppConfig struct { // //meta:operation POST /app-manifests/{code}/conversions func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { - u := fmt.Sprintf("app-manifests/%s/conversions", code) + u := fmt.Sprintf("app-manifests/%v/conversions", code) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v67/github/apps_marketplace.go b/vendor/github.com/google/go-github/v79/github/apps_marketplace.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/apps_marketplace.go rename to vendor/github.com/google/go-github/v79/github/apps_marketplace.go diff --git a/vendor/github.com/google/go-github/v67/github/attestations.go b/vendor/github.com/google/go-github/v79/github/attestations.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/attestations.go rename to vendor/github.com/google/go-github/v79/github/attestations.go diff --git a/vendor/github.com/google/go-github/v67/github/authorizations.go b/vendor/github.com/google/go-github/v79/github/authorizations.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/authorizations.go rename to vendor/github.com/google/go-github/v79/github/authorizations.go index 8b8a67d552..52f19c0f75 100644 --- a/vendor/github.com/google/go-github/v67/github/authorizations.go +++ b/vendor/github.com/google/go-github/v79/github/authorizations.go @@ -257,7 +257,7 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { @@ -279,7 +279,7 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v79/github/billing.go b/vendor/github.com/google/go-github/v79/github/billing.go new file mode 100644 index 0000000000..bb6f8ec49e --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/billing.go @@ -0,0 +1,398 @@ +// Copyright 2021 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// BillingService provides access to the billing related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/billing +type BillingService service + +// MinutesUsedBreakdown counts the actions minutes used by machine type (e.g. UBUNTU, WINDOWS, MACOS). +type MinutesUsedBreakdown = map[string]int + +// PackagesBilling represents billing of GitHub Packages . +type PackagesBilling struct { + TotalGigabytesBandwidthUsed int `json:"total_gigabytes_bandwidth_used"` + TotalPaidGigabytesBandwidthUsed int `json:"total_paid_gigabytes_bandwidth_used"` + IncludedGigabytesBandwidth int `json:"included_gigabytes_bandwidth"` +} + +// StorageBilling represents a GitHub Storage billing. +type StorageBilling struct { + DaysLeftInBillingCycle int `json:"days_left_in_billing_cycle"` + EstimatedPaidStorageForMonth int `json:"estimated_paid_storage_for_month"` + EstimatedStorageForMonth int `json:"estimated_storage_for_month"` +} + +// ActiveCommittersListOptions specifies optional parameters to the +// BillingService.GetAdvancedSecurityActiveCommittersOrg method. +type ActiveCommittersListOptions struct { + // The security product to get GitHub Advanced Security active committers for. For standalone + // Code Scanning or Secret Protection products, this parameter is required to specify which + // product you want committer information for. For other plans this parameter cannot be used. + // + // Can be one of: "code_security", "secret_protection". + AdvancedSecurityProduct *string `url:"advanced_security_product,omitempty"` + + ListOptions +} + +// ActiveCommitters represents the total active committers across all repositories in an Organization. +type ActiveCommitters struct { + TotalAdvancedSecurityCommitters *int `json:"total_advanced_security_committers,omitempty"` + TotalCount *int `json:"total_count,omitempty"` + MaximumAdvancedSecurityCommitters *int `json:"maximum_advanced_security_committers,omitempty"` + PurchasedAdvancedSecurityCommitters *int `json:"purchased_advanced_security_committers,omitempty"` + Repositories []*RepositoryActiveCommitters `json:"repositories"` +} + +// RepositoryActiveCommitters represents active committers on each repository. +type RepositoryActiveCommitters struct { + Name string `json:"name"` + AdvancedSecurityCommitters int `json:"advanced_security_committers"` + AdvancedSecurityCommittersBreakdown []*AdvancedSecurityCommittersBreakdown `json:"advanced_security_committers_breakdown"` +} + +// AdvancedSecurityCommittersBreakdown represents the user activity breakdown for ActiveCommitters. +type AdvancedSecurityCommittersBreakdown struct { + UserLogin string `json:"user_login"` + LastPushedDate string `json:"last_pushed_date"` + LastPushedEmail string `json:"last_pushed_email"` +} + +// UsageReportOptions specifies optional parameters for the enhanced billing platform usage report. +type UsageReportOptions struct { + // If specified, only return results for a single year. The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. The value of month is an integer between 1 and 12. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // If specified, only return results for a single hour. The value of hour is an integer between 0 and 23. + // If no year, month, or day is specified, the default year, month, and day are used. + Hour *int `url:"hour,omitempty"` +} + +// PremiumRequestUsageReportOptions specifies optional parameters +// for the enhanced billing platform premium request usage report. +type PremiumRequestUsageReportOptions struct { + // If specified, only return results for a single year. + // The value of year is an integer with four digits representing a year. For example, 2025. + // Default value is the current year. + Year *int `url:"year,omitempty"` + + // If specified, only return results for a single month. + // The value of month is an integer between 1 and 12. Default value is the current month. + // If no year is specified the default year is used. + Month *int `url:"month,omitempty"` + + // If specified, only return results for a single day. + // The value of day is an integer between 1 and 31. + // If no year or month is specified, the default year and month are used. + Day *int `url:"day,omitempty"` + + // The user name to query usage for. The name is not case-sensitive. + User *string `url:"user,omitempty"` + + // The model name to query usage for. The name is not case-sensitive. + Model *string `url:"model,omitempty"` + + // The product name to query usage for. The name is not case-sensitive. + Product *string `url:"product,omitempty"` +} + +// UsageItem represents a single usage item in the enhanced billing platform report. +type UsageItem struct { + Date string `json:"date"` + Product string `json:"product"` + SKU string `json:"sku"` + Quantity int `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 int `json:"grossQuantity"` + GrossAmount float64 `json:"grossAmount"` + DiscountQuantity int `json:"discountQuantity"` + DiscountAmount float64 `json:"discountAmount"` + NetQuantity int `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. +// +// 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) GetOrganizationPackagesBilling(ctx context.Context, org string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(PackagesBilling) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for an Org. +// +// 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) GetOrganizationStorageBilling(ctx context.Context, org string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(StorageBilling) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetOrganizationAdvancedSecurityActiveCommitters returns the GitHub Advanced Security active committers for an organization per repository. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/advanced-security +func (s *BillingService) GetOrganizationAdvancedSecurityActiveCommitters(ctx context.Context, org string, opts *ActiveCommittersListOptions) (*ActiveCommitters, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + result := new(ActiveCommitters) + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetPackagesBilling returns the free and paid storage used for GitHub Packages in gigabytes for a user. +// +// 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) GetPackagesBilling(ctx context.Context, user string) (*PackagesBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/packages", user) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + packagesUserBilling := new(PackagesBilling) + resp, err := s.client.Do(ctx, req, packagesUserBilling) + if err != nil { + return nil, resp, err + } + + return packagesUserBilling, resp, nil +} + +// GetStorageBilling returns the estimated paid and estimated total storage used for GitHub Actions +// and GitHub Packages in gigabytes for a user. +// +// 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) GetStorageBilling(ctx context.Context, user string) (*StorageBilling, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + storageUserBilling := new(StorageBilling) + resp, err := s.client.Do(ctx, req, storageUserBilling) + if err != nil { + return nil, resp, err + } + + return storageUserBilling, resp, nil +} + +// GetOrganizationUsageReport returns a report of the total usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/usage +func (s *BillingService) GetOrganizationUsageReport(ctx context.Context, org string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + usageReport := new(UsageReport) + resp, err := s.client.Do(ctx, req, usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetUsageReport returns a report of the total usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/usage +func (s *BillingService) GetUsageReport(ctx context.Context, user string, opts *UsageReportOptions) (*UsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + usageReport := new(UsageReport) + resp, err := s.client.Do(ctx, req, usageReport) + if err != nil { + return nil, resp, err + } + + return usageReport, resp, nil +} + +// GetOrganizationPremiumRequestUsageReport returns a report of the premium request +// usage for an organization using the enhanced billing platform. +// +// Note: This endpoint is only available to organizations with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-premium-request-usage-report-for-an-organization +// +//meta:operation GET /organizations/{org}/settings/billing/premium_request/usage +func (s *BillingService) GetOrganizationPremiumRequestUsageReport(ctx context.Context, org string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("organizations/%v/settings/billing/premium_request/usage", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + premiumRequestUsageReport := new(PremiumRequestUsageReport) + resp, err := s.client.Do(ctx, req, premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} + +// GetPremiumRequestUsageReport returns a report of the premium request +// usage for a user using the enhanced billing platform. +// +// Note: This endpoint is only available to users with access to the enhanced billing platform. +// +// GitHub API docs: https://docs.github.com/rest/billing/enhanced-billing#get-billing-premium-request-usage-report-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/premium_request/usage +func (s *BillingService) GetPremiumRequestUsageReport(ctx context.Context, user string, opts *PremiumRequestUsageReportOptions) (*PremiumRequestUsageReport, *Response, error) { + u := fmt.Sprintf("users/%v/settings/billing/premium_request/usage", user) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + premiumRequestUsageReport := new(PremiumRequestUsageReport) + resp, err := s.client.Do(ctx, req, premiumRequestUsageReport) + if err != nil { + return nil, resp, err + } + + return premiumRequestUsageReport, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/checks.go b/vendor/github.com/google/go-github/v79/github/checks.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/checks.go rename to vendor/github.com/google/go-github/v79/github/checks.go index 711be207c2..d39cfa5363 100644 --- a/vendor/github.com/google/go-github/v67/github/checks.go +++ b/vendor/github.com/google/go-github/v79/github/checks.go @@ -87,8 +87,8 @@ type CheckSuite struct { // The following fields are only populated by Webhook events. HeadCommit *Commit `json:"head_commit,omitempty"` LatestCheckRunsCount *int64 `json:"latest_check_runs_count,omitempty"` - Rerequstable *bool `json:"rerequestable,omitempty"` - RunsRerequstable *bool `json:"runs_rerequestable,omitempty"` + Rerequestable *bool `json:"rerequestable,omitempty"` + RunsRerequestable *bool `json:"runs_rerequestable,omitempty"` } func (c CheckRun) String() string { @@ -269,6 +269,8 @@ 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 // @@ -345,7 +347,7 @@ func (s *ChecksService) ReRequestCheckRun(ctx context.Context, owner, repo strin // 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,6 +359,8 @@ 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 // diff --git a/vendor/github.com/google/go-github/v79/github/classroom.go b/vendor/github.com/google/go-github/v79/github/classroom.go new file mode 100644 index 0000000000..47124dd4a0 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/classroom.go @@ -0,0 +1,256 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ClassroomService handles communication with the GitHub Classroom related +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom +type ClassroomService service + +// ClassroomUser represents a GitHub user simplified for Classroom. +type ClassroomUser struct { + ID *int64 `json:"id,omitempty"` + Login *string `json:"login,omitempty"` + AvatarURL *string `json:"avatar_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` +} + +func (u ClassroomUser) String() string { + return Stringify(u) +} + +// Classroom represents a GitHub Classroom. +type Classroom struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Archived *bool `json:"archived,omitempty"` + Organization *Organization `json:"organization,omitempty"` + URL *string `json:"url,omitempty"` +} + +func (c Classroom) String() string { + return Stringify(c) +} + +// ClassroomAssignment represents a GitHub Classroom assignment. +type ClassroomAssignment struct { + ID *int64 `json:"id,omitempty"` + PublicRepo *bool `json:"public_repo,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `json:"type,omitempty"` + InviteLink *string `json:"invite_link,omitempty"` + InvitationsEnabled *bool `json:"invitations_enabled,omitempty"` + Slug *string `json:"slug,omitempty"` + StudentsAreRepoAdmins *bool `json:"students_are_repo_admins,omitempty"` + FeedbackPullRequestsEnabled *bool `json:"feedback_pull_requests_enabled,omitempty"` + MaxTeams *int `json:"max_teams,omitempty"` + MaxMembers *int `json:"max_members,omitempty"` + Editor *string `json:"editor,omitempty"` + Accepted *int `json:"accepted,omitempty"` + Submitted *int `json:"submitted,omitempty"` + Passing *int `json:"passing,omitempty"` + Language *string `json:"language,omitempty"` + Deadline *Timestamp `json:"deadline,omitempty"` + StarterCodeRepository *Repository `json:"starter_code_repository,omitempty"` + Classroom *Classroom `json:"classroom,omitempty"` +} + +func (a ClassroomAssignment) String() string { + return Stringify(a) +} + +// AcceptedAssignment represents a GitHub Classroom accepted assignment. +type AcceptedAssignment struct { + ID *int64 `json:"id,omitempty"` + Submitted *bool `json:"submitted,omitempty"` + Passing *bool `json:"passing,omitempty"` + CommitCount *int `json:"commit_count,omitempty"` + Grade *string `json:"grade,omitempty"` + Students []*ClassroomUser `json:"students,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Assignment *ClassroomAssignment `json:"assignment,omitempty"` +} + +func (a AcceptedAssignment) String() string { + return Stringify(a) +} + +// AssignmentGrade represents a GitHub Classroom assignment grade. +type AssignmentGrade struct { + AssignmentName *string `json:"assignment_name,omitempty"` + AssignmentURL *string `json:"assignment_url,omitempty"` + StarterCodeURL *string `json:"starter_code_url,omitempty"` + GithubUsername *string `json:"github_username,omitempty"` + RosterIdentifier *string `json:"roster_identifier,omitempty"` + StudentRepositoryName *string `json:"student_repository_name,omitempty"` + StudentRepositoryURL *string `json:"student_repository_url,omitempty"` + SubmissionTimestamp *Timestamp `json:"submission_timestamp,omitempty"` + PointsAwarded *int `json:"points_awarded,omitempty"` + PointsAvailable *int `json:"points_available,omitempty"` + GroupName *string `json:"group_name,omitempty"` +} + +func (g AssignmentGrade) String() string { + return Stringify(g) +} + +// GetAssignment gets a GitHub Classroom assignment. Assignment will only be +// returned if the current user is an administrator of the GitHub Classroom +// for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-an-assignment +// +//meta:operation GET /assignments/{assignment_id} +func (s *ClassroomService) GetAssignment(ctx context.Context, assignmentID int64) (*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v", assignmentID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + assignment := new(ClassroomAssignment) + resp, err := s.client.Do(ctx, req, assignment) + if err != nil { + return nil, resp, err + } + + return assignment, resp, nil +} + +// GetClassroom gets a GitHub Classroom for the current user. Classroom will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-a-classroom +// +//meta:operation GET /classrooms/{classroom_id} +func (s *ClassroomService) GetClassroom(ctx context.Context, classroomID int64) (*Classroom, *Response, error) { + u := fmt.Sprintf("classrooms/%v", classroomID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + classroom := new(Classroom) + resp, err := s.client.Do(ctx, req, classroom) + if err != nil { + return nil, resp, err + } + + return classroom, resp, nil +} + +// ListClassrooms lists GitHub Classrooms for the current user. Classrooms will only be +// returned if the current user is an administrator of one or more GitHub Classrooms. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-classrooms +// +//meta:operation GET /classrooms +func (s *ClassroomService) ListClassrooms(ctx context.Context, opts *ListOptions) ([]*Classroom, *Response, error) { + u, err := addOptions("classrooms", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var classrooms []*Classroom + resp, err := s.client.Do(ctx, req, &classrooms) + if err != nil { + return nil, resp, err + } + + return classrooms, resp, nil +} + +// ListClassroomAssignments lists GitHub Classroom assignments for a classroom. Assignments will only be +// returned if the current user is an administrator of the GitHub Classroom. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-assignments-for-a-classroom +// +//meta:operation GET /classrooms/{classroom_id}/assignments +func (s *ClassroomService) ListClassroomAssignments(ctx context.Context, classroomID int64, opts *ListOptions) ([]*ClassroomAssignment, *Response, error) { + u := fmt.Sprintf("classrooms/%v/assignments", classroomID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var assignments []*ClassroomAssignment + resp, err := s.client.Do(ctx, req, &assignments) + if err != nil { + return nil, resp, err + } + + return assignments, resp, nil +} + +// ListAcceptedAssignments lists accepted assignments for a GitHub Classroom assignment. +// Accepted assignments will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#list-accepted-assignments-for-an-assignment +// +//meta:operation GET /assignments/{assignment_id}/accepted_assignments +func (s *ClassroomService) ListAcceptedAssignments(ctx context.Context, assignmentID int64, opts *ListOptions) ([]*AcceptedAssignment, *Response, error) { + u := fmt.Sprintf("assignments/%v/accepted_assignments", assignmentID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var acceptedAssignments []*AcceptedAssignment + resp, err := s.client.Do(ctx, req, &acceptedAssignments) + if err != nil { + return nil, resp, err + } + + return acceptedAssignments, resp, nil +} + +// GetAssignmentGrades gets assignment grades for a GitHub Classroom assignment. +// Grades will only be returned if the current user is an administrator +// of the GitHub Classroom for the assignment. +// +// GitHub API docs: https://docs.github.com/rest/classroom/classroom#get-assignment-grades +// +//meta:operation GET /assignments/{assignment_id}/grades +func (s *ClassroomService) GetAssignmentGrades(ctx context.Context, assignmentID int64) ([]*AssignmentGrade, *Response, error) { + u := fmt.Sprintf("assignments/%v/grades", assignmentID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var grades []*AssignmentGrade + resp, err := s.client.Do(ctx, req, &grades) + if err != nil { + return nil, resp, err + } + + return grades, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/code_scanning.go b/vendor/github.com/google/go-github/v79/github/code_scanning.go similarity index 97% rename from vendor/github.com/google/go-github/v67/github/code_scanning.go rename to vendor/github.com/google/go-github/v79/github/code_scanning.go index a8fca98a92..982efc4597 100644 --- a/vendor/github.com/google/go-github/v67/github/code_scanning.go +++ b/vendor/github.com/google/go-github/v79/github/code_scanning.go @@ -141,6 +141,15 @@ type AlertListOptions struct { // The name of a code scanning tool. Only results by this tool will be listed. ToolName string `url:"tool_name,omitempty"` + // The GUID of a code scanning tool. Only results by this tool will be listed. + ToolGUID string `url:"tool_guid,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 // Add ListOptions so offset pagination with integer type "page" query parameter is accepted @@ -391,7 +400,7 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin return nil, nil, err } - // This will always return an error without unmarshalling the data + // This will always return an error without unmarshaling the data resp, err := s.client.Do(ctx, req, nil) // Even though there was an error, we still return the response // in case the caller wants to inspect it further. @@ -604,7 +613,7 @@ type DefaultSetupConfiguration struct { // //meta:operation GET /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) GetDefaultSetupConfiguration(ctx context.Context, owner, repo string) (*DefaultSetupConfiguration, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -647,7 +656,7 @@ type UpdateDefaultSetupConfigurationResponse struct { // //meta:operation PATCH /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) + u := fmt.Sprintf("repos/%v/%v/code-scanning/default-setup", owner, repo) req, err := s.client.NewRequest("PATCH", u, options) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/codesofconduct.go b/vendor/github.com/google/go-github/v79/github/codesofconduct.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/codesofconduct.go rename to vendor/github.com/google/go-github/v79/github/codesofconduct.go index aba0574171..a514aac6b9 100644 --- a/vendor/github.com/google/go-github/v67/github/codesofconduct.go +++ b/vendor/github.com/google/go-github/v79/github/codesofconduct.go @@ -36,7 +36,6 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) var cs []*CodeOfConduct @@ -61,13 +60,12 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // //meta:operation GET /codes_of_conduct/{key} func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("codes_of_conduct/%s", key) + u := fmt.Sprintf("codes_of_conduct/%v", key) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) coc := new(CodeOfConduct) diff --git a/vendor/github.com/google/go-github/v67/github/codespaces.go b/vendor/github.com/google/go-github/v79/github/codespaces.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/codespaces.go rename to vendor/github.com/google/go-github/v79/github/codespaces.go diff --git a/vendor/github.com/google/go-github/v67/github/codespaces_secrets.go b/vendor/github.com/google/go-github/v79/github/codespaces_secrets.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/codespaces_secrets.go rename to vendor/github.com/google/go-github/v79/github/codespaces_secrets.go index 438c27f8ff..ba4b9abd9d 100644 --- a/vendor/github.com/google/go-github/v67/github/codespaces_secrets.go +++ b/vendor/github.com/google/go-github/v79/github/codespaces_secrets.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -187,6 +188,10 @@ func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, // //meta:operation PUT /user/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("user/codespaces/secrets/%v", eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } @@ -199,6 +204,10 @@ func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecre // //meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } @@ -211,6 +220,10 @@ func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org str // //meta:operation PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("encrypted secret must be provided") + } + u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) } @@ -382,6 +395,13 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st // //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) } @@ -394,6 +414,13 @@ func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, nam // //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) } @@ -420,6 +447,13 @@ func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url str // //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) } @@ -432,6 +466,13 @@ func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context // //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) } diff --git a/vendor/github.com/google/go-github/v67/github/copilot.go b/vendor/github.com/google/go-github/v79/github/copilot.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/copilot.go rename to vendor/github.com/google/go-github/v79/github/copilot.go index a2b2aa0995..25f5969ebe 100644 --- a/vendor/github.com/google/go-github/v67/github/copilot.go +++ b/vendor/github.com/google/go-github/v79/github/copilot.go @@ -46,14 +46,14 @@ type ListCopilotSeatsResponse struct { // 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"` + 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. @@ -185,6 +185,7 @@ type CopilotMetrics struct { CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"` } +// 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 @@ -203,7 +204,12 @@ func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { cp.PlanType = seatDetail.PlanType switch v := seatDetail.Assignee.(type) { - case map[string]interface{}: + case nil: + // Assignee can be null according to GitHub API specification. + // See: https://docs.github.com/en/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 @@ -307,7 +313,7 @@ func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts // // 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-enterprise +// 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) { @@ -467,7 +473,7 @@ func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) ( // GetEnterpriseMetrics gets Copilot usage metrics for an enterprise. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-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) { @@ -493,7 +499,7 @@ func (s *CopilotService) GetEnterpriseMetrics(ctx context.Context, enterprise st // GetEnterpriseTeamMetrics gets Copilot usage metrics for an enterprise team. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-metrics#get-copilot-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) { diff --git a/vendor/github.com/google/go-github/v67/github/dependabot.go b/vendor/github.com/google/go-github/v79/github/dependabot.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/dependabot.go rename to vendor/github.com/google/go-github/v79/github/dependabot.go diff --git a/vendor/github.com/google/go-github/v67/github/dependabot_alerts.go b/vendor/github.com/google/go-github/v79/github/dependabot_alerts.go similarity index 94% rename from vendor/github.com/google/go-github/v67/github/dependabot_alerts.go rename to vendor/github.com/google/go-github/v79/github/dependabot_alerts.go index c274f07bec..67e624c9e8 100644 --- a/vendor/github.com/google/go-github/v67/github/dependabot_alerts.go +++ b/vendor/github.com/google/go-github/v79/github/dependabot_alerts.go @@ -29,6 +29,15 @@ type AdvisoryCWEs struct { 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"` @@ -39,6 +48,7 @@ type DependabotSecurityAdvisory struct { Severity *string `json:"severity,omitempty"` CVSS *AdvisoryCVSS `json:"cvss,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"` diff --git a/vendor/github.com/google/go-github/v67/github/dependabot_secrets.go b/vendor/github.com/google/go-github/v79/github/dependabot_secrets.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/dependabot_secrets.go rename to vendor/github.com/google/go-github/v79/github/dependabot_secrets.go index e85c805a63..b4b3e0aa56 100644 --- a/vendor/github.com/google/go-github/v67/github/dependabot_secrets.go +++ b/vendor/github.com/google/go-github/v79/github/dependabot_secrets.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -150,6 +151,10 @@ func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret * // //meta:operation PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *DependabotEncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("dependabot encrypted secret must be provided") + } + url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) } @@ -160,6 +165,10 @@ func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, // //meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *DependabotEncryptedSecret) (*Response, error) { + if eSecret == nil { + return nil, errors.New("dependabot encrypted secret must be provided") + } + repoIDs := make([]string, len(eSecret.SelectedRepositoryIDs)) for i, secret := range eSecret.SelectedRepositoryIDs { repoIDs[i] = fmt.Sprintf("%v", secret) @@ -264,6 +273,13 @@ func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, or // //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) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("PUT", url, nil) if err != nil { @@ -279,6 +295,13 @@ func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, // //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) { + if repo == nil { + return nil, errors.New("repository must be provided") + } + if repo.ID == nil { + return nil, errors.New("id must be provided") + } + url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("DELETE", url, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v79/github/dependency_graph.go b/vendor/github.com/google/go-github/v79/github/dependency_graph.go new file mode 100644 index 0000000000..8d9a263138 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/dependency_graph.go @@ -0,0 +1,129 @@ +// 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" +) + +// DependencyGraphService handles communication with the dependency graph +// related methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/dependency-graph +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. +// +// 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/v67/github/dependency_graph_snapshots.go b/vendor/github.com/google/go-github/v79/github/dependency_graph_snapshots.go similarity index 89% rename from vendor/github.com/google/go-github/v67/github/dependency_graph_snapshots.go rename to vendor/github.com/google/go-github/v79/github/dependency_graph_snapshots.go index 0606b98151..ddfecf429f 100644 --- a/vendor/github.com/google/go-github/v67/github/dependency_graph_snapshots.go +++ b/vendor/github.com/google/go-github/v79/github/dependency_graph_snapshots.go @@ -15,6 +15,15 @@ import ( // GitHub API docs: https://docs.github.com/rest/dependency-graph/dependency-submission#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. @@ -59,6 +68,7 @@ type DependencyGraphSnapshotManifestFile struct { type DependencyGraphSnapshotManifest struct { Name *string `json:"name,omitempty"` File *DependencyGraphSnapshotManifestFile `json:"file,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` Resolved map[string]*DependencyGraphSnapshotResolvedDependency `json:"resolved,omitempty"` } @@ -72,6 +82,7 @@ type DependencyGraphSnapshot struct { Job *DependencyGraphSnapshotJob `json:"job,omitempty"` Detector *DependencyGraphSnapshotDetector `json:"detector,omitempty"` Scanned *Timestamp `json:"scanned,omitempty"` + Metadata map[string]any `json:"metadata,omitempty"` Manifests map[string]*DependencyGraphSnapshotManifest `json:"manifests,omitempty"` } diff --git a/vendor/github.com/google/go-github/v67/github/doc.go b/vendor/github.com/google/go-github/v79/github/doc.go similarity index 75% rename from vendor/github.com/google/go-github/v67/github/doc.go rename to vendor/github.com/google/go-github/v79/github/doc.go index bee1a616fd..a9fcb8dacb 100644 --- a/vendor/github.com/google/go-github/v67/github/doc.go +++ b/vendor/github.com/google/go-github/v79/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v67/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v79/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to @@ -31,27 +31,27 @@ 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 . -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 [Client.WithAuthToken] to configure your client to authenticate using an OAuth token (for example, a personal access token). This is what is needed for a majority of use cases aside from GitHub Apps. client := github.NewClient(nil).WithAuthToken("... your access token ...") -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. @@ -100,21 +100,21 @@ 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") } @@ -129,20 +129,26 @@ 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") } # Conditional Requests -The GitHub API has good support for conditional requests 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. We recommend using -https://github.com/gregjones/httpcache for that. +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]. + +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. @@ -151,13 +157,13 @@ https://docs.github.com/rest/overview/resources-in-the-rest-api#conditional-requ 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, +A helper function, [Ptr], has been provided 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.String("foo"), - Private: github.Bool(true), + Name: github.Ptr("foo"), + Private: github.Ptr(true), } client.Repositories.Create(ctx, "", repo) @@ -167,10 +173,10 @@ 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) diff --git a/vendor/github.com/google/go-github/v67/github/emojis.go b/vendor/github.com/google/go-github/v79/github/emojis.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/emojis.go rename to vendor/github.com/google/go-github/v79/github/emojis.go diff --git a/vendor/github.com/google/go-github/v67/github/enterprise.go b/vendor/github.com/google/go-github/v79/github/enterprise.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/enterprise.go rename to vendor/github.com/google/go-github/v79/github/enterprise.go diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_actions_hosted_runners.go b/vendor/github.com/google/go-github/v79/github/enterprise_actions_hosted_runners.go new file mode 100644 index 0000000000..e82ba9b806 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_actions_hosted_runners.go @@ -0,0 +1,234 @@ +// 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + runners := &HostedRunners{} + resp, err := s.client.Do(ctx, 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#create-a-github-hosted-runner-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/hosted-runners +func (s *EnterpriseService) CreateHostedRunner(ctx context.Context, enterprise string, request *HostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateCreateHostedRunnerRequest(request); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners", enterprise) + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunnerImages := new(HostedRunnerImages) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunnerImages := new(HostedRunnerImages) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + publicIPLimits := new(HostedRunnerPublicIPLimits) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + machineSpecs := new(HostedRunnerMachineSpecs) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + platforms := new(HostedRunnerPlatforms) + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, 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#update-a-github-hosted-runner-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/actions/hosted-runners/{hosted_runner_id} +func (s *EnterpriseService) UpdateHostedRunner(ctx context.Context, enterprise string, runnerID int64, updateReq HostedRunnerRequest) (*HostedRunner, *Response, error) { + if err := validateUpdateHostedRunnerRequest(&updateReq); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/actions/hosted-runners/%v", enterprise, runnerID) + req, err := s.client.NewRequest("PATCH", u, updateReq) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, 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#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("DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + hostedRunner := new(HostedRunner) + resp, err := s.client.Do(ctx, req, hostedRunner) + if err != nil { + return nil, resp, err + } + + return hostedRunner, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/enterprise_actions_runner_groups.go b/vendor/github.com/google/go-github/v79/github/enterprise_actions_runner_groups.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/enterprise_actions_runner_groups.go rename to vendor/github.com/google/go-github/v79/github/enterprise_actions_runner_groups.go diff --git a/vendor/github.com/google/go-github/v67/github/enterprise_actions_runners.go b/vendor/github.com/google/go-github/v79/github/enterprise_actions_runners.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/enterprise_actions_runners.go rename to vendor/github.com/google/go-github/v79/github/enterprise_actions_runners.go index fa345aea8a..408dcfd849 100644 --- a/vendor/github.com/google/go-github/v67/github/enterprise_actions_runners.go +++ b/vendor/github.com/google/go-github/v79/github/enterprise_actions_runners.go @@ -75,7 +75,7 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr return registrationToken, resp, nil } -// ListRunners lists all the self-hosted runners for a enterprise. +// ListRunners lists all the self-hosted runners for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise // diff --git a/vendor/github.com/google/go-github/v67/github/enterprise_audit_log.go b/vendor/github.com/google/go-github/v79/github/enterprise_audit_log.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/enterprise_audit_log.go rename to vendor/github.com/google/go-github/v79/github/enterprise_audit_log.go diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_billing_cost_centers.go b/vendor/github.com/google/go-github/v79/github/enterprise_billing_cost_centers.go new file mode 100644 index 0000000000..97fba64052 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/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/enterprise-admin/billing#get-all-cost-centers-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) ListCostCenters(ctx context.Context, enterprise string, opts *ListCostCenterOptions) (*CostCenters, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + costCenters := &CostCenters{} + resp, err := s.client.Do(ctx, req, costCenters) + if err != nil { + return nil, resp, err + } + + return costCenters, resp, nil +} + +// CreateCostCenter creates a new cost center for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#create-a-new-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers +func (s *EnterpriseService) CreateCostCenter(ctx context.Context, enterprise string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers", enterprise) + + req, err := s.client.NewRequest("POST", u, costCenter) + if err != nil { + return nil, nil, err + } + + result := &CostCenter{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// GetCostCenter gets a cost center by ID for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#get-a-cost-center-by-id +// +//meta:operation GET /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) GetCostCenter(ctx context.Context, enterprise, costCenterID string) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + costCenter := &CostCenter{} + resp, err := s.client.Do(ctx, req, costCenter) + if err != nil { + return nil, resp, err + } + + return costCenter, resp, nil +} + +// UpdateCostCenter updates the name of a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#update-a-cost-center-name +// +//meta:operation PATCH /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) UpdateCostCenter(ctx context.Context, enterprise, costCenterID string, costCenter CostCenterRequest) (*CostCenter, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("PATCH", u, costCenter) + if err != nil { + return nil, nil, err + } + + result := &CostCenter{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// DeleteCostCenter deletes a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#delete-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id} +func (s *EnterpriseService) DeleteCostCenter(ctx context.Context, enterprise, costCenterID string) (*DeleteCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v", enterprise, costCenterID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + result := &DeleteCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// AddResourcesToCostCenter adds resources to a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#add-resources-to-a-cost-center +// +//meta:operation POST /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) AddResourcesToCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*AddResourcesToCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest("POST", u, resources) + if err != nil { + return nil, nil, err + } + + result := &AddResourcesToCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} + +// RemoveResourcesFromCostCenter removes resources from a cost center. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/billing#remove-resources-from-a-cost-center +// +//meta:operation DELETE /enterprises/{enterprise}/settings/billing/cost-centers/{cost_center_id}/resource +func (s *EnterpriseService) RemoveResourcesFromCostCenter(ctx context.Context, enterprise, costCenterID string, resources CostCenterResourceRequest) (*RemoveResourcesFromCostCenterResponse, *Response, error) { + u := fmt.Sprintf("enterprises/%v/settings/billing/cost-centers/%v/resource", enterprise, costCenterID) + + req, err := s.client.NewRequest("DELETE", u, resources) + if err != nil { + return nil, nil, err + } + + result := &RemoveResourcesFromCostCenterResponse{} + resp, err := s.client.Do(ctx, req, result) + if err != nil { + return nil, resp, err + } + + return result, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/enterprise_code_security_and_analysis.go b/vendor/github.com/google/go-github/v79/github/enterprise_code_security_and_analysis.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/enterprise_code_security_and_analysis.go rename to vendor/github.com/google/go-github/v79/github/enterprise_code_security_and_analysis.go diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_codesecurity_configurations.go b/vendor/github.com/google/go-github/v79/github/enterprise_codesecurity_configurations.go new file mode 100644 index 0000000000..687873dec4 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_codesecurity_configurations.go @@ -0,0 +1,232 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" +) + +// ListEnterpriseCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListEnterpriseCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before *string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After *string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage *int `url:"per_page,omitempty"` +} + +// ListCodeSecurityConfigurations lists all code security configurations available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) ListCodeSecurityConfigurations(ctx context.Context, enterprise string, opts *ListEnterpriseCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// CreateCodeSecurityConfiguration creates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations +func (s *EnterpriseService) CreateCodeSecurityConfiguration(ctx context.Context, enterprise string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations", enterprise) + + req, err := s.client.NewRequest("POST", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// ListDefaultCodeSecurityConfigurations lists the default code security configurations for an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/defaults +func (s *EnterpriseService) ListDefaultCodeSecurityConfigurations(ctx context.Context, enterprise string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/defaults", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &configurations) + if err != nil { + return nil, resp, err + } + return configurations, resp, nil +} + +// GetCodeSecurityConfiguration gets a code security configuration available in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#retrieve-a-code-security-configuration-of-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) GetCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// UpdateCodeSecurityConfiguration updates a code security configuration in an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#update-a-custom-code-security-configuration-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) UpdateCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("PATCH", u, config) + if err != nil { + return nil, nil, err + } + + var configuration *CodeSecurityConfiguration + resp, err := s.client.Do(ctx, req, &configuration) + if err != nil { + return nil, resp, err + } + return configuration, resp, nil +} + +// DeleteCodeSecurityConfiguration deletes a code security configuration from an enterprise. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id} +func (s *EnterpriseService) DeleteCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v", enterprise, configurationID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// AttachCodeSecurityConfigurationToRepositories attaches an enterprise code security configuration to repositories. +// `scope` is the type of repositories to attach the configuration to. +// Can be one of: `all`, `all_without_configurations`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#attach-an-enterprise-configuration-to-repositories +// +//meta:operation POST /enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach +func (s *EnterpriseService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, enterprise string, configurationID int64, scope string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/attach", enterprise, configurationID) + type scopeType struct { + Scope string `json:"scope"` + } + + req, err := s.client.NewRequest("POST", u, scopeType{Scope: scope}) + if err != nil { + return nil, err + } + resp, err := s.client.Do(ctx, req, nil) + if err != nil && resp.StatusCode != http.StatusAccepted { // StatusAccepted(202) is the expected status code as job is queued for processing + return resp, err + } + return resp, nil +} + +// SetDefaultCodeSecurityConfiguration sets a code security configuration as a default for an enterprise. +// `defaultForNewRepos` specifies which types of repository this security configuration should be applied to by default. +// Can be one of: `all`, `none`, `private_and_internal`, `public`. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults +func (s *EnterpriseService) SetDefaultCodeSecurityConfiguration(ctx context.Context, enterprise string, configurationID int64, defaultForNewRepos string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/defaults", enterprise, configurationID) + type configParam struct { + DefaultForNewRepos string `json:"default_for_new_repos"` + } + + req, err := s.client.NewRequest("PUT", u, configParam{DefaultForNewRepos: defaultForNewRepos}) + if err != nil { + return nil, nil, err + } + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &config) + if err != nil { + return nil, resp, err + } + return config, resp, nil +} + +// ListCodeSecurityConfigurationRepositories lists the repositories associated with an enterprise code security configuration. +// +// GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-an-enterprise-code-security-configuration +// +//meta:operation GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories +func (s *EnterpriseService) ListCodeSecurityConfigurationRepositories(ctx context.Context, enterprise string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("enterprises/%v/code-security/configurations/%v/repositories", enterprise, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + var attachments []*RepositoryAttachment + resp, err := s.client.Do(ctx, req, &attachments) + if err != nil { + return nil, resp, err + } + return attachments, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_licenses.go b/vendor/github.com/google/go-github/v79/github/enterprise_licenses.go new file mode 100644 index 0000000000..7f2273af5c --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_licenses.go @@ -0,0 +1,138 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseConsumedLicenses represents information about users with consumed enterprise licenses. +type EnterpriseConsumedLicenses struct { + TotalSeatsConsumed int `json:"total_seats_consumed"` + TotalSeatsPurchased int `json:"total_seats_purchased"` + Users []*EnterpriseLicensedUsers `json:"users,omitempty"` +} + +// EnterpriseLicensedUsers represents a user with license information in an enterprise. +type EnterpriseLicensedUsers struct { + GithubComLogin string `json:"github_com_login"` + GithubComName *string `json:"github_com_name"` + EnterpriseServerUserIDs []string `json:"enterprise_server_user_ids,omitempty"` + GithubComUser bool `json:"github_com_user"` + EnterpriseServerUser *bool `json:"enterprise_server_user"` + VisualStudioSubscriptionUser bool `json:"visual_studio_subscription_user"` + LicenseType string `json:"license_type"` + GithubComProfile *string `json:"github_com_profile"` + GithubComMemberRoles []string `json:"github_com_member_roles,omitempty"` + GithubComEnterpriseRoles []string `json:"github_com_enterprise_roles,omitempty"` + GithubComVerifiedDomainEmails []string `json:"github_com_verified_domain_emails,omitempty"` + GithubComSamlNameID *string `json:"github_com_saml_name_id"` + GithubComOrgsWithPendingInvites []string `json:"github_com_orgs_with_pending_invites,omitempty"` + GithubComTwoFactorAuth *bool `json:"github_com_two_factor_auth"` + EnterpriseServerEmails []string `json:"enterprise_server_emails,omitempty"` + VisualStudioLicenseStatus *string `json:"visual_studio_license_status"` + VisualStudioSubscriptionEmail *string `json:"visual_studio_subscription_email"` + TotalUserAccounts int `json:"total_user_accounts"` +} + +// EnterpriseLicenseSyncStatus represents the synchronization status of +// GitHub Enterprise Server instances with an enterprise account. +type EnterpriseLicenseSyncStatus struct { + Title string `json:"title"` + Description string `json:"description"` + Properties *ServerInstanceProperties `json:"properties,omitempty"` +} + +// ServerInstanceProperties contains the collection of server instances. +type ServerInstanceProperties struct { + ServerInstances *ServerInstances `json:"server_instances,omitempty"` +} + +// ServerInstances represents a collection of GitHub Enterprise Server instances +// and their synchronization status. +type ServerInstances struct { + Type string `json:"type"` + Items *ServiceInstanceItems `json:"items,omitempty"` +} + +// ServiceInstanceItems defines the structure and properties of individual server instances +// in the collection. +type ServiceInstanceItems struct { + Type string `json:"type"` + Properties *ServerItemProperties `json:"properties,omitempty"` +} + +// ServerItemProperties represents the properties of a GitHub Enterprise Server instance, +// including its identifier, hostname, and last synchronization status. +type ServerItemProperties struct { + ServerID string `json:"server_id"` + Hostname string `json:"hostname"` + LastSync *LastLicenseSync `json:"last_sync,omitempty"` +} + +// LastLicenseSync contains information about the most recent license synchronization +// attempt for a server instance. +type LastLicenseSync struct { + Type string `json:"type"` + Properties *LastLicenseSyncProperties `json:"properties,omitempty"` +} + +// LastLicenseSyncProperties represents the details of the last synchronization attempt, +// including the date, status, and any error that occurred. +type LastLicenseSyncProperties struct { + Date *Timestamp `json:"date,omitempty"` + Status string `json:"status"` + Error string `json:"error"` +} + +// GetConsumedLicenses collect information about the number of consumed licenses and a collection with all the users with consumed enterprise licenses. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/license#list-enterprise-consumed-licenses +// +//meta:operation GET /enterprises/{enterprise}/consumed-licenses +func (s *EnterpriseService) GetConsumedLicenses(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseConsumedLicenses, *Response, error) { + u := fmt.Sprintf("enterprises/%v/consumed-licenses", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + consumedLicenses := &EnterpriseConsumedLicenses{} + resp, err := s.client.Do(ctx, req, &consumedLicenses) + if err != nil { + return nil, resp, err + } + + return consumedLicenses, resp, nil +} + +// GetLicenseSyncStatus collects information about the status of a license sync job for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/license#get-a-license-sync-status +// +//meta:operation GET /enterprises/{enterprise}/license-sync-status +func (s *EnterpriseService) GetLicenseSyncStatus(ctx context.Context, enterprise string) (*EnterpriseLicenseSyncStatus, *Response, error) { + u := fmt.Sprintf("enterprises/%v/license-sync-status", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + syncStatus := &EnterpriseLicenseSyncStatus{} + resp, err := s.client.Do(ctx, req, &syncStatus) + if err != nil { + return nil, resp, err + } + + return syncStatus, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes.go b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes.go new file mode 100644 index 0000000000..f9ffd03f6f --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes.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" +) + +// NodeQueryOptions specifies the optional parameters to the EnterpriseService +// Node management APIs. +type NodeQueryOptions struct { + // UUID filters issues based on the node UUID. + UUID *string `url:"uuid,omitempty"` + + // ClusterRoles filters the cluster roles from the cluster configuration file. + ClusterRoles *string `url:"cluster_roles,omitempty"` +} + +// ClusterStatus represents a response from the ClusterStatus and ReplicationStatus methods. +type ClusterStatus struct { + Status *string `json:"status,omitempty"` + Nodes []*ClusterStatusNode `json:"nodes"` +} + +// ClusterStatusNode represents the status of a cluster node. +type ClusterStatusNode struct { + Hostname *string `json:"hostname,omitempty"` + Status *string `json:"status,omitempty"` + Services []*ClusterStatusNodeServiceItem `json:"services"` +} + +// ClusterStatusNodeServiceItem represents the status of a service running on a cluster node. +type ClusterStatusNodeServiceItem struct { + Status *string `json:"status,omitempty"` + Name *string `json:"name,omitempty"` + Details *string `json:"details,omitempty"` +} + +// SystemRequirements represents a response from the CheckSystemRequirements method. +type SystemRequirements struct { + Status *string `json:"status,omitempty"` + Nodes []*SystemRequirementsNode `json:"nodes"` +} + +// SystemRequirementsNode represents the status of a system node. +type SystemRequirementsNode struct { + Hostname *string `json:"hostname,omitempty"` + Status *string `json:"status,omitempty"` + RolesStatus []*SystemRequirementsNodeRoleStatus `json:"roles_status"` +} + +// SystemRequirementsNodeRoleStatus represents the status of a role on a system node. +type SystemRequirementsNodeRoleStatus struct { + Status *string `json:"status,omitempty"` + Role *string `json:"role,omitempty"` +} + +// NodeReleaseVersion represents a response from the GetNodeReleaseVersions method. +type NodeReleaseVersion struct { + Hostname *string `json:"hostname,omitempty"` + Version *ReleaseVersion `json:"version"` +} + +// ReleaseVersion holds the release version information of the node. +type ReleaseVersion struct { + Version *string `json:"version,omitempty"` + Platform *string `json:"platform,omitempty"` + BuildID *string `json:"build_id,omitempty"` + BuildDate *string `json:"build_date,omitempty"` +} + +// CheckSystemRequirements checks if GHES system nodes meet the system requirements. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) + if err != nil { + return nil, nil, err + } + + systemRequirements := new(SystemRequirements) + resp, err := s.client.Do(ctx, req, systemRequirements) + if err != nil { + return nil, resp, err + } + + return systemRequirements, resp, nil +} + +// ClusterStatus gets the status of all services running on each cluster node. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) + if err != nil { + return nil, nil, err + } + + clusterStatus := new(ClusterStatus) + resp, err := s.client.Do(ctx, req, clusterStatus) + if err != nil { + return nil, resp, err + } + + return clusterStatus, resp, nil +} + +// ReplicationStatus gets the status of all services running on each replica node. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u, err := addOptions("manage/v1/replication/status", opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + status := new(ClusterStatus) + resp, err := s.client.Do(ctx, req, status) + if err != nil { + return nil, resp, err + } + + return status, resp, nil +} + +// GetNodeReleaseVersions gets the version information deployed to each node. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u, err := addOptions("manage/v1/version", opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var releaseVersions []*NodeReleaseVersion + resp, err := s.client.Do(ctx, req, &releaseVersions) + if err != nil { + return nil, resp, err + } + + return releaseVersions, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_config.go b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_config.go new file mode 100644 index 0000000000..512eabe7f0 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_config.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" +) + +// ConfigApplyOptions is a struct to hold the options for the ConfigApply API and the response. +type ConfigApplyOptions struct { + // RunID is the ID of the run to get the status of. If empty a random one will be generated. + RunID *string `json:"run_id,omitempty"` +} + +// ConfigApplyStatus is a struct to hold the response from the ConfigApply API. +type ConfigApplyStatus struct { + Running *bool `json:"running,omitempty"` + Successful *bool `json:"successful,omitempty"` + Nodes []*ConfigApplyStatusNode `json:"nodes"` +} + +// ConfigApplyStatusNode is a struct to hold the response from the ConfigApply API. +type ConfigApplyStatusNode struct { + Hostname *string `json:"hostname,omitempty"` + Running *bool `json:"running,omitempty"` + Successful *bool `json:"successful,omitempty"` + RunID *string `json:"run_id,omitempty"` +} + +// ConfigApplyEventsOptions is used to enable pagination. +type ConfigApplyEventsOptions struct { + LastRequestID *string `url:"last_request_id,omitempty"` +} + +// ConfigApplyEvents is a struct to hold the response from the ConfigApplyEvents API. +type ConfigApplyEvents struct { + Nodes []*ConfigApplyEventsNode `json:"nodes"` +} + +// ConfigApplyEventsNode is a struct to hold the response from the ConfigApplyEvents API. +type ConfigApplyEventsNode struct { + Node *string `json:"node,omitempty"` + LastRequestID *string `json:"last_request_id,omitempty"` + Events []*ConfigApplyEventsNodeEvent `json:"events"` +} + +// ConfigApplyEventsNodeEvent is a struct to hold the response from the ConfigApplyEvents API. +type ConfigApplyEventsNodeEvent struct { + Timestamp *Timestamp `json:"timestamp,omitempty"` + SeverityText *string `json:"severity_text,omitempty"` + Body *string `json:"body,omitempty"` + EventName *string `json:"event_name,omitempty"` + Topology *string `json:"topology,omitempty"` + Hostname *string `json:"hostname,omitempty"` + ConfigRunID *string `json:"config_run_id,omitempty"` + TraceID *string `json:"trace_id,omitempty"` + SpanID *string `json:"span_id,omitempty"` + SpanParentID *int64 `json:"span_parent_id,omitempty"` + SpanDepth *int `json:"span_depth,omitempty"` +} + +// InitialConfigOptions represents the payload for initializing instance configuration. +type InitialConfigOptions struct { + License string `json:"license"` + Password string `json:"password"` +} + +// LicenseStatus is a struct to hold the response from the License API. +type LicenseStatus struct { + AdvancedSecurityEnabled *bool `json:"advancedSecurityEnabled,omitempty"` + AdvancedSecuritySeats *int `json:"advancedSecuritySeats,omitempty"` + ClusterSupport *bool `json:"clusterSupport,omitempty"` + Company *string `json:"company,omitempty"` + CroquetSupport *bool `json:"croquetSupport,omitempty"` + CustomTerms *bool `json:"customTerms,omitempty"` + Evaluation *bool `json:"evaluation,omitempty"` + ExpireAt *Timestamp `json:"expireAt,omitempty"` + InsightsEnabled *bool `json:"insightsEnabled,omitempty"` + InsightsExpireAt *Timestamp `json:"insightsExpireAt,omitempty"` + LearningLabEvaluationExpires *Timestamp `json:"learningLabEvaluationExpires,omitempty"` + LearningLabSeats *int `json:"learningLabSeats,omitempty"` + Perpetual *bool `json:"perpetual,omitempty"` + 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"` +} + +// UploadLicenseOptions is a struct to hold the options for the UploadLicense API. +type UploadLicenseOptions struct { + License string `url:"license"` +} + +// LicenseCheck is a struct to hold the response from the LicenseStatus API. +type LicenseCheck struct { + Status *string `json:"status,omitempty"` +} + +// ConfigSettings is a struct to hold the response from the Settings API. +// There are many fields that link to other structs. +type ConfigSettings struct { + PrivateMode *bool `json:"private_mode,omitempty"` + PublicPages *bool `json:"public_pages,omitempty"` + SubdomainIsolation *bool `json:"subdomain_isolation,omitempty"` + SignupEnabled *bool `json:"signup_enabled,omitempty"` + GithubHostname *string `json:"github_hostname,omitempty"` + IdenticonsHost *string `json:"identicons_host,omitempty"` + HTTPProxy *string `json:"http_proxy,omitempty"` + AuthMode *string `json:"auth_mode,omitempty"` + ExpireSessions *bool `json:"expire_sessions,omitempty"` + AdminPassword *string `json:"admin_password,omitempty"` + ConfigurationID *int64 `json:"configuration_id,omitempty"` + ConfigurationRunCount *int `json:"configuration_run_count,omitempty"` + Avatar *ConfigSettingsAvatar `json:"avatar,omitempty"` + Customer *ConfigSettingsCustomer `json:"customer,omitempty"` + License *ConfigSettingsLicenseSettings `json:"license,omitempty"` + GithubSSL *ConfigSettingsGithubSSL `json:"github_ssl,omitempty"` + LDAP *ConfigSettingsLDAP `json:"ldap,omitempty"` + CAS *ConfigSettingsCAS `json:"cas,omitempty"` + SAML *ConfigSettingsSAML `json:"saml,omitempty"` + GithubOAuth *ConfigSettingsGithubOAuth `json:"github_oauth,omitempty"` + SMTP *ConfigSettingsSMTP `json:"smtp,omitempty"` + NTP *ConfigSettingsNTP `json:"ntp,omitempty"` + Timezone *string `json:"timezone,omitempty"` + SNMP *ConfigSettingsSNMP `json:"snmp,omitempty"` + Syslog *ConfigSettingsSyslog `json:"syslog,omitempty"` + Assets *string `json:"assets,omitempty"` + Pages *ConfigSettingsPagesSettings `json:"pages,omitempty"` + Collectd *ConfigSettingsCollectd `json:"collectd,omitempty"` + Mapping *ConfigSettingsMapping `json:"mapping,omitempty"` + LoadBalancer *string `json:"load_balancer,omitempty"` +} + +// ConfigSettingsAvatar is a struct to hold the response from the Settings API. +type ConfigSettingsAvatar struct { + Enabled *bool `json:"enabled,omitempty"` + URI *string `json:"uri,omitempty"` +} + +// ConfigSettingsCustomer is a struct to hold the response from the Settings API. +type ConfigSettingsCustomer struct { + Name *string `json:"name,omitempty"` + Email *string `json:"email,omitempty"` + UUID *string `json:"uuid,omitempty"` + Secret *string `json:"secret,omitempty"` + PublicKeyData *string `json:"public_key_data,omitempty"` +} + +// ConfigSettingsLicenseSettings is a struct to hold the response from the Settings API. +type ConfigSettingsLicenseSettings struct { + Seats *int `json:"seats,omitempty"` + Evaluation *bool `json:"evaluation,omitempty"` + Perpetual *bool `json:"perpetual,omitempty"` + UnlimitedSeating *bool `json:"unlimited_seating,omitempty"` + SupportKey *string `json:"support_key,omitempty"` + SSHAllowed *bool `json:"ssh_allowed,omitempty"` + ClusterSupport *bool `json:"cluster_support,omitempty"` + ExpireAt *Timestamp `json:"expire_at,omitempty"` +} + +// ConfigSettingsGithubSSL is a struct to hold the response from the Settings API. +type ConfigSettingsGithubSSL struct { + Enabled *bool `json:"enabled,omitempty"` + Cert *string `json:"cert,omitempty"` + Key *string `json:"key,omitempty"` +} + +// ConfigSettingsLDAP is a struct to hold the response from the Settings API. +type ConfigSettingsLDAP struct { + Host *string `json:"host,omitempty"` + Port *int `json:"port,omitempty"` + Base []string `json:"base,omitempty"` + UID *string `json:"uid,omitempty"` + BindDN *string `json:"bind_dn,omitempty"` + Password *string `json:"password,omitempty"` + Method *string `json:"method,omitempty"` + SearchStrategy *string `json:"search_strategy,omitempty"` + UserGroups []string `json:"user_groups,omitempty"` + AdminGroup *string `json:"admin_group,omitempty"` + VirtualAttributeEnabled *bool `json:"virtual_attribute_enabled,omitempty"` + RecursiveGroupSearch *bool `json:"recursive_group_search,omitempty"` + PosixSupport *bool `json:"posix_support,omitempty"` + UserSyncEmails *bool `json:"user_sync_emails,omitempty"` + UserSyncKeys *bool `json:"user_sync_keys,omitempty"` + UserSyncInterval *int `json:"user_sync_interval,omitempty"` + TeamSyncInterval *int `json:"team_sync_interval,omitempty"` + SyncEnabled *bool `json:"sync_enabled,omitempty"` + Reconciliation *ConfigSettingsLDAPReconciliation `json:"reconciliation,omitempty"` + Profile *ConfigSettingsLDAPProfile `json:"profile,omitempty"` +} + +// ConfigSettingsLDAPReconciliation is part of the ConfigSettingsLDAP struct. +type ConfigSettingsLDAPReconciliation struct { + User *string `json:"user,omitempty"` + Org *string `json:"org,omitempty"` +} + +// ConfigSettingsLDAPProfile is part of the ConfigSettingsLDAP struct. +type ConfigSettingsLDAPProfile struct { + UID *string `json:"uid,omitempty"` + Name *string `json:"name,omitempty"` + Mail *string `json:"mail,omitempty"` + Key *string `json:"key,omitempty"` +} + +// ConfigSettingsCAS is a struct to hold the response from the Settings API. +type ConfigSettingsCAS struct { + URL *string `json:"url,omitempty"` +} + +// ConfigSettingsSAML is a struct to hold the response from the Settings API. +type ConfigSettingsSAML struct { + SSOURL *string `json:"sso_url,omitempty"` + Certificate *string `json:"certificate,omitempty"` + CertificatePath *string `json:"certificate_path,omitempty"` + Issuer *string `json:"issuer,omitempty"` + IDPInitiatedSSO *bool `json:"idp_initiated_sso,omitempty"` + DisableAdminDemote *bool `json:"disable_admin_demote,omitempty"` +} + +// ConfigSettingsGithubOAuth is a struct to hold the response from the Settings API. +type ConfigSettingsGithubOAuth struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + OrganizationName *string `json:"organization_name,omitempty"` + OrganizationTeam *string `json:"organization_team,omitempty"` +} + +// ConfigSettingsSMTP is a struct to hold the response from the Settings API. +type ConfigSettingsSMTP struct { + Enabled *bool `json:"enabled,omitempty"` + Address *string `json:"address,omitempty"` + Authentication *string `json:"authentication,omitempty"` + Port *string `json:"port,omitempty"` + Domain *string `json:"domain,omitempty"` + Username *string `json:"username,omitempty"` + UserName *string `json:"user_name,omitempty"` + EnableStarttlsAuto *bool `json:"enable_starttls_auto,omitempty"` + Password *string `json:"password,omitempty"` + DiscardToNoreplyAddress *bool `json:"discard-to-noreply-address,omitempty"` + SupportAddress *string `json:"support_address,omitempty"` + SupportAddressType *string `json:"support_address_type,omitempty"` + NoreplyAddress *string `json:"noreply_address,omitempty"` +} + +// ConfigSettingsNTP is a struct to hold the response from the Settings API. +type ConfigSettingsNTP struct { + PrimaryServer *string `json:"primary_server,omitempty"` + SecondaryServer *string `json:"secondary_server,omitempty"` +} + +// ConfigSettingsSNMP is a struct to hold the response from the Settings API. +type ConfigSettingsSNMP struct { + Enabled *bool `json:"enabled,omitempty"` + Community *string `json:"community,omitempty"` +} + +// ConfigSettingsSyslog is a struct to hold the response from the Settings API. +type ConfigSettingsSyslog struct { + Enabled *bool `json:"enabled,omitempty"` + Server *string `json:"server,omitempty"` + ProtocolName *string `json:"protocol_name,omitempty"` +} + +// ConfigSettingsPagesSettings is a struct to hold the response from the Settings API. +type ConfigSettingsPagesSettings struct { + Enabled *bool `json:"enabled,omitempty"` +} + +// ConfigSettingsCollectd is a struct to hold the response from the Settings API. +type ConfigSettingsCollectd struct { + Enabled *bool `json:"enabled,omitempty"` + Server *string `json:"server,omitempty"` + Port *int `json:"port,omitempty"` + Encryption *string `json:"encryption,omitempty"` + Username *string `json:"username,omitempty"` + Password *string `json:"password,omitempty"` +} + +// ConfigSettingsMapping is a struct to hold the response from the Settings API. +type ConfigSettingsMapping struct { + Enabled *bool `json:"enabled,omitempty"` + Tileserver *string `json:"tileserver,omitempty"` + Basemap *string `json:"basemap,omitempty"` + Token *string `json:"token,omitempty"` +} + +// NodeMetadataStatus is a struct to hold the response from the NodeMetadata API. +type NodeMetadataStatus struct { + Topology *string `json:"topology,omitempty"` + Nodes []*NodeDetails `json:"nodes"` +} + +// NodeDetails is a struct to hold the response from the NodeMetadata API. +type NodeDetails struct { + Hostname *string `json:"hostname,omitempty"` + UUID *string `json:"uuid,omitempty"` + ClusterRoles []string `json:"cluster_roles,omitempty"` +} + +// ConfigApplyEvents gets events from the command ghe-config-apply. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u, err := addOptions("manage/v1/config/apply/events", opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + configApplyEvents := new(ConfigApplyEvents) + resp, err := s.client.Do(ctx, req, configApplyEvents) + if err != nil { + return nil, resp, err + } + + return configApplyEvents, resp, nil +} + +// 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.18/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" + + payload := &InitialConfigOptions{ + License: license, + Password: password, + } + + req, err := s.client.NewRequest("POST", u, payload) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// License gets the current license information for the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/config/license" + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var licenseStatus []*LicenseStatus + resp, err := s.client.Do(ctx, req, &licenseStatus) + if err != nil { + return nil, resp, err + } + + return licenseStatus, resp, nil +} + +// UploadLicense uploads a new license to the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/config/license" + opts := &UploadLicenseOptions{ + License: license, + } + req, err := s.client.NewRequest("PUT", u, opts) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// LicenseStatus gets the current license status for the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) + if err != nil { + return nil, nil, err + } + + var checks []*LicenseCheck + resp, err := s.client.Do(ctx, req, &checks) + if err != nil { + return nil, resp, err + } + + return checks, resp, nil +} + +// 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.18/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) { + u, err := addOptions("manage/v1/config/nodes", opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + status := new(NodeMetadataStatus) + resp, err := s.client.Do(ctx, req, status) + if err != nil { + return nil, resp, err + } + + return status, resp, nil +} + +// Settings gets the current configuration settings for the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) + if err != nil { + return nil, nil, err + } + + configSettings := new(ConfigSettings) + resp, err := s.client.Do(ctx, req, configSettings) + if err != nil { + return nil, resp, err + } + + return configSettings, resp, nil +} + +// UpdateSettings updates the configuration settings for the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/config/settings" + + if opts == nil { + return nil, errors.New("opts should not be nil") + } + req, err := s.client.NewRequest("PUT", u, opts) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// ConfigApply triggers a configuration apply run on the GitHub Enterprise instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/config/apply" + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + configApplyOptions := new(ConfigApplyOptions) + resp, err := s.client.Do(ctx, req, configApplyOptions) + if err != nil { + return nil, resp, err + } + return configApplyOptions, resp, nil +} + +// 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.18/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) + if err != nil { + return nil, nil, err + } + + status := new(ConfigApplyStatus) + resp, err := s.client.Do(ctx, req, status) + if err != nil { + return nil, resp, err + } + return status, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_maintenance.go b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_maintenance.go new file mode 100644 index 0000000000..13bf0f9fe6 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_maintenance.go @@ -0,0 +1,94 @@ +// 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" +) + +// MaintenanceOperationStatus represents the message to be displayed when the instance gets a maintenance operation request. +type MaintenanceOperationStatus struct { + Hostname *string `json:"hostname,omitempty"` + UUID *string `json:"uuid,omitempty"` + Message *string `json:"message,omitempty"` +} + +// MaintenanceStatus represents the status of maintenance mode for all nodes. +type MaintenanceStatus struct { + Hostname *string `json:"hostname,omitempty"` + UUID *string `json:"uuid,omitempty"` + Status *string `json:"status,omitempty"` + ScheduledTime *Timestamp `json:"scheduled_time,omitempty"` + ConnectionServices []*ConnectionServiceItem `json:"connection_services,omitempty"` + CanUnsetMaintenance *bool `json:"can_unset_maintenance,omitempty"` + IPExceptionList []string `json:"ip_exception_list,omitempty"` + MaintenanceModeMessage *string `json:"maintenance_mode_message,omitempty"` +} + +// ConnectionServiceItem represents the connection services for the maintenance status. +type ConnectionServiceItem struct { + Name *string `json:"name,omitempty"` + Number *int `json:"number,omitempty"` +} + +// MaintenanceOptions represents the options for setting the maintenance mode for the instance. +// When can be a string, so we can't use a Timestamp type. +type MaintenanceOptions struct { + Enabled bool `json:"enabled"` + UUID *string `json:"uuid,omitempty"` + When *string `json:"when,omitempty"` + IPExceptionList []string `json:"ip_exception_list,omitempty"` + MaintenanceModeMessage *string `json:"maintenance_mode_message,omitempty"` +} + +// GetMaintenanceStatus gets the status of maintenance mode for all nodes. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u, err := addOptions("manage/v1/maintenance", opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var status []*MaintenanceStatus + resp, err := s.client.Do(ctx, req, &status) + if err != nil { + return nil, resp, err + } + + return status, resp, nil +} + +// 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.18/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) { + u := "manage/v1/maintenance" + + opts.Enabled = enable + + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + var i []*MaintenanceOperationStatus + resp, err := s.client.Do(ctx, req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_ssh.go b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_ssh.go new file mode 100644 index 0000000000..9f582d6059 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_manage_ghes_ssh.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" +) + +// SSHKeyStatus represents the status of a SSH key operation. +type SSHKeyStatus struct { + Hostname *string `json:"hostname,omitempty"` + UUID *string `json:"uuid,omitempty"` + Message *string `json:"message,omitempty"` + Modified *bool `json:"modified,omitempty"` +} + +// SSHKeyOptions specifies the parameters to the SSH create and delete functions. +type SSHKeyOptions struct { + // Key is the SSH key to add to the instance. + Key string `json:"key"` +} + +// ClusterSSHKey represents the SSH keys configured for the instance. +type ClusterSSHKey struct { + Key *string `json:"key,omitempty"` + Fingerprint *string `json:"fingerprint,omitempty"` +} + +// DeleteSSHKey deletes the SSH key from the instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/access/ssh" + opts := &SSHKeyOptions{ + Key: key, + } + req, err := s.client.NewRequest("DELETE", u, opts) + if err != nil { + return nil, nil, err + } + + var sshStatus []*SSHKeyStatus + resp, err := s.client.Do(ctx, req, &sshStatus) + if err != nil { + return nil, resp, err + } + + return sshStatus, resp, nil +} + +// GetSSHKey gets the SSH keys configured for the instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) + if err != nil { + return nil, nil, err + } + + var sshKeys []*ClusterSSHKey + resp, err := s.client.Do(ctx, req, &sshKeys) + if err != nil { + return nil, resp, err + } + + return sshKeys, resp, nil +} + +// CreateSSHKey adds a new SSH key to the instance. +// +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/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) { + u := "manage/v1/access/ssh" + opts := &SSHKeyOptions{ + Key: key, + } + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + var sshKeyResponse []*SSHKeyStatus + resp, err := s.client.Do(ctx, req, &sshKeyResponse) + if err != nil { + return nil, resp, err + } + + return sshKeyResponse, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_network_configurations.go b/vendor/github.com/google/go-github/v79/github/enterprise_network_configurations.go new file mode 100644 index 0000000000..a6a690d786 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_network_configurations.go @@ -0,0 +1,139 @@ +// 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + networks := &NetworkConfigurations{} + resp, err := s.client.Do(ctx, 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#create-a-hosted-compute-network-configuration-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/network-configurations +func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(createReq); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise) + req, err := s.client.NewRequest("POST", u, createReq) + if err != nil { + return nil, nil, err + } + + network := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + network := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#update-a-hosted-compute-network-configuration-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id} +func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(updateReq); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID) + req, err := s.client.NewRequest("PATCH", u, updateReq) + if err != nil { + return nil, nil, err + } + + network := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#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("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + resource := &NetworkSettingsResource{} + resp, err := s.client.Do(ctx, req, resource) + if err != nil { + return nil, resp, err + } + return resource, resp, err +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_organization_properties.go b/vendor/github.com/google/go-github/v79/github/enterprise_organization_properties.go new file mode 100644 index 0000000000..01a646b38a --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_organization_properties.go @@ -0,0 +1,189 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// EnterpriseCustomPropertySchema represents the schema response for GetEnterpriseCustomPropertiesSchema. +type EnterpriseCustomPropertySchema struct { + // An ordered list of the custom property defined in the enterprise. + Properties []*CustomProperty `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertiesValues represents the custom properties values for an organization within an enterprise. +type EnterpriseCustomPropertiesValues struct { + // The Organization ID that the custom property values will be applied to. + OrganizationID *int64 `json:"organization_id,omitempty"` + // The names of organizations that the custom property values will be applied to. + OrganizationLogin *string `json:"organization_login,omitempty"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// EnterpriseCustomPropertyValuesRequest represents the request to update custom property values for organizations within an enterprise. +type EnterpriseCustomPropertyValuesRequest struct { + // The names of organizations that the custom property values will be applied to. + // OrganizationLogin specifies the organization name when updating multiple organizations. + OrganizationLogin []string `json:"organization_login"` + // List of custom property names and associated values to apply to the organizations. + Properties []*CustomPropertyValue `json:"properties"` +} + +// GetOrganizationCustomPropertySchema gets all organization custom property definitions that are defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#get-organization-custom-properties-schema-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) GetOrganizationCustomPropertySchema(ctx context.Context, enterprise string) (*EnterpriseCustomPropertySchema, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var schema *EnterpriseCustomPropertySchema + resp, err := s.client.Do(ctx, req, &schema) + if err != nil { + return nil, resp, err + } + + return schema, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertySchema creates new or updates existing organization custom properties defined on an enterprise in a batch. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#create-or-update-organization-custom-property-definitions-on-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/schema +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertySchema(ctx context.Context, enterprise string, schema EnterpriseCustomPropertySchema) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema", enterprise) + req, err := s.client.NewRequest("PATCH", u, schema) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetOrganizationCustomProperty retrieves a specific organization custom property definition from an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#get-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) GetOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*CustomProperty, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var property *CustomProperty + resp, err := s.client.Do(ctx, req, &property) + if err != nil { + return nil, resp, err + } + + return property, resp, nil +} + +// CreateOrUpdateOrganizationCustomProperty creates a new or updates an existing organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#create-or-update-an-organization-custom-property-definition-on-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string, property CustomProperty) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest("PUT", u, property) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DeleteOrganizationCustomProperty removes an organization custom property definition that is defined on an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#remove-an-organization-custom-property-definition-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/org-properties/schema/{custom_property_name} +func (s *EnterpriseService) DeleteOrganizationCustomProperty(ctx context.Context, enterprise, customPropertyName string) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/schema/%v", enterprise, customPropertyName) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListOrganizationCustomPropertyValues lists enterprise organizations with all of their custom property values. +// Returns a list of organizations and their custom property values defined in the enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#list-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) ListOrganizationCustomPropertyValues(ctx context.Context, enterprise string, opts *ListOptions) ([]*EnterpriseCustomPropertiesValues, *Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*EnterpriseCustomPropertiesValues + resp, err := s.client.Do(ctx, req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for organizations in an enterprise. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/custom-properties-for-orgs#create-or-update-custom-property-values-for-organizations-in-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/org-properties/values +func (s *EnterpriseService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, enterprise string, values EnterpriseCustomPropertyValuesRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/org-properties/values", enterprise) + req, err := s.client.NewRequest("PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_properties.go b/vendor/github.com/google/go-github/v79/github/enterprise_properties.go new file mode 100644 index 0000000000..bc5ab55a3a --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_properties.go @@ -0,0 +1,121 @@ +// 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" +) + +// 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 +// +//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) + if err != nil { + return nil, nil, err + } + + var customProperties []*CustomProperty + resp, err := s.client.Do(ctx, req, &customProperties) + if err != nil { + return nil, resp, err + } + + return customProperties, resp, nil +} + +// 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 +// +//meta:operation PATCH /enterprises/{enterprise}/properties/schema +func (s *EnterpriseService) CreateOrUpdateCustomProperties(ctx context.Context, enterprise string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { + u := fmt.Sprintf("enterprises/%v/properties/schema", enterprise) + + params := struct { + Properties []*CustomProperty `json:"properties"` + }{ + Properties: properties, + } + + req, err := s.client.NewRequest("PATCH", u, params) + if err != nil { + return nil, nil, err + } + + var customProperties []*CustomProperty + resp, err := s.client.Do(ctx, req, &customProperties) + if err != nil { + return nil, resp, err + } + + return customProperties, resp, nil +} + +// 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 +// +//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) + if err != nil { + return nil, nil, err + } + + var customProperty *CustomProperty + resp, err := s.client.Do(ctx, req, &customProperty) + if err != nil { + return nil, resp, err + } + + return customProperty, resp, nil +} + +// 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 +// +//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) { + u := fmt.Sprintf("enterprises/%v/properties/schema/%v", enterprise, customPropertyName) + + req, err := s.client.NewRequest("PUT", u, property) + if err != nil { + return nil, nil, err + } + + var customProperty *CustomProperty + resp, err := s.client.Do(ctx, req, &customProperty) + if err != nil { + return nil, resp, err + } + + return customProperty, resp, nil +} + +// 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 +// +//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) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_rules.go b/vendor/github.com/google/go-github/v79/github/enterprise_rules.go new file mode 100644 index 0000000000..33485824f7 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_rules.go @@ -0,0 +1,120 @@ +// 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" +) + +// 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 +// +//meta:operation POST /enterprises/{enterprise}/rulesets +func (s *EnterpriseService) CreateRepositoryRuleset(ctx context.Context, enterprise string, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("enterprises/%v/rulesets", enterprise) + + 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 enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/rules#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) + 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 enterprise. +// +// 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) UpdateRepositoryRuleset(ctx context.Context, enterprise string, rulesetID int64, ruleset RepositoryRuleset) (*RepositoryRuleset, *Response, error) { + u := fmt.Sprintf("enterprises/%v/rulesets/%v", enterprise, 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 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{ + BypassActors: []*BypassActor{}, + } + + 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 +// +//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) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v79/github/enterprise_scim.go b/vendor/github.com/google/go-github/v79/github/enterprise_scim.go new file mode 100644 index 0000000000..fe7aa3406d --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/enterprise_scim.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" +) + +// 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" + +// 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" + +// SCIMEnterpriseGroupAttributes represents supported SCIM Enterprise group attributes. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#supported-scim-group-attributes +type SCIMEnterpriseGroupAttributes struct { + DisplayName *string `json:"displayName,omitempty"` // Human-readable name for a group. + Members []*SCIMEnterpriseDisplayReference `json:"members,omitempty"` // List of members who are assigned to the group in SCIM provider + ExternalID *string `json:"externalId,omitempty"` // This identifier is generated by a SCIM provider. Must be unique per user. + // Bellow: Only populated as a result of calling SetSCIMInformationForProvisionedGroup: + Schemas []string `json:"schemas,omitempty"` // The URIs that are used to indicate the namespaces of the SCIM schemas. + 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"` // The URI reference to the member resource (e.g., https://api.github.com/scim/v2/Users/{id}). + Display *string `json:"display,omitempty"` // The display name associated with the member (e.g., user name or group name). +} + +// SCIMEnterpriseMeta represents metadata about the SCIM resource. +type SCIMEnterpriseMeta struct { + ResourceType string `json:"resourceType"` // A type of a resource (`User` or `Group`). + Created *Timestamp `json:"created,omitempty"` // A date and time when the user was created. + LastModified *Timestamp `json:"lastModified,omitempty"` // A date and time when the user was last modified. + Location *string `json:"location,omitempty"` // A URL location of an object +} + +// SCIMEnterpriseGroups represents the result of calling ListProvisionedSCIMGroups. +type SCIMEnterpriseGroups struct { + Schemas []string `json:"schemas,omitempty"` + TotalResults *int `json:"totalResults,omitempty"` + Resources []*SCIMEnterpriseGroupAttributes `json:"Resources,omitempty"` + StartIndex *int `json:"startIndex,omitempty"` + ItemsPerPage *int `json:"itemsPerPage,omitempty"` +} + +// ListProvisionedSCIMGroupsEnterpriseOptions represents query parameters for ListProvisionedSCIMGroups. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise--parameters +type ListProvisionedSCIMGroupsEnterpriseOptions struct { + // If specified, only results that match the specified filter will be returned. + // Possible filters are `externalId`, `id`, and `displayName`. For example, `externalId eq "a123"`. + Filter string `url:"filter,omitempty"` + // Excludes the specified attribute 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"` +} + +// ListProvisionedSCIMGroups lists provisioned SCIM groups in 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 *EnterpriseService) ListProvisionedSCIMGroups(ctx context.Context, enterprise string, opts *ListProvisionedSCIMGroupsEnterpriseOptions) (*SCIMEnterpriseGroups, *Response, error) { + u := fmt.Sprintf("scim/v2/enterprises/%v/Groups", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + groups := new(SCIMEnterpriseGroups) + resp, err := s.client.Do(ctx, req, groups) + if err != nil { + return nil, resp, err + } + + return groups, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/event.go b/vendor/github.com/google/go-github/v79/github/event.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/event.go rename to vendor/github.com/google/go-github/v79/github/event.go index e98606bce5..446db7fa01 100644 --- a/vendor/github.com/google/go-github/v67/github/event.go +++ b/vendor/github.com/google/go-github/v79/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/v67/github/event_types.go b/vendor/github.com/google/go-github/v79/github/event_types.go similarity index 86% rename from vendor/github.com/google/go-github/v67/github/event_types.go rename to vendor/github.com/google/go-github/v79/github/event_types.go index 373d59bad2..178df686f2 100644 --- a/vendor/github.com/google/go-github/v67/github/event_types.go +++ b/vendor/github.com/google/go-github/v79/github/event_types.go @@ -132,6 +132,43 @@ type CreateEvent struct { Installation *Installation `json:"installation,omitempty"` } +// CustomPropertyEvent represents a created, deleted or updated custom property. +// The Webhook event name is "custom_property". +// +// Note: this is related to custom property configuration at the enterprise or organization level. +// See CustomPropertyValuesEvent for activity related to custom property values for a repository. +// +// GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#custom_property +type CustomPropertyEvent struct { + // Action possible values are: "created", "deleted", "updated". + Action *string `json:"action,omitempty"` + Definition *CustomProperty `json:"definition,omitempty"` + + // The following fields are only populated by Webhook events. + Enterprise *Enterprise `json:"enterprise,omitempty"` + Installation *Installation `json:"installation,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` +} + +// CustomPropertyValuesEvent represents an update to a custom property. +// The Webhook event name is "custom_property_values". +// +// GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#custom_property_values +type CustomPropertyValuesEvent struct { + // Action possible values are: "updated". + Action *string `json:"action,omitempty"` + NewPropertyValues []*CustomPropertyValue `json:"new_property_values,omitempty"` + OldPropertyValues []*CustomPropertyValue `json:"old_property_values,omitempty"` + + // The following fields are only populated by Webhook events. + Enterprise *Enterprise `json:"enterprise,omitempty"` + Installation *Installation `json:"installation,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` +} + // DeleteEvent represents a deleted branch or tag. // The Webhook event name is "delete". // @@ -228,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"` @@ -317,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#get-a-discussion-comment AuthorAssociation *string `json:"author_association,omitempty"` Body *string `json:"body,omitempty"` ChildCommentCount *int `json:"child_comment_count,omitempty"` @@ -366,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#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. @@ -810,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"` @@ -821,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"` @@ -1046,63 +1097,13 @@ type PingEvent struct { Installation *Installation `json:"installation,omitempty"` } -// ProjectEvent is triggered when project is created, modified or deleted. -// The webhook event name is "project". -// -// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project -type ProjectEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectChange `json:"changes,omitempty"` - Project *Project `json:"project,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. -// The webhook event name is "project_card". -// -// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project_card -type ProjectCardEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectCardChange `json:"changes,omitempty"` - AfterID *int64 `json:"after_id,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - -// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. -// The webhook event name is "project_column". -// -// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project_column -type ProjectColumnEvent struct { - Action *string `json:"action,omitempty"` - Changes *ProjectColumnChange `json:"changes,omitempty"` - AfterID *int64 `json:"after_id,omitempty"` - ProjectColumn *ProjectColumn `json:"project_column,omitempty"` - - // The following fields are only populated by Webhook events. - Repo *Repository `json:"repository,omitempty"` - Org *Organization `json:"organization,omitempty"` - Sender *User `json:"sender,omitempty"` - Installation *Installation `json:"installation,omitempty"` -} - // ProjectV2Event is triggered when there is activity relating to an organization-level project. // The Webhook event name is "projects_v2". // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2 type ProjectV2Event struct { - Action *string `json:"action,omitempty"` - ProjectsV2 *ProjectsV2 `json:"projects_v2,omitempty"` + Action *string `json:"action,omitempty"` + ProjectsV2 *ProjectV2 `json:"projects_v2,omitempty"` // The following fields are only populated by Webhook events. Installation *Installation `json:"installation,omitempty"` @@ -1110,24 +1111,6 @@ type ProjectV2Event struct { Sender *User `json:"sender,omitempty"` } -// ProjectsV2 represents a projects v2 project. -type ProjectsV2 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"` -} - // ProjectV2ItemEvent is triggered when there is activity relating to an item on an organization-level project. // The Webhook event name is "projects_v2_item". // @@ -1146,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. @@ -1154,17 +1138,52 @@ type ArchivedAt struct { To *Timestamp `json:"to,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"` +} + +// 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"` +} + // 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"` + 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"` + ProjectURL *string `json:"project_url,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"` + ItemURL *string `json:"item_url,omitempty"` + Fields []*ProjectV2ItemFieldValue `json:"fields,omitempty"` } // PublicEvent is triggered when a private repository is open sourced. @@ -1214,7 +1233,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. @@ -1343,13 +1363,28 @@ 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#list-commits + Size *int `json:"size,omitempty"` + // Commits is the list of commits in the push event. + // + // Deprecated: GitHub will remove commit summaries from Events API payloads on October 7, 2025. + // Use the Commits REST API endpoint to get detailed commit information. + // See: https://docs.github.com/rest/commits/commits#list-commits + Commits []*HeadCommit `json:"commits,omitempty"` + 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#compare-two-commits + DistinctSize *int `json:"distinct_size,omitempty"` // The following fields are only populated by Webhook events. Action *string `json:"action,omitempty"` @@ -1400,44 +1435,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. @@ -1446,6 +1481,26 @@ 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. // The Webhook event name is "release". @@ -1523,14 +1578,73 @@ type RepositoryImportEvent struct { // // GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset type RepositoryRulesetEvent struct { - Action *string `json:"action,omitempty"` - Enterprise *Enterprise `json:"enterprise,omitempty"` - Installation *Installation `json:"installation,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Repository *Repository `json:"repository,omitempty"` - RepositoryRuleset *RepositoryRuleset `json:"repository_ruleset"` - Changes *RepositoryRulesetEditedChanges `json:"changes,omitempty"` - Sender *User `json:"sender"` + Action *string `json:"action,omitempty"` + Enterprise *Enterprise `json:"enterprise,omitempty"` + Installation *Installation `json:"installation,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Repository *Repository `json:"repository,omitempty"` + RepositoryRuleset *RepositoryRuleset `json:"repository_ruleset"` + Changes *RepositoryRulesetChanges `json:"changes,omitempty"` + Sender *User `json:"sender"` +} + +// RepositoryRulesetChanges represents the changes made to a repository ruleset. +type RepositoryRulesetChanges struct { + Name *RepositoryRulesetChangeSource `json:"name,omitempty"` + Enforcement *RepositoryRulesetChangeSource `json:"enforcement,omitempty"` + Conditions *RepositoryRulesetChangedConditions `json:"conditions,omitempty"` + Rules *RepositoryRulesetChangedRules `json:"rules,omitempty"` +} + +// RepositoryRulesetChangeSource represents a source change for the ruleset. +type RepositoryRulesetChangeSource struct { + From *string `json:"from,omitempty"` +} + +// RepositoryRulesetChangeSources represents multiple source changes for the ruleset. +type RepositoryRulesetChangeSources struct { + From []string `json:"from,omitempty"` +} + +// RepositoryRulesetChangedConditions holds changes to conditions in a ruleset. +type RepositoryRulesetChangedConditions struct { + Added []*RepositoryRulesetConditions `json:"added,omitempty"` + Deleted []*RepositoryRulesetConditions `json:"deleted,omitempty"` + Updated []*RepositoryRulesetUpdatedConditions `json:"updated,omitempty"` +} + +// RepositoryRulesetUpdatedConditions represents the edited updates to conditions in a ruleset. +type RepositoryRulesetUpdatedConditions struct { + Condition *RepositoryRulesetConditions `json:"condition,omitempty"` + Changes *RepositoryRulesetUpdatedCondition `json:"changes,omitempty"` +} + +// RepositoryRulesetUpdatedCondition represents the changes to a condition in a ruleset. +type RepositoryRulesetUpdatedCondition struct { + ConditionType *RepositoryRulesetChangeSource `json:"condition_type,omitempty"` + Target *RepositoryRulesetChangeSource `json:"target,omitempty"` + Include *RepositoryRulesetChangeSources `json:"include,omitempty"` + Exclude *RepositoryRulesetChangeSources `json:"exclude,omitempty"` +} + +// RepositoryRulesetChangedRules holds changes to rules in a ruleset. +type RepositoryRulesetChangedRules struct { + Added []*RepositoryRule `json:"added,omitempty"` + Deleted []*RepositoryRule `json:"deleted,omitempty"` + Updated []*RepositoryRulesetUpdatedRules `json:"updated,omitempty"` +} + +// RepositoryRulesetUpdatedRules holds updates to rules in a ruleset. +type RepositoryRulesetUpdatedRules struct { + Rule *RepositoryRule `json:"rule,omitempty"` + Changes *RepositoryRulesetChangedRule `json:"changes,omitempty"` +} + +// RepositoryRulesetChangedRule holds changes made to a rule in a ruleset. +type RepositoryRulesetChangedRule struct { + Configuration *RepositoryRulesetChangeSource `json:"configuration,omitempty"` + RuleType *RepositoryRulesetChangeSource `json:"rule_type,omitempty"` + Pattern *RepositoryRulesetChangeSource `json:"pattern,omitempty"` } // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. @@ -1756,7 +1870,7 @@ type WatchEvent struct { } // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or -// sends a POST request to the create a workflow dispatch event endpoint. +// sends a POST request to the endpoint to create a workflow dispatch event. // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch type WorkflowDispatchEvent struct { diff --git a/vendor/github.com/google/go-github/v67/github/gists.go b/vendor/github.com/google/go-github/v79/github/gists.go similarity index 99% rename from vendor/github.com/google/go-github/v67/github/gists.go rename to vendor/github.com/google/go-github/v79/github/gists.go index 08180c6d30..ee4314b986 100644 --- a/vendor/github.com/google/go-github/v67/github/gists.go +++ b/vendor/github.com/google/go-github/v79/github/gists.go @@ -1,6 +1,6 @@ // Copyright 2013 The go-github AUTHORS. All rights reserved. // -// Use of this source code is governed by BSD-style +// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package github diff --git a/vendor/github.com/google/go-github/v67/github/gists_comments.go b/vendor/github.com/google/go-github/v79/github/gists_comments.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/gists_comments.go rename to vendor/github.com/google/go-github/v79/github/gists_comments.go diff --git a/vendor/github.com/google/go-github/v67/github/git.go b/vendor/github.com/google/go-github/v79/github/git.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/git.go rename to vendor/github.com/google/go-github/v79/github/git.go diff --git a/vendor/github.com/google/go-github/v67/github/git_blobs.go b/vendor/github.com/google/go-github/v79/github/git_blobs.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/git_blobs.go rename to vendor/github.com/google/go-github/v79/github/git_blobs.go index d890428889..c734d595b3 100644 --- a/vendor/github.com/google/go-github/v67/github/git_blobs.go +++ b/vendor/github.com/google/go-github/v79/github/git_blobs.go @@ -26,7 +26,7 @@ type Blob struct { // GitHub API docs: https://docs.github.com/rest/git/blobs#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) if err != nil { @@ -71,7 +71,7 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // GitHub API docs: https://docs.github.com/rest/git/blobs#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, blob Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) req, err := s.client.NewRequest("POST", u, blob) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/git_commits.go b/vendor/github.com/google/go-github/v79/github/git_commits.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/git_commits.go rename to vendor/github.com/google/go-github/v79/github/git_commits.go index fdb3d26cea..5bf6cf7aa9 100644 --- a/vendor/github.com/google/go-github/v67/github/git_commits.go +++ b/vendor/github.com/google/go-github/v79/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) } @@ -49,7 +50,6 @@ type Commit struct { Message *string `json:"message,omitempty"` Tree *Tree `json:"tree,omitempty"` Parents []*Commit `json:"parents,omitempty"` - Stats *CommitStats `json:"stats,omitempty"` HTMLURL *string `json:"html_url,omitempty"` URL *string `json:"url,omitempty"` Verification *SignatureVerification `json:"verification,omitempty"` @@ -85,7 +85,7 @@ func (c CommitAuthor) String() string { // GitHub API docs: https://docs.github.com/rest/git/commits#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) if err != nil { @@ -111,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. @@ -127,10 +129,7 @@ type CreateCommitOptions struct { // GitHub API docs: https://docs.github.com/rest/git/commits#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{} } @@ -203,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 { @@ -218,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/v67/github/git_refs.go b/vendor/github.com/google/go-github/v79/github/git_refs.go similarity index 71% rename from vendor/github.com/google/go-github/v67/github/git_refs.go rename to vendor/github.com/google/go-github/v79/github/git_refs.go index ad7b10d7d3..735aef006b 100644 --- a/vendor/github.com/google/go-github/v67/github/git_refs.go +++ b/vendor/github.com/google/go-github/v79/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,24 +37,25 @@ 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 // //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) @@ -82,6 +85,7 @@ func refURLEscape(ref string) string { // ReferenceListOptions specifies optional parameters to the // GitService.ListMatchingRefs method. type ReferenceListOptions struct { + // The ref must be formatted as `heads/` for branches and `tags/` for tags. Ref string `url:"-"` ListOptions @@ -123,13 +127,20 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o // GitHub API docs: https://docs.github.com/rest/git/refs#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, ref CreateRef) (*Reference, *Response, error) { + if ref.Ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if ref.SHA == "" { + return nil, nil, errors.New("sha must be provided") + } + + // ensure the 'refs/' prefix is present + ref.Ref = "refs/" + strings.TrimPrefix(ref.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: String("refs/" + strings.TrimPrefix(*ref.Ref, "refs/")), - SHA: ref.Object.SHA, - }) + req, err := s.client.NewRequest("POST", u, ref) if err != nil { return nil, nil, err } @@ -148,13 +159,18 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r // GitHub API docs: https://docs.github.com/rest/git/refs#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, updateRef UpdateRef) (*Reference, *Response, error) { + if ref == "" { + return nil, nil, errors.New("ref must be provided") + } + + if updateRef.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("PATCH", u, updateRef) if err != nil { return nil, nil, err } @@ -173,7 +189,7 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r // GitHub API docs: https://docs.github.com/rest/git/refs#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) diff --git a/vendor/github.com/google/go-github/v67/github/git_tags.go b/vendor/github.com/google/go-github/v79/github/git_tags.go similarity index 63% rename from vendor/github.com/google/go-github/v67/github/git_tags.go rename to vendor/github.com/google/go-github/v79/github/git_tags.go index 67321566f7..750b03760c 100644 --- a/vendor/github.com/google/go-github/v67/github/git_tags.go +++ b/vendor/github.com/google/go-github/v79/github/git_tags.go @@ -22,14 +22,12 @@ 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,omitempty"` + Message string `json:"message,omitempty"` + Object string `json:"object,omitempty"` + Type string `json:"type,omitempty"` Tagger *CommitAuthor `json:"tagger,omitempty"` } @@ -38,7 +36,7 @@ type createTagRequest struct { // GitHub API docs: https://docs.github.com/rest/git/tags#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) if err != nil { @@ -59,21 +57,10 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha // GitHub API docs: https://docs.github.com/rest/git/tags#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, tag 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("POST", u, tag) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/google/go-github/v67/github/git_trees.go b/vendor/github.com/google/go-github/v79/github/git_trees.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/git_trees.go rename to vendor/github.com/google/go-github/v79/github/git_trees.go index b8eed58e13..2b701a3c65 100644 --- a/vendor/github.com/google/go-github/v67/github/git_trees.go +++ b/vendor/github.com/google/go-github/v79/github/git_trees.go @@ -58,6 +58,7 @@ type treeEntryWithFileDelete struct { URL *string `json:"url,omitempty"` } +// MarshalJSON implements the json.Marshaler interface. func (t *TreeEntry) MarshalJSON() ([]byte, error) { if t.SHA == nil && t.Content == nil { return json.Marshal(struct { @@ -96,7 +97,7 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) { // GitHub API docs: https://docs.github.com/rest/git/trees#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" @@ -118,8 +119,8 @@ 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 @@ -129,10 +130,10 @@ type createTree struct { // GitHub API docs: https://docs.github.com/rest/git/trees#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{ diff --git a/vendor/github.com/google/go-github/v67/github/github-accessors.go b/vendor/github.com/google/go-github/v79/github/github-accessors.go similarity index 82% rename from vendor/github.com/google/go-github/v67/github/github-accessors.go rename to vendor/github.com/google/go-github/v79/github/github-accessors.go index 0782ba2f32..2a1a9394f6 100644 --- a/vendor/github.com/google/go-github/v67/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v79/github/github-accessors.go @@ -22,6 +22,62 @@ func (a *AbuseRateLimitError) GetRetryAfter() time.Duration { return *a.RetryAfter } +// GetAssignment returns the Assignment field. +func (a *AcceptedAssignment) GetAssignment() *ClassroomAssignment { + if a == nil { + return nil + } + return a.Assignment +} + +// GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetCommitCount() int { + if a == nil || a.CommitCount == nil { + return 0 + } + return *a.CommitCount +} + +// GetGrade returns the Grade field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetGrade() string { + if a == nil || a.Grade == nil { + return "" + } + return *a.Grade +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetID() int64 { + if a == nil || a.ID == nil { + return 0 + } + return *a.ID +} + +// GetPassing returns the Passing field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetPassing() bool { + if a == nil || a.Passing == nil { + return false + } + return *a.Passing +} + +// GetRepository returns the Repository field. +func (a *AcceptedAssignment) GetRepository() *Repository { + if a == nil { + return nil + } + return a.Repository +} + +// GetSubmitted returns the Submitted field if it's non-nil, zero value otherwise. +func (a *AcceptedAssignment) GetSubmitted() bool { + if a == nil || a.Submitted == nil { + return false + } + return *a.Submitted +} + // GetGithubOwnedAllowed returns the GithubOwnedAllowed field if it's non-nil, zero value otherwise. func (a *ActionsAllowed) GetGithubOwnedAllowed() bool { if a == nil || a.GithubOwnedAllowed == nil { @@ -150,6 +206,14 @@ func (a *ActionsPermissions) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissions) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissionsEnterprise) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { @@ -198,6 +262,14 @@ func (a *ActionsPermissionsRepository) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetSHAPinningRequired returns the SHAPinningRequired field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsRepository) GetSHAPinningRequired() bool { + if a == nil || a.SHAPinningRequired == nil { + return false + } + return *a.SHAPinningRequired +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (a *ActionsVariable) GetCreatedAt() Timestamp { if a == nil || a.CreatedAt == nil { @@ -238,6 +310,46 @@ func (a *ActionsVariable) GetVisibility() string { return *a.Visibility } +// GetMaximumAdvancedSecurityCommitters returns the MaximumAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetMaximumAdvancedSecurityCommitters() int { + if a == nil || a.MaximumAdvancedSecurityCommitters == nil { + return 0 + } + return *a.MaximumAdvancedSecurityCommitters +} + +// GetPurchasedAdvancedSecurityCommitters returns the PurchasedAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetPurchasedAdvancedSecurityCommitters() int { + if a == nil || a.PurchasedAdvancedSecurityCommitters == nil { + return 0 + } + return *a.PurchasedAdvancedSecurityCommitters +} + +// GetTotalAdvancedSecurityCommitters returns the TotalAdvancedSecurityCommitters field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalAdvancedSecurityCommitters() int { + if a == nil || a.TotalAdvancedSecurityCommitters == nil { + return 0 + } + return *a.TotalAdvancedSecurityCommitters +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (a *ActiveCommitters) GetTotalCount() int { + if a == nil || a.TotalCount == nil { + return 0 + } + return *a.TotalCount +} + +// GetAdvancedSecurityProduct returns the AdvancedSecurityProduct field if it's non-nil, zero value otherwise. +func (a *ActiveCommittersListOptions) GetAdvancedSecurityProduct() string { + if a == nil || a.AdvancedSecurityProduct == nil { + return "" + } + return *a.AdvancedSecurityProduct +} + // GetCountryCode returns the CountryCode field if it's non-nil, zero value otherwise. func (a *ActorLocation) GetCountryCode() string { if a == nil || a.CountryCode == nil { @@ -246,6 +358,14 @@ func (a *ActorLocation) GetCountryCode() string { return *a.CountryCode } +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (a *AddResourcesToCostCenterResponse) GetMessage() string { + if a == nil || a.Message == nil { + return "" + } + return *a.Message +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (a *AdminEnforcedChanges) GetFrom() bool { if a == nil || a.From == nil { @@ -350,22 +470,6 @@ func (a *AdvancedSecurity) GetStatus() string { return *a.Status } -// GetLastPushedDate returns the LastPushedDate field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurityCommittersBreakdown) GetLastPushedDate() string { - if a == nil || a.LastPushedDate == nil { - return "" - } - return *a.LastPushedDate -} - -// GetUserLogin returns the UserLogin field if it's non-nil, zero value otherwise. -func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { - if a == nil || a.UserLogin == nil { - return "" - } - return *a.UserLogin -} - // GetScore returns the Score field. func (a *AdvisoryCVSS) GetScore() *float64 { if a == nil { @@ -934,6 +1038,14 @@ func (a *Artifact) GetCreatedAt() Timestamp { return *a.CreatedAt } +// 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 *a.Digest +} + // GetExpired returns the Expired field if it's non-nil, zero value otherwise. func (a *Artifact) GetExpired() bool { if a == nil || a.Expired == nil { @@ -1014,6 +1126,30 @@ func (a *ArtifactList) GetTotalCount() int64 { return *a.TotalCount } +// 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 *a.Days +} + +// 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 *a.MaximumAllowedDays +} + +// GetDays returns the Days field if it's non-nil, zero value otherwise. +func (a *ArtifactPeriodOpt) GetDays() int { + if a == nil || a.Days == nil { + return 0 + } + return *a.Days +} + // GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. func (a *ArtifactWorkflowRun) GetHeadBranch() string { if a == nil || a.HeadBranch == nil { @@ -1054,6 +1190,94 @@ func (a *ArtifactWorkflowRun) GetRepositoryID() int64 { return *a.RepositoryID } +// GetAssignmentName returns the AssignmentName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentName() string { + if a == nil || a.AssignmentName == nil { + return "" + } + return *a.AssignmentName +} + +// GetAssignmentURL returns the AssignmentURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetAssignmentURL() string { + if a == nil || a.AssignmentURL == nil { + return "" + } + return *a.AssignmentURL +} + +// GetGithubUsername returns the GithubUsername field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGithubUsername() string { + if a == nil || a.GithubUsername == nil { + return "" + } + return *a.GithubUsername +} + +// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetGroupName() string { + if a == nil || a.GroupName == nil { + return "" + } + return *a.GroupName +} + +// 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 *a.RosterIdentifier +} + +// GetStarterCodeURL returns the StarterCodeURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStarterCodeURL() string { + if a == nil || a.StarterCodeURL == nil { + return "" + } + return *a.StarterCodeURL +} + +// GetStudentRepositoryName returns the StudentRepositoryName field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryName() string { + if a == nil || a.StudentRepositoryName == nil { + return "" + } + return *a.StudentRepositoryName +} + +// GetStudentRepositoryURL returns the StudentRepositoryURL field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetStudentRepositoryURL() string { + if a == nil || a.StudentRepositoryURL == nil { + return "" + } + return *a.StudentRepositoryURL +} + +// GetSubmissionTimestamp returns the SubmissionTimestamp field if it's non-nil, zero value otherwise. +func (a *AssignmentGrade) GetSubmissionTimestamp() Timestamp { + if a == nil || a.SubmissionTimestamp == nil { + return Timestamp{} + } + return *a.SubmissionTimestamp +} + // GetBody returns the Body field if it's non-nil, zero value otherwise. func (a *Attachment) GetBody() string { if a == nil || a.Body == nil { @@ -1110,6 +1334,14 @@ func (a *AuditEntry) GetActorLocation() *ActorLocation { return a.ActorLocation } +// 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 a.AdditionalFields +} + // GetBusiness returns the Business field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetBusiness() string { if a == nil || a.Business == nil { @@ -1134,6 +1366,14 @@ func (a *AuditEntry) GetCreatedAt() Timestamp { return *a.CreatedAt } +// 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 a.Data +} + // GetDocumentID returns the DocumentID field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetDocumentID() string { if a == nil || a.DocumentID == nil { @@ -1598,6 +1838,14 @@ func (b *Branch) GetProtection() *Protection { return b.Protection } +// 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 *b.ProtectionURL +} + // GetCommit returns the Commit field. func (b *BranchCommit) GetCommit() *Commit { if b == nil { @@ -1846,6 +2094,14 @@ func (b *BranchProtectionRule) GetRequiredStatusChecksEnforcementLevel() string return *b.RequiredStatusChecksEnforcementLevel } +// 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 *b.RequireLastPushApproval +} + // GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field if it's non-nil, zero value otherwise. func (b *BranchProtectionRule) GetSignatureRequirementEnforcementLevel() string { if b == nil || b.SignatureRequirementEnforcementLevel == nil { @@ -1934,20 +2190,20 @@ func (b *BypassActor) GetActorID() int64 { return *b.ActorID } -// GetActorType returns the ActorType field if it's non-nil, zero value otherwise. -func (b *BypassActor) GetActorType() string { - if b == nil || b.ActorType == nil { - return "" +// GetActorType returns the ActorType field. +func (b *BypassActor) GetActorType() *BypassActorType { + if b == nil { + return nil } - return *b.ActorType + return b.ActorType } -// GetBypassMode returns the BypassMode field if it's non-nil, zero value otherwise. -func (b *BypassActor) GetBypassMode() string { - if b == nil || b.BypassMode == nil { - return "" +// GetBypassMode returns the BypassMode field. +func (b *BypassActor) GetBypassMode() *BypassMode { + if b == nil { + return nil } - return *b.BypassMode + return b.BypassMode } // GetApp returns the App field. @@ -2358,20 +2614,20 @@ func (c *CheckSuite) GetRepository() *Repository { return c.Repository } -// GetRerequstable returns the Rerequstable field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetRerequstable() bool { - if c == nil || c.Rerequstable == 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.Rerequstable + return *c.Rerequestable } -// GetRunsRerequstable returns the RunsRerequstable field if it's non-nil, zero value otherwise. -func (c *CheckSuite) GetRunsRerequstable() bool { - if c == nil || c.RunsRerequstable == nil { +// 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.RunsRerequstable + return *c.RunsRerequestable } // GetStatus returns the Status field if it's non-nil, zero value otherwise. @@ -2462,123 +2718,411 @@ func (c *CheckSuitePreferenceResults) GetRepository() *Repository { return c.Repository } -// 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 "" +// 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.Body + return *c.Archived } -// 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 "" +// 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.Key + return *c.ID } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetName() string { +func (c *Classroom) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } +// GetOrganization returns the Organization field. +func (c *Classroom) GetOrganization() *Organization { + if c == nil { + return nil + } + return c.Organization +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeOfConduct) GetURL() string { +func (c *Classroom) GetURL() string { if c == nil || c.URL == nil { return "" } return *c.URL } -// 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 "" +// 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.Suggestion + return *c.Accepted } -// 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 "" +// GetClassroom returns the Classroom field. +func (c *ClassroomAssignment) GetClassroom() *Classroom { + if c == nil { + return nil } - return *c.ContentType + return c.Classroom } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetCreatedAt() Timestamp { - if c == nil || c.CreatedAt == nil { +// 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.CreatedAt + return *c.Deadline +} + +// 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.Editor +} + +// 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.FeedbackPullRequestsEnabled } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetID() int64 { +func (c *ClassroomAssignment) GetID() int64 { if c == nil || c.ID == nil { return 0 } return *c.ID } +// 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.InvitationsEnabled +} + +// 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.InviteLink +} + // GetLanguage returns the Language field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetLanguage() string { +func (c *ClassroomAssignment) GetLanguage() string { if c == nil || c.Language == nil { return "" } return *c.Language } -// 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 "" +// 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.Name + return *c.MaxMembers } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetSize() int64 { - if c == nil || c.Size == nil { +// 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.Size + return *c.MaxTeams } -// 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{} +// 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.UpdatedAt + return *c.Passing } -// GetUploader returns the Uploader field. -func (c *CodeQLDatabase) GetUploader() *User { - if c == nil { - return nil +// 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.Uploader + return *c.PublicRepo } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (c *CodeQLDatabase) GetURL() string { - if c == nil || c.URL == 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.URL + return *c.Slug } -// 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 "" - } +// GetStarterCodeRepository returns the StarterCodeRepository field. +func (c *ClassroomAssignment) GetStarterCodeRepository() *Repository { + if c == nil { + return nil + } + return c.StarterCodeRepository +} + +// 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.StudentsAreRepoAdmins +} + +// 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.Submitted +} + +// 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.Title +} + +// 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.Type +} + +// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetAvatarURL() string { + if c == nil || c.AvatarURL == nil { + return "" + } + return *c.AvatarURL +} + +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetHTMLURL() string { + if c == nil || c.HTMLURL == nil { + return "" + } + return *c.HTMLURL +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (c *ClassroomUser) GetLogin() string { + if c == nil || c.Login == nil { + return "" + } + return *c.Login +} + +// 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.Fingerprint +} + +// 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.Key +} + +// 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.Status +} + +// 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.Hostname +} + +// 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.Status +} + +// 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.Details +} + +// 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.Name +} + +// 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.Status +} + +// 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 *CodeOfConduct) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// 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.URL +} + +// 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.Suggestion +} + +// 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.ID +} + +// 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.Language +} + +// 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.Name +} + +// 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.Size +} + +// 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.UpdatedAt +} + +// GetUploader returns the Uploader field. +func (c *CodeQLDatabase) GetUploader() *User { + if c == nil { + return nil + } + return c.Uploader +} + +// 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.URL +} + +// 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.HTMLURL } @@ -2694,6 +3238,22 @@ func (c *CodeScanningAlertState) GetDismissedReason() string { return *c.DismissedReason } +// GetRunnerLabel returns the RunnerLabel field if it's non-nil, zero value otherwise. +func (c *CodeScanningDefaultSetupOptions) GetRunnerLabel() string { + if c == nil || c.RunnerLabel == nil { + return "" + } + return *c.RunnerLabel +} + +// GetAllowAdvanced returns the AllowAdvanced field if it's non-nil, zero value otherwise. +func (c *CodeScanningOptions) GetAllowAdvanced() bool { + if c == nil || c.AllowAdvanced == nil { + return false + } + return *c.AllowAdvanced +} + // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (c *CodeSearchResult) GetIncompleteResults() bool { if c == nil || c.IncompleteResults == nil { @@ -2726,6 +3286,38 @@ func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetup() string { return *c.CodeScanningDefaultSetup } +// GetCodeScanningDefaultSetupOptions returns the CodeScanningDefaultSetupOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningDefaultSetupOptions() *CodeScanningDefaultSetupOptions { + if c == nil { + return nil + } + return c.CodeScanningDefaultSetupOptions +} + +// GetCodeScanningDelegatedAlertDismissal returns the CodeScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeScanningDelegatedAlertDismissal() string { + if c == nil || c.CodeScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.CodeScanningDelegatedAlertDismissal +} + +// GetCodeScanningOptions returns the CodeScanningOptions field. +func (c *CodeSecurityConfiguration) GetCodeScanningOptions() *CodeScanningOptions { + if c == nil { + return nil + } + return c.CodeScanningOptions +} + +// GetCodeSecurity returns the CodeSecurity field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetCodeSecurity() string { + if c == nil || c.CodeSecurity == nil { + return "" + } + return *c.CodeSecurity +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetCreatedAt() Timestamp { if c == nil || c.CreatedAt == nil { @@ -2774,14 +3366,6 @@ func (c *CodeSecurityConfiguration) GetDependencyGraphAutosubmitActionOptions() return c.DependencyGraphAutosubmitActionOptions } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetDescription() string { - if c == nil || c.Description == nil { - return "" - } - return *c.Description -} - // GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetEnforcement() string { if c == nil || c.Enforcement == nil { @@ -2806,14 +3390,6 @@ func (c *CodeSecurityConfiguration) GetID() int64 { return *c.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CodeSecurityConfiguration) GetName() string { - if c == nil || c.Name == nil { - return "" - } - return *c.Name -} - // GetPrivateVulnerabilityReporting returns the PrivateVulnerabilityReporting field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { if c == nil || c.PrivateVulnerabilityReporting == nil { @@ -2822,6 +3398,14 @@ func (c *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting() string { return *c.PrivateVulnerabilityReporting } +// GetSecretProtection returns the SecretProtection field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretProtection() string { + if c == nil || c.SecretProtection == nil { + return "" + } + return *c.SecretProtection +} + // GetSecretScanning returns the SecretScanning field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanning() string { if c == nil || c.SecretScanning == nil { @@ -2830,6 +3414,22 @@ func (c *CodeSecurityConfiguration) GetSecretScanning() string { return *c.SecretScanning } +// GetSecretScanningDelegatedAlertDismissal returns the SecretScanningDelegatedAlertDismissal field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningDelegatedAlertDismissal() string { + if c == nil || c.SecretScanningDelegatedAlertDismissal == nil { + return "" + } + return *c.SecretScanningDelegatedAlertDismissal +} + +// GetSecretScanningGenericSecrets returns the SecretScanningGenericSecrets field if it's non-nil, zero value otherwise. +func (c *CodeSecurityConfiguration) GetSecretScanningGenericSecrets() string { + if c == nil || c.SecretScanningGenericSecrets == nil { + return "" + } + return *c.SecretScanningGenericSecrets +} + // GetSecretScanningNonProviderPatterns returns the SecretScanningNonProviderPatterns field if it's non-nil, zero value otherwise. func (c *CodeSecurityConfiguration) GetSecretScanningNonProviderPatterns() string { if c == nil || c.SecretScanningNonProviderPatterns == nil { @@ -3542,14 +4142,6 @@ func (c *Commit) GetSHA() string { return *c.SHA } -// GetStats returns the Stats field. -func (c *Commit) GetStats() *CommitStats { - if c == nil { - return nil - } - return c.Stats -} - // GetTree returns the Tree field. func (c *Commit) GetTree() *Tree { if c == nil { @@ -4046,2864 +4638,2720 @@ func (c *CommunityHealthMetrics) GetUpdatedAt() Timestamp { return *c.UpdatedAt } -// 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 +// 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 *c.ID + return *c.LastRequestID } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *ContentReference) GetNodeID() string { - if c == nil || c.NodeID == 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 *c.NodeID + return *c.Node } -// GetReference returns the Reference field if it's non-nil, zero value otherwise. -func (c *ContentReference) GetReference() string { - if c == nil || c.Reference == 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 *c.Reference + return *c.Body } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (c *ContentReferenceEvent) GetAction() string { - if c == nil || c.Action == 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 *c.Action + return *c.ConfigRunID } -// GetContentReference returns the ContentReference field. -func (c *ContentReferenceEvent) GetContentReference() *ContentReference { - if c == nil { - return 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 c.ContentReference + return *c.EventName } -// GetInstallation returns the Installation field. -func (c *ContentReferenceEvent) GetInstallation() *Installation { - if c == nil { - return 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 c.Installation + return *c.Hostname } -// GetRepo returns the Repo field. -func (c *ContentReferenceEvent) GetRepo() *Repository { - if c == 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 c.Repo + return *c.SeverityText } -// GetSender returns the Sender field. -func (c *ContentReferenceEvent) GetSender() *User { - if c == 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 c.Sender + return *c.SpanDepth } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetAvatarURL() string { - if c == nil || c.AvatarURL == 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 *c.AvatarURL + return *c.SpanID } -// GetContributions returns the Contributions field if it's non-nil, zero value otherwise. -func (c *Contributor) GetContributions() int { - if c == nil || c.Contributions == 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 *c.Contributions + return *c.SpanParentID } -// 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 "" +// 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 *c.Email + return *c.Timestamp } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetEventsURL() string { - if c == nil || c.EventsURL == 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 *c.EventsURL + return *c.Topology } -// GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowersURL() string { - if c == nil || c.FollowersURL == 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 *c.FollowersURL + return *c.TraceID } -// GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetFollowingURL() string { - if c == nil || c.FollowingURL == 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 *c.FollowingURL + return *c.LastRequestID } -// GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetGistsURL() string { - if c == nil || c.GistsURL == nil { +// 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 *c.GistsURL + return *c.RunID } -// 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 "" +// 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 *c.GravatarID + return *c.Running } -// 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 "" +// 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 *c.HTMLURL + return *c.Successful } -// 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 +// 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 *c.ID + return *c.Hostname } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *Contributor) GetLogin() string { - if c == nil || c.Login == 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 *c.Login + return *c.RunID } -// 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 "" +// 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 *c.Name + return *c.Running } -// 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 "" +// 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 *c.NodeID + return *c.Successful } -// GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetOrganizationsURL() string { - if c == nil || c.OrganizationsURL == 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 *c.OrganizationsURL + return *c.AdminPassword } -// GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReceivedEventsURL() string { - if c == nil || c.ReceivedEventsURL == nil { +// 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 *c.ReceivedEventsURL + return *c.Assets } -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (c *Contributor) GetReposURL() string { - if c == nil || c.ReposURL == 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 *c.ReposURL + return *c.AuthMode } -// 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 +// GetAvatar returns the Avatar field. +func (c *ConfigSettings) GetAvatar() *ConfigSettingsAvatar { + if c == nil { + return nil } - return *c.SiteAdmin + return c.Avatar } -// 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 "" +// GetCAS returns the CAS field. +func (c *ConfigSettings) GetCAS() *ConfigSettingsCAS { + if c == nil { + return nil } - return *c.StarredURL + return c.CAS } -// 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 "" +// GetCollectd returns the Collectd field. +func (c *ConfigSettings) GetCollectd() *ConfigSettingsCollectd { + if c == nil { + return nil } - return *c.SubscriptionsURL + return c.Collectd } -// 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 "" +// 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 *c.Type + return *c.ConfigurationID } -// 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 "" +// 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 *c.URL + return *c.ConfigurationRunCount } -// GetAuthor returns the Author field. -func (c *ContributorStats) GetAuthor() *Contributor { +// GetCustomer returns the Customer field. +func (c *ConfigSettings) GetCustomer() *ConfigSettingsCustomer { if c == nil { return nil } - return c.Author + return c.Customer } -// 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 +// 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 *c.Total + return *c.ExpireSessions } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotDotcomChatModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == 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 *c.CustomModelTrainingDate + return *c.GithubHostname } -// 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 "" +// GetGithubOAuth returns the GithubOAuth field. +func (c *ConfigSettings) GetGithubOAuth() *ConfigSettingsGithubOAuth { + if c == nil { + return nil } - return *c.CustomModelTrainingDate + return c.GithubOAuth } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotIDEChatModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == nil { +// GetGithubSSL returns the GithubSSL field. +func (c *ConfigSettings) GetGithubSSL() *ConfigSettingsGithubSSL { + if c == nil { + return nil + } + return c.GithubSSL +} + +// 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 *c.CustomModelTrainingDate + return *c.HTTPProxy } -// GetCustomModelTrainingDate returns the CustomModelTrainingDate field if it's non-nil, zero value otherwise. -func (c *CopilotIDECodeCompletionsModel) GetCustomModelTrainingDate() string { - if c == nil || c.CustomModelTrainingDate == 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 *c.CustomModelTrainingDate + return *c.IdenticonsHost } -// GetCopilotDotcomChat returns the CopilotDotcomChat field. -func (c *CopilotMetrics) GetCopilotDotcomChat() *CopilotDotcomChat { +// GetLDAP returns the LDAP field. +func (c *ConfigSettings) GetLDAP() *ConfigSettingsLDAP { if c == nil { return nil } - return c.CopilotDotcomChat + return c.LDAP } -// GetCopilotDotcomPullRequests returns the CopilotDotcomPullRequests field. -func (c *CopilotMetrics) GetCopilotDotcomPullRequests() *CopilotDotcomPullRequests { +// GetLicense returns the License field. +func (c *ConfigSettings) GetLicense() *ConfigSettingsLicenseSettings { if c == nil { return nil } - return c.CopilotDotcomPullRequests + return c.License } -// GetCopilotIDEChat returns the CopilotIDEChat field. -func (c *CopilotMetrics) GetCopilotIDEChat() *CopilotIDEChat { +// 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 *c.LoadBalancer +} + +// GetMapping returns the Mapping field. +func (c *ConfigSettings) GetMapping() *ConfigSettingsMapping { if c == nil { return nil } - return c.CopilotIDEChat + return c.Mapping } -// GetCopilotIDECodeCompletions returns the CopilotIDECodeCompletions field. -func (c *CopilotMetrics) GetCopilotIDECodeCompletions() *CopilotIDECodeCompletions { +// GetNTP returns the NTP field. +func (c *ConfigSettings) GetNTP() *ConfigSettingsNTP { if c == nil { return nil } - return c.CopilotIDECodeCompletions + return c.NTP } -// 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 +// GetPages returns the Pages field. +func (c *ConfigSettings) GetPages() *ConfigSettingsPagesSettings { + if c == nil { + return nil } - return *c.TotalActiveUsers + return c.Pages } -// 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 +// 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 *c.TotalEngagedUsers + return *c.PrivateMode } -// 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{} +// 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 *c.Since + return *c.PublicPages } -// 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{} +// GetSAML returns the SAML field. +func (c *ConfigSettings) GetSAML() *ConfigSettingsSAML { + if c == nil { + return nil } - return *c.Until + return c.SAML } -// GetSeatBreakdown returns the SeatBreakdown field. -func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { +// 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 *c.SignupEnabled +} + +// GetSMTP returns the SMTP field. +func (c *ConfigSettings) GetSMTP() *ConfigSettingsSMTP { if c == nil { return nil } - return c.SeatBreakdown + return c.SMTP } -// GetAssigningTeam returns the AssigningTeam field. -func (c *CopilotSeatDetails) GetAssigningTeam() *Team { +// GetSNMP returns the SNMP field. +func (c *ConfigSettings) GetSNMP() *ConfigSettingsSNMP { if c == nil { return nil } - return c.AssigningTeam + return c.SNMP } -// 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{} +// 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 *c.CreatedAt + return *c.SubdomainIsolation } -// 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{} +// GetSyslog returns the Syslog field. +func (c *ConfigSettings) GetSyslog() *ConfigSettingsSyslog { + if c == nil { + return nil } - return *c.LastActivityAt + return c.Syslog } -// GetLastActivityEditor returns the LastActivityEditor field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetLastActivityEditor() string { - if c == nil || c.LastActivityEditor == 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 *c.LastActivityEditor + return *c.Timezone } -// 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 "" +// 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 *c.PendingCancellationDate + return *c.Enabled } -// GetPlanType returns the PlanType field if it's non-nil, zero value otherwise. -func (c *CopilotSeatDetails) GetPlanType() string { - if c == nil || c.PlanType == 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 *c.PlanType + return *c.URI } -// 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{} +// 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 *c.UpdatedAt + return *c.URL } -// 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{} +// 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 *c.CompletedAt + return *c.Enabled } -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetConclusion() string { - if c == nil || c.Conclusion == 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 *c.Conclusion + return *c.Encryption } -// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetDetailsURL() string { - if c == nil || c.DetailsURL == 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 *c.DetailsURL + return *c.Password } -// 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 "" +// 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 *c.ExternalID + return *c.Port } -// GetOutput returns the Output field. -func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { - if c == 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 c.Output + return *c.Server } -// 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{} +// 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 *c.StartedAt + return *c.Username } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (c *CreateCheckRunOptions) GetStatus() string { - if c == nil || c.Status == 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 *c.Status + return *c.Email } -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (c *CreateCheckSuiteOptions) GetHeadBranch() string { - if c == nil || c.HeadBranch == 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 *c.HeadBranch + return *c.Name } -// GetClientIP returns the ClientIP field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetClientIP() string { - if c == nil || c.ClientIP == 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 *c.ClientIP + return *c.PublicKeyData } -// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetDevcontainerPath() string { - if c == nil || c.DevcontainerPath == 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 *c.DevcontainerPath + return *c.Secret } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetDisplayName() string { - if c == nil || c.DisplayName == nil { +// 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 *c.DisplayName + return *c.UUID } -// GetGeo returns the Geo field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetGeo() string { - if c == nil || c.Geo == 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 *c.Geo + return *c.ClientID } -// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetIdleTimeoutMinutes() int { - if c == nil || c.IdleTimeoutMinutes == nil { - return 0 +// 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 *c.IdleTimeoutMinutes + return *c.ClientSecret } -// GetMachine returns the Machine field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetMachine() string { - if c == nil || c.Machine == 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 *c.Machine + return *c.OrganizationName } -// 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 +// 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 *c.MultiRepoPermissionsOptOut + return *c.OrganizationTeam } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetRef() string { - if c == nil || c.Ref == 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 *c.Ref + return *c.Cert } -// 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 +// 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 *c.RetentionPeriodMinutes + return *c.Enabled } -// GetWorkingDirectory returns the WorkingDirectory field if it's non-nil, zero value otherwise. -func (c *CreateCodespaceOptions) GetWorkingDirectory() string { - if c == nil || c.WorkingDirectory == 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 *c.WorkingDirectory + return *c.Key } -// 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 +// 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 *c.AllowsPublicRepositories + return *c.AdminGroup } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { - if c == nil || c.Name == 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 *c.Name + return *c.BindDN } -// 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 +// 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 *c.RestrictedToWorkflows + return *c.Host } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (c *CreateEnterpriseRunnerGroupRequest) GetVisibility() string { - if c == nil || c.Visibility == 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 *c.Visibility + return *c.Method } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetDescription() string { - if c == nil || c.Description == 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 *c.Description + return *c.Password } -// GetInstallation returns the Installation field. -func (c *CreateEvent) GetInstallation() *Installation { - if c == 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 c.Installation + return *c.Port } -// 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 "" +// 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 *c.MasterBranch + return *c.PosixSupport } -// GetOrg returns the Org field. -func (c *CreateEvent) GetOrg() *Organization { +// GetProfile returns the Profile field. +func (c *ConfigSettingsLDAP) GetProfile() *ConfigSettingsLDAPProfile { if c == nil { return nil } - return c.Org + return c.Profile } -// 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 "" +// GetReconciliation returns the Reconciliation field. +func (c *ConfigSettingsLDAP) GetReconciliation() *ConfigSettingsLDAPReconciliation { + if c == nil { + return nil } - return *c.PusherType + return c.Reconciliation } -// 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 "" +// 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 *c.Ref + return *c.RecursiveGroupSearch } -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (c *CreateEvent) GetRefType() string { - if c == nil || c.RefType == 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 *c.RefType + return *c.SearchStrategy } -// GetRepo returns the Repo field. -func (c *CreateEvent) GetRepo() *Repository { - if c == nil { - return 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 c.Repo + return *c.SyncEnabled } -// GetSender returns the Sender field. -func (c *CreateEvent) GetSender() *User { - if c == nil { - return nil +// 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 c.Sender + return *c.TeamSyncInterval } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateOrgInvitationOptions) GetEmail() string { - if c == nil || c.Email == 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 *c.Email + return *c.UID } -// 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 +// 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 *c.InviteeID + return *c.UserSyncEmails } -// 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 "" +// 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 *c.Role + return *c.UserSyncInterval } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateCustomRepoRoleOptions) GetBaseRole() string { - if c == nil || c.BaseRole == nil { - return "" +// 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.BaseRole + return *c.UserSyncKeys } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateCustomRepoRoleOptions) GetDescription() string { - if c == nil || c.Description == nil { - return "" +// 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.Description + return *c.VirtualAttributeEnabled } -// 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 "" - } - return *c.Name -} - -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetBaseRole() string { - if c == nil || c.BaseRole == nil { +// 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 *c.BaseRole + return *c.Key } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string { - if c == nil || c.Description == nil { +// 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 *c.Description + return *c.Mail } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateOrUpdateOrgRoleOptions) GetName() string { +func (c *ConfigSettingsLDAPProfile) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } -// 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 +// 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 *c.From + return *c.UID } -// 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 +// 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 *c.AllowsPublicRepositories + return *c.Org } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetName() string { - if c == nil || c.Name == 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 *c.Name + return *c.User } -// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. -func (c *CreateRunnerGroupRequest) GetRestrictedToWorkflows() bool { - if c == nil || c.RestrictedToWorkflows == nil { +// 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 *c.RestrictedToWorkflows -} - -// 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 + return *c.ClusterSupport } -// GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetCanAdminsBypass() bool { - if c == nil || c.CanAdminsBypass == nil { +// 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 *c.CanAdminsBypass + return *c.Evaluation } -// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. -func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { - if c == 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 c.DeploymentBranchPolicy + return *c.ExpireAt } -// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { - if c == nil || c.PreventSelfReview == nil { +// 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 *c.PreventSelfReview + return *c.Perpetual } -// GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. -func (c *CreateUpdateEnvironment) GetWaitTimer() int { - if c == nil || c.WaitTimer == 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 *c.WaitTimer + return *c.Seats } -// 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 +// 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 *c.RepositoryID + return *c.SSHAllowed } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (c *CreateUpdateRequiredWorkflowOptions) GetScope() string { - if c == nil || c.Scope == 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 *c.Scope + return *c.SupportKey } -// GetSelectedRepositoryIDs returns the SelectedRepositoryIDs field. -func (c *CreateUpdateRequiredWorkflowOptions) GetSelectedRepositoryIDs() *SelectedRepoIDs { - if c == nil { - return nil +// 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 c.SelectedRepositoryIDs + return *c.UnlimitedSeating } -// GetWorkflowFilePath returns the WorkflowFilePath field if it's non-nil, zero value otherwise. -func (c *CreateUpdateRequiredWorkflowOptions) GetWorkflowFilePath() string { - if c == nil || c.WorkflowFilePath == 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 *c.WorkflowFilePath + return *c.Basemap } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (c *CreateUserProjectOptions) GetBody() string { - if c == nil || c.Body == nil { - return "" +// 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.Body + return *c.Enabled } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (c *CreateUserRequest) GetEmail() string { - if c == nil || c.Email == nil { +// 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 *c.Email + return *c.Tileserver } -// 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 +// 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 *c.Suspended + return *c.Token } -// 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{} +// 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 *c.Created + return *c.PrimaryServer } -// 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{} +// 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 *c.AuthorizedCredentialExpiresAt + return *c.SecondaryServer } -// 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 +// 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 *c.AuthorizedCredentialID + return *c.Enabled } -// GetAuthorizedCredentialNote returns the AuthorizedCredentialNote field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialNote() string { - if c == nil || c.AuthorizedCredentialNote == 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 *c.AuthorizedCredentialNote + return *c.Certificate } -// GetAuthorizedCredentialTitle returns the AuthorizedCredentialTitle field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetAuthorizedCredentialTitle() string { - if c == nil || c.AuthorizedCredentialTitle == 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 *c.AuthorizedCredentialTitle + return *c.CertificatePath } -// 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{} +// 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 *c.CredentialAccessedAt + return *c.DisableAdminDemote } -// 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{} +// 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 *c.CredentialAuthorizedAt + return *c.IDPInitiatedSSO } -// 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 +// 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 *c.CredentialID + return *c.Issuer } -// GetCredentialType returns the CredentialType field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetCredentialType() string { - if c == nil || c.CredentialType == 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 *c.CredentialType + return *c.SSOURL } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetFingerprint() string { - if c == nil || c.Fingerprint == nil { +// 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 *c.Fingerprint + return *c.Address } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (c *CredentialAuthorization) GetLogin() string { - if c == nil || c.Login == 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 *c.Login + return *c.Authentication } -// 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 "" +// 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 *c.TokenLastEight + return *c.DiscardToNoreplyAddress } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (c *Credit) GetType() string { - if c == nil || c.Type == 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 *c.Type + return *c.Domain } -// GetUser returns the User field. -func (c *Credit) GetUser() *User { - if c == nil { - return nil +// 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 c.User + return *c.Enabled } -// GetApp returns the App field. -func (c *CustomDeploymentProtectionRule) GetApp() *CustomDeploymentProtectionRuleApp { - if c == nil { - return nil +// 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 c.App + return *c.EnableStarttlsAuto } -// 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 +// 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 *c.Enabled + return *c.NoreplyAddress } -// 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 +// 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 *c.ID + return *c.Password } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRule) GetNodeID() string { - if c == nil || c.NodeID == 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 *c.NodeID + return *c.Port } -// 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 +// 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 *c.ID + return *c.SupportAddress } -// GetIntegrationURL returns the IntegrationURL field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetIntegrationURL() string { - if c == nil || c.IntegrationURL == nil { +// 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 *c.IntegrationURL + return *c.SupportAddressType } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetNodeID() string { - if c == nil || c.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 *c.NodeID + return *c.Username } -// GetSlug returns the Slug field if it's non-nil, zero value otherwise. -func (c *CustomDeploymentProtectionRuleApp) GetSlug() string { - if c == nil || c.Slug == 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 *c.Slug + return *c.UserName } -// 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 +// 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 *c.IntegrationID + return *c.Community } -// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetBaseRole() string { - if c == nil || c.BaseRole == nil { - return "" +// 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 *c.BaseRole + return *c.Enabled } -// 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{} +// 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 *c.CreatedAt + return *c.Enabled } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetDescription() string { - if c == nil || c.Description == 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 *c.Description + return *c.ProtocolName } -// 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 +// 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 *c.ID + return *c.Server } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) GetName() string { +func (c *ConnectionServiceItem) GetName() string { if c == nil || c.Name == nil { return "" } return *c.Name } -// GetOrg returns the Org field. -func (c *CustomOrgRoles) GetOrg() *Organization { - if c == 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 c.Org + return *c.Number } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (c *CustomOrgRoles) 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 *CustomOrgRoles) GetUpdatedAt() Timestamp { - if c == nil || c.UpdatedAt == nil { - return Timestamp{} +// 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 *c.UpdatedAt + return *c.ID } -// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDefaultValue() string { - if c == nil || c.DefaultValue == 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 *c.DefaultValue + return *c.NodeID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetDescription() string { - if c == nil || c.Description == 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 *c.Description + return *c.Reference } -// GetPropertyName returns the PropertyName field if it's non-nil, zero value otherwise. -func (c *CustomProperty) GetPropertyName() string { - if c == nil || c.PropertyName == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (c *ContentReferenceEvent) GetAction() string { + if c == nil || c.Action == nil { return "" } - return *c.PropertyName + return *c.Action } -// 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 +// GetContentReference returns the ContentReference field. +func (c *ContentReferenceEvent) GetContentReference() *ContentReference { + if c == nil { + return nil } - return *c.Required + return c.ContentReference } -// 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 "" +// GetInstallation returns the Installation field. +func (c *ContentReferenceEvent) GetInstallation() *Installation { + if c == nil { + return nil } - return *c.ValuesEditableBy + return c.Installation } -// 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 "" +// GetRepo returns the Repo field. +func (c *ContentReferenceEvent) GetRepo() *Repository { + if c == nil { + return nil } - return *c.BaseRole + return c.Repo } -// 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{} +// GetSender returns the Sender field. +func (c *ContentReferenceEvent) GetSender() *User { + if c == nil { + return nil } - return *c.CreatedAt + return c.Sender } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetDescription() string { - if c == nil || c.Description == 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 *c.Description + return *c.AvatarURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetID() int64 { - if c == nil || c.ID == 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 *c.ID + return *c.Contributions } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *CustomRepoRoles) GetName() string { - if c == nil || c.Name == 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 *c.Name -} - -// GetOrg returns the Org field. -func (c *CustomRepoRoles) GetOrg() *Organization { - if c == nil { - return nil - } - return c.Org + return *c.Email } -// 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{} +// 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 *c.UpdatedAt + return *c.EventsURL } -// GetQuerySuite returns the QuerySuite field if it's non-nil, zero value otherwise. -func (d *DefaultSetupConfiguration) GetQuerySuite() string { - if d == nil || d.QuerySuite == 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.QuerySuite + return *c.FollowersURL } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DefaultSetupConfiguration) GetState() string { - if d == nil || d.State == 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.State + return *c.FollowingURL } -// 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{} +// 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.UpdatedAt + return *c.GistsURL } -// 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 +// 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.CanApprovePullRequestReviews + return *c.GravatarID } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionEnterprise) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == nil { +// 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.DefaultWorkflowPermissions + return *c.HTMLURL } -// 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 +// 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.CanApprovePullRequestReviews + return *c.ID } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionOrganization) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == 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.DefaultWorkflowPermissions + return *c.Login } -// 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 +// 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.CanApprovePullRequestReviews + return *c.Name } -// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. -func (d *DefaultWorkflowPermissionRepository) GetDefaultWorkflowPermissions() string { - if d == nil || d.DefaultWorkflowPermissions == 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.DefaultWorkflowPermissions + return *c.NodeID } -// GetConfirmDeleteURL returns the ConfirmDeleteURL field if it's non-nil, zero value otherwise. -func (d *DeleteAnalysis) GetConfirmDeleteURL() string { - if d == nil || d.ConfirmDeleteURL == nil { +// 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.ConfirmDeleteURL + return *c.OrganizationsURL } -// GetNextAnalysisURL returns the NextAnalysisURL field if it's non-nil, zero value otherwise. -func (d *DeleteAnalysis) GetNextAnalysisURL() string { - if d == nil || d.NextAnalysisURL == 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.NextAnalysisURL + return *c.ReceivedEventsURL } -// GetInstallation returns the Installation field. -func (d *DeleteEvent) GetInstallation() *Installation { - if d == nil { - return nil +// 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.Installation + return *c.ReposURL } -// GetOrg returns the Org field. -func (d *DeleteEvent) GetOrg() *Organization { - if d == nil { - return nil +// 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.Org + return *c.SiteAdmin } -// GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetPusherType() string { - if d == nil || d.PusherType == 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 *d.PusherType + return *c.StarredURL } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRef() string { - if d == nil || d.Ref == 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 *d.Ref + return *c.SubscriptionsURL } -// GetRefType returns the RefType field if it's non-nil, zero value otherwise. -func (d *DeleteEvent) GetRefType() string { - if d == nil || d.RefType == 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 *d.RefType + return *c.Type } -// GetRepo returns the Repo field. -func (d *DeleteEvent) GetRepo() *Repository { - if d == 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 d.Repo + return *c.URL } -// GetSender returns the Sender field. -func (d *DeleteEvent) GetSender() *User { - if d == nil { +// GetAuthor returns the Author field. +func (c *ContributorStats) GetAuthor() *Contributor { + if c == nil { return nil } - return d.Sender + return c.Author } -// 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{} +// 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 *d.AutoDismissedAt + return *c.Total } -// 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{} +// 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 *d.CreatedAt + return *c.CustomModelTrainingDate } -// GetDependency returns the Dependency field. -func (d *DependabotAlert) GetDependency() *Dependency { - if d == nil { - return nil +// 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 d.Dependency + return *c.CustomModelTrainingDate } -// 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{} +// 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 *d.DismissedAt + return *c.CustomModelTrainingDate } -// GetDismissedBy returns the DismissedBy field. -func (d *DependabotAlert) GetDismissedBy() *User { - if d == nil { +// 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 *c.CustomModelTrainingDate +} + +// GetCopilotDotcomChat returns the CopilotDotcomChat field. +func (c *CopilotMetrics) GetCopilotDotcomChat() *CopilotDotcomChat { + if c == nil { return nil } - return d.DismissedBy + return c.CopilotDotcomChat } -// 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 "" +// GetCopilotDotcomPullRequests returns the CopilotDotcomPullRequests field. +func (c *CopilotMetrics) GetCopilotDotcomPullRequests() *CopilotDotcomPullRequests { + if c == nil { + return nil } - return *d.DismissedComment + return c.CopilotDotcomPullRequests } -// 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 "" +// GetCopilotIDEChat returns the CopilotIDEChat field. +func (c *CopilotMetrics) GetCopilotIDEChat() *CopilotIDEChat { + if c == nil { + return nil } - return *d.DismissedReason + return c.CopilotIDEChat } -// 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{} +// GetCopilotIDECodeCompletions returns the CopilotIDECodeCompletions field. +func (c *CopilotMetrics) GetCopilotIDECodeCompletions() *CopilotIDECodeCompletions { + if c == nil { + return nil } - return *d.FixedAt + return c.CopilotIDECodeCompletions } -// 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 "" +// 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 *d.HTMLURL + return *c.TotalActiveUsers } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetNumber() int { - if d == nil || d.Number == nil { +// 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 *d.Number + return *c.TotalEngagedUsers } -// GetRepository returns the Repository field. -func (d *DependabotAlert) GetRepository() *Repository { - if d == 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 d.Repository + return *c.Since } -// GetSecurityAdvisory returns the SecurityAdvisory field. -func (d *DependabotAlert) GetSecurityAdvisory() *DependabotSecurityAdvisory { - if d == 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 d.SecurityAdvisory + return *c.Until } -// GetSecurityVulnerability returns the SecurityVulnerability field. -func (d *DependabotAlert) GetSecurityVulnerability() *AdvisoryVulnerability { - if d == nil { +// GetSeatBreakdown returns the SeatBreakdown field. +func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { + if c == nil { return nil } - return d.SecurityVulnerability + return c.SeatBreakdown } -// 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 "" +// GetAssigningTeam returns the AssigningTeam field. +func (c *CopilotSeatDetails) GetAssigningTeam() *Team { + if c == nil { + return nil } - return *d.State + return c.AssigningTeam } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (d *DependabotAlert) GetUpdatedAt() Timestamp { - if d == nil || d.UpdatedAt == 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 *d.UpdatedAt + return *c.CreatedAt } -// 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 "" +// 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 *d.URL + return *c.LastActivityAt } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DependabotAlertEvent) GetAction() string { - if d == nil || d.Action == nil { +// 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 *d.Action + return *c.LastActivityEditor } -// GetAlert returns the Alert field. -func (d *DependabotAlertEvent) GetAlert() *DependabotAlert { - if d == nil { - return nil +// 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 d.Alert + return *c.PendingCancellationDate } -// GetEnterprise returns the Enterprise field. -func (d *DependabotAlertEvent) GetEnterprise() *Enterprise { - if d == nil { - return nil +// 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 d.Enterprise + return *c.PlanType } -// GetInstallation returns the Installation field. -func (d *DependabotAlertEvent) GetInstallation() *Installation { - if d == nil { - return nil +// 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 d.Installation + return *c.UpdatedAt } -// GetOrganization returns the Organization field. -func (d *DependabotAlertEvent) GetOrganization() *Organization { - if d == nil { - return nil +// 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 d.Organization + return *c.AzureSubscription } -// GetRepo returns the Repo field. -func (d *DependabotAlertEvent) GetRepo() *Repository { - if d == nil { - return nil +// 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 d.Repo + return *c.State } -// GetSender returns the Sender field. -func (d *DependabotAlertEvent) GetSender() *User { - if d == nil { - return nil +// 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 d.Sender + return *c.CompletedAt } -// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedComment() string { - if d == nil || d.DismissedComment == nil { +// 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 *d.DismissedComment + return *c.Conclusion } -// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. -func (d *DependabotAlertState) GetDismissedReason() string { - if d == nil || d.DismissedReason == nil { +// 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 *d.DismissedReason + return *c.DetailsURL } -// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetCVEID() string { - if d == nil || d.CVEID == nil { +// 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 *d.CVEID + return *c.ExternalID } -// GetCVSS returns the CVSS field. -func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { - if d == nil { +// GetOutput returns the Output field. +func (c *CreateCheckRunOptions) GetOutput() *CheckRunOutput { + if c == nil { return nil } - return d.CVSS -} - -// 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 -} - -// 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 + return c.Output } -// GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetPublishedAt() Timestamp { - if d == nil || d.PublishedAt == nil { +// 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 *d.PublishedAt + return *c.StartedAt } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetSeverity() string { - if d == nil || d.Severity == nil { +// 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 *d.Severity + return *c.Status } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityAdvisory) GetSummary() string { - if d == nil || d.Summary == nil { +// 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 *d.Summary + return *c.HeadBranch } -// 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{} +// 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 *d.UpdatedAt + return *c.ClientIP } -// 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{} +// GetDevcontainerPath returns the DevcontainerPath field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetDevcontainerPath() string { + if c == nil || c.DevcontainerPath == nil { + return "" } - return *d.WithdrawnAt + return *c.DevcontainerPath } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (d *DependabotSecurityUpdates) GetStatus() string { - if d == nil || d.Status == nil { +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetDisplayName() string { + if c == nil || c.DisplayName == nil { return "" } - return *d.Status + return *c.DisplayName } -// GetManifestPath returns the ManifestPath field if it's non-nil, zero value otherwise. -func (d *Dependency) GetManifestPath() string { - if d == nil || d.ManifestPath == nil { +// GetGeo returns the Geo field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetGeo() string { + if c == nil || c.Geo == nil { return "" } - return *d.ManifestPath + return *c.Geo } -// GetPackage returns the Package field. -func (d *Dependency) GetPackage() *VulnerabilityPackage { - if d == nil { - return nil +// GetIdleTimeoutMinutes returns the IdleTimeoutMinutes field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetIdleTimeoutMinutes() int { + if c == nil || c.IdleTimeoutMinutes == nil { + return 0 } - return d.Package + return *c.IdleTimeoutMinutes } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (d *Dependency) GetScope() string { - if d == nil || d.Scope == nil { +// GetMachine returns the Machine field if it's non-nil, zero value otherwise. +func (c *CreateCodespaceOptions) GetMachine() string { + if c == nil || c.Machine == nil { return "" } - return *d.Scope + return *c.Machine } -// GetLabeledRunners returns the LabeledRunners field if it's non-nil, zero value otherwise. -func (d *DependencyGraphAutosubmitActionOptions) GetLabeledRunners() bool { - if d == nil || d.LabeledRunners == nil { +// 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 } - return *d.LabeledRunners + return *c.MultiRepoPermissionsOptOut } -// GetDetector returns the Detector field. -func (d *DependencyGraphSnapshot) GetDetector() *DependencyGraphSnapshotDetector { - if d == nil { - return nil +// 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 "" } - return d.Detector + return *c.Ref } -// GetJob returns the Job field. -func (d *DependencyGraphSnapshot) GetJob() *DependencyGraphSnapshotJob { - if d == nil { - return nil +// 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 } - return d.Job + return *c.RetentionPeriodMinutes } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshot) GetRef() string { - if d == nil || d.Ref == nil { +// 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 "" } - return *d.Ref + return *c.WorkingDirectory } -// 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{} +// 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 *d.Scanned + return *c.AllowsPublicRepositories } -// GetSha returns the Sha field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshot) GetSha() string { - if d == nil || d.Sha == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { + if c == nil || c.Name == nil { return "" } - return *d.Sha + return *c.Name } -// 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{} +// 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 *d.CreatedAt + return *c.RestrictedToWorkflows } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotCreationData) GetMessage() string { - if d == nil || d.Message == nil { +// 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 *d.Message + return *c.Visibility } -// GetResult returns the Result field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotCreationData) GetResult() string { - if d == nil || d.Result == nil { +// 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 *d.Result + return *c.Description } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotDetector) GetName() string { - if d == nil || d.Name == nil { - return "" +// GetInstallation returns the Installation field. +func (c *CreateEvent) GetInstallation() *Installation { + if c == nil { + return nil } - return *d.Name + return c.Installation } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotDetector) GetURL() string { - if d == nil || d.URL == nil { +// 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 *d.URL + return *c.MasterBranch } -// 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 "" +// GetOrg returns the Org field. +func (c *CreateEvent) GetOrg() *Organization { + if c == nil { + return nil } - return *d.Version + return c.Org } -// GetCorrelator returns the Correlator field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetCorrelator() string { - if d == nil || d.Correlator == nil { +// 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 *d.Correlator + return *c.PusherType } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { +// 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 *d.HTMLURL + return *c.Ref } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotJob) GetID() string { - if d == nil || d.ID == nil { +// 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 *d.ID + return *c.RefType } -// GetFile returns the File field. -func (d *DependencyGraphSnapshotManifest) GetFile() *DependencyGraphSnapshotManifestFile { - if d == nil { +// GetRepo returns the Repo field. +func (c *CreateEvent) GetRepo() *Repository { + if c == nil { return nil } - return d.File + return c.Repo } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotManifest) GetName() string { - if d == nil || d.Name == nil { - return "" +// GetSender returns the Sender field. +func (c *CreateEvent) GetSender() *User { + if c == nil { + return nil } - return *d.Name + return c.Sender } -// GetSourceLocation returns the SourceLocation field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotManifestFile) GetSourceLocation() string { - if d == nil || d.SourceLocation == nil { +// 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 *d.SourceLocation + return *c.Username } -// GetPackageURL returns the PackageURL field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotResolvedDependency) GetPackageURL() string { - if d == nil || d.PackageURL == nil { +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CreateOrgInvitationOptions) GetEmail() string { + if c == nil || c.Email == nil { return "" } - return *d.PackageURL + return *c.Email } -// 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 "" +// GetInviteeID returns the InviteeID field if it's non-nil, zero value otherwise. +func (c *CreateOrgInvitationOptions) GetInviteeID() int64 { + if c == nil || c.InviteeID == nil { + return 0 } - return *d.Relationship + return *c.InviteeID } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (d *DependencyGraphSnapshotResolvedDependency) GetScope() string { - if d == nil || d.Scope == nil { +// 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 "" } - return *d.Scope + return *c.Role } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeployKeyEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateCustomRepoRoleOptions) GetBaseRole() string { + if c == nil || c.BaseRole == 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.BaseRole } -// GetKey returns the Key field. -func (d *DeployKeyEvent) GetKey() *Key { - if d == nil { - return nil +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateCustomRepoRoleOptions) GetDescription() string { + if c == nil || c.Description == nil { + return "" } - return d.Key + return *c.Description } -// GetOrganization returns the Organization field. -func (d *DeployKeyEvent) GetOrganization() *Organization { - if d == nil { - return nil +// 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 "" } - return d.Organization + return *c.Name } -// GetRepo returns the Repo field. -func (d *DeployKeyEvent) GetRepo() *Repository { - if d == nil { - return nil +// 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 d.Repo + return *c.Color } -// GetSender returns the Sender field. -func (d *DeployKeyEvent) GetSender() *User { - if d == nil { - return nil +// 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 d.Sender + return *c.Description } -// 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{} +// 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 *d.CreatedAt + return *c.IsPrivate } -// GetCreator returns the Creator field. -func (d *Deployment) GetCreator() *User { - if d == nil { - return nil +// 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 "" } - return d.Creator + return *c.BaseRole } // GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *Deployment) GetDescription() string { - if d == nil || d.Description == nil { +func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string { + if c == nil || c.Description == nil { return "" } - return *d.Description + return *c.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 { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateOrgRoleOptions) GetName() string { + if c == nil || c.Name == nil { return "" } - return *d.Environment + return *c.Name } -// 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 +// 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 *d.ID + return *c.From } -// 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 "" +// 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 *d.NodeID + return *c.AllowsPublicRepositories } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRef() string { - if d == nil || d.Ref == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateRunnerGroupRequest) GetName() string { + if c == nil || c.Name == nil { return "" } - return *d.Ref + return *c.Name } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { +// 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 *d.RepositoryURL + return *c.NetworkConfigurationID } -// 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 "" +// 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 *d.SHA + return *c.RestrictedToWorkflows } -// GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise. -func (d *Deployment) GetStatusesURL() string { - if d == nil || d.StatusesURL == nil { +// 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 *d.StatusesURL + return *c.Visibility } -// 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 "" +// GetTagger returns the Tagger field. +func (c *CreateTag) GetTagger() *CommitAuthor { + if c == nil { + return nil } - return *d.Task + return c.Tagger } -// 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{} +// 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 *d.UpdatedAt + return *c.CanAdminsBypass } -// 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 "" +// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. +func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { + if c == nil { + return nil } - return *d.URL + return c.DeploymentBranchPolicy } -// 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 +// 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 *d.ID + return *c.PreventSelfReview } -// 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 "" +// 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 *d.Name + return *c.WaitTimer } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DeploymentBranchPolicy) GetNodeID() string { - if d == nil || d.NodeID == nil { +// 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 *d.NodeID + return *c.Email } -// 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 "" +// 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 *d.Type + return *c.Suspended } -// 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 "" +// 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 *d.Name + return c.Inputs } -// 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 "" +// 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 *d.Type + return *c.Created } -// 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 +// 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 d.Deployment + return *c.AuthorizedCredentialExpiresAt } -// GetInstallation returns the Installation field. -func (d *DeploymentEvent) GetInstallation() *Installation { - if d == nil { - return nil +// 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 d.Installation + return *c.AuthorizedCredentialID } -// GetOrg returns the Org field. -func (d *DeploymentEvent) GetOrg() *Organization { - if d == nil { - return nil +// 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 d.Org + return *c.AuthorizedCredentialNote } -// GetRepo returns the Repo field. -func (d *DeploymentEvent) GetRepo() *Repository { - if d == nil { - return nil +// 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 d.Repo + return *c.AuthorizedCredentialTitle } -// GetSender returns the Sender field. -func (d *DeploymentEvent) GetSender() *User { - if d == nil { - return nil +// 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 d.Sender + return *c.CredentialAccessedAt } -// GetWorkflow returns the Workflow field. -func (d *DeploymentEvent) GetWorkflow() *Workflow { - if d == nil { - return nil +// 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 d.Workflow + return *c.CredentialAuthorizedAt } -// GetWorkflowRun returns the WorkflowRun field. -func (d *DeploymentEvent) GetWorkflowRun() *WorkflowRun { - if d == nil { - return nil +// 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 d.WorkflowRun + return *c.CredentialID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetAction() string { - if d == nil || d.Action == nil { +// 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 *d.Action + return *c.CredentialType } -// GetDeployment returns the Deployment field. -func (d *DeploymentProtectionRuleEvent) GetDeployment() *Deployment { - if d == nil { - return nil +// 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 d.Deployment + return *c.Fingerprint } -// GetDeploymentCallbackURL returns the DeploymentCallbackURL field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetDeploymentCallbackURL() string { - if d == nil || d.DeploymentCallbackURL == nil { +// 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 *d.DeploymentCallbackURL + return *c.Login } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetEnvironment() string { - if d == nil || d.Environment == nil { +// 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 *d.Environment + return *c.TokenLastEight } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (d *DeploymentProtectionRuleEvent) GetEvent() string { - if d == nil || d.Event == nil { +// 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 *d.Event + return *c.Type } -// GetInstallation returns the Installation field. -func (d *DeploymentProtectionRuleEvent) GetInstallation() *Installation { - if d == nil { +// GetUser returns the User field. +func (c *Credit) GetUser() *User { + if c == nil { return nil } - return d.Installation + return c.User } -// GetOrganization returns the Organization field. -func (d *DeploymentProtectionRuleEvent) GetOrganization() *Organization { - if d == nil { +// GetApp returns the App field. +func (c *CustomDeploymentProtectionRule) GetApp() *CustomDeploymentProtectionRuleApp { + if c == nil { return nil } - return d.Organization + return c.App } -// GetRepo returns the Repo field. -func (d *DeploymentProtectionRuleEvent) GetRepo() *Repository { - if d == nil { - return nil +// 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 d.Repo + return *c.Enabled } -// GetSender returns the Sender field. -func (d *DeploymentProtectionRuleEvent) GetSender() *User { - if d == nil { - return nil +// 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 d.Sender + return *c.ID } -// 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 +// 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 *d.AutoMerge + return *c.NodeID } -// 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 "" +// 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 *d.Description + return *c.ID } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { +// 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 *d.Environment + return *c.IntegrationURL } -// 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 +// 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 *d.ProductionEnvironment + return *c.NodeID } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRef() string { - if d == nil || d.Ref == nil { +// 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 *d.Ref + return *c.Slug } -// GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetRequiredContexts() []string { - if d == nil || d.RequiredContexts == nil { - return nil +// 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 *d.RequiredContexts + return *c.IntegrationID } -// GetTask returns the Task field if it's non-nil, zero value otherwise. -func (d *DeploymentRequest) GetTask() string { - if d == nil || d.Task == nil { +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CustomOrgRoles) GetBaseRole() string { + if c == nil || c.BaseRole == nil { return "" } - return *d.Task + return *c.BaseRole } -// 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 +// 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{} } - return *d.TransientEnvironment + return *c.CreatedAt } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetAction() string { - if d == nil || d.Action == nil { +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CustomOrgRoles) GetDescription() string { + if c == nil || c.Description == nil { return "" } - return *d.Action + return *c.Description } -// GetApprover returns the Approver field. -func (d *DeploymentReviewEvent) GetApprover() *User { - if d == nil { - return nil +// 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 } - return d.Approver + return *c.ID } -// GetComment returns the Comment field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetComment() string { - if d == nil || d.Comment == nil { +// 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 "" } - return *d.Comment + return *c.Name } -// GetEnterprise returns the Enterprise field. -func (d *DeploymentReviewEvent) GetEnterprise() *Enterprise { - if d == nil { +// GetOrg returns the Org field. +func (c *CustomOrgRoles) GetOrg() *Organization { + if c == nil { return nil } - return d.Enterprise + return c.Org } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetEnvironment() string { - if d == nil || d.Environment == nil { +// GetSource returns the Source field if it's non-nil, zero value otherwise. +func (c *CustomOrgRoles) GetSource() string { + if c == nil || c.Source == 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 + return *c.Source } -// GetSender returns the Sender field. -func (d *DeploymentReviewEvent) GetSender() *User { - if d == nil { - return nil +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CustomOrgRoles) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} } - return d.Sender + return *c.UpdatedAt } -// GetSince returns the Since field if it's non-nil, zero value otherwise. -func (d *DeploymentReviewEvent) GetSince() string { - if d == nil || d.Since == nil { +// GetPatternScope returns the PatternScope field if it's non-nil, zero value otherwise. +func (c *CustomPatternBackfillScan) GetPatternScope() string { + if c == nil || c.PatternScope == nil { return "" } - return *d.Since -} - -// GetWorkflowJobRun returns the WorkflowJobRun field. -func (d *DeploymentReviewEvent) GetWorkflowJobRun() *WorkflowJobRun { - if d == nil { - return nil - } - return d.WorkflowJobRun -} - -// GetWorkflowRun returns the WorkflowRun field. -func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { - if d == nil { - return nil - } - return d.WorkflowRun -} - -// 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 + return *c.PatternScope } -// GetCreator returns the Creator field. -func (d *DeploymentStatus) GetCreator() *User { - if d == nil { - return nil +// 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 d.Creator + return *c.PatternSlug } -// GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDeploymentURL() string { - if d == nil || d.DeploymentURL == nil { +// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetDefaultValue() string { + if c == nil || c.DefaultValue == nil { return "" } - return *d.DeploymentURL + return *c.DefaultValue } // GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetDescription() string { - if d == nil || d.Description == nil { +func (c *CustomProperty) GetDescription() string { + if c == nil || c.Description == nil { return "" } - return *d.Description + return *c.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 { +// 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 *d.Environment + return *c.PropertyName } -// 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 "" +// 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 *d.EnvironmentURL + return *c.Required } -// 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 +// 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 *d.ID + return *c.SourceType } -// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetLogURL() string { - if d == nil || d.LogURL == nil { +// 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 *d.LogURL + return *c.URL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetNodeID() string { - if d == nil || d.NodeID == nil { +// 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 *d.NodeID + return *c.ValuesEditableBy } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatus) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { +// 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 *d.RepositoryURL + return *c.Action } -// 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 "" +// GetDefinition returns the Definition field. +func (c *CustomPropertyEvent) GetDefinition() *CustomProperty { + if c == nil { + return nil } - return *d.State + return c.Definition } -// 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 "" +// GetEnterprise returns the Enterprise field. +func (c *CustomPropertyEvent) GetEnterprise() *Enterprise { + if c == nil { + return nil } - return *d.TargetURL + return c.Enterprise } -// 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{} +// GetInstallation returns the Installation field. +func (c *CustomPropertyEvent) GetInstallation() *Installation { + if c == nil { + return nil } - return *d.UpdatedAt + return c.Installation } -// 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 "" +// GetOrg returns the Org field. +func (c *CustomPropertyEvent) GetOrg() *Organization { + if c == nil { + return nil } - return *d.URL + return c.Org } -// 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 "" +// GetSender returns the Sender field. +func (c *CustomPropertyEvent) GetSender() *User { + if c == nil { + return nil } - return *d.Action + return c.Sender } -// GetDeployment returns the Deployment field. -func (d *DeploymentStatusEvent) GetDeployment() *Deployment { - if d == nil { - return nil +// 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 d.Deployment + return *c.Action } -// GetDeploymentStatus returns the DeploymentStatus field. -func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus { - if d == nil { +// GetEnterprise returns the Enterprise field. +func (c *CustomPropertyValuesEvent) GetEnterprise() *Enterprise { + if c == nil { return nil } - return d.DeploymentStatus + return c.Enterprise } // GetInstallation returns the Installation field. -func (d *DeploymentStatusEvent) GetInstallation() *Installation { - if d == nil { +func (c *CustomPropertyValuesEvent) GetInstallation() *Installation { + if c == nil { return nil } - return d.Installation + return c.Installation } // GetOrg returns the Org field. -func (d *DeploymentStatusEvent) GetOrg() *Organization { - if d == nil { +func (c *CustomPropertyValuesEvent) GetOrg() *Organization { + if c == nil { return nil } - return d.Org + return c.Org } // GetRepo returns the Repo field. -func (d *DeploymentStatusEvent) GetRepo() *Repository { - if d == nil { +func (c *CustomPropertyValuesEvent) GetRepo() *Repository { + if c == nil { return nil } - return d.Repo + return c.Repo } // GetSender returns the Sender field. -func (d *DeploymentStatusEvent) GetSender() *User { - if d == nil { +func (c *CustomPropertyValuesEvent) GetSender() *User { + if c == nil { return nil } - return d.Sender + return c.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 +// 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 *d.AutoInactive + return *c.BaseRole } -// 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 "" +// 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 *d.Description + return *c.CreatedAt } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetEnvironment() string { - if d == nil || d.Environment == nil { +// 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 *d.Environment + return *c.Description } -// 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 "" +// 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 *d.EnvironmentURL + return *c.ID } -// GetLogURL returns the LogURL field if it's non-nil, zero value otherwise. -func (d *DeploymentStatusRequest) GetLogURL() string { - if d == nil || d.LogURL == nil { +// 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 *d.LogURL + return *c.Name } -// 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 "" +// GetOrg returns the Org field. +func (c *CustomRepoRoles) GetOrg() *Organization { + if c == nil { + return nil } - return *d.State + return c.Org } -// 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 "" +// 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 *d.ActiveLockReason + return *c.UpdatedAt } -// 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{} +// 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.AnswerChosenAt + return *d.QuerySuite } -// GetAnswerChosenBy returns the AnswerChosenBy field if it's non-nil, zero value otherwise. -func (d *Discussion) GetAnswerChosenBy() string { - if d == nil || d.AnswerChosenBy == nil { +// 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.AnswerChosenBy + return *d.State } -// 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 "" +// 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.AnswerHTMLURL + return *d.UpdatedAt } -// 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 "" +// 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.AuthorAssociation + return *d.CanApprovePullRequestReviews } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *Discussion) GetBody() string { - if d == nil || d.Body == nil { +// 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.Body + return *d.DefaultWorkflowPermissions } -// 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 +// 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.Comments + return *d.CanApprovePullRequestReviews } -// 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{} +// 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.CreatedAt + return *d.DefaultWorkflowPermissions } -// GetDiscussionCategory returns the DiscussionCategory field. -func (d *Discussion) GetDiscussionCategory() *DiscussionCategory { - if d == nil { - return nil +// 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.DiscussionCategory + return *d.CanApprovePullRequestReviews } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *Discussion) GetHTMLURL() string { - if d == nil || d.HTMLURL == nil { +// 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.HTMLURL + return *d.DefaultWorkflowPermissions } -// 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 +// 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.ID + return *d.ConfirmDeleteURL } -// 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 +// 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.Locked + return *d.NextAnalysisURL } -// 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 "" +// GetInstallation returns the Installation field. +func (d *DeleteEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *d.NodeID + return d.Installation } -// 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 +// GetOrg returns the Org field. +func (d *DeleteEvent) GetOrg() *Organization { + if d == nil { + return nil } - return *d.Number + return d.Org } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (d *Discussion) GetRepositoryURL() string { - if d == nil || d.RepositoryURL == nil { +// 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.RepositoryURL + return *d.PusherType } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *Discussion) GetState() string { - if d == nil || d.State == nil { +// 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.State + return *d.Ref } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (d *Discussion) GetTitle() string { - if d == nil || d.Title == nil { +// 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.Title + return *d.RefType } -// 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{} +// GetRepo returns the Repo field. +func (d *DeleteEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *d.UpdatedAt + return d.Repo } -// GetUser returns the User field. -func (d *Discussion) GetUser() *User { +// GetSender returns the Sender field. +func (d *DeleteEvent) GetSender() *User { if d == nil { return nil } - return d.User + 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 *DiscussionCategory) GetCreatedAt() Timestamp { +func (d *DependabotAlert) 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 "" +// GetDependency returns the Dependency field. +func (d *DependabotAlert) GetDependency() *Dependency { + if d == nil { + return nil } - return *d.Description + return d.Dependency } -// 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 "" +// 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.Emoji + return *d.DismissedAt } -// 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 +// GetDismissedBy returns the DismissedBy field. +func (d *DependabotAlert) GetDismissedBy() *User { + if d == nil { + return nil } - return *d.ID + return d.DismissedBy } -// 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 +// 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.IsAnswerable + return *d.DismissedComment } -// 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 { +// 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.BodyVersion + return *d.DismissedReason } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetCreatedAt() Timestamp { - if d == nil || d.CreatedAt == nil { +// 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.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 + return *d.FixedAt } // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetHTMLURL() string { +func (d *DependabotAlert) 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{} +// 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.LastEditedAt + return *d.Number } -// 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 "" +// GetRepository returns the Repository field. +func (d *DependabotAlert) GetRepository() *Repository { + if d == nil { + return nil } - return *d.NodeID + return d.Repository } -// 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 +// GetSecurityAdvisory returns the SecurityAdvisory field. +func (d *DependabotAlert) GetSecurityAdvisory() *DependabotSecurityAdvisory { + if d == nil { + return nil } - return *d.Number + return d.SecurityAdvisory } -// GetReactions returns the Reactions field. -func (d *DiscussionComment) GetReactions() *Reactions { +// GetSecurityVulnerability returns the SecurityVulnerability field. +func (d *DependabotAlert) GetSecurityVulnerability() *AdvisoryVulnerability { if d == nil { return nil } - return d.Reactions + 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 *DiscussionComment) GetUpdatedAt() Timestamp { +func (d *DependabotAlert) GetUpdatedAt() Timestamp { if d == nil || d.UpdatedAt == nil { return Timestamp{} } @@ -6911,7 +7359,7 @@ func (d *DiscussionComment) GetUpdatedAt() Timestamp { } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (d *DiscussionComment) GetURL() string { +func (d *DependabotAlert) GetURL() string { if d == nil || d.URL == nil { return "" } @@ -6919,47 +7367,47 @@ func (d *DiscussionComment) GetURL() string { } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DiscussionCommentEvent) GetAction() string { +func (d *DependabotAlertEvent) GetAction() string { if d == nil || d.Action == nil { return "" } return *d.Action } -// GetComment returns the Comment field. -func (d *DiscussionCommentEvent) GetComment() *CommentDiscussion { +// GetAlert returns the Alert field. +func (d *DependabotAlertEvent) GetAlert() *DependabotAlert { if d == nil { return nil } - return d.Comment + return d.Alert } -// GetDiscussion returns the Discussion field. -func (d *DiscussionCommentEvent) GetDiscussion() *Discussion { +// GetEnterprise returns the Enterprise field. +func (d *DependabotAlertEvent) GetEnterprise() *Enterprise { if d == nil { return nil } - return d.Discussion + return d.Enterprise } // GetInstallation returns the Installation field. -func (d *DiscussionCommentEvent) GetInstallation() *Installation { +func (d *DependabotAlertEvent) GetInstallation() *Installation { if d == nil { return nil } return d.Installation } -// GetOrg returns the Org field. -func (d *DiscussionCommentEvent) GetOrg() *Organization { +// GetOrganization returns the Organization field. +func (d *DependabotAlertEvent) GetOrganization() *Organization { if d == nil { return nil } - return d.Org + return d.Organization } // GetRepo returns the Repo field. -func (d *DiscussionCommentEvent) GetRepo() *Repository { +func (d *DependabotAlertEvent) GetRepo() *Repository { if d == nil { return nil } @@ -6967,7967 +7415,10479 @@ func (d *DiscussionCommentEvent) GetRepo() *Repository { } // GetSender returns the Sender field. -func (d *DiscussionCommentEvent) GetSender() *User { +func (d *DependabotAlertEvent) GetSender() *User { if d == nil { return nil } return d.Sender } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (d *DiscussionEvent) GetAction() string { - if d == nil || d.Action == nil { +// 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.Action + return *d.DismissedComment } -// GetDiscussion returns the Discussion field. -func (d *DiscussionEvent) GetDiscussion() *Discussion { - if d == nil { - return nil +// 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.Discussion + return *d.DismissedReason } -// GetInstallation returns the Installation field. -func (d *DiscussionEvent) GetInstallation() *Installation { - if d == nil { - return nil +// 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.Installation + return *d.CVEID } -// GetOrg returns the Org field. -func (d *DiscussionEvent) GetOrg() *Organization { +// GetCVSS returns the CVSS field. +func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { if d == nil { return nil } - return d.Org + return d.CVSS } -// GetRepo returns the Repo field. -func (d *DiscussionEvent) GetRepo() *Repository { - if d == nil { - return nil +// 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.Repo + return *d.Description } -// GetSender returns the Sender field. -func (d *DiscussionEvent) GetSender() *User { +// GetEPSS returns the EPSS field. +func (d *DependabotSecurityAdvisory) GetEPSS() *AdvisoryEPSS { if d == nil { return nil } - return d.Sender + return d.EPSS } -// 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 +// 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.Apps + return *d.GHSAID } -// 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 +// 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.Teams + return *d.PublishedAt } -// 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 +// 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.Users + return *d.Severity } -// GetDismissalCommitID returns the DismissalCommitID field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetDismissalCommitID() string { - if d == nil || d.DismissalCommitID == nil { +// 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.DismissalCommitID + return *d.Summary } -// 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 "" +// 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.DismissalMessage + return *d.UpdatedAt } -// 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 +// 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.ReviewID + return *d.WithdrawnAt } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (d *DismissedReview) GetState() string { - if d == nil || d.State == nil { +// 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.State + return *d.Status } -// 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 +// 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.From + return *d.ManifestPath } -// 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{} +// GetPackage returns the Package field. +func (d *Dependency) GetPackage() *VulnerabilityPackage { + if d == nil { + return nil } - return *d.ClientPayload + return d.Package } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetBody() string { - if d == nil || d.Body == nil { +// 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.Body + return *d.Scope } -// 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 +// 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.Line + return *d.LabeledRunners } -// 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 "" +// GetDetector returns the Detector field. +func (d *DependencyGraphSnapshot) GetDetector() *DependencyGraphSnapshotDetector { + if d == nil { + return nil } - return *d.Path + return d.Detector } -// 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 +// GetJob returns the Job field. +func (d *DependencyGraphSnapshot) GetJob() *DependencyGraphSnapshotJob { + if d == nil { + return nil } - return *d.Position + return d.Job } -// GetSide returns the Side field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetSide() string { - if d == nil || d.Side == nil { +// GetMetadata returns the Metadata map if it's non-nil, an empty map otherwise. +func (d *DependencyGraphSnapshot) GetMetadata() map[string]any { + if d == nil || d.Metadata == nil { + return map[string]any{} + } + return d.Metadata +} + +// 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 "" } - return *d.Side + return *d.Ref } -// 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 +// 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{} } - return *d.StartLine + return *d.Scanned } -// GetStartSide returns the StartSide field if it's non-nil, zero value otherwise. -func (d *DraftReviewComment) GetStartSide() string { - if d == nil || d.StartSide == nil { +// 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 "" } - return *d.StartSide + return *d.Sha } -// GetRef returns the Ref field. -func (e *EditBase) GetRef() *EditRef { - if e == nil { - return nil +// 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 e.Ref + return *d.CreatedAt } -// GetSHA returns the SHA field. -func (e *EditBase) GetSHA() *EditSHA { - if e == nil { - return nil +// 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 e.SHA + return *d.Message } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditBody) GetFrom() string { - if e == nil || e.From == nil { +// 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 *e.From + return *d.Result } -// GetBase returns the Base field. -func (e *EditChange) GetBase() *EditBase { - if e == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotDetector) GetName() string { + if d == nil || d.Name == nil { + return "" } - return e.Base + return *d.Name } -// GetBody returns the Body field. -func (e *EditChange) GetBody() *EditBody { - if e == nil { - return nil +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotDetector) GetURL() string { + if d == nil || d.URL == nil { + return "" } - return e.Body + return *d.URL } -// GetDefaultBranch returns the DefaultBranch field. -func (e *EditChange) GetDefaultBranch() *EditDefaultBranch { - if e == nil { - return nil +// 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 "" } - return e.DefaultBranch + return *d.Version } -// GetOwner returns the Owner field. -func (e *EditChange) GetOwner() *EditOwner { - if e == nil { - return nil +// 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 "" } - return e.Owner + return *d.Correlator } -// GetRepo returns the Repo field. -func (e *EditChange) GetRepo() *EditRepo { - if e == nil { - return nil +// 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 e.Repo + return *d.HTMLURL } -// GetTitle returns the Title field. -func (e *EditChange) GetTitle() *EditTitle { - if e == nil { - return nil +// 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 "" } - return e.Title + return *d.ID } -// GetTopics returns the Topics field. -func (e *EditChange) GetTopics() *EditTopics { - if e == nil { +// GetFile returns the File field. +func (d *DependencyGraphSnapshotManifest) GetFile() *DependencyGraphSnapshotManifestFile { + if d == nil { return nil } - return e.Topics + return d.File } -// 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 "" +// 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 *e.From + return d.Metadata } -// GetOwnerInfo returns the OwnerInfo field. -func (e *EditOwner) GetOwnerInfo() *OwnerInfo { - if e == nil { - return nil +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (d *DependencyGraphSnapshotManifest) GetName() string { + if d == nil || d.Name == nil { + return "" } - return e.OwnerInfo + return *d.Name } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditRef) GetFrom() string { - if e == nil || e.From == nil { +// 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 *e.From + return *d.SourceLocation } -// GetName returns the Name field. -func (e *EditRepo) GetName() *RepoName { - if e == nil { - return nil +// 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 e.Name + return d.Metadata } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditSHA) GetFrom() string { - if e == nil || e.From == nil { +// 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 *e.From + return *d.PackageURL } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (e *EditTitle) GetFrom() string { - if e == nil || e.From == nil { +// 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 *e.From + return *d.Relationship } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetAvatarURL() string { - if e == nil || e.AvatarURL == nil { +// 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 *e.AvatarURL + return *d.Scope } -// 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 { +// 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 *e.Description + return *d.Action } -// 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 "" +// GetInstallation returns the Installation field. +func (d *DeployKeyEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *e.HTMLURL + return d.Installation } -// 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 +// GetKey returns the Key field. +func (d *DeployKeyEvent) GetKey() *Key { + if d == nil { + return nil } - return *e.ID + return d.Key } -// 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 "" +// GetOrganization returns the Organization field. +func (d *DeployKeyEvent) GetOrganization() *Organization { + if d == nil { + return nil } - return *e.Name + return d.Organization } -// 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 "" +// GetRepo returns the Repo field. +func (d *DeployKeyEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *e.NodeID + return d.Repo } -// 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 "" +// GetSender returns the Sender field. +func (d *DeployKeyEvent) GetSender() *User { + if d == nil { + return nil } - return *e.Slug + return d.Sender } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (e *Enterprise) GetUpdatedAt() Timestamp { - if e == nil || e.UpdatedAt == nil { +// 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 *e.UpdatedAt + return *d.CreatedAt } -// 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 "" +// GetCreator returns the Creator field. +func (d *Deployment) GetCreator() *User { + if d == nil { + return nil } - return *e.WebsiteURL + return d.Creator } -// 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 +// 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 *e.AllowsPublicRepositories + return *d.Description } -// 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 +// 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 *e.Default + return *d.Environment } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetID() int64 { - if e == nil || e.ID == nil { +func (d *Deployment) GetID() int64 { + if d == nil || d.ID == nil { return 0 } - return *e.ID + return *d.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 +// 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 *e.Inherited + return *d.NodeID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetName() string { - if e == nil || e.Name == nil { +// 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 *e.Name + return *d.Ref } -// 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 +// 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 *e.RestrictedToWorkflows + return *d.RepositoryURL } -// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetRunnersURL() string { - if e == nil || e.RunnersURL == nil { +// 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 *e.RunnersURL + return *d.SHA } -// GetSelectedOrganizationsURL returns the SelectedOrganizationsURL field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetSelectedOrganizationsURL() string { - if e == nil || e.SelectedOrganizationsURL == nil { +// 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 *e.SelectedOrganizationsURL + return *d.StatusesURL } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (e *EnterpriseRunnerGroup) GetVisibility() string { - if e == nil || e.Visibility == nil { +// 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 *e.Visibility + return *d.Task } -// 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 +// 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 *e.WorkflowRestrictionsReadOnly + return *d.UpdatedAt } -// 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 +// 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 *e.TotalCount + return *d.URL } -// 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 +// 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 *e.AdvancedSecurityEnabledForNewRepositories + return *d.ID } -// 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 +// 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 *e.SecretScanningEnabledForNewRepositories + return *d.Name } -// GetSecretScanningPushProtectionCustomLink returns the SecretScanningPushProtectionCustomLink field if it's non-nil, zero value otherwise. -func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionCustomLink() string { - if e == nil || e.SecretScanningPushProtectionCustomLink == nil { +// 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 *e.SecretScanningPushProtectionCustomLink + return *d.NodeID } -// 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 +// 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 *e.SecretScanningPushProtectionEnabledForNewRepositories + return *d.Type } -// 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 +// 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 "" } - return *e.SecretScanningValidityChecksEnabled + return *d.Name } -// 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 +// 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 "" } - return *e.CanAdminsBypass + return *d.Type } -// 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{} +// 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 *e.CreatedAt + return *d.TotalCount } -// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. -func (e *Environment) GetDeploymentBranchPolicy() *BranchPolicy { - if e == nil { +// GetDeployment returns the Deployment field. +func (d *DeploymentEvent) GetDeployment() *Deployment { + if d == nil { return nil } - return e.DeploymentBranchPolicy + return d.Deployment } -// 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 "" +// GetInstallation returns the Installation field. +func (d *DeploymentEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *e.EnvironmentName + return d.Installation } -// 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 "" +// GetOrg returns the Org field. +func (d *DeploymentEvent) GetOrg() *Organization { + if d == nil { + return nil } - return *e.HTMLURL + return d.Org } -// 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 +// GetRepo returns the Repo field. +func (d *DeploymentEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *e.ID + return d.Repo } -// 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 "" +// GetSender returns the Sender field. +func (d *DeploymentEvent) GetSender() *User { + if d == nil { + return nil } - return *e.Name + return d.Sender } -// 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 "" +// GetWorkflow returns the Workflow field. +func (d *DeploymentEvent) GetWorkflow() *Workflow { + if d == nil { + return nil } - return *e.NodeID + return d.Workflow } -// 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 "" +// GetWorkflowRun returns the WorkflowRun field. +func (d *DeploymentEvent) GetWorkflowRun() *WorkflowRun { + if d == nil { + return nil } - return *e.Owner + return d.WorkflowRun } -// GetRepo returns the Repo field if it's non-nil, zero value otherwise. -func (e *Environment) GetRepo() string { - if e == nil || e.Repo == nil { +// 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 *e.Repo + return *d.Action } -// 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{} +// GetDeployment returns the Deployment field. +func (d *DeploymentProtectionRuleEvent) GetDeployment() *Deployment { + if d == nil { + return nil } - return *e.UpdatedAt + return d.Deployment } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (e *Environment) GetURL() string { - if e == nil || e.URL == nil { +// 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 *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 + return *d.DeploymentCallbackURL } -// 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 +// 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 *e.TotalCount + return *d.Environment } -// 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 +// 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 *e.ID + return *d.Event } -// 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 "" +// GetInstallation returns the Installation field. +func (d *DeploymentProtectionRuleEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *e.Type + return d.Installation } -// 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{} +// GetOrganization returns the Organization field. +func (d *DeploymentProtectionRuleEvent) GetOrganization() *Organization { + if d == nil { + return nil } - return *e.CreatedAt + return d.Organization } -// GetBlock returns the Block field. -func (e *ErrorResponse) GetBlock() *ErrorBlock { - if e == nil { +// GetRepo returns the Repo field. +func (d *DeploymentProtectionRuleEvent) GetRepo() *Repository { + if d == nil { return nil } - return e.Block + return d.Repo } -// GetActor returns the Actor field. -func (e *Event) GetActor() *User { - if e == nil { +// GetSender returns the Sender field. +func (d *DeploymentProtectionRuleEvent) GetSender() *User { + if d == nil { return nil } - return e.Actor + return d.Sender } -// 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{} +// 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 *e.CreatedAt + return *d.AutoMerge } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (e *Event) GetID() string { - if e == nil || e.ID == nil { +// 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 *e.ID + return *d.Description } -// GetOrg returns the Org field. -func (e *Event) GetOrg() *Organization { - if e == nil { - return nil +// 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 e.Org + return *d.Environment } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (e *Event) GetPublic() bool { - if e == nil || e.Public == nil { +// 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 *e.Public + return *d.ProductionEnvironment } -// 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{} +// 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 *e.RawPayload + return *d.Ref } -// GetRepo returns the Repo field. -func (e *Event) GetRepo() *Repository { - if e == nil { +// GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise. +func (d *DeploymentRequest) GetRequiredContexts() []string { + if d == nil || d.RequiredContexts == nil { return nil } - return e.Repo + return *d.RequiredContexts } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (e *Event) GetType() string { - if e == nil || e.Type == nil { +// 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 *e.Type + return *d.Task } -// 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 +// 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 *e.GroupID + return *d.TransientEnvironment } -// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. -func (e *ExternalGroup) GetGroupName() string { - if e == nil || e.GroupName == nil { +// 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 *e.GroupName + return *d.Action } -// 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{} +// GetApprover returns the Approver field. +func (d *DeploymentReviewEvent) GetApprover() *User { + if d == nil { + return nil } - return *e.UpdatedAt + return d.Approver } -// GetMemberEmail returns the MemberEmail field if it's non-nil, zero value otherwise. -func (e *ExternalGroupMember) GetMemberEmail() string { - if e == nil || e.MemberEmail == nil { +// 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 *e.MemberEmail + return *d.Comment } -// 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 +// GetEnterprise returns the Enterprise field. +func (d *DeploymentReviewEvent) GetEnterprise() *Enterprise { + if d == nil { + return nil } - return *e.MemberID + return d.Enterprise } -// 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 { +// 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 *e.MemberName + return *d.Environment } -// 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 +// GetInstallation returns the Installation field. +func (d *DeploymentReviewEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *e.TeamID + return d.Installation } -// 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 "" +// GetOrganization returns the Organization field. +func (d *DeploymentReviewEvent) GetOrganization() *Organization { + if d == nil { + return nil } - return *e.TeamName + return d.Organization } -// 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 "" +// GetRepo returns the Repo field. +func (d *DeploymentReviewEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *f.HRef + return d.Repo } -// 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 "" +// GetRequester returns the Requester field. +func (d *DeploymentReviewEvent) GetRequester() *User { + if d == nil { + return nil } - return *f.Type + return d.Requester } -// GetCurrentUser returns the CurrentUser field. -func (f *FeedLinks) GetCurrentUser() *FeedLink { - if f == nil { +// GetSender returns the Sender field. +func (d *DeploymentReviewEvent) GetSender() *User { + if d == nil { return nil } - return f.CurrentUser + return d.Sender } -// GetCurrentUserActor returns the CurrentUserActor field. -func (f *FeedLinks) GetCurrentUserActor() *FeedLink { - if f == nil { - return nil +// 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 f.CurrentUserActor + return *d.Since } -// GetCurrentUserOrganization returns the CurrentUserOrganization field. -func (f *FeedLinks) GetCurrentUserOrganization() *FeedLink { - if f == nil { +// GetWorkflowJobRun returns the WorkflowJobRun field. +func (d *DeploymentReviewEvent) GetWorkflowJobRun() *WorkflowJobRun { + if d == nil { return nil } - return f.CurrentUserOrganization + return d.WorkflowJobRun } -// GetCurrentUserPublic returns the CurrentUserPublic field. -func (f *FeedLinks) GetCurrentUserPublic() *FeedLink { - if f == nil { +// GetWorkflowRun returns the WorkflowRun field. +func (d *DeploymentReviewEvent) GetWorkflowRun() *WorkflowRun { + if d == nil { return nil } - return f.CurrentUserPublic + return d.WorkflowRun } -// GetTimeline returns the Timeline field. -func (f *FeedLinks) GetTimeline() *FeedLink { - if f == nil { - return nil +// 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 f.Timeline + return *d.CreatedAt } -// GetUser returns the User field. -func (f *FeedLinks) GetUser() *FeedLink { - if f == nil { +// GetCreator returns the Creator field. +func (d *DeploymentStatus) GetCreator() *User { + if d == nil { return nil } - return f.User + return d.Creator } -// GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserActorURL() string { - if f == nil || f.CurrentUserActorURL == nil { +// 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 *f.CurrentUserActorURL + return *d.DeploymentURL } -// GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserOrganizationURL() string { - if f == nil || f.CurrentUserOrganizationURL == nil { +// 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 *f.CurrentUserOrganizationURL + return *d.Description } -// GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserPublicURL() string { - if f == nil || f.CurrentUserPublicURL == nil { +// 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 *f.CurrentUserPublicURL + return *d.Environment } -// GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetCurrentUserURL() string { - if f == nil || f.CurrentUserURL == nil { +// 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 *f.CurrentUserURL + return *d.EnvironmentURL } -// GetLinks returns the Links field. -func (f *Feeds) GetLinks() *FeedLinks { - if f == nil { - return nil +// 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 f.Links + return *d.ID } -// GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetTimelineURL() string { - if f == nil || f.TimelineURL == nil { +// 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 *f.TimelineURL + return *d.LogURL } -// GetUserURL returns the UserURL field if it's non-nil, zero value otherwise. -func (f *Feeds) GetUserURL() string { - if f == nil || f.UserURL == nil { +// 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 *f.UserURL + return *d.NodeID } -// GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise. -func (f *FirstPatchedVersion) GetIdentifier() string { - if f == nil || f.Identifier == nil { +// 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 *f.Identifier + return *d.RepositoryURL } -// GetForkee returns the Forkee field. -func (f *ForkEvent) GetForkee() *Repository { - if f == nil { - return nil +// 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 f.Forkee + return *d.State } -// GetInstallation returns the Installation field. -func (f *ForkEvent) GetInstallation() *Installation { - if f == nil { - return nil +// 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 f.Installation + return *d.TargetURL } -// GetRepo returns the Repo field. -func (f *ForkEvent) GetRepo() *Repository { - if f == nil { - return nil +// 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 f.Repo + return *d.UpdatedAt } -// GetSender returns the Sender field. -func (f *ForkEvent) GetSender() *User { - if f == nil { - return nil +// 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 f.Sender + return *d.URL } -// GetWorkFolder returns the WorkFolder field if it's non-nil, zero value otherwise. -func (g *GenerateJITConfigRequest) GetWorkFolder() string { - if g == nil || g.WorkFolder == nil { +// 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 *g.WorkFolder + return *d.Action } -// 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 "" +// GetDeployment returns the Deployment field. +func (d *DeploymentStatusEvent) GetDeployment() *Deployment { + if d == nil { + return nil } - return *g.PreviousTagName + return d.Deployment } -// 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 "" +// GetDeploymentStatus returns the DeploymentStatus field. +func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus { + if d == nil { + return nil } - return *g.TargetCommitish + return d.DeploymentStatus } -// 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 "" +// GetInstallation returns the Installation field. +func (d *DeploymentStatusEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *g.Include + return d.Installation } -// 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 "" +// GetOrg returns the Org field. +func (d *DeploymentStatusEvent) GetOrg() *Organization { + if d == nil { + return nil } - return *g.Order + return d.Org } -// 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 "" +// GetRepo returns the Repo field. +func (d *DeploymentStatusEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *g.Phrase + return d.Repo } -// 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 +// GetSender returns the Sender field. +func (d *DeploymentStatusEvent) GetSender() *User { + if d == nil { + return nil } - return *g.Comments + return d.Sender } -// 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{} +// 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 *g.CreatedAt + return *d.AutoInactive } // GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (g *Gist) GetDescription() string { - if g == nil || g.Description == nil { +func (d *DeploymentStatusRequest) GetDescription() string { + if d == nil || d.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 + return *d.Description } -// GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPullURL() string { - if g == nil || g.GitPullURL == nil { +// 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 *g.GitPullURL + return *d.Environment } -// GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetGitPushURL() string { - if g == nil || g.GitPushURL == nil { +// 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 *g.GitPushURL + return *d.EnvironmentURL } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (g *Gist) GetHTMLURL() string { - if g == nil || g.HTMLURL == nil { +// 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 *g.HTMLURL + return *d.LogURL } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *Gist) GetID() string { - if g == nil || g.ID == nil { +// 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 "" } - return *g.ID + return *d.State } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *Gist) GetNodeID() string { - if g == nil || g.NodeID == nil { +// 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 *g.NodeID + return *d.ActiveLockReason } -// GetOwner returns the Owner field. -func (g *Gist) GetOwner() *User { - if g == nil { - return nil +// 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 g.Owner + return *d.AnswerChosenAt } -// 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 +// 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 *g.Public + return *d.AnswerChosenBy } -// 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{} +// 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 *g.UpdatedAt + return *d.AnswerHTMLURL } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (g *GistComment) GetBody() string { - if g == nil || g.Body == nil { +// 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 *g.Body + return *d.AuthorAssociation } -// 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{} +// 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 *g.CreatedAt + return *d.Body } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (g *GistComment) GetID() int64 { - if g == nil || g.ID == nil { +// 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 *g.ID + return *d.Comments } -// 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 "" +// 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 *g.URL + return *d.CreatedAt } -// GetUser returns the User field. -func (g *GistComment) GetUser() *User { - if g == nil { +// GetDiscussionCategory returns the DiscussionCategory field. +func (d *Discussion) GetDiscussionCategory() *DiscussionCategory { + if d == nil { return nil } - return g.User + return d.DiscussionCategory } -// GetChangeStatus returns the ChangeStatus field. -func (g *GistCommit) GetChangeStatus() *CommitStats { - if g == nil { - return nil +// 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 g.ChangeStatus + return *d.HTMLURL } -// 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{} +// 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 *g.CommittedAt + return *d.ID } -// 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 "" +// 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 *g.NodeID + return *d.Locked } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetURL() string { - if g == nil || g.URL == nil { +// 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 *g.URL + return *d.NodeID } -// GetUser returns the User field. -func (g *GistCommit) GetUser() *User { - if g == nil { - return nil +// 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 g.User + return *d.Number } -// GetVersion returns the Version field if it's non-nil, zero value otherwise. -func (g *GistCommit) GetVersion() string { - if g == nil || g.Version == nil { +// 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 *g.Version + return *d.RepositoryURL } -// GetContent returns the Content field if it's non-nil, zero value otherwise. -func (g *GistFile) GetContent() string { - if g == nil || g.Content == nil { +// 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 *g.Content + return *d.State } -// GetFilename returns the Filename field if it's non-nil, zero value otherwise. -func (g *GistFile) GetFilename() string { - if g == nil || g.Filename == nil { +// 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 *g.Filename + return *d.Title } -// 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 "" +// 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 *g.Language + return *d.UpdatedAt } -// 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 "" +// GetUser returns the User field. +func (d *Discussion) GetUser() *User { + if d == nil { + return nil } - 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 + return d.User } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (g *GistFork) GetCreatedAt() Timestamp { - if g == nil || g.CreatedAt == nil { +func (d *DiscussionCategory) GetCreatedAt() Timestamp { + if d == nil || d.CreatedAt == nil { return Timestamp{} } - return *g.CreatedAt + return *d.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 { +// 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 *g.ID + return *d.Description } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (g *GistFork) GetNodeID() string { - if g == nil || g.NodeID == nil { +// 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 *g.NodeID + return *d.Emoji } -// 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{} +// 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 *g.UpdatedAt + return *d.ID } -// 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 "" +// 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 *g.URL + return *d.IsAnswerable } -// GetUser returns the User field. -func (g *GistFork) GetUser() *User { - if g == nil { - return nil +// 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 g.User + return *d.Name } -// 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 +// 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 *g.PrivateGists + return *d.NodeID } -// GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise. -func (g *GistStats) GetPublicGists() int { - if g == nil || g.PublicGists == nil { +// 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 *g.PublicGists + return *d.RepositoryID } -// 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 +// 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 *g.TotalGists + return *d.Slug } -// 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 "" +// 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 *g.Action + return *d.UpdatedAt } -// GetInstallation returns the Installation field. -func (g *GitHubAppAuthorizationEvent) GetInstallation() *Installation { - if g == nil { +// GetAuthor returns the Author field. +func (d *DiscussionComment) GetAuthor() *User { + if d == nil { return nil } - return g.Installation + return d.Author } -// GetSender returns the Sender field. -func (g *GitHubAppAuthorizationEvent) GetSender() *User { - if g == nil { - return nil +// 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 g.Sender + return *d.Body } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetName() string { - if g == nil || g.Name == nil { +// 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 *g.Name + return *d.BodyHTML } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (g *Gitignore) GetSource() string { - if g == nil || g.Source == nil { +// 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 *g.Source + return *d.BodyVersion } -// 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 "" +// 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 *g.SHA + return *d.CreatedAt } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GitObject) GetType() string { - if g == nil || g.Type == nil { +// 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 *g.Type + return *d.DiscussionURL } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *GitObject) GetURL() string { - if g == nil || g.URL == nil { +// 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 *g.URL + return *d.HTMLURL } -// GetGithubReviewedAt returns the GithubReviewedAt field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetGithubReviewedAt() Timestamp { - if g == nil || g.GithubReviewedAt == nil { +// 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 *g.GithubReviewedAt + return *d.LastEditedAt } -// 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 +// 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 *g.ID + return *d.NodeID } -// 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{} +// 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 *g.NVDPublishedAt + return *d.Number } -// 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 "" +// GetReactions returns the Reactions field. +func (d *DiscussionComment) GetReactions() *Reactions { + if d == nil { + return nil } - return *g.RepositoryAdvisoryURL + return d.Reactions } -// 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 "" +// 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 *g.SourceCodeLocation + return *d.UpdatedAt } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityAdvisory) GetType() string { - if g == nil || g.Type == nil { +// 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 *g.Type + return *d.URL } -// GetFirstPatchedVersion returns the FirstPatchedVersion field if it's non-nil, zero value otherwise. -func (g *GlobalSecurityVulnerability) GetFirstPatchedVersion() string { - if g == nil || g.FirstPatchedVersion == nil { +// 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 *g.FirstPatchedVersion + return *d.Action } -// GetPackage returns the Package field. -func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { - if g == nil { +// GetComment returns the Comment field. +func (d *DiscussionCommentEvent) GetComment() *CommentDiscussion { + if d == nil { return nil } - return g.Package + return d.Comment } -// 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 "" +// GetDiscussion returns the Discussion field. +func (d *DiscussionCommentEvent) GetDiscussion() *Discussion { + if d == nil { + return nil } - return *g.VulnerableVersionRange + return d.Discussion } // GetInstallation returns the Installation field. -func (g *GollumEvent) GetInstallation() *Installation { - if g == nil { +func (d *DiscussionCommentEvent) GetInstallation() *Installation { + if d == nil { return nil } - return g.Installation + return d.Installation } // GetOrg returns the Org field. -func (g *GollumEvent) GetOrg() *Organization { - if g == nil { +func (d *DiscussionCommentEvent) GetOrg() *Organization { + if d == nil { return nil } - return g.Org + return d.Org } // GetRepo returns the Repo field. -func (g *GollumEvent) GetRepo() *Repository { - if g == nil { +func (d *DiscussionCommentEvent) GetRepo() *Repository { + if d == nil { return nil } - return g.Repo + return d.Repo } // GetSender returns the Sender field. -func (g *GollumEvent) GetSender() *User { - if g == nil { +func (d *DiscussionCommentEvent) GetSender() *User { + if d == nil { return nil } - return g.Sender + return d.Sender } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (g *GPGEmail) GetEmail() string { - if g == nil || g.Email == nil { +// 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 *g.Email + return *d.Action } -// 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 +// GetDiscussion returns the Discussion field. +func (d *DiscussionEvent) GetDiscussion() *Discussion { + if d == nil { + return nil } - return *g.Verified + return d.Discussion } -// 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 +// GetInstallation returns the Installation field. +func (d *DiscussionEvent) GetInstallation() *Installation { + if d == nil { + return nil } - return *g.CanCertify + return d.Installation } -// 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 +// GetOrg returns the Org field. +func (d *DiscussionEvent) GetOrg() *Organization { + if d == nil { + return nil } - return *g.CanEncryptComms + return d.Org } -// 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 +// GetRepo returns the Repo field. +func (d *DiscussionEvent) GetRepo() *Repository { + if d == nil { + return nil } - return *g.CanEncryptStorage + return d.Repo } -// 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 +// GetSender returns the Sender field. +func (d *DiscussionEvent) GetSender() *User { + if d == nil { + return nil } - return *g.CanSign + return d.Sender } -// 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{} +// 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 *g.CreatedAt + return *d.Apps } -// 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{} +// 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 *g.ExpiresAt + return *d.Teams } -// 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 +// 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 *g.ID + return *d.Users } -// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetKeyID() string { - if g == nil || g.KeyID == nil { +// 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 *g.KeyID + return *d.DismissalCommitID } -// 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 +// 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 *g.PrimaryKeyID + return *d.DismissalMessage } -// 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 "" +// 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 *g.PublicKey + return *d.ReviewID } -// GetRawKey returns the RawKey field if it's non-nil, zero value otherwise. -func (g *GPGKey) GetRawKey() string { - if g == nil || g.RawKey == nil { +// 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 *g.RawKey + return *d.State } -// GetApp returns the App field. -func (g *Grant) GetApp() *AuthorizationApp { - if g == nil { - return nil +// 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 g.App + return *d.From } -// 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{} +// 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 *g.CreatedAt + return *d.ClientPayload } -// 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 +// 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 *g.ID + return *d.Body } -// 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{} +// 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 *g.UpdatedAt + return *d.Line } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (g *Grant) GetURL() string { - if g == nil || g.URL == nil { +// 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 *g.URL + return *d.Path } -// GetAuthor returns the Author field. -func (h *HeadCommit) GetAuthor() *CommitAuthor { - if h == nil { - return nil +// 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 h.Author + return *d.Position } -// GetCommitter returns the Committer field. -func (h *HeadCommit) GetCommitter() *CommitAuthor { - if h == nil { - return nil +// 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 h.Committer + return *d.Side } -// 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 +// 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 *h.Distinct + return *d.StartLine } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (h *HeadCommit) GetID() string { - if h == nil || h.ID == nil { +// 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 *h.ID + return *d.StartSide } -// 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 "" +// GetRef returns the Ref field. +func (e *EditBase) GetRef() *EditRef { + if e == nil { + return nil } - return *h.Message + return e.Ref } -// 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 "" +// GetSHA returns the SHA field. +func (e *EditBase) GetSHA() *EditSHA { + if e == nil { + return nil } - return *h.SHA + return e.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{} +// 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 *h.Timestamp + return *e.From } -// 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 "" +// GetBase returns the Base field. +func (e *EditChange) GetBase() *EditBase { + if e == nil { + return nil } - return *h.TreeID + return e.Base } -// 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 "" +// GetBody returns the Body field. +func (e *EditChange) GetBody() *EditBody { + if e == nil { + return nil } - return *h.URL + return e.Body } -// 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 +// GetDefaultBranch returns the DefaultBranch field. +func (e *EditChange) GetDefaultBranch() *EditDefaultBranch { + if e == nil { + return nil } - return *h.Active + return e.DefaultBranch } -// GetConfig returns the Config field. -func (h *Hook) GetConfig() *HookConfig { - if h == nil { +// GetOwner returns the Owner field. +func (e *EditChange) GetOwner() *EditOwner { + if e == nil { return nil } - return h.Config + return e.Owner } -// 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{} +// GetRepo returns the Repo field. +func (e *EditChange) GetRepo() *EditRepo { + if e == nil { + return nil } - return *h.CreatedAt + return e.Repo } -// 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 +// GetTitle returns the Title field. +func (e *EditChange) GetTitle() *EditTitle { + if e == nil { + return nil } - return *h.ID + return e.Title } -// 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 "" +// GetTopics returns the Topics field. +func (e *EditChange) GetTopics() *EditTopics { + if e == nil { + return nil } - return *h.Name + return e.Topics } -// GetPingURL returns the PingURL field if it's non-nil, zero value otherwise. -func (h *Hook) GetPingURL() string { - if h == nil || h.PingURL == nil { +// 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 *h.PingURL + return *e.From } -// 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 "" +// GetOwnerInfo returns the OwnerInfo field. +func (e *EditOwner) GetOwnerInfo() *OwnerInfo { + if e == nil { + return nil } - return *h.TestURL + return e.OwnerInfo } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (h *Hook) GetType() string { - if h == nil || h.Type == nil { +// 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 *h.Type + return *e.From } -// 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{} +// GetName returns the Name field. +func (e *EditRepo) GetName() *RepoName { + if e == nil { + return nil } - return *h.UpdatedAt + return e.Name } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *Hook) GetURL() string { - if h == nil || h.URL == nil { +// 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 *h.URL + return *e.From } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetContentType() string { - if h == nil || h.ContentType == nil { +// 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 *h.ContentType + return *e.From } -// GetInsecureSSL returns the InsecureSSL field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetInsecureSSL() string { - if h == nil || h.InsecureSSL == nil { +// 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 *h.InsecureSSL + return *e.AvatarURL } -// 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 "" +// 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 *h.Secret + return *e.CreatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (h *HookConfig) GetURL() string { - if h == nil || h.URL == nil { +// 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 *h.URL + return *e.Description } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetAction() string { - if h == nil || h.Action == nil { +// 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 *h.Action + return *e.HTMLURL } -// 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{} +// 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 *h.DeliveredAt + return *e.ID } -// GetDuration returns the Duration field. -func (h *HookDelivery) GetDuration() *float64 { - if h == nil { - return nil +// 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 h.Duration + return *e.Name } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetEvent() string { - if h == nil || h.Event == nil { +// 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 *h.Event + return *e.NodeID } -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetGUID() string { - if h == nil || h.GUID == nil { +// 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 *h.GUID + return *e.Slug } -// 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 +// 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 *h.ID + return *e.UpdatedAt } -// 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 +// 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 *h.InstallationID + return *e.WebsiteURL } -// 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 +// 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 *h.Redelivery + return *e.OrganizationID } -// 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 +// 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 *h.RepositoryID + return *e.OrganizationLogin } -// GetRequest returns the Request field. -func (h *HookDelivery) GetRequest() *HookRequest { - if h == nil { - return nil +// 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 h.Request + return *e.EnterpriseServerUser } -// GetResponse returns the Response field. -func (h *HookDelivery) GetResponse() *HookResponse { - if h == nil { - return nil +// 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 h.Response + return *e.GithubComName } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (h *HookDelivery) GetStatus() string { - if h == nil || h.Status == nil { +// 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 *h.Status + return *e.GithubComProfile } -// 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 +// 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 *h.StatusCode + return *e.GithubComSamlNameID } -// 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{} +// 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 h.Headers + return *e.GithubComTwoFactorAuth } -// 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{} +// 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 *h.RawPayload + return *e.VisualStudioLicenseStatus } -// 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{} +// 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 h.Headers + return *e.VisualStudioSubscriptionEmail } -// 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{} +// GetProperties returns the Properties field. +func (e *EnterpriseLicenseSyncStatus) GetProperties() *ServerInstanceProperties { + if e == nil { + return nil } - return *h.RawPayload + return e.Properties } -// 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 +// 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 *h.ActiveHooks + return *e.AllowsPublicRepositories } -// 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 +// 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 *h.InactiveHooks + return *e.Default } -// GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise. -func (h *HookStats) GetTotalHooks() int { - if h == nil || h.TotalHooks == nil { +// 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 *h.TotalHooks + return *e.ID } -// 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 "" +// 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 *i.GroupDescription + return *e.Inherited } -// GetGroupID returns the GroupID field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupID() string { - if i == nil || i.GroupID == nil { +// 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 *i.GroupID + return *e.Name } -// GetGroupName returns the GroupName field if it's non-nil, zero value otherwise. -func (i *IDPGroup) GetGroupName() string { - if i == nil || i.GroupName == nil { +// 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 *i.GroupName + return *e.RunnersURL } -// 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 +// 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 *i.AuthorsCount + return *e.SelectedOrganizationsURL } -// GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise. -func (i *Import) GetAuthorsURL() string { - if i == nil || i.AuthorsURL == nil { +// 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 *i.AuthorsURL + return *e.Visibility } -// 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 +// 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 *i.CommitCount + return *e.WorkflowRestrictionsReadOnly } -// 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 "" +// 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 *i.FailedStep + return *e.TotalCount } -// GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise. -func (i *Import) GetHasLargeFiles() bool { - if i == nil || i.HasLargeFiles == nil { +// 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 *i.HasLargeFiles + return *e.AdvancedSecurityEnabledForNewRepositories } -// 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 "" +// 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 *i.HTMLURL + return *e.SecretScanningEnabledForNewRepositories } -// GetHumanName returns the HumanName field if it's non-nil, zero value otherwise. -func (i *Import) GetHumanName() string { - if i == nil || i.HumanName == nil { +// 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 *i.HumanName + return *e.SecretScanningPushProtectionCustomLink } -// 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 +// 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 *i.LargeFilesCount + return *e.SecretScanningPushProtectionEnabledForNewRepositories } -// 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 +// 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 *i.LargeFilesSize + return *e.SecretScanningValidityChecksEnabled } -// 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 "" +// 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 *i.Message + return *e.CanAdminsBypass } -// 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 +// 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 *i.Percent + return *e.CreatedAt } -// 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 +// GetDeploymentBranchPolicy returns the DeploymentBranchPolicy field. +func (e *Environment) GetDeploymentBranchPolicy() *BranchPolicy { + if e == nil { + return nil } - return *i.PushPercent + return e.DeploymentBranchPolicy } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Import) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { +// 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 *i.RepositoryURL + return *e.EnvironmentName } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (i *Import) GetStatus() string { - if i == nil || i.Status == nil { +// 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 *i.Status + return *e.HTMLURL } -// 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 "" +// 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 *i.StatusText + return *e.ID } -// GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise. -func (i *Import) GetTFVCProject() string { - if i == nil || i.TFVCProject == nil { +// 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 *i.TFVCProject + return *e.Name } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Import) GetURL() string { - if i == nil || i.URL == nil { +// 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 *i.URL + return *e.NodeID } -// GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise. -func (i *Import) GetUseLFS() string { - if i == nil || i.UseLFS == nil { +// 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 *i.UseLFS + return *e.Owner } -// GetVCS returns the VCS field if it's non-nil, zero value otherwise. -func (i *Import) GetVCS() string { - if i == nil || i.VCS == nil { +// 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 *i.VCS + return *e.Repo } -// 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 "" +// 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 *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 + return *e.UpdatedAt } -// GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise. -func (i *Import) GetVCSUsername() string { - if i == nil || i.VCSUsername == nil { +// 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 *i.VCSUsername + return *e.URL } -// 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 "" +// 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 *i.AccessTokensURL + return *e.WaitTimer } -// GetAccount returns the Account field. -func (i *Installation) GetAccount() *User { - if i == nil { - return nil +// 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 i.Account + return *e.TotalCount } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (i *Installation) GetAppID() int64 { - if i == nil || i.AppID == nil { +// 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 *i.AppID + return *e.ID } -// GetAppSlug returns the AppSlug field if it's non-nil, zero value otherwise. -func (i *Installation) GetAppSlug() string { - if i == nil || i.AppSlug == nil { +// 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 *i.AppSlug + return *e.Type } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetCreatedAt() Timestamp { - if i == nil || i.CreatedAt == nil { +func (e *ErrorBlock) GetCreatedAt() Timestamp { + if e == nil || e.CreatedAt == nil { return Timestamp{} } - return *i.CreatedAt + return *e.CreatedAt } -// 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 +// GetBlock returns the Block field. +func (e *ErrorResponse) GetBlock() *ErrorBlock { + if e == nil { + return nil } - return *i.HasMultipleSingleFiles + return e.Block } -// 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 "" +// GetActor returns the Actor field. +func (e *Event) GetActor() *User { + if e == nil { + return nil } - return *i.HTMLURL + return e.Actor } -// 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 +// 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 *i.ID + return *e.CreatedAt } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Installation) GetNodeID() string { - if i == nil || i.NodeID == nil { +// 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 *i.NodeID + return *e.ID } -// GetPermissions returns the Permissions field. -func (i *Installation) GetPermissions() *InstallationPermissions { - if i == nil { +// GetOrg returns the Org field. +func (e *Event) GetOrg() *Organization { + if e == 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 + return e.Org } -// 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 "" +// 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 *i.RepositorySelection + return *e.Public } -// 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 "" +// 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 *i.SingleFileName + return *e.RawPayload } -// 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{} +// GetRepo returns the Repo field. +func (e *Event) GetRepo() *Repository { + if e == nil { + return nil } - return *i.SuspendedAt + return e.Repo } -// GetSuspendedBy returns the SuspendedBy field. -func (i *Installation) GetSuspendedBy() *User { - if i == nil { - return nil +// 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 i.SuspendedBy + return *e.Type } -// GetTargetID returns the TargetID field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetID() int64 { - if i == nil || i.TargetID == nil { +// 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 *i.TargetID + return *e.GroupID } -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (i *Installation) GetTargetType() string { - if i == nil || i.TargetType == nil { +// 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 *i.TargetType + return *e.GroupName } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *Installation) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { +func (e *ExternalGroup) GetUpdatedAt() Timestamp { + if e == nil || e.UpdatedAt == nil { return Timestamp{} } - return *i.UpdatedAt + return *e.UpdatedAt } -// GetLogin returns the Login field. -func (i *InstallationChanges) GetLogin() *InstallationLoginChange { - if i == nil { - return nil +// 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 i.Login + return *e.MemberEmail } -// GetSlug returns the Slug field. -func (i *InstallationChanges) GetSlug() *InstallationSlugChange { - if i == nil { - return nil +// 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 i.Slug + return *e.MemberID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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 *i.Action + return *e.MemberLogin } -// GetInstallation returns the Installation field. -func (i *InstallationEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *e.MemberName } -// GetOrg returns the Org field. -func (i *InstallationEvent) GetOrg() *Organization { - if i == nil { - return nil +// 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 i.Org + return *e.TeamID } -// GetRequester returns the Requester field. -func (i *InstallationEvent) GetRequester() *User { - if i == nil { - return nil +// 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 i.Requester + return *e.TeamName } -// GetSender returns the Sender field. -func (i *InstallationEvent) GetSender() *User { - if i == nil { - return nil +// 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 i.Sender + return *f.HRef } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (i *InstallationLoginChange) GetFrom() string { - if i == nil || i.From == nil { +// 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 *i.From + return *f.Type } -// 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 +// GetCurrentUser returns the CurrentUser field. +func (f *FeedLinks) GetCurrentUser() *FeedLink { + if f == nil { + return nil + } + return f.CurrentUser } -// 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 "" +// GetCurrentUserActor returns the CurrentUserActor field. +func (f *FeedLinks) GetCurrentUserActor() *FeedLink { + if f == nil { + return nil } - return *i.ActionsVariables + return f.CurrentUserActor } -// 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 "" +// GetCurrentUserOrganization returns the CurrentUserOrganization field. +func (f *FeedLinks) GetCurrentUserOrganization() *FeedLink { + if f == nil { + return nil } - return *i.Administration + return f.CurrentUserOrganization } -// 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 "" +// GetCurrentUserPublic returns the CurrentUserPublic field. +func (f *FeedLinks) GetCurrentUserPublic() *FeedLink { + if f == nil { + return nil } - return *i.Blocking + return f.CurrentUserPublic } -// 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 "" +// GetTimeline returns the Timeline field. +func (f *FeedLinks) GetTimeline() *FeedLink { + if f == nil { + return nil } - return *i.Checks + return f.Timeline } -// 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 "" +// GetUser returns the User field. +func (f *FeedLinks) GetUser() *FeedLink { + if f == nil { + return nil } - return *i.Codespaces + return f.User } -// GetCodespacesLifecycleAdmin returns the CodespacesLifecycleAdmin field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesLifecycleAdmin() string { - if i == nil || i.CodespacesLifecycleAdmin == nil { +// 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 *i.CodespacesLifecycleAdmin + return *f.CurrentUserActorURL } -// GetCodespacesMetadata returns the CodespacesMetadata field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesMetadata() string { - if i == nil || i.CodespacesMetadata == nil { +// 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 *i.CodespacesMetadata + return *f.CurrentUserOrganizationURL } -// GetCodespacesSecrets returns the CodespacesSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetCodespacesSecrets() string { - if i == nil || i.CodespacesSecrets == nil { +// 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 *i.CodespacesSecrets + return *f.CurrentUserPublicURL } -// GetContentReferences returns the ContentReferences field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetContentReferences() string { - if i == nil || i.ContentReferences == nil { +// 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 *i.ContentReferences + return *f.CurrentUserURL } -// 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 "" +// GetLinks returns the Links field. +func (f *Feeds) GetLinks() *FeedLinks { + if f == nil { + return nil } - return *i.Contents + return f.Links } -// GetDependabotSecrets returns the DependabotSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDependabotSecrets() string { - if i == nil || i.DependabotSecrets == nil { +// 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 *i.DependabotSecrets + return *f.TimelineURL } -// GetDeployments returns the Deployments field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDeployments() string { - if i == nil || i.Deployments == nil { +// 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 *i.Deployments + return *f.UserURL } -// GetDiscussions returns the Discussions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetDiscussions() string { - if i == nil || i.Discussions == nil { +// 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 *i.Discussions + return *f.FieldName } -// GetEmails returns the Emails field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetEmails() string { - if i == nil || i.Emails == nil { +// 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 *i.Emails + return *f.FieldNodeID } -// GetEnvironments returns the Environments field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetEnvironments() string { - if i == nil || i.Environments == nil { +// 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 *i.Environments + return *f.FieldType } -// 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 "" +// 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 *i.Followers + return *f.ProjectNumber } -// GetIssues returns the Issues field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetIssues() string { - if i == nil || i.Issues == nil { +// 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 *i.Issues + return *f.Identifier } -// 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 "" +// GetForkee returns the Forkee field. +func (f *ForkEvent) GetForkee() *Repository { + if f == nil { + return nil } - return *i.Members + return f.Forkee } -// 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 "" +// GetInstallation returns the Installation field. +func (f *ForkEvent) GetInstallation() *Installation { + if f == nil { + return nil } - return *i.MergeQueues + return f.Installation } -// 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 "" +// GetRepo returns the Repo field. +func (f *ForkEvent) GetRepo() *Repository { + if f == nil { + return nil } - return *i.Metadata + return f.Repo } -// 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 "" +// GetSender returns the Sender field. +func (f *ForkEvent) GetSender() *User { + if f == nil { + return nil } - return *i.OrganizationAdministration + return f.Sender } -// GetOrganizationCustomOrgRoles returns the OrganizationCustomOrgRoles field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomOrgRoles() string { - if i == nil || i.OrganizationCustomOrgRoles == nil { +// 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 "" } - return *i.OrganizationCustomOrgRoles + return *g.WorkFolder } -// GetOrganizationCustomProperties returns the OrganizationCustomProperties field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomProperties() string { - if i == nil || i.OrganizationCustomProperties == nil { +// 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 "" } - return *i.OrganizationCustomProperties + return *g.PreviousTagName } -// GetOrganizationCustomRoles returns the OrganizationCustomRoles field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationCustomRoles() string { - if i == nil || i.OrganizationCustomRoles == nil { +// 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 "" } - return *i.OrganizationCustomRoles + return *g.TargetCommitish } -// GetOrganizationHooks returns the OrganizationHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationHooks() string { - if i == nil || i.OrganizationHooks == nil { +// 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 *i.OrganizationHooks + return *g.Include } -// GetOrganizationPackages returns the OrganizationPackages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPackages() string { - if i == nil || i.OrganizationPackages == nil { +// 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 *i.OrganizationPackages + return *g.Order } -// GetOrganizationPersonalAccessTokenRequests returns the OrganizationPersonalAccessTokenRequests field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPersonalAccessTokenRequests() string { - if i == nil || i.OrganizationPersonalAccessTokenRequests == nil { +// 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 *i.OrganizationPersonalAccessTokenRequests + return *g.Phrase } -// 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 "" +// 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 *i.OrganizationPersonalAccessTokens + return *g.Comments } -// 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 "" +// 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 *i.OrganizationPlan + return *g.CreatedAt } -// GetOrganizationPreReceiveHooks returns the OrganizationPreReceiveHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationPreReceiveHooks() string { - if i == nil || i.OrganizationPreReceiveHooks == nil { +// 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 *i.OrganizationPreReceiveHooks + return *g.Description } -// 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 "" +// 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 *i.OrganizationProjects + return g.Files } -// GetOrganizationSecrets returns the OrganizationSecrets field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationSecrets() string { - if i == nil || i.OrganizationSecrets == nil { +// 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 *i.OrganizationSecrets + return *g.GitPullURL } -// GetOrganizationSelfHostedRunners returns the OrganizationSelfHostedRunners field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationSelfHostedRunners() string { - if i == nil || i.OrganizationSelfHostedRunners == nil { +// 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 *i.OrganizationSelfHostedRunners + return *g.GitPushURL } -// GetOrganizationUserBlocking returns the OrganizationUserBlocking field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetOrganizationUserBlocking() string { - if i == nil || i.OrganizationUserBlocking == nil { +// 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 *i.OrganizationUserBlocking + return *g.HTMLURL } -// GetPackages returns the Packages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPackages() string { - if i == nil || i.Packages == nil { +// 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 *i.Packages + return *g.ID } -// GetPages returns the Pages field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetPages() string { - if i == nil || i.Pages == nil { +// 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 *i.Pages + return *g.NodeID } -// 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 "" +// GetOwner returns the Owner field. +func (g *Gist) GetOwner() *User { + if g == nil { + return nil } - return *i.PullRequests + return g.Owner } -// 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 "" +// 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 *i.RepositoryAdvisories + return *g.Public } -// 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 "" +// 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 *i.RepositoryCustomProperties + return *g.UpdatedAt } -// GetRepositoryHooks returns the RepositoryHooks field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetRepositoryHooks() string { - if i == nil || i.RepositoryHooks == nil { +// 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 *i.RepositoryHooks + return *g.Body } -// 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 "" +// 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 *i.RepositoryPreReceiveHooks + return *g.CreatedAt } -// 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 (g *GistComment) GetID() int64 { + if g == nil || g.ID == nil { + return 0 } - return *i.RepositoryProjects + return *g.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 { +// 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 *i.Secrets + return *g.URL } -// 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 "" +// GetUser returns the User field. +func (g *GistComment) GetUser() *User { + if g == nil { + return nil } - return *i.SecretScanningAlerts + return g.User } -// 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 "" +// GetChangeStatus returns the ChangeStatus field. +func (g *GistCommit) GetChangeStatus() *CommitStats { + if g == nil { + return nil } - return *i.SecurityEvents + return g.ChangeStatus } -// 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 "" +// 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 *i.SingleFile + return *g.CommittedAt } -// GetStatuses returns the Statuses field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetStatuses() string { - if i == nil || i.Statuses == nil { +// 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 *i.Statuses + return *g.NodeID } -// GetTeamDiscussions returns the TeamDiscussions field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetTeamDiscussions() string { - if i == nil || i.TeamDiscussions == nil { +// 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 *i.TeamDiscussions + return *g.URL } -// 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 "" +// GetUser returns the User field. +func (g *GistCommit) GetUser() *User { + if g == nil { + return nil } - return *i.VulnerabilityAlerts + return g.User } -// GetWorkflows returns the Workflows field if it's non-nil, zero value otherwise. -func (i *InstallationPermissions) GetWorkflows() string { - if i == nil || i.Workflows == nil { +// 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 *i.Workflows + return *g.Version } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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 *i.Action + return *g.Content } -// GetInstallation returns the Installation field. -func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *g.Filename } -// GetOrg returns the Org field. -func (i *InstallationRepositoriesEvent) GetOrg() *Organization { - if i == nil { - return nil +// 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 i.Org + return *g.Language } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { - if i == nil || i.RepositorySelection == nil { +// 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 *i.RepositorySelection + return *g.RawURL } -// GetSender returns the Sender field. -func (i *InstallationRepositoriesEvent) GetSender() *User { - if i == nil { - return nil +// 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 i.Sender + return *g.Size } -// GetAccount returns the Account field. -func (i *InstallationRequest) GetAccount() *User { - if i == nil { - return nil +// 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 i.Account + return *g.Type } // 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 (g *GistFork) GetCreatedAt() Timestamp { + if g == nil || g.CreatedAt == nil { return Timestamp{} } - return *i.CreatedAt + return *g.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 +func (g *GistFork) GetID() string { + if g == nil || g.ID == nil { + return "" } - return *i.ID + return *g.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 (g *GistFork) GetNodeID() string { + if g == nil || g.NodeID == nil { return "" } - return *i.NodeID + return *g.NodeID } -// GetRequester returns the Requester field. -func (i *InstallationRequest) GetRequester() *User { - if i == nil { - return nil +// 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 i.Requester + return *g.UpdatedAt } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (i *InstallationSlugChange) GetFrom() string { - if i == nil || i.From == nil { +// 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 *i.From + return *g.URL } -// GetAccount returns the Account field. -func (i *InstallationTargetEvent) GetAccount() *User { - if i == nil { +// GetUser returns the User field. +func (g *GistFork) GetUser() *User { + if g == nil { return nil } - return i.Account + return g.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 { - return "" +// 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 *i.Action + return *g.PrivateGists } -// GetChanges returns the Changes field. -func (i *InstallationTargetEvent) GetChanges() *InstallationChanges { - if i == nil { - return nil +// 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 i.Changes + return *g.PublicGists } -// GetEnterprise returns the Enterprise field. -func (i *InstallationTargetEvent) GetEnterprise() *Enterprise { - if i == nil { - return nil +// 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 i.Enterprise + return *g.TotalGists } -// GetInstallation returns the Installation field. -func (i *InstallationTargetEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *g.Action } -// GetOrganization returns the Organization field. -func (i *InstallationTargetEvent) GetOrganization() *Organization { - if i == nil { +// GetInstallation returns the Installation field. +func (g *GitHubAppAuthorizationEvent) GetInstallation() *Installation { + if g == nil { return nil } - return i.Organization + return g.Installation } -// GetRepository returns the Repository field. -func (i *InstallationTargetEvent) GetRepository() *Repository { - if i == nil { +// GetSender returns the Sender field. +func (g *GitHubAppAuthorizationEvent) GetSender() *User { + if g == nil { return nil } - return i.Repository + return g.Sender } -// GetSender returns the Sender field. -func (i *InstallationTargetEvent) GetSender() *User { - if i == nil { - return nil +// 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 i.Sender + return *g.Name } -// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. -func (i *InstallationTargetEvent) GetTargetType() string { - if i == nil || i.TargetType == nil { +// 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 *i.TargetType + return *g.Source } -// 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{} +// 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 *i.ExpiresAt + return *g.SHA } -// GetPermissions returns the Permissions field. -func (i *InstallationToken) GetPermissions() *InstallationPermissions { - if i == nil { - return nil +// 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 i.Permissions + return *g.Type } -// GetToken returns the Token field if it's non-nil, zero value otherwise. -func (i *InstallationToken) GetToken() string { - if i == nil || i.Token == nil { +// 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 *i.Token + return *g.URL } -// GetPermissions returns the Permissions field. -func (i *InstallationTokenListRepoOptions) GetPermissions() *InstallationPermissions { - if i == nil { - return nil +// 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 i.Permissions + return *g.GithubReviewedAt } -// GetPermissions returns the Permissions field. -func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { - if i == nil { - return nil +// 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 i.Permissions + return *g.ID } -// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetExpiresAt() Timestamp { - if i == nil || i.ExpiresAt == nil { +// 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 *i.ExpiresAt + return *g.NVDPublishedAt } -// GetLimit returns the Limit field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetLimit() string { - if i == nil || i.Limit == nil { +// 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 *i.Limit + return *g.RepositoryAdvisoryURL } -// GetOrigin returns the Origin field if it's non-nil, zero value otherwise. -func (i *InteractionRestriction) GetOrigin() string { - if i == nil || i.Origin == nil { +// 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 *i.Origin + return *g.SourceCodeLocation } -// 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{} +// 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 *i.CreatedAt + return *g.Type } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (i *Invitation) GetEmail() string { - if i == nil || i.Email == nil { +// 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 *i.Email + return *g.FirstPatchedVersion } -// 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{} +// GetPackage returns the Package field. +func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { + if g == nil { + return nil } - return *i.FailedAt + return g.Package } -// GetFailedReason returns the FailedReason field if it's non-nil, zero value otherwise. -func (i *Invitation) GetFailedReason() string { - if i == nil || i.FailedReason == nil { +// 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 *i.FailedReason + return *g.VulnerableVersionRange } -// 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 +// GetInstallation returns the Installation field. +func (g *GollumEvent) GetInstallation() *Installation { + if g == nil { + return nil } - return *i.ID + return g.Installation } -// 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 "" +// GetOrg returns the Org field. +func (g *GollumEvent) GetOrg() *Organization { + if g == nil { + return nil } - return *i.InvitationTeamURL + return g.Org } -// GetInviter returns the Inviter field. -func (i *Invitation) GetInviter() *User { - if i == nil { +// GetRepo returns the Repo field. +func (g *GollumEvent) GetRepo() *Repository { + if g == nil { return nil } - return i.Inviter + return g.Repo } -// 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 "" +// GetSender returns the Sender field. +func (g *GollumEvent) GetSender() *User { + if g == nil { + return nil } - return *i.Login + return g.Sender } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Invitation) GetNodeID() string { - if i == nil || i.NodeID == nil { +// 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 *i.NodeID + return *g.Email } -// 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 +// 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 *i.TeamCount + return *g.Verified } -// 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 "" +// 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 *i.ActiveLockReason + return *g.CanCertify } -// GetAssignee returns the Assignee field. -func (i *Issue) GetAssignee() *User { - if i == nil { - return nil +// 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 i.Assignee + return *g.CanEncryptComms } -// 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 "" +// 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 *i.AuthorAssociation + return *g.CanEncryptStorage } -// 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 "" +// 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 *i.Body + return *g.CanSign } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (i *Issue) GetClosedAt() Timestamp { - if i == nil || i.ClosedAt == nil { +// 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 *i.ClosedAt + return *g.CreatedAt } -// GetClosedBy returns the ClosedBy field. -func (i *Issue) GetClosedBy() *User { - if i == nil { - return nil +// 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 i.ClosedBy + return *g.ExpiresAt } -// GetComments returns the Comments field if it's non-nil, zero value otherwise. -func (i *Issue) GetComments() int { - if i == nil || i.Comments == nil { +// 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 *i.Comments + return *g.ID } -// GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetCommentsURL() string { - if i == nil || i.CommentsURL == nil { +// 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 *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 + return *g.KeyID } -// 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 +// 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 *i.Draft + return *g.PrimaryKeyID } -// GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetEventsURL() string { - if i == nil || i.EventsURL == nil { +// 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 *i.EventsURL + return *g.PublicKey } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetHTMLURL() string { - if i == nil || i.HTMLURL == nil { +// 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 *i.HTMLURL + return *g.RawKey } -// 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 +// GetApp returns the App field. +func (g *Grant) GetApp() *AuthorizationApp { + if g == nil { + return nil } - return *i.ID + return g.App } -// 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 "" +// 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 *i.LabelsURL + return *g.CreatedAt } -// 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 +// 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 *i.Locked + return *g.ID } -// GetMilestone returns the Milestone field. -func (i *Issue) GetMilestone() *Milestone { - if i == nil { - return nil +// 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 i.Milestone + return *g.UpdatedAt } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *Issue) GetNodeID() string { - if i == nil || i.NodeID == nil { +// 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 *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 + return *g.URL } -// GetPullRequestLinks returns the PullRequestLinks field. -func (i *Issue) GetPullRequestLinks() *PullRequestLinks { - if i == nil { +// GetAuthor returns the Author field. +func (h *HeadCommit) GetAuthor() *CommitAuthor { + if h == nil { return nil } - return i.PullRequestLinks + return h.Author } -// GetReactions returns the Reactions field. -func (i *Issue) GetReactions() *Reactions { - if i == nil { +// GetCommitter returns the Committer field. +func (h *HeadCommit) GetCommitter() *CommitAuthor { + if h == nil { return nil } - return i.Reactions + return h.Committer } -// GetRepository returns the Repository field. -func (i *Issue) GetRepository() *Repository { - if i == nil { - return nil +// 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 i.Repository + return *h.Distinct } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *Issue) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { +// 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 *i.RepositoryURL + return *h.ID } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *Issue) GetState() string { - if i == nil || i.State == nil { +// 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 *i.State + return *h.Message } -// GetStateReason returns the StateReason field if it's non-nil, zero value otherwise. -func (i *Issue) GetStateReason() string { - if i == nil || i.StateReason == nil { +// 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 *i.StateReason + return *h.SHA } -// 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 "" +// 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 *i.Title + return *h.Timestamp } -// 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{} +// 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 *i.UpdatedAt + return *h.TreeID } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (i *Issue) GetURL() string { - if i == nil || i.URL == nil { +func (h *HeadCommit) GetURL() string { + if h == nil || h.URL == nil { return "" } - return *i.URL + return *h.URL } -// GetUser returns the User field. -func (i *Issue) GetUser() *User { - if i == nil { - return nil +// 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 i.User + return *h.Active } -// 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 "" +// GetConfig returns the Config field. +func (h *Hook) GetConfig() *HookConfig { + if h == nil { + return nil } - return *i.AuthorAssociation + return h.Config } -// 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 "" +// 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 *i.Body + return *h.CreatedAt } -// 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{} +// 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 *i.CreatedAt + return *h.ID } -// 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 "" +// 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 *i.HTMLURL + return h.LastResponse } -// 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 +// 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 *i.ID + return *h.Name } -// GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetIssueURL() string { - if i == nil || i.IssueURL == nil { +// 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 *i.IssueURL + return *h.PingURL } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetNodeID() string { - if i == nil || i.NodeID == nil { +// 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 *i.NodeID + return *h.TestURL } -// GetReactions returns the Reactions field. -func (i *IssueComment) GetReactions() *Reactions { - if i == nil { - return nil +// 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 i.Reactions + return *h.Type } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (i *IssueComment) GetUpdatedAt() Timestamp { - if i == nil || i.UpdatedAt == nil { +func (h *Hook) GetUpdatedAt() Timestamp { + if h == nil || h.UpdatedAt == nil { return Timestamp{} } - return *i.UpdatedAt + return *h.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 { +func (h *Hook) GetURL() string { + if h == nil || h.URL == nil { return "" } - return *i.URL + return *h.URL } -// GetUser returns the User field. -func (i *IssueComment) GetUser() *User { - if i == nil { - return nil +// 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 i.User + return *h.ContentType } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssueCommentEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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 *i.Action + return *h.InsecureSSL } -// GetChanges returns the Changes field. -func (i *IssueCommentEvent) GetChanges() *EditChange { - if i == nil { - return nil +// 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 i.Changes + return *h.Secret } -// GetComment returns the Comment field. -func (i *IssueCommentEvent) GetComment() *IssueComment { - if i == nil { - return nil +// 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 i.Comment + return *h.URL } -// GetInstallation returns the Installation field. -func (i *IssueCommentEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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 i.Installation + return *h.Action } -// GetIssue returns the Issue field. -func (i *IssueCommentEvent) GetIssue() *Issue { - if i == nil { - return nil +// 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 i.Issue + return *h.DeliveredAt } -// GetOrganization returns the Organization field. -func (i *IssueCommentEvent) GetOrganization() *Organization { - if i == nil { +// GetDuration returns the Duration field. +func (h *HookDelivery) GetDuration() *float64 { + if h == nil { return nil } - return i.Organization + return h.Duration } -// GetRepo returns the Repo field. -func (i *IssueCommentEvent) GetRepo() *Repository { - if i == nil { - return nil +// 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 i.Repo + return *h.Event } -// GetSender returns the Sender field. -func (i *IssueCommentEvent) GetSender() *User { - if i == nil { - return nil +// 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 i.Sender + return *h.GUID } -// GetActor returns the Actor field. -func (i *IssueEvent) GetActor() *User { - if i == nil { - return nil +// 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 i.Actor + return *h.ID } -// GetAssignee returns the Assignee field. -func (i *IssueEvent) GetAssignee() *User { - if i == nil { - return nil +// 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 i.Assignee + return *h.InstallationID } -// GetAssigner returns the Assigner field. -func (i *IssueEvent) GetAssigner() *User { - if i == nil { - return nil +// 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 i.Assigner + return *h.Redelivery } -// 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 "" +// 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 *i.CommitID + return *h.RepositoryID } -// 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{} +// GetRequest returns the Request field. +func (h *HookDelivery) GetRequest() *HookRequest { + if h == nil { + return nil } - return *i.CreatedAt + return h.Request } -// GetDismissedReview returns the DismissedReview field. -func (i *IssueEvent) GetDismissedReview() *DismissedReview { - if i == nil { +// GetResponse returns the Response field. +func (h *HookDelivery) GetResponse() *HookResponse { + if h == nil { return nil } - return i.DismissedReview + return h.Response } -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetEvent() string { - if i == nil || i.Event == nil { +// 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 *i.Event + return *h.Status } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (i *IssueEvent) GetID() int64 { - if i == nil || i.ID == nil { +// 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 *i.ID + return *h.StatusCode } -// GetIssue returns the Issue field. -func (i *IssueEvent) GetIssue() *Issue { - if i == nil { - return nil +// 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 i.Issue + return h.Headers } -// GetLabel returns the Label field. -func (i *IssueEvent) GetLabel() *Label { - if i == nil { - return nil +// 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 i.Label + return *h.RawPayload } -// 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 "" +// 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 *i.LockReason + return h.Headers } -// GetMilestone returns the Milestone field. -func (i *IssueEvent) GetMilestone() *Milestone { - if i == nil { - return nil +// 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 i.Milestone + return *h.RawPayload } -// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. -func (i *IssueEvent) GetPerformedViaGithubApp() *App { - if i == nil { - return nil +// 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 i.PerformedViaGithubApp + return *h.ActiveHooks } -// GetProjectCard returns the ProjectCard field. -func (i *IssueEvent) GetProjectCard() *ProjectCard { - if i == nil { - return nil +// 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 i.ProjectCard + return *h.InactiveHooks } -// GetRename returns the Rename field. -func (i *IssueEvent) GetRename() *Rename { - if i == nil { - return nil +// 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 i.Rename + return *h.TotalHooks } -// GetRepository returns the Repository field. -func (i *IssueEvent) GetRepository() *Repository { - if i == nil { - return nil +// 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 i.Repository + return *h.ID } -// GetRequestedReviewer returns the RequestedReviewer field. -func (i *IssueEvent) GetRequestedReviewer() *User { - if i == nil { +// GetImageDetails returns the ImageDetails field. +func (h *HostedRunner) GetImageDetails() *HostedRunnerImageDetail { + if h == nil { return nil } - return i.RequestedReviewer + return h.ImageDetails } -// GetRequestedTeam returns the RequestedTeam field. -func (i *IssueEvent) GetRequestedTeam() *Team { - if i == nil { - return nil +// 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 i.RequestedTeam + return *h.LastActiveOn } -// GetReviewRequester returns the ReviewRequester field. -func (i *IssueEvent) GetReviewRequester() *User { - if i == nil { +// GetMachineSizeDetails returns the MachineSizeDetails field. +func (h *HostedRunner) GetMachineSizeDetails() *HostedRunnerMachineSpec { + if h == nil { return nil } - return i.ReviewRequester + return h.MachineSizeDetails } -// 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 "" +// 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 *i.URL + return *h.MaximumRunners } -// GetAssignee returns the Assignee field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetAssignee() string { - if i == nil || i.Assignee == nil { +// 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 *i.Assignee -} - -// 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 + return *h.Name } -// 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{} +// 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 *i.ClosedAt + return *h.Platform } -// 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{} +// 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 *i.CreatedAt + return *h.PublicIPEnabled } -// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. -func (i *IssueImport) GetMilestone() int { - if i == nil || i.Milestone == nil { +// 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 *i.Milestone + return *h.RunnerGroupID } -// 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{} +// 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 *i.UpdatedAt + return *h.Status } -// GetCode returns the Code field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetCode() string { - if i == nil || i.Code == nil { +// 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 *i.Code + return *h.DisplayName } -// GetField returns the Field field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetField() string { - if i == nil || i.Field == nil { +// 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 *i.Field + return *h.ID } -// 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 "" +// 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 *i.Location + return *h.SizeGB } -// GetResource returns the Resource field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetResource() string { - if i == nil || i.Resource == nil { +// 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 *i.Resource + return *h.Source } -// GetValue returns the Value field if it's non-nil, zero value otherwise. -func (i *IssueImportError) GetValue() string { - if i == nil || i.Value == nil { +// 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 *i.Value + return *h.Version } -// 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{} +// GetPublicIPs returns the PublicIPs field. +func (h *HostedRunnerPublicIPLimits) GetPublicIPs() *PublicIPUsage { + if h == nil { + return nil } - return *i.CreatedAt + return h.PublicIPs } -// GetDocumentationURL returns the DocumentationURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetDocumentationURL() string { - if i == nil || i.DocumentationURL == nil { +// 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.DocumentationURL -} - -// 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 + return *i.GroupDescription } -// GetImportIssuesURL returns the ImportIssuesURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetImportIssuesURL() string { - if i == nil || i.ImportIssuesURL == nil { +// 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.ImportIssuesURL + return *i.GroupID } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetMessage() string { - if i == nil || i.Message == nil { +// 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.Message + return *i.GroupName } -// GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetRepositoryURL() string { - if i == nil || i.RepositoryURL == nil { +// GetEnforcedRepositories returns the EnforcedRepositories field if it's non-nil, zero value otherwise. +func (i *ImmutableReleasePolicy) GetEnforcedRepositories() string { + if i == nil || i.EnforcedRepositories == nil { return "" } - return *i.RepositoryURL + return *i.EnforcedRepositories } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (i *IssueImportResponse) GetStatus() string { - if i == nil || i.Status == nil { +// 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.Status + return *i.EnforcedRepositories } -// 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{} +// 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.UpdatedAt + return *i.SelectedRepositoriesURL } -// 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 "" +// 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.URL + return *i.AuthorsCount } -// GetDirection returns the Direction field if it's non-nil, zero value otherwise. -func (i *IssueListCommentsOptions) GetDirection() string { - if i == nil || i.Direction == nil { +// 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.Direction + return *i.AuthorsURL } -// 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{} +// 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.Since + return *i.CommitCount } -// GetSort returns the Sort field if it's non-nil, zero value otherwise. -func (i *IssueListCommentsOptions) GetSort() string { - if i == nil || i.Sort == nil { +// 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.Sort + return *i.FailedStep } -// 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 "" +// 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.Assignee + return *i.HasLargeFiles } -// 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 +// 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.Assignees + return *i.HTMLURL } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetBody() string { - if i == nil || i.Body == nil { +// 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.Body + return *i.HumanName } -// GetLabels returns the Labels field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetLabels() []string { - if i == nil || i.Labels == nil { - return nil +// 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.Labels + return *i.LargeFilesCount } -// GetMilestone returns the Milestone field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetMilestone() int { - if i == nil || i.Milestone == nil { +// 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.Milestone + return *i.LargeFilesSize } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetState() string { - if i == nil || i.State == nil { +// 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.State + return *i.Message } -// 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 "" +// 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.StateReason + return *i.Percent } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (i *IssueRequest) GetTitle() string { - if i == nil || i.Title == nil { +// 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.Title + return *i.RepositoryURL } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (i *IssuesEvent) GetAction() string { - if i == nil || i.Action == nil { +// 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.Action + return *i.Status } -// GetAssignee returns the Assignee field. -func (i *IssuesEvent) GetAssignee() *User { - if i == nil { - return nil +// 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.Assignee + return *i.StatusText } -// GetChanges returns the Changes field. -func (i *IssuesEvent) GetChanges() *EditChange { - if i == nil { - return nil +// 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.Changes + return *i.TFVCProject } -// GetInstallation returns the Installation field. -func (i *IssuesEvent) GetInstallation() *Installation { - if i == nil { - return nil +// 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.Installation + return *i.URL } -// GetIssue returns the Issue field. -func (i *IssuesEvent) GetIssue() *Issue { - if i == nil { - return nil +// 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.Issue + return *i.UseLFS } -// GetLabel returns the Label field. -func (i *IssuesEvent) GetLabel() *Label { - if i == nil { - return nil +// 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.Label + return *i.VCS } -// GetMilestone returns the Milestone field. -func (i *IssuesEvent) GetMilestone() *Milestone { - if i == nil { - return nil +// 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.Milestone + return *i.VCSPassword } -// GetOrg returns the Org field. -func (i *IssuesEvent) GetOrg() *Organization { - if i == nil { - return nil +// 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.Org + return *i.VCSURL } -// GetRepo returns the Repo field. -func (i *IssuesEvent) GetRepo() *Repository { - if i == nil { - return nil +// 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.Repo + return *i.VCSUsername } -// GetSender returns the Sender field. -func (i *IssuesEvent) GetSender() *User { - if i == nil { - return nil +// 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.Sender + return *i.AccessTokensURL } -// 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 +// GetAccount returns the Account field. +func (i *Installation) GetAccount() *User { + if i == nil { + return nil } - return *i.IncompleteResults + return i.Account } -// GetTotal returns the Total field if it's non-nil, zero value otherwise. -func (i *IssuesSearchResult) GetTotal() int { - if i == nil || i.Total == nil { +// 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.Total + return *i.AppID } -// 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 +// 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.ClosedIssues + return *i.AppSlug } -// 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 +// 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.OpenIssues + return *i.ClientID } -// 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 +// 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.TotalIssues + return *i.CreatedAt } -// 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 "" +// 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 *j.EncodedJITConfig + return *i.HasMultipleSingleFiles } -// GetRunner returns the Runner field. -func (j *JITRunnerConfig) GetRunner() *Runner { - if j == nil { - return nil +// 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 j.Runner + return *i.HTMLURL } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (j *Jobs) GetTotalCount() int { - if j == nil || j.TotalCount == nil { +// 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 *j.TotalCount + return *i.ID } -// GetAddedBy returns the AddedBy field if it's non-nil, zero value otherwise. -func (k *Key) GetAddedBy() string { - if k == nil || k.AddedBy == nil { +// 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 *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 + return *i.NodeID } -// 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 +// GetPermissions returns the Permissions field. +func (i *Installation) GetPermissions() *InstallationPermissions { + if i == nil { + return nil } - return *k.ID + return i.Permissions } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (k *Key) GetKey() string { - if k == nil || k.Key == nil { +// 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 *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 + return *i.RepositoriesURL } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (k *Key) GetTitle() string { - if k == nil || k.Title == nil { +// 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 *k.Title + return *i.RepositorySelection } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (k *Key) GetURL() string { - if k == nil || k.URL == nil { +// 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 *k.URL + return *i.SingleFileName } -// 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 +// 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 *k.Verified + return *i.SuspendedAt } -// GetColor returns the Color field if it's non-nil, zero value otherwise. -func (l *Label) GetColor() string { - if l == nil || l.Color == nil { - return "" +// GetSuspendedBy returns the SuspendedBy field. +func (i *Installation) GetSuspendedBy() *User { + if i == nil { + return nil } - return *l.Color + return i.SuspendedBy } -// 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 +// 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 *l.Default + return *i.TargetID } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *Label) GetDescription() string { - if l == nil || l.Description == nil { +// 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 *l.Description -} - -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (l *Label) GetID() int64 { - if l == nil || l.ID == nil { - return 0 - } - return *l.ID + return *i.TargetType } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *Label) GetName() string { - if l == nil || l.Name == nil { - return "" +// 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 *l.Name + return *i.UpdatedAt } -// 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 "" +// GetLogin returns the Login field. +func (i *InstallationChanges) GetLogin() *InstallationLoginChange { + if i == nil { + return nil } - return *l.NodeID + return i.Login } -// 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 "" +// GetSlug returns the Slug field. +func (i *InstallationChanges) GetSlug() *InstallationSlugChange { + if i == nil { + return nil } - return *l.URL + return i.Slug } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (l *LabelEvent) GetAction() string { - if l == nil || l.Action == nil { +func (i *InstallationEvent) GetAction() string { + if i == nil || i.Action == nil { return "" } - return *l.Action -} - -// GetChanges returns the Changes field. -func (l *LabelEvent) GetChanges() *EditChange { - if l == nil { - return nil - } - return l.Changes + return *i.Action } // 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 { +func (i *InstallationEvent) GetInstallation() *Installation { + if i == nil { return nil } - return l.Label + return i.Installation } // GetOrg returns the Org field. -func (l *LabelEvent) GetOrg() *Organization { - if l == nil { +func (i *InstallationEvent) GetOrg() *Organization { + if i == nil { return nil } - return l.Org + return i.Org } -// GetRepo returns the Repo field. -func (l *LabelEvent) GetRepo() *Repository { - if l == nil { +// GetRequester returns the Requester field. +func (i *InstallationEvent) GetRequester() *User { + if i == nil { return nil } - return l.Repo + return i.Requester } // GetSender returns the Sender field. -func (l *LabelEvent) GetSender() *User { - if l == nil { +func (i *InstallationEvent) GetSender() *User { + if i == nil { return nil } - return l.Sender + return i.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 { +// 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 *l.Color + return *i.From } -// 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 +// 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 *l.Default + return *i.Actions } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetDescription() string { - if l == nil || l.Description == nil { +// 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 *l.Description + return *i.ActionsVariables } -// 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 +// 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 *l.ID + return *i.Administration } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetName() string { - if l == nil || l.Name == nil { +// 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 *l.Name + return *i.Attestations } -// GetScore returns the Score field. -func (l *LabelResult) GetScore() *float64 { - if l == nil { - return nil +// 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 l.Score + return *i.Blocking } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *LabelResult) GetURL() string { - if l == nil || l.URL == nil { +// 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 *l.URL + return *i.Checks } -// 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 +// 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 *l.IncompleteResults + return *i.Codespaces } -// 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 +// 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 *l.Total + return *i.CodespacesLifecycleAdmin } -// GetOID returns the OID field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetOID() string { - if l == nil || l.OID == nil { +// 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 *l.OID + return *i.CodespacesMetadata } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetPath() string { - if l == nil || l.Path == nil { +// 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 *l.Path + return *i.CodespacesSecrets } -// GetRefName returns the RefName field if it's non-nil, zero value otherwise. -func (l *LargeFile) GetRefName() string { - if l == nil || l.RefName == nil { +// 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 *l.RefName + return *i.CodespacesUserSecrets } -// 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 +// 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 *l.Size + return *i.ContentReferences } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (l *License) GetBody() string { - if l == nil || l.Body == nil { +// 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 *l.Body + return *i.Contents } -// 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 +// 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 *l.Conditions + return *i.CopilotMessages } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (l *License) GetDescription() string { - if l == nil || l.Description == nil { +// 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 *l.Description + return *i.DependabotSecrets } -// 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 +// 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 *l.Featured + return *i.Deployments } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (l *License) GetHTMLURL() string { - if l == nil || l.HTMLURL == nil { +// 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 *l.HTMLURL + return *i.Discussions } -// GetImplementation returns the Implementation field if it's non-nil, zero value otherwise. -func (l *License) GetImplementation() string { - if l == nil || l.Implementation == nil { +// 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 *l.Implementation + return *i.Emails } -// GetKey returns the Key field if it's non-nil, zero value otherwise. -func (l *License) GetKey() string { - if l == nil || l.Key == nil { +// 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 *l.Key + return *i.Environments } -// 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 +// 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 *l.Limitations + return *i.Followers } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *License) GetName() string { - if l == nil || l.Name == nil { +// 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 *l.Name + return *i.Gists } -// 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 +// 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 *l.Permissions + return *i.GitSigningSSHPublicKeys } -// GetSPDXID returns the SPDXID field if it's non-nil, zero value otherwise. -func (l *License) GetSPDXID() string { - if l == nil || l.SPDXID == nil { +// 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 *l.SPDXID + return *i.GPGKeys } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (l *License) GetURL() string { - if l == nil || l.URL == nil { +// 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 *l.URL + return *i.InteractionLimits } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (l *LinearHistoryRequirementEnforcementLevelChanges) GetFrom() string { - if l == nil || l.From == nil { +// 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 *l.From + return *i.Issues } -// GetDirection returns the Direction field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetDirection() string { - if l == nil || l.Direction == nil { +// 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 *l.Direction + return *i.Keys } -// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetEcosystem() string { - if l == nil || l.Ecosystem == nil { +// 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 *l.Ecosystem + return *i.Members } -// GetPackage returns the Package field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetPackage() string { - if l == nil || l.Package == nil { +// 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 *l.Package + return *i.MergeQueues } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetScope() string { - if l == nil || l.Scope == nil { +// 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 *l.Scope + return *i.Metadata } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetSeverity() string { - if l == nil || l.Severity == nil { +// 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 *l.Severity + return *i.OrganizationActionsVariables } -// GetSort returns the Sort field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetSort() string { - if l == nil || l.Sort == nil { +// 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 *l.Sort + return *i.OrganizationAdministration } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (l *ListAlertsOptions) GetState() string { - if l == nil || l.State == nil { +// 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 *l.State + return *i.OrganizationAnnouncementBanners } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *ListArtifactsOptions) GetName() string { - if l == nil || l.Name == nil { +// 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 *l.Name + return *i.OrganizationAPIInsights } -// 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 +// 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 *l.AppID + return *i.OrganizationCodespaces } -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { +// 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 *l.CheckName + return *i.OrganizationCodespacesSecrets } -// GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetFilter() string { - if l == nil || l.Filter == nil { +// 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 *l.Filter + return *i.OrganizationCodespacesSettings } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (l *ListCheckRunsOptions) GetStatus() string { - if l == nil || l.Status == nil { +// 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 *l.Status + return *i.OrganizationCopilotSeatManagement } -// 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 +// 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 *l.Total + return *i.OrganizationCustomOrgRoles } -// 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 +// 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 *l.AppID + return *i.OrganizationCustomProperties } -// GetCheckName returns the CheckName field if it's non-nil, zero value otherwise. -func (l *ListCheckSuiteOptions) GetCheckName() string { - if l == nil || l.CheckName == nil { +// 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 *l.CheckName + return *i.OrganizationCustomRoles } -// 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 +// 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 *l.Total + return *i.OrganizationDependabotSecrets } -// 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 +// 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 *l.TotalCount + return *i.OrganizationEvents } -// GetAffiliation returns the Affiliation field if it's non-nil, zero value otherwise. -func (l *ListCollaboratorOptions) GetAffiliation() string { - if l == nil || l.Affiliation == nil { +// 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 *l.Affiliation + return *i.OrganizationHooks } -// 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 +// 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 *l.TotalCount + return *i.OrganizationKnowledgeBases } -// 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 +// 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 *l.TotalCount + return *i.OrganizationPackages } -// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. -func (l *ListExternalGroupsOptions) GetDisplayName() string { - if l == nil || l.DisplayName == nil { +// 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 *l.DisplayName + return *i.OrganizationPersonalAccessTokenRequests } -// GetAffects returns the Affects field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetAffects() string { - if l == nil || l.Affects == nil { +// 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 *l.Affects + return *i.OrganizationPersonalAccessTokens } -// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetCVEID() string { - if l == nil || l.CVEID == nil { +// 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 *l.CVEID + return *i.OrganizationPlan } -// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetEcosystem() string { - if l == nil || l.Ecosystem == nil { +// 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 *l.Ecosystem + return *i.OrganizationPreReceiveHooks } -// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetGHSAID() string { - if l == nil || l.GHSAID == nil { +// 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 *l.GHSAID + return *i.OrganizationProjects } -// 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 +// 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 *l.IsWithdrawn + return *i.OrganizationSecrets } -// GetModified returns the Modified field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetModified() string { - if l == nil || l.Modified == nil { +// 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 *l.Modified + return *i.OrganizationSelfHostedRunners } -// GetPublished returns the Published field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetPublished() string { - if l == nil || l.Published == nil { +// 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 *l.Published + return *i.OrganizationUserBlocking } -// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetSeverity() string { - if l == nil || l.Severity == nil { +// 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 *l.Severity + return *i.Packages } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetType() string { - if l == nil || l.Type == nil { +// 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 *l.Type + return *i.Pages } -// GetUpdated returns the Updated field if it's non-nil, zero value otherwise. -func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { - if l == nil || l.Updated == nil { +// 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 *l.Updated + return *i.Plan } -// 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 +// 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 *l.TotalCount + return *i.Profile } -// 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 +// 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 *l.TotalCount + return *i.PullRequests } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (l *ListRunnersOptions) GetName() string { - if l == nil || l.Name == nil { +// 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 *l.Name + return *i.RepositoryAdvisories } -// 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 +// 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 *l.Count + return *i.RepositoryCustomProperties } -// GetFilter returns the Filter field if it's non-nil, zero value otherwise. -func (l *ListSCIMProvisionedIdentitiesOptions) GetFilter() string { - if l == nil || l.Filter == nil { +// 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 *l.Filter + return *i.RepositoryHooks } -// 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 +// 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 *l.StartIndex + return *i.RepositoryPreReceiveHooks } -// 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 +// 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 *l.EndColumn + return *i.RepositoryProjects } -// 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 +// 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 *l.EndLine + return *i.Secrets } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (l *Location) GetPath() string { - if l == nil || l.Path == nil { +// 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 *l.Path + return *i.SecretScanningAlerts } -// 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 +// 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 *l.StartColumn + return *i.SecurityEvents } -// 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 +// 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 *l.StartLine + return *i.SingleFile } -// 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 +// 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 *l.Enabled + return *i.Starring } -// 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{} +// 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 *m.EffectiveDate + return *i.Statuses } -// 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 +// 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 *m.ID + return *i.TeamDiscussions } -// GetPlan returns the Plan field. -func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { - if m == nil { - return nil +// 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 m.Plan + return *i.UserEvents } -// 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 +// 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 *m.UnitCount + return *i.VulnerabilityAlerts } -// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetAccountsURL() string { - if m == nil || m.AccountsURL == nil { +// 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 *m.AccountsURL + return *i.Watching } -// 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 +// 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 *m.Bullets + return *i.Workflows } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetDescription() string { - if m == nil || m.Description == nil { +// 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 *m.Description + return *i.Action } -// 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 +// GetInstallation returns the Installation field. +func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { + if i == nil { + return nil } - return *m.HasFreeTrial + return i.Installation } -// 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 +// GetOrg returns the Org field. +func (i *InstallationRepositoriesEvent) GetOrg() *Organization { + if i == nil { + return nil } - return *m.ID + return i.Org } -// 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 +// 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 *m.MonthlyPriceInCents + return *i.RepositorySelection } -// 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 "" +// GetSender returns the Sender field. +func (i *InstallationRepositoriesEvent) GetSender() *User { + if i == nil { + return nil } - return *m.Name + return i.Sender } -// 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 +// GetAccount returns the Account field. +func (i *InstallationRequest) GetAccount() *User { + if i == nil { + return nil } - return *m.Number + return i.Account } -// 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 "" +// 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 *m.PriceModel + return *i.CreatedAt } -// 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 "" +// 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 *m.State + return *i.ID } -// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise. -func (m *MarketplacePlan) GetUnitName() string { - if m == nil || m.UnitName == nil { +// 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 *m.UnitName + return *i.NodeID } -// 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 "" +// GetRequester returns the Requester field. +func (i *InstallationRequest) GetRequester() *User { + if i == nil { + return nil } - return *m.URL + return i.Requester } -// 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 +// 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 *m.YearlyPriceInCents + return *i.From } -// 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 +// GetAccount returns the Account field. +func (i *InstallationTargetEvent) GetAccount() *User { + if i == nil { + return nil } - return *m.ID + return i.Account } -// GetLogin returns the Login field if it's non-nil, zero value otherwise. -func (m *MarketplacePlanAccount) GetLogin() string { - if m == nil || m.Login == nil { +// 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 *m.Login + return *i.Action } -// GetMarketplacePendingChange returns the MarketplacePendingChange field. -func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { - if m == nil { +// GetChanges returns the Changes field. +func (i *InstallationTargetEvent) GetChanges() *InstallationChanges { + if i == nil { return nil } - return m.MarketplacePendingChange + return i.Changes } -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { +// GetEnterprise returns the Enterprise field. +func (i *InstallationTargetEvent) GetEnterprise() *Enterprise { + if i == nil { return nil } - return m.MarketplacePurchase + return i.Enterprise } -// 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 "" +// GetInstallation returns the Installation field. +func (i *InstallationTargetEvent) GetInstallation() *Installation { + if i == nil { + return nil } - return *m.OrganizationBillingEmail + return i.Installation } -// 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 "" +// GetOrganization returns the Organization field. +func (i *InstallationTargetEvent) GetOrganization() *Organization { + if i == nil { + return nil } - return *m.Type + return i.Organization } -// 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 "" +// GetRepository returns the Repository field. +func (i *InstallationTargetEvent) GetRepository() *Repository { + if i == nil { + return nil } - return *m.URL + return i.Repository } -// GetAccount returns the Account field. -func (m *MarketplacePurchase) GetAccount() *MarketplacePurchaseAccount { - if m == nil { +// GetSender returns the Sender field. +func (i *InstallationTargetEvent) GetSender() *User { + if i == nil { return nil } - return m.Account + return i.Sender } -// GetBillingCycle returns the BillingCycle field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetBillingCycle() string { - if m == nil || m.BillingCycle == nil { +// 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 *m.BillingCycle + return *i.TargetType } -// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp { - if m == nil || m.FreeTrialEndsOn == nil { +// 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 *m.FreeTrialEndsOn + return *i.ExpiresAt } -// 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{} +// GetPermissions returns the Permissions field. +func (i *InstallationToken) GetPermissions() *InstallationPermissions { + if i == nil { + return nil } - return *m.NextBillingDate + return i.Permissions } -// 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 +// 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 *m.OnFreeTrial + return *i.Token } -// GetPlan returns the Plan field. -func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { - if m == nil { +// GetPermissions returns the Permissions field. +func (i *InstallationTokenListRepoOptions) GetPermissions() *InstallationPermissions { + if i == nil { return nil } - return m.Plan + return i.Permissions } -// 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 +// GetPermissions returns the Permissions field. +func (i *InstallationTokenOptions) GetPermissions() *InstallationPermissions { + if i == nil { + return nil } - return *m.UnitCount + return i.Permissions } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchase) GetUpdatedAt() Timestamp { - if m == nil || m.UpdatedAt == nil { +// 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 *m.UpdatedAt + return *i.ExpiresAt } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetEmail() string { - if m == nil || m.Email == nil { +// 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 *m.Email + return *i.Limit } -// 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 +// 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 *m.ID + return *i.Origin } -// 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 "" +// 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 *m.Login + return *i.CreatedAt } -// 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 { +// 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 *m.OrganizationBillingEmail + return *i.Email } -// 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 "" +// 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 *m.Type + return *i.FailedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *MarketplacePurchaseAccount) GetURL() string { - if m == nil || m.URL == nil { +// 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 *m.URL + return *i.FailedReason } -// 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 "" +// 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 *m.Action + return *i.ID } -// 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{} +// 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 *m.EffectiveDate + return *i.InvitationTeamURL } -// GetInstallation returns the Installation field. -func (m *MarketplacePurchaseEvent) GetInstallation() *Installation { - if m == nil { +// GetInviter returns the Inviter field. +func (i *Invitation) GetInviter() *User { + if i == nil { return nil } - return m.Installation + return i.Inviter } -// GetMarketplacePurchase returns the MarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil +// 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 m.MarketplacePurchase + return *i.Login } -// GetOrg returns the Org field. -func (m *MarketplacePurchaseEvent) GetOrg() *Organization { - if m == nil { - return nil +// 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 m.Org + return *i.NodeID } -// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. -func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { - if m == nil { - return nil +// 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 m.PreviousMarketplacePurchase + return *i.Role } -// GetSender returns the Sender field. -func (m *MarketplacePurchaseEvent) GetSender() *User { - if m == nil { - return nil +// 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 m.Sender + return *i.TeamCount } -// GetText returns the Text field if it's non-nil, zero value otherwise. -func (m *Match) GetText() string { - if m == nil || m.Text == nil { +// 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 *m.Text + return *i.ActiveLockReason } -// GetPermission returns the Permission field. -func (m *MemberChanges) GetPermission() *MemberChangesPermission { - if m == nil { +// GetAssignee returns the Assignee field. +func (i *Issue) GetAssignee() *User { + if i == nil { return nil } - return m.Permission + return i.Assignee } -// GetRoleName returns the RoleName field. -func (m *MemberChanges) GetRoleName() *MemberChangesRoleName { - if m == nil { - return nil +// 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 m.RoleName + return *i.AuthorAssociation } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (m *MemberChangesPermission) GetFrom() string { - if m == nil || m.From == nil { +// 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 *m.From + return *i.Body } -// 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 "" +// 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 *m.To + return *i.ClosedAt } -// 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 "" +// GetClosedBy returns the ClosedBy field. +func (i *Issue) GetClosedBy() *User { + if i == nil { + return nil } - return *m.From + return i.ClosedBy } -// 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 "" +// 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 *m.To + return *i.Comments } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MemberEvent) GetAction() string { - if m == nil || m.Action == nil { +// 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 *m.Action + return *i.CommentsURL } -// GetChanges returns the Changes field. -func (m *MemberEvent) GetChanges() *MemberChanges { - if m == nil { - return nil +// 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 m.Changes + return *i.CreatedAt } -// GetInstallation returns the Installation field. -func (m *MemberEvent) GetInstallation() *Installation { - if m == nil { - return nil +// 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 m.Installation + return *i.Draft } -// GetMember returns the Member field. -func (m *MemberEvent) GetMember() *User { - if m == nil { - return nil +// 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 m.Member + return *i.EventsURL } -// GetOrg returns the Org field. -func (m *MemberEvent) GetOrg() *Organization { - if m == nil { - return nil +// 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 m.Org + return *i.HTMLURL } -// GetRepo returns the Repo field. -func (m *MemberEvent) GetRepo() *Repository { - if m == nil { - return nil +// 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 m.Repo + return *i.ID } -// GetSender returns the Sender field. -func (m *MemberEvent) GetSender() *User { - if m == nil { - return nil +// 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 m.Sender + return *i.LabelsURL } -// GetOrganization returns the Organization field. -func (m *Membership) GetOrganization() *Organization { - if m == nil { - return nil +// 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 m.Organization + return *i.Locked } -// 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 "" +// GetMilestone returns the Milestone field. +func (i *Issue) GetMilestone() *Milestone { + if i == nil { + return nil } - return *m.OrganizationURL + return i.Milestone } -// GetRole returns the Role field if it's non-nil, zero value otherwise. -func (m *Membership) GetRole() string { - if m == nil || m.Role == nil { +// 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 *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 + return *i.NodeID } -// 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 "" +// 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 *m.URL + return *i.Number } -// GetUser returns the User field. -func (m *Membership) GetUser() *User { - if m == nil { +// GetPullRequestLinks returns the PullRequestLinks field. +func (i *Issue) GetPullRequestLinks() *PullRequestLinks { + if i == nil { return nil } - return m.User + return i.PullRequestLinks } -// 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 "" +// GetReactions returns the Reactions field. +func (i *Issue) GetReactions() *Reactions { + if i == nil { + return nil } - return *m.Action + return i.Reactions } -// GetInstallation returns the Installation field. -func (m *MembershipEvent) GetInstallation() *Installation { - if m == nil { +// GetRepository returns the Repository field. +func (i *Issue) GetRepository() *Repository { + if i == nil { return nil } - return m.Installation + return i.Repository } -// GetMember returns the Member field. -func (m *MembershipEvent) GetMember() *User { - if m == nil { - return nil +// 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 m.Member + return *i.RepositoryURL } -// GetOrg returns the Org field. -func (m *MembershipEvent) GetOrg() *Organization { - if m == nil { - return nil +// 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 m.Org + return *i.State } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (m *MembershipEvent) GetScope() string { - if m == nil || m.Scope == nil { +// 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 *m.Scope + return *i.StateReason } -// GetSender returns the Sender field. -func (m *MembershipEvent) GetSender() *User { - if m == nil { - return nil +// 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 m.Sender + return *i.Title } -// GetTeam returns the Team field. -func (m *MembershipEvent) GetTeam() *Team { - if m == nil { +// GetType returns the Type field. +func (i *Issue) GetType() *IssueType { + if i == nil { return nil } - return m.Team + return i.Type } -// 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 "" +// 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 *m.BaseRef + return *i.UpdatedAt } -// GetBaseSHA returns the BaseSHA field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetBaseSHA() string { - if m == nil || m.BaseSHA == nil { +// 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 *m.BaseSHA + return *i.URL } -// GetHeadCommit returns the HeadCommit field. -func (m *MergeGroup) GetHeadCommit() *Commit { - if m == nil { +// GetUser returns the User field. +func (i *Issue) GetUser() *User { + if i == nil { return nil } - return m.HeadCommit + return i.User } -// GetHeadRef returns the HeadRef field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetHeadRef() string { - if m == nil || m.HeadRef == nil { +// 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 *m.HeadRef + return *i.AuthorAssociation } -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (m *MergeGroup) GetHeadSHA() string { - if m == nil || m.HeadSHA == nil { +// 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 *m.HeadSHA + return *i.Body } -// 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 "" +// 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 *m.Action + return *i.CreatedAt } -// GetInstallation returns the Installation field. -func (m *MergeGroupEvent) GetInstallation() *Installation { - if m == nil { - return nil +// 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 m.Installation + return *i.HTMLURL } -// GetMergeGroup returns the MergeGroup field. -func (m *MergeGroupEvent) GetMergeGroup() *MergeGroup { - if m == nil { - return nil +// 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 m.MergeGroup + return *i.ID } -// GetOrg returns the Org field. -func (m *MergeGroupEvent) GetOrg() *Organization { - if m == nil { - return nil +// 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 m.Org + return *i.IssueURL } -// GetRepo returns the Repo field. -func (m *MergeGroupEvent) GetRepo() *Repository { - if m == nil { - return nil +// 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 m.Repo + return *i.NodeID } -// GetSender returns the Sender field. -func (m *MergeGroupEvent) GetSender() *User { - if m == nil { +// GetReactions returns the Reactions field. +func (i *IssueComment) GetReactions() *Reactions { + if i == nil { return nil } - return m.Sender + return i.Reactions } -// 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 "" +// 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 *m.Text + return *i.UpdatedAt } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MetaEvent) GetAction() string { - if m == nil || m.Action == nil { +// 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 *m.Action + return *i.URL } -// GetHook returns the Hook field. -func (m *MetaEvent) GetHook() *Hook { - if m == nil { +// GetUser returns the User field. +func (i *IssueComment) GetUser() *User { + if i == nil { return nil } - return m.Hook + return i.User } -// 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 +// 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 *m.HookID + return *i.Action } -// GetInstallation returns the Installation field. -func (m *MetaEvent) GetInstallation() *Installation { - if m == nil { +// GetChanges returns the Changes field. +func (i *IssueCommentEvent) GetChanges() *EditChange { + if i == nil { return nil } - return m.Installation + return i.Changes } -// GetOrg returns the Org field. -func (m *MetaEvent) GetOrg() *Organization { - if m == nil { +// GetComment returns the Comment field. +func (i *IssueCommentEvent) GetComment() *IssueComment { + if i == nil { return nil } - return m.Org + return i.Comment } -// GetRepo returns the Repo field. -func (m *MetaEvent) GetRepo() *Repository { - if m == nil { +// GetInstallation returns the Installation field. +func (i *IssueCommentEvent) GetInstallation() *Installation { + if i == nil { return nil } - return m.Repo + return i.Installation } -// GetSender returns the Sender field. -func (m *MetaEvent) GetSender() *User { - if m == nil { +// GetIssue returns the Issue field. +func (i *IssueCommentEvent) GetIssue() *Issue { + if i == nil { return nil } - return m.Sender + return i.Issue } -// 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 "" +// GetOrganization returns the Organization field. +func (i *IssueCommentEvent) GetOrganization() *Organization { + if i == nil { + return nil } - return *m.HTMLURL + return i.Organization } -// 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 "" +// GetRepo returns the Repo field. +func (i *IssueCommentEvent) GetRepo() *Repository { + if i == nil { + return nil } - return *m.Key + return i.Repo } -// 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 "" +// GetSender returns the Sender field. +func (i *IssueCommentEvent) GetSender() *User { + if i == nil { + return nil } - return *m.Name + return i.Sender } -// 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 "" +// GetActor returns the Actor field. +func (i *IssueEvent) GetActor() *User { + if i == nil { + return nil } - return *m.NodeID + return i.Actor } -// 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 "" +// GetAssignee returns the Assignee field. +func (i *IssueEvent) GetAssignee() *User { + if i == nil { + return nil } - return *m.SPDXID + return i.Assignee } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Metric) GetURL() string { - if m == nil || m.URL == nil { +// 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 *m.URL + return *i.CommitID } // 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 "" +func (i *IssueEvent) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} } - return *m.CreatedAt + return *i.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 +// GetDismissedReview returns the DismissedReview field. +func (i *IssueEvent) GetDismissedReview() *DismissedReview { + if i == nil { + return nil } - return *m.ExcludeAttachments + return i.DismissedReview } -// GetGUID returns the GUID field if it's non-nil, zero value otherwise. -func (m *Migration) GetGUID() string { - if m == nil || m.GUID == nil { +// 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 *m.GUID + return *i.Event } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (m *Migration) GetID() int64 { - if m == nil || m.ID == nil { +func (i *IssueEvent) GetID() int64 { + if i == nil || i.ID == nil { return 0 } - return *m.ID + return *i.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 +// GetIssue returns the Issue field. +func (i *IssueEvent) GetIssue() *Issue { + if i == nil { + return nil } - return *m.LockRepositories + return i.Issue } -// 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 "" +// GetLabel returns the Label field. +func (i *IssueEvent) GetLabel() *Label { + if i == nil { + return nil } - return *m.State + return i.Label } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (m *Migration) GetUpdatedAt() string { - if m == nil || m.UpdatedAt == nil { +// 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 *m.UpdatedAt + return *i.LockReason } -// 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 "" +// GetMilestone returns the Milestone field. +func (i *IssueEvent) GetMilestone() *Milestone { + if i == nil { + return nil } - return *m.URL + return i.Milestone } -// 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{} +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (i *IssueEvent) GetPerformedViaGithubApp() *App { + if i == nil { + return nil } - return *m.ClosedAt + return i.PerformedViaGithubApp } -// 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 +// GetRename returns the Rename field. +func (i *IssueEvent) GetRename() *Rename { + if i == nil { + return nil } - return *m.ClosedIssues + return i.Rename } -// 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{} +// GetRepository returns the Repository field. +func (i *IssueEvent) GetRepository() *Repository { + if i == nil { + return nil } - return *m.CreatedAt + return i.Repository } -// GetCreator returns the Creator field. -func (m *Milestone) GetCreator() *User { - if m == nil { +// GetRequestedReviewer returns the RequestedReviewer field. +func (i *IssueEvent) GetRequestedReviewer() *User { + if i == nil { return nil } - return m.Creator + return i.RequestedReviewer } -// 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 "" +// GetRequestedTeam returns the RequestedTeam field. +func (i *IssueEvent) GetRequestedTeam() *Team { + if i == nil { + return nil } - return *m.Description + return i.RequestedTeam } -// 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{} +// GetReviewRequester returns the ReviewRequester field. +func (i *IssueEvent) GetReviewRequester() *User { + if i == nil { + return nil } - return *m.DueOn + return i.ReviewRequester } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { +// 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 *m.HTMLURL + return *i.URL } -// 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 +// 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 *m.ID + return *i.Assignee } -// 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 "" +// 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 *m.LabelsURL + return *i.Closed } -// 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 "" +// 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 *m.NodeID + return *i.ClosedAt } -// 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 +// 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 *m.Number + return *i.CreatedAt } -// GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise. -func (m *Milestone) GetOpenIssues() int { - if m == nil || m.OpenIssues == nil { +// 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 *m.OpenIssues + return *i.Milestone } -// 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 +// 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 } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (m *Milestone) GetTitle() string { - if m == nil || m.Title == nil { +// 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 *m.Title + return *i.Code } -// 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{} +// 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 *m.UpdatedAt + return *i.Field } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (m *Milestone) GetURL() string { - if m == nil || m.URL == nil { +// 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 *m.URL + return *i.Location } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (m *MilestoneEvent) GetAction() string { - if m == nil || m.Action == nil { +// 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 *m.Action + return *i.Resource } -// GetChanges returns the Changes field. -func (m *MilestoneEvent) GetChanges() *EditChange { - if m == nil { - return nil +// 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 m.Changes + return *i.Value } -// GetInstallation returns the Installation field. -func (m *MilestoneEvent) GetInstallation() *Installation { - if m == nil { - return nil +// 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 m.Installation + return *i.CreatedAt } -// GetMilestone returns the Milestone field. -func (m *MilestoneEvent) GetMilestone() *Milestone { - if m == nil { - return nil +// 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 m.Milestone + return *i.DocumentationURL } -// GetOrg returns the Org field. -func (m *MilestoneEvent) GetOrg() *Organization { - if m == nil { - return nil +// 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 m.Org + return *i.ID } -// GetRepo returns the Repo field. -func (m *MilestoneEvent) GetRepo() *Repository { - if m == nil { - return nil +// 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 m.Repo + return *i.ImportIssuesURL } -// GetSender returns the Sender field. -func (m *MilestoneEvent) GetSender() *User { - if m == nil { - return nil +// 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 m.Sender + return *i.Message } -// 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 +// 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 *m.ClosedMilestones + return *i.RepositoryURL } -// 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 +// 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 *m.OpenMilestones + return *i.Status } -// 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 +// 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 *m.TotalMilestones + return *i.UpdatedAt } -// GetAnalysisKey returns the AnalysisKey field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetAnalysisKey() string { - if m == nil || m.AnalysisKey == nil { +// 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 *m.AnalysisKey + return *i.URL } -// GetCategory returns the Category field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetCategory() string { - if m == nil || m.Category == nil { +// 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 *m.Category + return *i.Direction } -// 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 "" +// 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 *m.CommitSHA + return *i.Since } -// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetEnvironment() string { - if m == nil || m.Environment == nil { +// 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 *m.Environment + return *i.Sort } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetHTMLURL() string { - if m == nil || m.HTMLURL == nil { +// 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 "" } - return *m.HTMLURL + return *i.Assignee } -// GetLocation returns the Location field. -func (m *MostRecentInstance) GetLocation() *Location { - if m == nil { +// 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 } - return m.Location + return *i.Assignees } -// GetMessage returns the Message field. -func (m *MostRecentInstance) GetMessage() *Message { - if m == nil { +// 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 "" + } + return *i.Body +} + +// GetLabels returns the Labels field if it's non-nil, zero value otherwise. +func (i *IssueRequest) GetLabels() []string { + if i == nil || i.Labels == nil { return nil } - return m.Message + return *i.Labels } -// 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 "" +// 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 } - return *m.Ref + return *i.Milestone } // GetState returns the State field if it's non-nil, zero value otherwise. -func (m *MostRecentInstance) GetState() string { - if m == nil || m.State == nil { +func (i *IssueRequest) GetState() string { + if i == nil || i.State == nil { return "" } - return *m.State + return *i.State } -// GetBase returns the Base field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBase() string { - if n == nil || n.Base == nil { +// 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 "" } - return *n.Base + return *i.StateReason } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetBody() string { - if n == nil || n.Body == nil { +// 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 "" } - return *n.Body + return *i.Title } -// 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 +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (i *IssueRequest) GetType() string { + if i == nil || i.Type == nil { + return "" } - return *n.Draft + return *i.Type } -// GetHead returns the Head field if it's non-nil, zero value otherwise. -func (n *NewPullRequest) GetHead() string { - if n == nil || n.Head == nil { +// 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 *n.Head + return *i.Action } -// 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 "" +// GetAssignee returns the Assignee field. +func (i *IssuesEvent) GetAssignee() *User { + if i == nil { + return nil } - return *n.HeadRepo + return i.Assignee } -// 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 +// GetChanges returns the Changes field. +func (i *IssuesEvent) GetChanges() *EditChange { + if i == nil { + return nil } - return *n.Issue + return i.Changes } -// 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 +// GetInstallation returns the Installation field. +func (i *IssuesEvent) GetInstallation() *Installation { + if i == nil { + return nil } - return *n.MaintainerCanModify + return i.Installation } -// 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 "" +// GetIssue returns the Issue field. +func (i *IssuesEvent) GetIssue() *Issue { + if i == nil { + return nil } - return *n.Title + return i.Issue } -// 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 "" +// GetLabel returns the Label field. +func (i *IssuesEvent) GetLabel() *Label { + if i == nil { + return nil } - return *n.Description + return i.Label } -// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetLDAPDN() string { - if n == nil || n.LDAPDN == nil { - return "" +// GetMilestone returns the Milestone field. +func (i *IssuesEvent) GetMilestone() *Milestone { + if i == nil { + return nil } - return *n.LDAPDN + return i.Milestone } -// 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 "" +// GetOrg returns the Org field. +func (i *IssuesEvent) GetOrg() *Organization { + if i == nil { + return nil } - return *n.NotificationSetting + return i.Org } -// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. -func (n *NewTeam) GetParentTeamID() int64 { - if n == nil || n.ParentTeamID == nil { - return 0 +// GetRepo returns the Repo field. +func (i *IssuesEvent) GetRepo() *Repository { + if i == nil { + return nil } - return *n.ParentTeamID + return i.Repo } -// 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 "" +// GetSender returns the Sender field. +func (i *IssuesEvent) GetSender() *User { + if i == nil { + return nil } - return *n.Permission + return i.Sender } -// 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 "" +// 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 *n.Privacy + return *i.IncompleteResults } -// 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 "" +// 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 *n.ID + return *i.Total } -// 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{} +// 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 *n.LastReadAt + return *i.ClosedIssues } -// 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 "" +// 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 *n.Reason + return *i.OpenIssues } -// GetRepository returns the Repository field. -func (n *Notification) GetRepository() *Repository { - if n == nil { - return nil +// 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 n.Repository + return *i.TotalIssues } -// GetSubject returns the Subject field. -func (n *Notification) GetSubject() *NotificationSubject { - if n == nil { - return nil +// 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 n.Subject + return *i.Color } -// 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 +// 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 *n.Unread + return *i.CreatedAt } -// 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{} +// 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 *n.UpdatedAt + return *i.Description } -// 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 "" +// 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 *n.URL + return *i.ID } -// GetLatestCommentURL returns the LatestCommentURL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetLatestCommentURL() string { - if n == nil || n.LatestCommentURL == nil { +// 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 *n.LatestCommentURL + return *i.Name } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetTitle() string { - if n == nil || n.Title == nil { +// 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 *n.Title + return *i.NodeID } -// 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 "" +// 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 *n.Type + return *i.UpdatedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (n *NotificationSubject) GetURL() string { - if n == nil || n.URL == nil { +// 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 *n.URL + return *j.EncodedJITConfig } -// 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 "" +// GetRunner returns the Runner field. +func (j *JITRunnerConfig) GetRunner() *Runner { + if j == nil { + return nil } - return *o.ClientID + return j.Runner } -// 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 "" +// 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 *o.Name + return *j.TotalCount } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (o *OAuthAPP) GetURL() string { - if o == nil || o.URL == nil { +// 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 *o.URL + return *k.AddedBy } -// 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 +// 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 *o.UseDefault + return *k.CreatedAt } -// 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 +// 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 *o.AdvancedSecurityEnabledForNewRepos + return *k.ID } -// GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetAvatarURL() string { - if o == nil || o.AvatarURL == nil { +// 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 *o.AvatarURL + return *k.Key } -// 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 "" +// 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 *o.BillingEmail + return *k.LastUsed } -// 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 "" +// 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 *o.Blog + return *k.ReadOnly } -// 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 +// 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 *o.Collaborators + return *k.Title } -// GetCompany returns the Company field if it's non-nil, zero value otherwise. -func (o *Organization) GetCompany() string { - if o == nil || o.Company == nil { +// 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 *o.Company + return *k.URL } -// 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{} +// 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 *o.CreatedAt + return *k.Verified } -// GetDefaultRepoPermission returns the DefaultRepoPermission field if it's non-nil, zero value otherwise. -func (o *Organization) GetDefaultRepoPermission() string { - if o == nil || o.DefaultRepoPermission == nil { +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (l *Label) GetColor() string { + if l == nil || l.Color == nil { return "" } - return *o.DefaultRepoPermission + return *l.Color } -// 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 "" +// 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 *o.DefaultRepoSettings + return *l.Default } -// 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 (l *Label) GetDescription() string { + if l == nil || l.Description == nil { + return "" } - return *o.DependabotAlertsEnabledForNewRepos + return *l.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 { - return false +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (l *Label) GetID() int64 { + if l == nil || l.ID == nil { + return 0 } - return *o.DependabotSecurityUpdatesEnabledForNewRepos + return *l.ID } -// 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 +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (l *Label) GetName() string { + if l == nil || l.Name == nil { + return "" } - return *o.DependencyGraphEnabledForNewRepos + return *l.Name } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (o *Organization) GetDescription() string { - if o == nil || o.Description == nil { +// 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 "" } - return *o.Description + return *l.NodeID } -// 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 +// 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 "" } - return *o.DiskUsage + return *l.URL } -// GetEmail returns the Email field if it's non-nil, zero value otherwise. -func (o *Organization) GetEmail() string { - if o == nil || o.Email == nil { +// 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 *o.Email + return *l.Action } -// 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 "" +// GetChanges returns the Changes field. +func (l *LabelEvent) GetChanges() *EditChange { + if l == nil { + return nil } - return *o.EventsURL + return l.Changes } -// 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 +// GetInstallation returns the Installation field. +func (l *LabelEvent) GetInstallation() *Installation { + if l == nil { + return nil } - return *o.Followers + return l.Installation } -// 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 +// GetLabel returns the Label field. +func (l *LabelEvent) GetLabel() *Label { + if l == nil { + return nil } - return *o.Following + return l.Label } -// 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 +// GetOrg returns the Org field. +func (l *LabelEvent) GetOrg() *Organization { + if l == nil { + return nil } - return *o.HasOrganizationProjects + return l.Org } -// 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 +// GetRepo returns the Repo field. +func (l *LabelEvent) GetRepo() *Repository { + if l == nil { + return nil } - return *o.HasRepositoryProjects + return l.Repo } -// 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 "" +// GetSender returns the Sender field. +func (l *LabelEvent) GetSender() *User { + if l == nil { + return nil } - return *o.HooksURL + return l.Sender } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetHTMLURL() string { - if o == nil || o.HTMLURL == nil { +// 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 *o.HTMLURL + return *l.Color } -// 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 +// 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 *o.ID + return *l.Default } -// GetIssuesURL returns the IssuesURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetIssuesURL() string { - if o == nil || o.IssuesURL == nil { +// 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 *o.IssuesURL + return *l.Description } -// 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 +// 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 *o.IsVerified + return *l.ID } -// GetLocation returns the Location field if it's non-nil, zero value otherwise. -func (o *Organization) GetLocation() string { - if o == nil || o.Location == nil { +// 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 *o.Location + return *l.Name } -// 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 "" +// GetScore returns the Score field. +func (l *LabelResult) GetScore() *float64 { + if l == nil { + return nil } - return *o.Login + return l.Score } -// GetMembersAllowedRepositoryCreationType returns the MembersAllowedRepositoryCreationType field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersAllowedRepositoryCreationType() string { - if o == nil || o.MembersAllowedRepositoryCreationType == nil { +// 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 *o.MembersAllowedRepositoryCreationType + return *l.URL } -// GetMembersCanCreateInternalRepos returns the MembersCanCreateInternalRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersCanCreateInternalRepos() bool { - if o == nil || o.MembersCanCreateInternalRepos == nil { +// 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 *o.MembersCanCreateInternalRepos + return *l.IncompleteResults } -// 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 +// 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 *o.MembersCanCreatePages + return *l.Total } -// 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 +// 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 } -// 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 +// 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 *o.MembersCanCreatePrivateRepos + return *l.Path } -// 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 +// 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 *o.MembersCanCreatePublicPages + return *l.RefName } -// 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 +// 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 *o.MembersCanCreatePublicRepos + return *l.Size } -// 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 +// GetProperties returns the Properties field. +func (l *LastLicenseSync) GetProperties() *LastLicenseSyncProperties { + if l == nil { + return nil } - return *o.MembersCanCreateRepos + return l.Properties } -// 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 +// 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 *o.MembersCanForkPrivateRepos + return *l.Date } -// GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetMembersURL() string { - if o == nil || o.MembersURL == nil { +// 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 *o.MembersURL + return *l.Body } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *Organization) GetName() string { - if o == nil || o.Name == nil { +// 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 *o.Name + return *l.Description } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (o *Organization) GetNodeID() string { - if o == nil || o.NodeID == nil { +// 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 *o.NodeID + return *l.HTMLURL } -// 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 +// 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 *o.OwnedPrivateRepos + return *l.Implementation } -// GetPlan returns the Plan field. -func (o *Organization) GetPlan() *Plan { - if o == nil { +// 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 o.Plan + return *l.Limitations } -// 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 +// 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 *o.PrivateGists + return *l.Name } -// 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 +// 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 *o.PublicGists + return *l.Permissions } -// GetPublicMembersURL returns the PublicMembersURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetPublicMembersURL() string { - if o == nil || o.PublicMembersURL == nil { +// 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 *o.PublicMembersURL + return *l.SPDXID } -// 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 +// 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 *o.PublicRepos + return *l.URL } -// GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise. -func (o *Organization) GetReposURL() string { - if o == nil || o.ReposURL == nil { +// 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 *o.ReposURL + return *l.Status } -// GetSecretScanningEnabledForNewRepos returns the SecretScanningEnabledForNewRepos field if it's non-nil, zero value otherwise. -func (o *Organization) GetSecretScanningEnabledForNewRepos() bool { - if o == nil || o.SecretScanningEnabledForNewRepos == nil { +// 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 *o.SecretScanningEnabledForNewRepos + return *l.AdvancedSecurityEnabled } -// 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 +// 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 *o.SecretScanningPushProtectionEnabledForNewRepos + return *l.AdvancedSecuritySeats } -// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. -func (o *Organization) GetSecretScanningValidityChecksEnabled() bool { - if o == nil || o.SecretScanningValidityChecksEnabled == nil { +// 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 *o.SecretScanningValidityChecksEnabled + return *l.ClusterSupport } -// 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 +// 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 *o.TotalPrivateRepos + return *l.Company } -// 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 "" +// 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 *o.TwitterUsername + return *l.CroquetSupport } -// GetTwoFactorRequirementEnabled returns the TwoFactorRequirementEnabled field if it's non-nil, zero value otherwise. -func (o *Organization) GetTwoFactorRequirementEnabled() bool { - if o == nil || o.TwoFactorRequirementEnabled == nil { +// 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 *o.TwoFactorRequirementEnabled + return *l.CustomTerms } -// 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 "" +// 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 *o.Type + return *l.Evaluation } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (o *Organization) GetUpdatedAt() Timestamp { - if o == nil || o.UpdatedAt == nil { +// 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 *o.UpdatedAt + return *l.ExpireAt } -// 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 "" +// 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 *o.URL + return *l.InsightsEnabled } -// 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 +// 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 *o.WebCommitSignoffRequired + return *l.InsightsExpireAt } -// 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 +// 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 *o.TotalCount + return *l.LearningLabEvaluationExpires } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrganizationCustomRoles) GetTotalCount() int { - if o == nil || o.TotalCount == nil { +// 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 *o.TotalCount + return *l.LearningLabSeats } -// 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 "" +// 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 *o.Action + return *l.Perpetual } -// GetInstallation returns the Installation field. -func (o *OrganizationEvent) GetInstallation() *Installation { - if o == nil { - return nil +// 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 o.Installation + return *l.ReferenceNumber } -// GetInvitation returns the Invitation field. -func (o *OrganizationEvent) GetInvitation() *Invitation { - if o == nil { - return nil +// 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 o.Invitation + return *l.Seats } -// GetMembership returns the Membership field. -func (o *OrganizationEvent) GetMembership() *Membership { - if o == nil { - return nil +// 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 o.Membership + return *l.SSHAllowed } -// GetOrganization returns the Organization field. -func (o *OrganizationEvent) GetOrganization() *Organization { - if o == nil { - return nil +// GetSupportKey returns the SupportKey field if it's non-nil, zero value otherwise. +func (l *LicenseStatus) GetSupportKey() string { + if l == nil || l.SupportKey == nil { + return "" } - return o.Organization + return *l.SupportKey } -// GetSender returns the Sender field. -func (o *OrganizationEvent) GetSender() *User { - if o == nil { - return nil - } - return o.Sender -} - -// 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 +// 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 *o.TotalCount + return *l.UnlimitedSeating } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (o *OrgBlockEvent) GetAction() string { - if o == nil || o.Action == nil { +// 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 *o.Action -} - -// GetBlockedUser returns the BlockedUser field. -func (o *OrgBlockEvent) GetBlockedUser() *User { - if o == nil { - return nil - } - return o.BlockedUser + return *l.From } -// GetInstallation returns the Installation field. -func (o *OrgBlockEvent) GetInstallation() *Installation { - if o == nil { - return nil +// 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 o.Installation + return *l.Direction } -// GetOrganization returns the Organization field. -func (o *OrgBlockEvent) GetOrganization() *Organization { - if o == nil { - return nil +// 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 o.Organization + return *l.Ecosystem } -// GetSender returns the Sender field. -func (o *OrgBlockEvent) GetSender() *User { - if o == nil { - return nil +// 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 o.Sender + return *l.Package } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetCreatedAt() Timestamp { - if o == nil || o.CreatedAt == nil { - return Timestamp{} +// 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 *o.CreatedAt + return *l.Scope } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetID() int64 { - if o == nil || o.ID == nil { - return 0 +// 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 *o.ID + return *l.Severity } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetName() string { - if o == nil || o.Name == nil { +// 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 *o.Name + return *l.Sort } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetPath() string { - if o == nil || o.Path == nil { +// 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 *o.Path + return *l.State } -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetRef() string { - if o == nil || o.Ref == nil { +// 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 *o.Ref + return *l.Name } -// GetRepository returns the Repository field. -func (o *OrgRequiredWorkflow) GetRepository() *Repository { - if o == nil { - return nil +// 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 o.Repository + return *l.AppID } -// GetScope returns the Scope field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetScope() string { - if o == nil || o.Scope == nil { +// 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 *o.Scope + return *l.CheckName } -// GetSelectedRepositoriesURL returns the SelectedRepositoriesURL field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetSelectedRepositoriesURL() string { - if o == nil || o.SelectedRepositoriesURL == nil { +// 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 *o.SelectedRepositoriesURL + return *l.Filter } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflow) GetState() string { - if o == nil || o.State == nil { +// 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 *o.State + return *l.Status } -// 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{} +// 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 *o.UpdatedAt + return *l.Total } -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (o *OrgRequiredWorkflows) GetTotalCount() int { - if o == nil || o.TotalCount == nil { +// 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 *o.TotalCount + return *l.AppID } -// 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 +// 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 *o.DisabledOrgs + return *l.CheckName } -// GetTotalOrgs returns the TotalOrgs field if it's non-nil, zero value otherwise. -func (o *OrgStats) GetTotalOrgs() int { - if o == nil || o.TotalOrgs == nil { +// 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 *o.TotalOrgs + return *l.Total } -// 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 +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetAfter() string { + if l == nil || l.After == nil { + return "" } - return *o.TotalTeamMembers + return *l.After } -// 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 +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetBefore() string { + if l == nil || l.Before == nil { + return "" } - return *o.TotalTeams + return *l.Before } -// GetOrg returns the Org field. -func (o *OwnerInfo) GetOrg() *User { - if o == nil { - return nil +// GetPerPage returns the PerPage field if it's non-nil, zero value otherwise. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetPerPage() int { + if l == nil || l.PerPage == nil { + return 0 } - return o.Org + return *l.PerPage } -// GetUser returns the User field. -func (o *OwnerInfo) GetUser() *User { - if o == nil { - return nil +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (l *ListCodeSecurityConfigurationRepositoriesOptions) GetStatus() string { + if l == nil || l.Status == nil { + return "" } - return o.User + return *l.Status } -// 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{} +// 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 *p.CreatedAt + return *l.TotalCount } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Package) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// 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 *p.HTMLURL + return *l.State } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *Package) GetID() int64 { - if p == nil || p.ID == nil { +// 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 *p.ID + return *l.TotalCount } -// 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 "" +// 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 *p.Name + return *l.TotalCount } -// GetOwner returns the Owner field. -func (p *Package) GetOwner() *User { - if p == nil { - return nil +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil || l.After == nil { + return "" } - return p.Owner + return *l.After } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *Package) GetPackageType() string { - if p == nil || p.PackageType == nil { +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil || l.Before == nil { return "" } - return *p.PackageType + return *l.Before } -// GetPackageVersion returns the PackageVersion field. -func (p *Package) GetPackageVersion() *PackageVersion { - if p == nil { - return nil +// GetPerPage returns the PerPage field if it's non-nil, zero value otherwise. +func (l *ListEnterpriseCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil || l.PerPage == nil { + return 0 } - return p.PackageVersion + return *l.PerPage } -// GetRegistry returns the Registry field. -func (p *Package) GetRegistry() *PackageRegistry { - if p == nil { - return nil +// 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 p.Registry + return *l.DisplayName } -// GetRepository returns the Repository field. -func (p *Package) GetRepository() *Repository { - if p == nil { - return nil +// 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 p.Repository + return *l.Affects } -// 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{} +// 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 *p.UpdatedAt + return *l.CVEID } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Package) GetURL() string { - if p == nil || p.URL == nil { +// 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 *p.URL + return *l.Ecosystem } -// 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 +// 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 *p.VersionCount + return *l.GHSAID } -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (p *Package) GetVisibility() string { - if p == nil || p.Visibility == nil { +// 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 *p.Visibility + return *l.Modified } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PackageEvent) GetAction() string { - if p == nil || p.Action == nil { +// 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 *p.Action + return *l.Published } -// GetInstallation returns the Installation field. -func (p *PackageEvent) GetInstallation() *Installation { - if p == nil { - return nil +// 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 p.Installation + return *l.Severity } -// GetOrg returns the Org field. -func (p *PackageEvent) GetOrg() *Organization { - if p == nil { - return nil +// 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 p.Org + return *l.Type } -// GetPackage returns the Package field. -func (p *PackageEvent) GetPackage() *Package { - if p == nil { - return nil +// 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 p.Package + return *l.Updated } -// GetRepo returns the Repo field. -func (p *PackageEvent) GetRepo() *Repository { - if p == nil { - return nil +// 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 p.Repo + return *l.TotalCount } -// GetSender returns the Sender field. -func (p *PackageEvent) GetSender() *User { - if p == nil { - return nil +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (l *ListOrgCodeSecurityConfigurationOptions) GetAfter() string { + if l == nil || l.After == nil { + return "" } - return p.Sender + return *l.After } -// GetAuthor returns the Author field. -func (p *PackageFile) GetAuthor() *User { - if p == nil { - return nil +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (l *ListOrgCodeSecurityConfigurationOptions) GetBefore() string { + if l == nil || l.Before == nil { + return "" } - return p.Author + return *l.Before } -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetContentType() string { - if p == nil || p.ContentType == nil { +// GetPerPage returns the PerPage field if it's non-nil, zero value otherwise. +func (l *ListOrgCodeSecurityConfigurationOptions) GetPerPage() int { + if l == nil || l.PerPage == nil { + return 0 + } + return *l.PerPage +} + +// GetTargetType returns the TargetType field if it's non-nil, zero value otherwise. +func (l *ListOrgCodeSecurityConfigurationOptions) GetTargetType() string { + if l == nil || l.TargetType == nil { return "" } - return *p.ContentType + return *l.TargetType } -// 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{} +// GetQuery returns the Query field if it's non-nil, zero value otherwise. +func (l *ListProjectsOptions) GetQuery() string { + if l == nil || l.Query == nil { + return "" } - return *p.CreatedAt + return *l.Query } -// GetDownloadURL returns the DownloadURL field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetDownloadURL() string { - if p == nil || p.DownloadURL == nil { +// GetAfter returns the After field if it's non-nil, zero value otherwise. +func (l *ListProjectsPaginationOptions) GetAfter() string { + if l == nil || l.After == nil { return "" } - return *p.DownloadURL + return *l.After } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetID() int64 { - if p == nil || p.ID == nil { +// GetBefore returns the Before field if it's non-nil, zero value otherwise. +func (l *ListProjectsPaginationOptions) GetBefore() string { + if l == nil || l.Before == nil { + return "" + } + return *l.Before +} + +// GetPerPage returns the PerPage field if it's non-nil, zero value otherwise. +func (l *ListProjectsPaginationOptions) GetPerPage() int { + if l == nil || l.PerPage == nil { return 0 } - return *p.ID + return *l.PerPage } -// 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 "" +// 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 *p.MD5 + return *l.TotalCount } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetName() string { - if p == nil || p.Name == nil { +func (l *ListRunnersOptions) GetName() string { + if l == nil || l.Name == nil { return "" } - return *p.Name + return *l.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 "" +// 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 *p.SHA1 + return *l.Count } -// GetSHA256 returns the SHA256 field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetSHA256() string { - if p == nil || p.SHA256 == nil { +// 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 *p.SHA256 + return *l.Filter } -// GetSize returns the Size field if it's non-nil, zero value otherwise. -func (p *PackageFile) GetSize() int64 { - if p == nil || p.Size == nil { +// 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 *p.Size + return *l.StartIndex } -// 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 "" +// 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 *p.State + return *l.EndColumn } -// 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{} +// 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 *p.UpdatedAt + return *l.EndLine } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *PackageListOptions) GetPackageType() string { - if p == nil || p.PackageType == nil { +// 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 *p.PackageType + return *l.Path } -// 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 "" +// 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 *p.State + return *l.StartColumn } -// 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 "" +// 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 *p.Visibility + return *l.StartLine } -// GetContainer returns the Container field. -func (p *PackageMetadata) GetContainer() *PackageContainerMetadata { - if p == nil { - return nil +// 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 p.Container + return *l.Enabled } -// GetPackageType returns the PackageType field if it's non-nil, zero value otherwise. -func (p *PackageMetadata) GetPackageType() string { - if p == nil || p.PackageType == nil { +// 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 *p.PackageType + return *m.Hostname } -// GetAboutURL returns the AboutURL field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetAboutURL() string { - if p == nil || p.AboutURL == nil { +// 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 *p.AboutURL + return *m.Message } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetName() string { - if p == nil || p.Name == nil { +// 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 *p.Name + return *m.UUID } -// GetType returns the Type field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetType() string { - if p == nil || p.Type == nil { +// 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 *p.Type + return *m.MaintenanceModeMessage } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetURL() string { - if p == nil || p.URL == nil { +// 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 *p.URL + return *m.UUID } -// GetVendor returns the Vendor field if it's non-nil, zero value otherwise. -func (p *PackageRegistry) GetVendor() string { - if p == nil || p.Vendor == nil { +// 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 *p.Vendor + return *m.When } -// GetAuthor returns the Author field. -func (p *PackageRelease) GetAuthor() *User { - if p == nil { - return nil +// 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 p.Author + return *m.CanUnsetMaintenance } -// 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{} +// 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 *p.CreatedAt + return *m.Hostname } -// 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 +// 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 *p.Draft + return *m.MaintenanceModeMessage } -// 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 "" +// 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 *p.HTMLURL + return *m.ScheduledTime } -// 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 +// 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 *p.ID + return *m.Status } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetName() string { - if p == nil || p.Name == nil { +// 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 *p.Name + return *m.UUID } -// 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 +// 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 *p.Prerelease + return *m.EffectiveDate } -// 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{} +// 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 *p.PublishedAt + return *m.ID } -// 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 "" +// GetPlan returns the Plan field. +func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan { + if m == nil { + return nil } - return *p.TagName + return m.Plan } -// 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 "" +// 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 *p.TargetCommitish + return *m.UnitCount } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageRelease) GetURL() string { - if p == nil || p.URL == nil { +// 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 *p.URL + return *m.AccountsURL } -// GetAuthor returns the Author field. -func (p *PackageVersion) GetAuthor() *User { - if p == nil { +// 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 p.Author + return *m.Bullets } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetBody() string { - if p == nil || p.Body == nil { +// 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 *p.Body + return *m.Description } -// 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 "" +// 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 *p.BodyHTML + return *m.HasFreeTrial } -// 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{} +// 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 *p.CreatedAt + return *m.ID } -// 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 +// 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 *p.Draft + return *m.MonthlyPriceInCents } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { +// 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 *p.HTMLURL + return *m.Name } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetID() int64 { - if p == nil || p.ID == nil { +// 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 *p.ID + return *m.Number } -// GetInstallationCommand returns the InstallationCommand field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetInstallationCommand() string { - if p == nil || p.InstallationCommand == nil { +// 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 *p.InstallationCommand + return *m.PriceModel } -// GetManifest returns the Manifest field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetManifest() string { - if p == nil || p.Manifest == nil { +// 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 *p.Manifest -} - -// GetMetadata returns the Metadata field. -func (p *PackageVersion) GetMetadata() *PackageMetadata { - if p == nil { - return nil - } - return p.Metadata + return *m.State } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetName() string { - if p == nil || p.Name == nil { +// 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 *p.Name + return *m.UnitName } -// GetPackageHTMLURL returns the PackageHTMLURL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetPackageHTMLURL() string { - if p == nil || p.PackageHTMLURL == nil { +// 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 *p.PackageHTMLURL + return *m.URL } -// 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 +// 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 *p.Prerelease + return *m.YearlyPriceInCents } -// GetRelease returns the Release field. -func (p *PackageVersion) GetRelease() *PackageRelease { - if p == nil { - return nil +// 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 p.Release + return *m.ID } -// GetSummary returns the Summary field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetSummary() string { - if p == nil || p.Summary == nil { +// 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 *p.Summary + return *m.Login } -// 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 "" +// GetMarketplacePendingChange returns the MarketplacePendingChange field. +func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange { + if m == nil { + return nil } - return *p.TagName + return m.MarketplacePendingChange } -// 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 "" +// GetMarketplacePurchase returns the MarketplacePurchase field. +func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase { + if m == nil { + return nil } - return *p.TargetCommitish + return m.MarketplacePurchase } -// GetTargetOID returns the TargetOID field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetTargetOID() string { - if p == nil || p.TargetOID == nil { +// 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 *p.TargetOID + return *m.OrganizationBillingEmail } -// 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{} +// 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 *p.UpdatedAt + return *m.Type } // GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *PackageVersion) GetURL() string { - if p == nil || p.URL == nil { +func (m *MarketplacePlanAccount) GetURL() string { + if m == nil || m.URL == nil { return "" } - return *p.URL + return *m.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 "" +// GetAccount returns the Account field. +func (m *MarketplacePurchase) GetAccount() *MarketplacePurchaseAccount { + if m == nil { + return nil } - return *p.Version + return m.Account } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *Page) GetAction() string { - if p == nil || p.Action == nil { +// 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 *p.Action + return *m.BillingCycle } -// 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 "" +// 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 *p.HTMLURL + return *m.FreeTrialEndsOn } -// 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 "" +// 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 *p.PageName + return *m.NextBillingDate } -// 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 "" +// 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 *p.SHA + return *m.OnFreeTrial } -// 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 "" +// GetPlan returns the Plan field. +func (m *MarketplacePurchase) GetPlan() *MarketplacePlan { + if m == nil { + return nil } - return *p.Summary + return m.Plan } -// 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 "" +// 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 *p.Title + return *m.UnitCount } -// GetBuild returns the Build field. -func (p *PageBuildEvent) GetBuild() *PagesBuild { - if p == nil { - return nil +// 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 p.Build + return *m.UpdatedAt } -// 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 +// 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 *p.ID + return *m.Email } -// GetInstallation returns the Installation field. -func (p *PageBuildEvent) GetInstallation() *Installation { - if p == nil { - return nil +// 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 p.Installation + return *m.ID } -// GetOrg returns the Org field. -func (p *PageBuildEvent) GetOrg() *Organization { - if p == nil { - return nil +// 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 p.Org + return *m.Login } -// GetRepo returns the Repo field. -func (p *PageBuildEvent) GetRepo() *Repository { - if p == nil { - return nil +// 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 p.Repo + return *m.NodeID } -// GetSender returns the Sender field. -func (p *PageBuildEvent) GetSender() *User { - if p == nil { - return nil +// 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 p.Sender + return *m.OrganizationBillingEmail } -// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. -func (p *Pages) GetBuildType() string { - if p == nil || p.BuildType == nil { +// 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 *p.BuildType + return *m.Type } -// GetCNAME returns the CNAME field if it's non-nil, zero value otherwise. -func (p *Pages) GetCNAME() string { - if p == nil || p.CNAME == nil { +// 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 *p.CNAME + return *m.URL } -// 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 +// 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 *p.Custom404 + return *m.Action } -// 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 "" +// 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 *p.HTMLURL + return *m.EffectiveDate } -// GetHTTPSCertificate returns the HTTPSCertificate field. -func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { - if p == nil { +// GetInstallation returns the Installation field. +func (m *MarketplacePurchaseEvent) GetInstallation() *Installation { + if m == nil { return nil } - return p.HTTPSCertificate + return m.Installation } -// 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 +// GetMarketplacePurchase returns the MarketplacePurchase field. +func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase { + if m == nil { + return nil } - return *p.HTTPSEnforced + return m.MarketplacePurchase } -// 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 +// GetOrg returns the Org field. +func (m *MarketplacePurchaseEvent) GetOrg() *Organization { + if m == nil { + return nil } - return *p.Public + return m.Org } -// GetSource returns the Source field. -func (p *Pages) GetSource() *PagesSource { - if p == nil { +// GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. +func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { + if m == nil { return nil } - return p.Source + return m.PreviousMarketplacePurchase } -// 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 "" +// GetSender returns the Sender field. +func (m *MarketplacePurchaseEvent) GetSender() *User { + if m == nil { + return nil } - return *p.Status + return m.Sender } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Pages) GetURL() string { - if p == nil || p.URL == nil { +// 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 *p.URL + return *m.Text } -// 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 "" +// GetPermission returns the Permission field. +func (m *MemberChanges) GetPermission() *MemberChangesPermission { + if m == nil { + return nil } - return *p.Commit + return m.Permission } -// 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{} +// GetRoleName returns the RoleName field. +func (m *MemberChanges) GetRoleName() *MemberChangesRoleName { + if m == nil { + return nil } - return *p.CreatedAt + return m.RoleName } -// 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 +// 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 *p.Duration + return *m.From } -// GetError returns the Error field. -func (p *PagesBuild) GetError() *PagesError { - if p == nil { - return nil +// 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 p.Error + return *m.To } -// GetPusher returns the Pusher field. -func (p *PagesBuild) GetPusher() *User { +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 "" + } + return *n.Base +} + +// 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 "" + } + return *n.Body +} + +// 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 + } + return *n.Draft +} + +// 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 "" + } + return *n.Head +} + +// 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 "" + } + return *n.HeadRepo +} + +// 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 + } + return *n.Issue +} + +// 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 + } + return *n.MaintainerCanModify +} + +// 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 "" + } + return *n.Title +} + +// 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 "" + } + return *n.Description +} + +// GetLDAPDN returns the LDAPDN field if it's non-nil, zero value otherwise. +func (n *NewTeam) GetLDAPDN() string { + if n == nil || n.LDAPDN == nil { + return "" + } + return *n.LDAPDN +} + +// 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 "" + } + return *n.NotificationSetting +} + +// GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. +func (n *NewTeam) GetParentTeamID() int64 { + if n == nil || n.ParentTeamID == nil { + return 0 + } + return *n.ParentTeamID +} + +// 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 "" + } + return *n.Permission +} + +// 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 "" + } + return *n.Privacy +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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.Pusher + return p.Author } -// GetStatus returns the Status field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetStatus() string { - if p == nil || p.Status == nil { +// 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.Status + return *p.HTMLURL } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *PagesBuild) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { +// 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.UpdatedAt + 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 *PagesBuild) GetURL() string { +func (p *PackageRelease) 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 { +// 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.CAAError + return *p.BodyHTML } -// 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 +// GetContainerMetadata returns the ContainerMetadata field. +func (p *PackageVersion) GetContainerMetadata() *PackageEventContainerMetadata { + if p == nil { + return nil } - return *p.DNSResolves + return p.ContainerMetadata } -// 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 +// 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.EnforcesHTTPS + return *p.CreatedAt } -// 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 +// 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.HasCNAMERecord + return *p.DeletedAt } -// GetHasMXRecordsPresent returns the HasMXRecordsPresent field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHasMXRecordsPresent() bool { - if p == nil || p.HasMXRecordsPresent == nil { +// 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 +} + +// 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.HasMXRecordsPresent + return *p.Draft } -// GetHost returns the Host field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHost() string { - if p == nil || p.Host == nil { +// 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.Host + return *p.HTMLURL } -// GetHTTPSError returns the HTTPSError field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetHTTPSError() string { - if p == nil || p.HTTPSError == nil { +// 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.HTTPSError + return *p.InstallationCommand } -// GetIsApexDomain returns the IsApexDomain field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsApexDomain() bool { - if p == nil || p.IsApexDomain == nil { +// 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 +} + +// 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.IsApexDomain + 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 } -// 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 +// 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.IsARecord + return *p.TagName } -// 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 +// 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.IsCloudflareIP + return *p.TargetCommitish } -// 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 +// 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.IsCNAMEToFastly + return *p.TargetOID } -// 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 +// 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.IsCNAMEToGithubUserDomain + return *p.UpdatedAt } -// 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 +// 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.IsCNAMEToPagesDotGithubDotCom + return *p.URL } -// 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 +// 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.IsFastlyIP + return *p.Version } -// 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 +// GetInfo returns the Info field. +func (p *PackageVersionBody) GetInfo() *PackageVersionBodyInfo { + if p == nil { + return nil } - return *p.IsHTTPSEligible + return p.Info } -// 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 +// GetRepo returns the Repo field. +func (p *PackageVersionBody) GetRepo() *Repository { + if p == nil { + return nil } - return *p.IsNonGithubPagesIPPresent + return p.Repo } -// GetIsOldIPAddress returns the IsOldIPAddress field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetIsOldIPAddress() bool { - if p == nil || p.IsOldIPAddress == nil { +// 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.IsOldIPAddress + return *p.Collection } -// 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 +// 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.IsPagesDomain + return *p.Mode } -// 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 +// 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.IsPointedToGithubPagesIP + return *p.Name } -// 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 +// 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.IsProxied + return *p.OID } -// 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 +// 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.IsServedByPages + return *p.Path } -// 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 +// 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.IsValid + return *p.Size } -// 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 +// 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.IsValidDomain + return *p.Type } -// GetNameservers returns the Nameservers field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetNameservers() string { - if p == nil || p.Nameservers == nil { +// 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.Nameservers + return *p.Action } -// GetReason returns the Reason field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetReason() string { - if p == nil || p.Reason == nil { +// 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.Reason + return *p.HTMLURL } -// 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 +// 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.RespondsToHTTPS + return *p.PageName } -// 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 +// 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.ShouldBeARecord + return *p.SHA } -// GetURI returns the URI field if it's non-nil, zero value otherwise. -func (p *PagesDomain) GetURI() string { - if p == nil || p.URI == nil { +// 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.URI + return *p.Summary } -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PagesError) GetMessage() string { - if p == nil || p.Message == nil { +// 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.Message + return *p.Title } -// GetAltDomain returns the AltDomain field. -func (p *PagesHealthCheckResponse) GetAltDomain() *PagesDomain { +// GetBuild returns the Build field. +func (p *PageBuildEvent) GetBuild() *PagesBuild { if p == nil { return nil } - return p.AltDomain + return p.Build } -// GetDomain returns the Domain field. -func (p *PagesHealthCheckResponse) GetDomain() *PagesDomain { +// 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.Domain + return p.Installation } -// 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 "" +// GetOrg returns the Org field. +func (p *PageBuildEvent) GetOrg() *Organization { + if p == nil { + return nil } - return *p.Description + return p.Org } -// 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 "" +// GetRepo returns the Repo field. +func (p *PageBuildEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *p.ExpiresAt + return p.Repo } -// 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 "" +// GetSender returns the Sender field. +func (p *PageBuildEvent) GetSender() *User { + if p == nil { + return nil } - return *p.State + return p.Sender } -// GetBranch returns the Branch field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetBranch() string { - if p == nil || p.Branch == nil { +// 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.Branch + return *p.BuildType } -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (p *PagesSource) GetPath() string { - if p == nil || p.Path == nil { +// 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.Path + return *p.CNAME } - -// 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 + +// 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.TotalPages + return *p.Custom404 } -// GetBuildType returns the BuildType field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetBuildType() string { - if p == nil || p.BuildType == nil { +// 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.BuildType + return *p.HTMLURL } -// 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 "" +// GetHTTPSCertificate returns the HTTPSCertificate field. +func (p *Pages) GetHTTPSCertificate() *PagesHTTPSCertificate { + if p == nil { + return nil } - return *p.CNAME + return p.HTTPSCertificate } // GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetHTTPSEnforced() bool { +func (p *Pages) GetHTTPSEnforced() bool { if p == nil || p.HTTPSEnforced == nil { return false } @@ -14935,7 +17895,7 @@ func (p *PagesUpdate) GetHTTPSEnforced() bool { } // GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *PagesUpdate) GetPublic() bool { +func (p *Pages) GetPublic() bool { if p == nil || p.Public == nil { return false } @@ -14943,439 +17903,519 @@ func (p *PagesUpdate) GetPublic() bool { } // GetSource returns the Source field. -func (p *PagesUpdate) GetSource() *PagesSource { +func (p *Pages) GetSource() *PagesSource { if p == nil { return nil } return p.Source } -// 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 +// 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.CurrentUserCanApprove + return *p.Status } -// GetEnvironment returns the Environment field. -func (p *PendingDeployment) GetEnvironment() *PendingDeploymentEnvironment { - if p == nil { - return nil +// 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.Environment + return *p.URL } -// 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 +// 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.WaitTimer + return *p.Commit } -// GetWaitTimerStartedAt returns the WaitTimerStartedAt field if it's non-nil, zero value otherwise. -func (p *PendingDeployment) GetWaitTimerStartedAt() Timestamp { - if p == nil || p.WaitTimerStartedAt == nil { +// 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.WaitTimerStartedAt + return *p.CreatedAt } -// 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 "" +// 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.HTMLURL + return *p.Duration } -// 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 +// GetError returns the Error field. +func (p *PagesBuild) GetError() *PagesError { + if p == nil { + return nil } - return *p.ID + return p.Error } -// 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 "" +// GetPusher returns the Pusher field. +func (p *PagesBuild) GetPusher() *User { + if p == nil { + return nil } - return *p.Name + return p.Pusher } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *PendingDeploymentEnvironment) GetNodeID() string { - if p == nil || p.NodeID == nil { +// 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.NodeID + 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 *PendingDeploymentEnvironment) GetURL() string { +func (p *PagesBuild) GetURL() string { if p == nil || p.URL == nil { return "" } return *p.URL } -// 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{} +// 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.AccessGrantedAt + return *p.CAAError } -// 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 +// 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.ID + return *p.DNSResolves } -// GetOwner returns the Owner field. -func (p *PersonalAccessToken) GetOwner() *User { - if p == nil { - return nil +// 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.Owner + return *p.EnforcesHTTPS } -// GetPermissions returns the Permissions field. -func (p *PersonalAccessToken) GetPermissions() *PersonalAccessTokenPermissions { - if p == nil { - return nil +// 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.Permissions + return *p.HasCNAMERecord } -// GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetRepositoriesURL() string { - if p == nil || p.RepositoriesURL == nil { +// 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.RepositoriesURL + return *p.Host } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetRepositorySelection() string { - if p == nil || p.RepositorySelection == nil { +// 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.RepositorySelection + return *p.HTTPSError } -// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. -func (p *PersonalAccessToken) GetTokenExpired() bool { - if p == nil || p.TokenExpired == nil { +// 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.TokenExpired + return *p.IsApexDomain } -// 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{} +// 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.TokenExpiresAt + return *p.IsARecord } -// 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{} +// 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.TokenLastUsedAt + return *p.IsCloudflareIP } -// 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{} +// 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.Org + return *p.IsCNAMEToFastly } -// 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{} +// 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.Other + return *p.IsCNAMEToGithubUserDomain } -// 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{} +// 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.Repo + return *p.IsNonGithubPagesIPPresent } -// 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{} +// 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.CreatedAt + return *p.IsOldIPAddress } -// 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 +// 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.ID + return *p.IsPagesDomain } -// GetOrg returns the Org field. -func (p *PersonalAccessTokenRequest) GetOrg() *Organization { - if p == nil { - return nil +// 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.Org + return *p.IsPointedToGithubPagesIP } -// GetOwner returns the Owner field. -func (p *PersonalAccessTokenRequest) GetOwner() *User { - if p == nil { - return nil +// 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.Owner + return *p.IsProxied } -// GetPermissionsAdded returns the PermissionsAdded field. -func (p *PersonalAccessTokenRequest) GetPermissionsAdded() *PersonalAccessTokenPermissions { - if p == nil { - return nil +// 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.PermissionsAdded + return *p.IsServedByPages } -// GetPermissionsResult returns the PermissionsResult field. -func (p *PersonalAccessTokenRequest) GetPermissionsResult() *PersonalAccessTokenPermissions { - if p == nil { - return nil +// 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.PermissionsResult + return *p.IsValid } -// GetPermissionsUpgraded returns the PermissionsUpgraded field. -func (p *PersonalAccessTokenRequest) GetPermissionsUpgraded() *PersonalAccessTokenPermissions { - if p == nil { - return nil +// 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.PermissionsUpgraded + return *p.IsValidDomain } -// 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 +// 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.RepositoryCount + return *p.Nameservers } -// GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetRepositorySelection() string { - if p == nil || p.RepositorySelection == nil { +// 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.RepositorySelection + return *p.Reason } -// GetTokenExpired returns the TokenExpired field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequest) GetTokenExpired() bool { - if p == nil || p.TokenExpired == nil { +// 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.TokenExpired + return *p.RespondsToHTTPS } -// 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{} +// 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.TokenExpiresAt + return *p.ShouldBeARecord } -// 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{} +// 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.TokenLastUsedAt + return *p.URI } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *PersonalAccessTokenRequestEvent) GetAction() string { - if p == nil || p.Action == nil { +// 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.Action + return *p.Message } -// GetInstallation returns the Installation field. -func (p *PersonalAccessTokenRequestEvent) GetInstallation() *Installation { +// GetAltDomain returns the AltDomain field. +func (p *PagesHealthCheckResponse) GetAltDomain() *PagesDomain { if p == nil { return nil } - return p.Installation + return p.AltDomain } -// GetOrg returns the Org field. -func (p *PersonalAccessTokenRequestEvent) GetOrg() *Organization { +// GetDomain returns the Domain field. +func (p *PagesHealthCheckResponse) GetDomain() *PagesDomain { if p == nil { return nil } - return p.Org + return p.Domain } -// GetPersonalAccessTokenRequest returns the PersonalAccessTokenRequest field. -func (p *PersonalAccessTokenRequestEvent) GetPersonalAccessTokenRequest() *PersonalAccessTokenRequest { - if p == nil { - return nil +// 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.PersonalAccessTokenRequest + return *p.Description } -// GetSender returns the Sender field. -func (p *PersonalAccessTokenRequestEvent) GetSender() *User { - if p == nil { - return nil +// 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.Sender + return *p.ExpiresAt } -// GetHook returns the Hook field. -func (p *PingEvent) GetHook() *Hook { - if p == nil { - return nil +// 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.Hook + return *p.State } -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetHookID() int64 { - if p == nil || p.HookID == nil { +// 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.HookID + return *p.TotalPages } -// GetInstallation returns the Installation field. -func (p *PingEvent) GetInstallation() *Installation { - if p == nil { - return nil +// 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.Installation + return *p.BuildType } -// GetOrg returns the Org field. -func (p *PingEvent) GetOrg() *Organization { - if p == nil { - return nil +// 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.Org + return *p.CNAME } -// GetRepo returns the Repo field. -func (p *PingEvent) GetRepo() *Repository { - if p == nil { - return nil +// 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.Repo + return *p.HTTPSEnforced } -// GetSender returns the Sender field. -func (p *PingEvent) GetSender() *User { +// 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.Sender + return p.Source } -// GetZen returns the Zen field if it's non-nil, zero value otherwise. -func (p *PingEvent) GetZen() string { - if p == nil || p.Zen == nil { +// 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.Zen + return *p.BuildType } -// 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 +// 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.Collaborators + return *p.Public } -// 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 +// GetSource returns the Source field. +func (p *PagesUpdateWithoutCNAME) GetSource() *PagesSource { + if p == nil { + return nil } - return *p.FilledSeats + return p.Source } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *Plan) GetName() string { +func (p *PatternRuleParameters) 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 +// 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.PrivateRepos + return *p.Negate } -// 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 +// 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.Seats + return *p.CurrentUserCanApprove } -// GetSpace returns the Space field if it's non-nil, zero value otherwise. -func (p *Plan) GetSpace() int { - if p == nil || p.Space == nil { +// GetEnvironment returns the Environment field. +func (p *PendingDeployment) GetEnvironment() *PendingDeploymentEnvironment { + if p == nil { + return nil + } + return p.Environment +} + +// 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.Space + return *p.WaitTimer } -// 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 "" +// 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.ConfigURL + return *p.WaitTimerStartedAt } -// GetEnforcement returns the Enforcement field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetEnforcement() string { - if p == nil || p.Enforcement == nil { +// 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.Enforcement + return *p.HTMLURL } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetID() int64 { +func (p *PendingDeploymentEnvironment) GetID() int64 { if p == nil || p.ID == nil { return 0 } @@ -15383,651 +18423,691 @@ func (p *PreReceiveHook) GetID() int64 { } // GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *PreReceiveHook) GetName() string { +func (p *PendingDeploymentEnvironment) GetName() string { if p == nil || p.Name == nil { return "" } return *p.Name } -// 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 (p *PendingDeploymentEnvironment) GetNodeID() string { + if p == nil || p.NodeID == nil { return "" } - return *p.HRef + return *p.NodeID } -// GetComments returns the Comments field. -func (p *PRLinks) GetComments() *PRLink { - if p == nil { - return nil +// 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.Comments + return *p.URL } -// GetCommits returns the Commits field. -func (p *PRLinks) GetCommits() *PRLink { - if p == nil { - return nil +// 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.Commits + return *p.AccessGrantedAt } -// GetHTML returns the HTML field. -func (p *PRLinks) GetHTML() *PRLink { - if p == nil { - return nil +// 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.HTML + return *p.ID } -// GetIssue returns the Issue field. -func (p *PRLinks) GetIssue() *PRLink { +// GetOwner returns the Owner field. +func (p *PersonalAccessToken) GetOwner() *User { if p == nil { return nil } - return p.Issue + return p.Owner } -// GetReviewComment returns the ReviewComment field. -func (p *PRLinks) GetReviewComment() *PRLink { +// GetPermissions returns the Permissions field. +func (p *PersonalAccessToken) GetPermissions() *PersonalAccessTokenPermissions { if p == nil { return nil } - return p.ReviewComment + return p.Permissions } -// GetReviewComments returns the ReviewComments field. -func (p *PRLinks) GetReviewComments() *PRLink { - if p == nil { - return nil +// 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.ReviewComments + return *p.RepositoriesURL } -// GetSelf returns the Self field. -func (p *PRLinks) GetSelf() *PRLink { - if p == nil { - return nil +// 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.Self + return *p.RepositorySelection } -// GetStatuses returns the Statuses field. -func (p *PRLinks) GetStatuses() *PRLink { - if p == nil { - return nil +// 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.Statuses + return *p.TokenExpired } -// GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *Project) GetBody() string { - if p == nil || p.Body == nil { - return "" +// 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.Body + return *p.TokenExpiresAt } -// GetColumnsURL returns the ColumnsURL field if it's non-nil, zero value otherwise. -func (p *Project) GetColumnsURL() string { - if p == nil || p.ColumnsURL == nil { - return "" +// 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.ColumnsURL + return *p.TokenID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *Project) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { +// 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.CreatedAt + return *p.TokenLastUsedAt } -// GetCreator returns the Creator field. -func (p *Project) GetCreator() *User { - if p == nil { - return nil +// 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.Creator + return *p.TokenName } -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (p *Project) GetHTMLURL() string { - if p == nil || p.HTMLURL == nil { - return "" +// 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.HTMLURL + 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 *Project) GetID() int64 { +func (p *PersonalAccessTokenRequest) 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 *Project) GetName() string { - if p == nil || p.Name == nil { - return "" +// GetOrg returns the Org field. +func (p *PersonalAccessTokenRequest) GetOrg() *Organization { + if p == nil { + return nil } - return *p.Name + return p.Org } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *Project) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetOwner returns the Owner field. +func (p *PersonalAccessTokenRequest) GetOwner() *User { + if p == nil { + return nil } - return *p.NodeID + return p.Owner } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *Project) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetPermissionsAdded returns the PermissionsAdded field. +func (p *PersonalAccessTokenRequest) GetPermissionsAdded() *PersonalAccessTokenPermissions { + if p == nil { + return nil } - return *p.Number + 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 } -// GetOrganizationPermission returns the OrganizationPermission field if it's non-nil, zero value otherwise. -func (p *Project) GetOrganizationPermission() string { - if p == nil || p.OrganizationPermission == nil { - return "" +// 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.OrganizationPermission + return *p.RepositoryCount } -// GetOwnerURL returns the OwnerURL field if it's non-nil, zero value otherwise. -func (p *Project) GetOwnerURL() string { - if p == nil || p.OwnerURL == nil { +// 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.OwnerURL + return *p.RepositorySelection } -// GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (p *Project) GetPrivate() bool { - if p == nil || p.Private == nil { +// 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.Private + return *p.TokenExpired } -// GetState returns the State field if it's non-nil, zero value otherwise. -func (p *Project) GetState() string { - if p == nil || p.State == nil { - return "" +// 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.State + return *p.TokenExpiresAt } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *Project) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { +// 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.UpdatedAt + return *p.TokenLastUsedAt } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *Project) GetURL() string { - if p == nil || p.URL == nil { +// 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.URL + return *p.Action } -// 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 "" +// GetInstallation returns the Installation field. +func (p *PersonalAccessTokenRequestEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *p.From + return p.Installation } -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetArchived() bool { - if p == nil || p.Archived == nil { - return false +// GetOrg returns the Org field. +func (p *PersonalAccessTokenRequestEvent) GetOrg() *Organization { + if p == nil { + return nil } - return *p.Archived + return p.Org } -// GetColumnID returns the ColumnID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnID() int64 { - if p == nil || p.ColumnID == nil { - return 0 +// GetPersonalAccessTokenRequest returns the PersonalAccessTokenRequest field. +func (p *PersonalAccessTokenRequestEvent) GetPersonalAccessTokenRequest() *PersonalAccessTokenRequest { + if p == nil { + return nil } - return *p.ColumnID + return p.PersonalAccessTokenRequest } -// GetColumnName returns the ColumnName field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnName() string { - if p == nil || p.ColumnName == nil { - return "" +// GetSender returns the Sender field. +func (p *PersonalAccessTokenRequestEvent) GetSender() *User { + if p == nil { + return nil } - return *p.ColumnName + return p.Sender } -// GetColumnURL returns the ColumnURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetColumnURL() string { - if p == nil || p.ColumnURL == nil { - return "" +// GetHook returns the Hook field. +func (p *PingEvent) GetHook() *Hook { + if p == nil { + return nil } - return *p.ColumnURL + return p.Hook } -// GetContentURL returns the ContentURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetContentURL() string { - if p == nil || p.ContentURL == nil { - return "" +// 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.ContentURL + return *p.HookID } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetInstallation returns the Installation field. +func (p *PingEvent) GetInstallation() *Installation { + if p == nil { + return nil } - return *p.CreatedAt + return p.Installation } -// GetCreator returns the Creator field. -func (p *ProjectCard) GetCreator() *User { +// GetOrg returns the Org field. +func (p *PingEvent) GetOrg() *Organization { if p == nil { return nil } - return p.Creator + return p.Org } -// GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetID() int64 { - if p == nil || p.ID == nil { - return 0 +// GetRepo returns the Repo field. +func (p *PingEvent) GetRepo() *Repository { + if p == nil { + return nil } - return *p.ID + return p.Repo } -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" +// GetSender returns the Sender field. +func (p *PingEvent) GetSender() *User { + if p == nil { + return nil } - return *p.NodeID + return p.Sender } -// GetNote returns the Note field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetNote() string { - if p == nil || p.Note == nil { +// 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.Note + return *p.Zen } -// GetPreviousColumnName returns the PreviousColumnName field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetPreviousColumnName() string { - if p == nil || p.PreviousColumnName == nil { - return "" +// 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.PreviousColumnName + return *p.Collaborators } -// GetProjectID returns the ProjectID field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetProjectID() int64 { - if p == nil || p.ProjectID == nil { +// 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.ProjectID + return *p.FilledSeats } -// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetProjectURL() string { - if p == nil || p.ProjectURL == nil { +// 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.ProjectURL + return *p.Name } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == nil { - return Timestamp{} +// 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.UpdatedAt + return *p.PrivateRepos } -// GetURL returns the URL field if it's non-nil, zero value otherwise. -func (p *ProjectCard) GetURL() string { - if p == nil || p.URL == nil { - return "" +// 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.URL + return *p.Seats } -// GetNote returns the Note field. -func (p *ProjectCardChange) GetNote() *ProjectCardNote { - if p == nil { - return nil +// 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.Note + return *p.Space } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectCardEvent) GetAction() string { - if p == nil || p.Action == 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 *p.Action + return *p.Model } -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectCardEvent) GetAfterID() int64 { - if p == nil || p.AfterID == nil { - return 0 +// GetOrganization returns the Organization field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReport) GetOrganization() string { + if p == nil || p.Organization == nil { + return "" } - return *p.AfterID + return *p.Organization } -// GetChanges returns the Changes field. -func (p *ProjectCardEvent) GetChanges() *ProjectCardChange { - if p == 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 p.Changes + return *p.Product } -// GetInstallation returns the Installation field. -func (p *ProjectCardEvent) GetInstallation() *Installation { - if p == nil { - return 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 p.Installation + return *p.User } -// GetOrg returns the Org field. -func (p *ProjectCardEvent) GetOrg() *Organization { - if p == nil { - return nil +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetDay() int { + if p == nil || p.Day == nil { + return 0 } - return p.Org + return *p.Day } -// GetProjectCard returns the ProjectCard field. -func (p *ProjectCardEvent) GetProjectCard() *ProjectCard { - if p == nil { - return 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 p.ProjectCard + return *p.Model } -// GetRepo returns the Repo field. -func (p *ProjectCardEvent) GetRepo() *Repository { - if p == nil { - return nil +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetMonth() int { + if p == nil || p.Month == nil { + return 0 } - return p.Repo + return *p.Month } -// GetSender returns the Sender field. -func (p *ProjectCardEvent) GetSender() *User { - if p == nil { - return 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 p.Sender + return *p.Product } -// GetArchivedState returns the ArchivedState field if it's non-nil, zero value otherwise. -func (p *ProjectCardListOptions) GetArchivedState() string { - if p == nil || p.ArchivedState == 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 *p.ArchivedState + return *p.User } -// 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 "" +// GetYear returns the Year field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageReportOptions) GetYear() int { + if p == nil || p.Year == nil { + return 0 } - return *p.From + return *p.Year } -// GetArchived returns the Archived field if it's non-nil, zero value otherwise. -func (p *ProjectCardOptions) GetArchived() bool { - if p == nil || p.Archived == nil { - return false +// GetDay returns the Day field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetDay() int { + if p == nil || p.Day == nil { + return 0 } - return *p.Archived + return *p.Day } -// GetBody returns the Body field. -func (p *ProjectChange) GetBody() *ProjectBody { - if p == nil { - return nil +// GetMonth returns the Month field if it's non-nil, zero value otherwise. +func (p *PremiumRequestUsageTimePeriod) GetMonth() int { + if p == nil || p.Month == nil { + return 0 } - return p.Body + return *p.Month } -// GetName returns the Name field. -func (p *ProjectChange) GetName() *ProjectName { - if p == nil { - return 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 *p.ConfigURL +} + +// 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 *p.Enforcement +} + +// 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 p.Name + return *p.ID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (p *ProjectCollaboratorOptions) GetPermission() string { - if p == nil || p.Permission == 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 *p.Permission + return *p.Name } -// GetCardsURL returns the CardsURL field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetCardsURL() string { - if p == nil || p.CardsURL == 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 *p.CardsURL + return *p.TotalCount } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetCreatedAt() Timestamp { +func (p *PrivateRegistry) 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 *ProjectColumn) 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 *ProjectColumn) GetName() string { +func (p *PrivateRegistry) 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 *ProjectColumn) GetNodeID() string { - if p == nil || p.NodeID == nil { - return "" - } - return *p.NodeID -} - -// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetProjectURL() string { - if p == nil || p.ProjectURL == nil { +// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. +func (p *PrivateRegistry) GetRegistryType() string { + if p == nil || p.RegistryType == nil { return "" } - return *p.ProjectURL + return *p.RegistryType } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectColumn) GetUpdatedAt() Timestamp { +func (p *PrivateRegistry) 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 *ProjectColumn) GetURL() string { - if p == nil || p.URL == 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 *p.URL + return *p.Username } -// GetName returns the Name field. -func (p *ProjectColumnChange) GetName() *ProjectColumnName { +// GetVisibility returns the Visibility field. +func (p *PrivateRegistry) GetVisibility() *PrivateRegistryVisibility { if p == nil { return nil } - return p.Name + return p.Visibility } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectColumnEvent) GetAction() string { - if p == nil || p.Action == 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 *p.Action + return *p.HRef } -// GetAfterID returns the AfterID field if it's non-nil, zero value otherwise. -func (p *ProjectColumnEvent) GetAfterID() int64 { - if p == nil || p.AfterID == nil { - return 0 +// GetComments returns the Comments field. +func (p *PRLinks) GetComments() *PRLink { + if p == nil { + return nil } - return *p.AfterID + return p.Comments } -// GetChanges returns the Changes field. -func (p *ProjectColumnEvent) GetChanges() *ProjectColumnChange { +// GetCommits returns the Commits field. +func (p *PRLinks) GetCommits() *PRLink { if p == nil { return nil } - return p.Changes + return p.Commits } -// GetInstallation returns the Installation field. -func (p *ProjectColumnEvent) GetInstallation() *Installation { +// GetHTML returns the HTML field. +func (p *PRLinks) GetHTML() *PRLink { if p == nil { return nil } - return p.Installation + return p.HTML } -// GetOrg returns the Org field. -func (p *ProjectColumnEvent) GetOrg() *Organization { +// GetIssue returns the Issue field. +func (p *PRLinks) GetIssue() *PRLink { if p == nil { return nil } - return p.Org + return p.Issue } -// GetProjectColumn returns the ProjectColumn field. -func (p *ProjectColumnEvent) GetProjectColumn() *ProjectColumn { +// GetReviewComment returns the ReviewComment field. +func (p *PRLinks) GetReviewComment() *PRLink { if p == nil { return nil } - return p.ProjectColumn + return p.ReviewComment } -// GetRepo returns the Repo field. -func (p *ProjectColumnEvent) GetRepo() *Repository { +// GetReviewComments returns the ReviewComments field. +func (p *PRLinks) GetReviewComments() *PRLink { if p == nil { return nil } - return p.Repo + return p.ReviewComments } -// GetSender returns the Sender field. -func (p *ProjectColumnEvent) GetSender() *User { +// GetSelf returns the Self field. +func (p *PRLinks) GetSelf() *PRLink { if p == nil { return nil } - return p.Sender + return p.Self } -// 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 "" +// GetStatuses returns the Statuses field. +func (p *PRLinks) GetStatuses() *PRLink { + if p == nil { + return nil } - return *p.From + return p.Statuses } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectEvent) GetAction() string { - if p == nil || p.Action == 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 *p.Action + return *p.From } -// GetChanges returns the Changes field. -func (p *ProjectEvent) GetChanges() *ProjectChange { +// GetNote returns the Note field. +func (p *ProjectCardChange) GetNote() *ProjectCardNote { if p == nil { return nil } - return p.Changes + return p.Note } -// GetInstallation returns the Installation field. -func (p *ProjectEvent) GetInstallation() *Installation { - if p == nil { - return 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 p.Installation + return *p.From } -// GetOrg returns the Org field. -func (p *ProjectEvent) GetOrg() *Organization { +// GetBody returns the Body field. +func (p *ProjectChange) GetBody() *ProjectBody { if p == nil { return nil } - return p.Org + return p.Body } -// GetProject returns the Project field. -func (p *ProjectEvent) GetProject() *Project { +// GetName returns the Name field. +func (p *ProjectChange) GetName() *ProjectName { if p == nil { return nil } - return p.Project + return p.Name } -// GetRepo returns the Repo field. -func (p *ProjectEvent) GetRepo() *Repository { +// GetName returns the Name field. +func (p *ProjectColumnChange) GetName() *ProjectColumnName { if p == nil { return nil } - return p.Repo + return p.Name } -// GetSender returns the Sender field. -func (p *ProjectEvent) GetSender() *User { - if p == nil { - return 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 p.Sender + return *p.From } // GetFrom returns the From field if it's non-nil, zero value otherwise. @@ -16039,211 +19119,371 @@ func (p *ProjectName) GetFrom() string { } // GetBody returns the Body field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetBody() string { +func (p *ProjectV2) GetBody() string { if p == nil || p.Body == nil { return "" } return *p.Body } +// 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 *p.ClosedAt +} + +// 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 *p.ColumnsURL +} + +// 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 *p.CreatedAt +} + +// GetCreator returns the Creator field. +func (p *ProjectV2) GetCreator() *User { + if p == nil { + return nil + } + return p.Creator +} + +// 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 *p.DeletedAt +} + +// GetDeletedBy returns the DeletedBy field. +func (p *ProjectV2) GetDeletedBy() *User { + if p == nil { + return nil + } + return p.DeletedBy +} + +// 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 *p.Description +} + +// 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 *p.HTMLURL +} + +// 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 *p.ID +} + // GetName returns the Name field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetName() string { +func (p *ProjectV2) 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 *ProjectV2) GetNodeID() string { + if p == nil || p.NodeID == nil { + return "" + } + return *p.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 + } + return *p.Number +} + // GetOrganizationPermission returns the OrganizationPermission field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetOrganizationPermission() string { +func (p *ProjectV2) GetOrganizationPermission() string { if p == nil || p.OrganizationPermission == nil { return "" } return *p.OrganizationPermission } +// GetOwner returns the Owner field. +func (p *ProjectV2) GetOwner() *User { + if p == nil { + return nil + } + return p.Owner +} + +// 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 *p.OwnerURL +} + // GetPrivate returns the Private field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetPrivate() bool { +func (p *ProjectV2) GetPrivate() bool { if p == nil || p.Private == nil { return false } return *p.Private } +// 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 *p.Public +} + +// 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 *p.ShortDescription +} + // GetState returns the State field if it's non-nil, zero value otherwise. -func (p *ProjectOptions) GetState() string { +func (p *ProjectV2) GetState() string { if p == nil || p.State == nil { return "" } - return *p.State + return *p.State +} + +// GetTitle returns the Title field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetTitle() string { + if p == nil || p.Title == nil { + return "" + } + return *p.Title +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetUpdatedAt() Timestamp { + if p == nil || p.UpdatedAt == nil { + return Timestamp{} + } + return *p.UpdatedAt +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (p *ProjectV2) GetURL() string { + if p == nil || p.URL == nil { + return "" + } + return *p.URL } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (p *ProjectPermissionLevel) GetPermission() string { - if p == nil || p.Permission == nil { +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (p *ProjectV2Event) GetAction() string { + if p == nil || p.Action == nil { return "" } - return *p.Permission + return *p.Action } -// GetUser returns the User field. -func (p *ProjectPermissionLevel) GetUser() *User { +// GetInstallation returns the Installation field. +func (p *ProjectV2Event) GetInstallation() *Installation { if p == nil { return nil } - return p.User + return p.Installation } -// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetClosedAt() Timestamp { - if p == nil || p.ClosedAt == nil { - return Timestamp{} +// GetOrg returns the Org field. +func (p *ProjectV2Event) GetOrg() *Organization { + if p == nil { + return nil } - return *p.ClosedAt + return p.Org } -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetCreatedAt() Timestamp { - if p == nil || p.CreatedAt == nil { - return Timestamp{} +// GetProjectsV2 returns the ProjectsV2 field. +func (p *ProjectV2Event) GetProjectsV2() *ProjectV2 { + if p == nil { + return nil } - return *p.CreatedAt + return p.ProjectsV2 } -// GetCreator returns the Creator field. -func (p *ProjectsV2) GetCreator() *User { +// GetSender returns the Sender field. +func (p *ProjectV2Event) GetSender() *User { if p == nil { return nil } - return p.Creator + return p.Sender } -// GetDeletedAt returns the DeletedAt field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetDeletedAt() Timestamp { - if p == nil || p.DeletedAt == nil { - return Timestamp{} +// GetConfiguration returns the Configuration field. +func (p *ProjectV2Field) GetConfiguration() *ProjectV2FieldConfiguration { + if p == nil { + return nil } - return *p.DeletedAt + return p.Configuration } -// GetDeletedBy returns the DeletedBy field. -func (p *ProjectsV2) GetDeletedBy() *User { - if p == 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 p.DeletedBy + return *p.CreatedAt } -// GetDescription returns the Description field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetDescription() string { - if p == nil || p.Description == 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 *p.Description + return *p.DataType } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetID() int64 { +func (p *ProjectV2Field) GetID() int64 { if p == nil || p.ID == nil { return 0 } return *p.ID } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetName() string { + if p == nil || p.Name == nil { + return "" + } + return *p.Name +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetNodeID() string { +func (p *ProjectV2Field) GetNodeID() string { if p == nil || p.NodeID == nil { return "" } return *p.NodeID } -// GetNumber returns the Number field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetNumber() int { - if p == nil || p.Number == nil { - return 0 +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Field) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { + return "" } - return *p.Number + return *p.ProjectURL } -// GetOwner returns the Owner field. -func (p *ProjectsV2) GetOwner() *User { - if p == nil { - return 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 p.Owner + return *p.UpdatedAt } -// GetPublic returns the Public field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetPublic() bool { - if p == nil || p.Public == nil { - return false +// GetDuration returns the Duration field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetDuration() int { + if p == nil || p.Duration == nil { + return 0 } - return *p.Public + return *p.Duration } -// GetShortDescription returns the ShortDescription field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetShortDescription() string { - if p == nil || p.ShortDescription == nil { - return "" +// GetStartDay returns the StartDay field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldConfiguration) GetStartDay() int { + if p == nil || p.StartDay == nil { + return 0 } - return *p.ShortDescription + return *p.StartDay } -// GetTitle returns the Title field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetTitle() string { - if p == nil || p.Title == 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 *p.Title + return *p.Duration } -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (p *ProjectsV2) GetUpdatedAt() Timestamp { - if p == nil || p.UpdatedAt == 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 *p.UpdatedAt + return *p.ID } -// GetAction returns the Action field if it's non-nil, zero value otherwise. -func (p *ProjectV2Event) GetAction() string { - if p == nil || p.Action == nil { +// GetStartDate returns the StartDate field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldIteration) GetStartDate() string { + if p == nil || p.StartDate == nil { return "" } - return *p.Action + return *p.StartDate } -// GetInstallation returns the Installation field. -func (p *ProjectV2Event) GetInstallation() *Installation { +// GetTitle returns the Title field. +func (p *ProjectV2FieldIteration) GetTitle() *ProjectV2TextContent { if p == nil { return nil } - return p.Installation + return p.Title } -// GetOrg returns the Org field. -func (p *ProjectV2Event) GetOrg() *Organization { - if p == nil { - return nil +// GetColor returns the Color field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetColor() string { + if p == nil || p.Color == nil { + return "" } - return p.Org + return *p.Color } -// GetProjectsV2 returns the ProjectsV2 field. -func (p *ProjectV2Event) GetProjectsV2() *ProjectsV2 { +// GetDescription returns the Description field. +func (p *ProjectV2FieldOption) GetDescription() *ProjectV2TextContent { if p == nil { return nil } - return p.ProjectsV2 + return p.Description } -// GetSender returns the Sender field. -func (p *ProjectV2Event) GetSender() *User { +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2FieldOption) GetID() string { + if p == nil || p.ID == nil { + return "" + } + return *p.ID +} + +// GetName returns the Name field. +func (p *ProjectV2FieldOption) GetName() *ProjectV2TextContent { if p == nil { return nil } - return p.Sender + return p.Name } // GetArchivedAt returns the ArchivedAt field if it's non-nil, zero value otherwise. @@ -16294,6 +19534,14 @@ func (p *ProjectV2Item) GetID() int64 { return *p.ID } +// GetItemURL returns the ItemURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetItemURL() string { + if p == nil || p.ItemURL == nil { + return "" + } + return *p.ItemURL +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetNodeID() string { if p == nil || p.NodeID == nil { @@ -16310,6 +19558,14 @@ func (p *ProjectV2Item) GetProjectNodeID() string { return *p.ProjectNodeID } +// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise. +func (p *ProjectV2Item) GetProjectURL() string { + if p == nil || p.ProjectURL == nil { + return "" + } + return *p.ProjectURL +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (p *ProjectV2Item) GetUpdatedAt() Timestamp { if p == nil || p.UpdatedAt == nil { @@ -16326,6 +19582,14 @@ func (p *ProjectV2ItemChange) GetArchivedAt() *ArchivedAt { return p.ArchivedAt } +// GetFieldValue returns the FieldValue field. +func (p *ProjectV2ItemChange) GetFieldValue() *FieldValue { + if p == nil { + return nil + } + return p.FieldValue +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *ProjectV2ItemEvent) GetAction() string { if p == nil || p.Action == nil { @@ -16374,6 +19638,30 @@ func (p *ProjectV2ItemEvent) GetSender() *User { return p.Sender } +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (p *ProjectV2ItemFieldValue) GetID() int64 { + if p == nil || p.ID == nil { + return 0 + } + return *p.ID +} + +// GetHTML returns the HTML field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetHTML() string { + if p == nil || p.HTML == nil { + return "" + } + return *p.HTML +} + +// GetRaw returns the Raw field if it's non-nil, zero value otherwise. +func (p *ProjectV2TextContent) GetRaw() string { + if p == nil || p.Raw == nil { + return "" + } + return *p.Raw +} + // GetAllowDeletions returns the AllowDeletions field. func (p *Protection) GetAllowDeletions() *AllowDeletions { if p == nil { @@ -16590,6 +19878,14 @@ func (p *ProtectionChanges) GetRequiredStatusChecksEnforcementLevel() *RequiredS return p.RequiredStatusChecksEnforcementLevel } +// GetRequireLastPushApproval returns the RequireLastPushApproval field. +func (p *ProtectionChanges) GetRequireLastPushApproval() *RequireLastPushApprovalChanges { + if p == nil { + return nil + } + return p.RequireLastPushApproval +} + // GetSignatureRequirementEnforcementLevel returns the SignatureRequirementEnforcementLevel field. func (p *ProtectionChanges) GetSignatureRequirementEnforcementLevel() *SignatureRequirementEnforcementLevelChanges { if p == nil { @@ -17510,6 +20806,14 @@ func (p *PullRequestEvent) GetPullRequest() *PullRequest { return p.PullRequest } +// GetReason returns the Reason field if it's non-nil, zero value otherwise. +func (p *PullRequestEvent) GetReason() string { + if p == nil || p.Reason == nil { + return "" + } + return *p.Reason +} + // GetRepo returns the Repo field. func (p *PullRequestEvent) GetRepo() *Repository { if p == nil { @@ -17990,6 +21294,14 @@ func (p *PullRequestReviewThreadEvent) GetThread() *PullRequestThread { return p.Thread } +// GetAutomaticCopilotCodeReviewEnabled returns the AutomaticCopilotCodeReviewEnabled field if it's non-nil, zero value otherwise. +func (p *PullRequestRuleParameters) GetAutomaticCopilotCodeReviewEnabled() bool { + if p == nil || p.AutomaticCopilotCodeReviewEnabled == nil { + return false + } + return *p.AutomaticCopilotCodeReviewEnabled +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (p *PullRequestTargetEvent) GetAction() string { if p == nil || p.Action == nil { @@ -18126,12 +21438,12 @@ func (p *PullRequestThread) GetNodeID() string { return *p.NodeID } -// GetMergablePulls returns the MergablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetMergablePulls() int { - if p == nil || p.MergablePulls == nil { +// 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 *p.MergablePulls + return *p.MergeablePulls } // GetMergedPulls returns the MergedPulls field if it's non-nil, zero value otherwise. @@ -18150,12 +21462,12 @@ func (p *PullStats) GetTotalPulls() int { return *p.TotalPulls } -// GetUnmergablePulls returns the UnmergablePulls field if it's non-nil, zero value otherwise. -func (p *PullStats) GetUnmergablePulls() int { - if p == nil || p.UnmergablePulls == nil { +// 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 *p.UnmergablePulls + return *p.UnmergeablePulls } // GetCommits returns the Commits field if it's non-nil, zero value otherwise. @@ -18390,6 +21702,14 @@ func (p *PushEventRepository) GetCreatedAt() Timestamp { return *p.CreatedAt } +// 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 p.CustomProperties +} + // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. func (p *PushEventRepository) GetDefaultBranch() string { if p == nil || p.DefaultBranch == nil { @@ -18646,6 +21966,14 @@ func (p *PushEventRepository) GetWatchersCount() int { return *p.WatchersCount } +// GetExpireAt returns the ExpireAt field if it's non-nil, zero value otherwise. +func (p *PushProtectionBypass) GetExpireAt() Timestamp { + if p == nil || p.ExpireAt == nil { + return Timestamp{} + } + return *p.ExpireAt +} + // GetActionsRunnerRegistration returns the ActionsRunnerRegistration field. func (r *RateLimits) GetActionsRunnerRegistration() *Rate { if r == nil { @@ -18742,6 +22070,14 @@ func (r *Reaction) GetContent() string { return *r.Content } +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *Reaction) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} + } + return *r.CreatedAt +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *Reaction) GetID() int64 { if r == nil || r.ID == nil { @@ -18846,6 +22182,30 @@ func (r *Reactions) GetURL() string { return *r.URL } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetName() string { + if r == nil || r.Name == nil { + return "" + } + return *r.Name +} + +// GetPreviousCostCenter returns the PreviousCostCenter field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetPreviousCostCenter() string { + if r == nil || r.PreviousCostCenter == nil { + return "" + } + return *r.PreviousCostCenter +} + +// GetResourceType returns the ResourceType field if it's non-nil, zero value otherwise. +func (r *ReassignedResource) GetResourceType() string { + if r == nil || r.ResourceType == nil { + return "" + } + return *r.ResourceType +} + // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. func (r *Reference) GetNodeID() string { if r == nil || r.NodeID == nil { @@ -18915,7 +22275,63 @@ func (r *RegistrationToken) GetToken() string { if r == nil || r.Token == nil { return "" } - return *r.Token + return *r.Token +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RegistryPackageEvent) GetAction() string { + if r == nil || r.Action == nil { + return "" + } + 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 (r *RegistryPackageEvent) GetInstallation() *Installation { + if r == nil { + return nil + } + return r.Installation +} + +// GetOrganization returns the Organization field. +func (r *RegistryPackageEvent) GetOrganization() *Organization { + if r == nil { + return nil + } + return r.Organization +} + +// GetRegistryPackage returns the RegistryPackage field. +func (r *RegistryPackageEvent) GetRegistryPackage() *Package { + if r == nil { + return nil + } + return r.RegistryPackage +} + +// GetRepository returns the Repository field. +func (r *RegistryPackageEvent) GetRepository() *Repository { + if r == nil { + return nil + } + return r.Repository +} + +// GetSender returns the Sender field. +func (r *RegistryPackageEvent) GetSender() *User { + if r == nil { + return nil + } + return r.Sender } // GetBrowserDownloadURL returns the BrowserDownloadURL field if it's non-nil, zero value otherwise. @@ -18942,6 +22358,14 @@ func (r *ReleaseAsset) GetCreatedAt() Timestamp { return *r.CreatedAt } +// 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 *r.Digest +} + // GetDownloadCount returns the DownloadCount field if it's non-nil, zero value otherwise. func (r *ReleaseAsset) GetDownloadCount() int { if r == nil || r.DownloadCount == nil { @@ -19070,6 +22494,46 @@ func (r *ReleaseEvent) GetSender() *User { 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 *r.BuildDate +} + +// 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 *r.BuildID +} + +// 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 *r.Platform +} + +// 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 *r.Version +} + +// GetMessage returns the Message field if it's non-nil, zero value otherwise. +func (r *RemoveResourcesFromCostCenterResponse) GetMessage() string { + if r == nil || r.Message == nil { + return "" + } + return *r.Message +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (r *RemoveToken) GetExpiresAt() Timestamp { if r == nil || r.ExpiresAt == nil { @@ -19254,102 +22718,6 @@ func (r *RepoName) GetFrom() string { return *r.From } -// GetBadgeURL returns the BadgeURL field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetBadgeURL() string { - if r == nil || r.BadgeURL == nil { - return "" - } - return *r.BadgeURL -} - -// 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{} - } - return *r.CreatedAt -} - -// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) 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 (r *RepoRequiredWorkflow) GetID() int64 { - if r == nil || r.ID == nil { - return 0 - } - return *r.ID -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) 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 *RepoRequiredWorkflow) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetPath returns the Path field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflow) GetPath() string { - if r == nil || r.Path == nil { - return "" - } - return *r.Path -} - -// GetSourceRepository returns the SourceRepository field. -func (r *RepoRequiredWorkflow) GetSourceRepository() *Repository { - if r == nil { - return nil - } - return r.SourceRepository -} - -// 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 "" - } - return *r.State -} - -// 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{} - } - return *r.UpdatedAt -} - -// 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 "" - } - return *r.URL -} - -// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. -func (r *RepoRequiredWorkflows) GetTotalCount() int { - if r == nil || r.TotalCount == nil { - return 0 - } - return *r.TotalCount -} - // GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise. func (r *RepositoriesSearchResult) GetIncompleteResults() bool { if r == nil || r.IncompleteResults == nil { @@ -19534,6 +22902,14 @@ func (r *Repository) GetCreatedAt() Timestamp { return *r.CreatedAt } +// 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 r.CustomProperties +} + // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. func (r *Repository) GetDefaultBranch() string { if r == nil || r.DefaultBranch == nil { @@ -20198,20 +23574,188 @@ func (r *RepositoryActionsAccessLevel) GetAccessLevel() string { return *r.AccessLevel } -// GetAdvancedSecurityCommitters returns the AdvancedSecurityCommitters field if it's non-nil, zero value otherwise. -func (r *RepositoryActiveCommitters) GetAdvancedSecurityCommitters() int { - if r == nil || r.AdvancedSecurityCommitters == nil { +// GetActor returns the Actor field. +func (r *RepositoryActivity) GetActor() *RepositoryActor { + if r == nil { + return nil + } + return r.Actor +} + +// 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 *r.Timestamp +} + +// 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 *r.AvatarURL +} + +// 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 *r.EventsURL +} + +// 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 *r.FollowersURL +} + +// 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 *r.FollowingURL +} + +// 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 *r.GistsURL +} + +// 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 *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 (r *RepositoryActor) GetID() int64 { + if r == nil || r.ID == nil { return 0 } - return *r.AdvancedSecurityCommitters + return *r.ID } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RepositoryActiveCommitters) GetName() string { - if r == nil || r.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 *r.Name + return *r.Login +} + +// 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 *r.NodeID +} + +// 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 *r.OrganizationsURL +} + +// 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 *r.ReceivedEventsURL +} + +// 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 *r.ReposURL +} + +// 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 *r.SiteAdmin +} + +// 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 *r.StarredURL +} + +// 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 *r.SubscriptionsURL +} + +// 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 *r.Type +} + +// 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 *r.URL +} + +// 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 *r.UserViewType +} + +// GetRepository returns the Repository field. +func (r *RepositoryAttachment) GetRepository() *Repository { + if r == nil { + return nil + } + return r.Repository +} + +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (r *RepositoryAttachment) GetStatus() string { + if r == nil || r.Status == nil { + return "" + } + return *r.Status } // GetConfiguration returns the Configuration field. @@ -20838,6 +24382,14 @@ func (r *RepositoryLicense) GetURL() string { return *r.URL } +// 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 *r.IncludesParents +} + // GetBase returns the Base field if it's non-nil, zero value otherwise. func (r *RepositoryMergeRequest) GetBase() string { if r == nil || r.Base == nil { @@ -20958,6 +24510,14 @@ func (r *RepositoryRelease) GetID() int64 { return *r.ID } +// GetImmutable returns the Immutable field if it's non-nil, zero value otherwise. +func (r *RepositoryRelease) GetImmutable() bool { + if r == nil || r.Immutable == nil { + return false + } + return *r.Immutable +} + // GetMakeLatest returns the MakeLatest field if it's non-nil, zero value otherwise. func (r *RepositoryRelease) GetMakeLatest() string { if r == nil || r.MakeLatest == nil { @@ -21046,12 +24606,12 @@ func (r *RepositoryRelease) GetZipballURL() string { return *r.ZipballURL } -// GetParameters returns the Parameters field if it's non-nil, zero value otherwise. -func (r *RepositoryRule) GetParameters() json.RawMessage { - if r == nil || r.Parameters == nil { - return json.RawMessage{} +// GetConditions returns the Conditions field. +func (r *RepositoryRuleset) GetConditions() *RepositoryRulesetConditions { + if r == nil { + return nil } - return *r.Parameters + return r.Conditions } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. @@ -21062,16 +24622,24 @@ func (r *RepositoryRuleset) GetCreatedAt() Timestamp { return *r.CreatedAt } -// GetCurrentUserCanBypass returns the CurrentUserCanBypass field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetCurrentUserCanBypass() string { - if r == nil || r.CurrentUserCanBypass == nil { - return "" +// GetCurrentUserCanBypass returns the CurrentUserCanBypass field. +func (r *RepositoryRuleset) GetCurrentUserCanBypass() *BypassMode { + if r == nil { + return nil + } + return r.CurrentUserCanBypass +} + +// 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 *r.CurrentUserCanBypass + return *r.ID } // GetLinks returns the Links field. -func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLink { +func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLinks { if r == nil { return nil } @@ -21086,20 +24654,28 @@ func (r *RepositoryRuleset) GetNodeID() string { return *r.NodeID } -// GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetSourceType() string { - if r == nil || r.SourceType == nil { - return "" +// GetRules returns the Rules field. +func (r *RepositoryRuleset) GetRules() *RepositoryRulesetRules { + if r == nil { + return nil } - return *r.SourceType + return r.Rules } -// GetTarget returns the Target field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetTarget() string { - if r == nil || r.Target == nil { - return "" +// GetSourceType returns the SourceType field. +func (r *RepositoryRuleset) GetSourceType() *RulesetSourceType { + if r == nil { + return nil } - return *r.Target + return r.SourceType +} + +// GetTarget returns the Target field. +func (r *RepositoryRuleset) GetTarget() *RulesetTarget { + if r == nil { + return nil + } + return r.Target } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. @@ -21110,16 +24686,32 @@ func (r *RepositoryRuleset) GetUpdatedAt() Timestamp { return *r.UpdatedAt } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetCodeScanningRule) GetParameters() *RuleCodeScanningParameters { +// GetConfiguration returns the Configuration field. +func (r *RepositoryRulesetChangedRule) GetConfiguration() *RepositoryRulesetChangeSource { + if r == nil { + return nil + } + return r.Configuration +} + +// GetPattern returns the Pattern field. +func (r *RepositoryRulesetChangedRule) GetPattern() *RepositoryRulesetChangeSource { + if r == nil { + return nil + } + return r.Pattern +} + +// GetRuleType returns the RuleType field. +func (r *RepositoryRulesetChangedRule) GetRuleType() *RepositoryRulesetChangeSource { if r == nil { return nil } - return r.Parameters + return r.RuleType } // GetConditions returns the Conditions field. -func (r *RepositoryRulesetEditedChanges) GetConditions() *RepositoryRulesetEditedConditions { +func (r *RepositoryRulesetChanges) GetConditions() *RepositoryRulesetChangedConditions { if r == nil { return nil } @@ -21127,7 +24719,7 @@ func (r *RepositoryRulesetEditedChanges) GetConditions() *RepositoryRulesetEdite } // GetEnforcement returns the Enforcement field. -func (r *RepositoryRulesetEditedChanges) GetEnforcement() *RepositoryRulesetEditedSource { +func (r *RepositoryRulesetChanges) GetEnforcement() *RepositoryRulesetChangeSource { if r == nil { return nil } @@ -21135,7 +24727,7 @@ func (r *RepositoryRulesetEditedChanges) GetEnforcement() *RepositoryRulesetEdit } // GetName returns the Name field. -func (r *RepositoryRulesetEditedChanges) GetName() *RepositoryRulesetEditedSource { +func (r *RepositoryRulesetChanges) GetName() *RepositoryRulesetChangeSource { if r == nil { return nil } @@ -21143,59 +24735,75 @@ func (r *RepositoryRulesetEditedChanges) GetName() *RepositoryRulesetEditedSourc } // GetRules returns the Rules field. -func (r *RepositoryRulesetEditedChanges) GetRules() *RepositoryRulesetEditedRules { +func (r *RepositoryRulesetChanges) GetRules() *RepositoryRulesetChangedRules { if r == nil { return nil } return r.Rules } -// GetConfiguration returns the Configuration field. -func (r *RepositoryRulesetEditedRuleChanges) GetConfiguration() *RepositoryRulesetEditedSources { +// 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 *r.From +} + +// GetOrganizationID returns the OrganizationID field. +func (r *RepositoryRulesetConditions) GetOrganizationID() *RepositoryRulesetOrganizationIDsConditionParameters { if r == nil { return nil } - return r.Configuration + return r.OrganizationID } -// GetPattern returns the Pattern field. -func (r *RepositoryRulesetEditedRuleChanges) GetPattern() *RepositoryRulesetEditedSources { +// GetOrganizationName returns the OrganizationName field. +func (r *RepositoryRulesetConditions) GetOrganizationName() *RepositoryRulesetOrganizationNamesConditionParameters { if r == nil { return nil } - return r.Pattern + return r.OrganizationName } -// GetRuleType returns the RuleType field. -func (r *RepositoryRulesetEditedRuleChanges) GetRuleType() *RepositoryRulesetEditedSources { +// GetOrganizationProperty returns the OrganizationProperty field. +func (r *RepositoryRulesetConditions) GetOrganizationProperty() *RepositoryRulesetOrganizationPropertyConditionParameters { if r == nil { return nil } - return r.RuleType + return r.OrganizationProperty } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RepositoryRulesetEditedSource) GetFrom() string { - if r == nil || r.From == nil { - return "" +// GetRefName returns the RefName field. +func (r *RepositoryRulesetConditions) GetRefName() *RepositoryRulesetRefConditionParameters { + if r == nil { + return nil } - return *r.From + return r.RefName } -// GetChanges returns the Changes field. -func (r *RepositoryRulesetEditedUpdatedConditions) GetChanges() *RepositoryRulesetUpdatedConditionsEdited { +// GetRepositoryID returns the RepositoryID field. +func (r *RepositoryRulesetConditions) GetRepositoryID() *RepositoryRulesetRepositoryIDsConditionParameters { if r == nil { return nil } - return r.Changes + return r.RepositoryID } -// GetCondition returns the Condition field. -func (r *RepositoryRulesetEditedUpdatedConditions) GetCondition() *RepositoryRulesetRefCondition { +// GetRepositoryName returns the RepositoryName field. +func (r *RepositoryRulesetConditions) GetRepositoryName() *RepositoryRulesetRepositoryNamesConditionParameters { if r == nil { return nil } - return r.Condition + return r.RepositoryName +} + +// GetRepositoryProperty returns the RepositoryProperty field. +func (r *RepositoryRulesetConditions) GetRepositoryProperty() *RepositoryRulesetRepositoryPropertyConditionParameters { + if r == nil { + return nil + } + return r.RepositoryProperty } // GetAction returns the Action field if it's non-nil, zero value otherwise. @@ -21207,7 +24815,7 @@ func (r *RepositoryRulesetEvent) GetAction() string { } // GetChanges returns the Changes field. -func (r *RepositoryRulesetEvent) GetChanges() *RepositoryRulesetEditedChanges { +func (r *RepositoryRulesetEvent) GetChanges() *RepositoryRulesetChanges { if r == nil { return nil } @@ -21262,24 +24870,16 @@ func (r *RepositoryRulesetEvent) GetSender() *User { return r.Sender } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetFileExtensionRestrictionRule) GetParameters() *RuleFileExtensionRestrictionParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetFilePathRestrictionRule) GetParameters() *RuleFileParameters { - if r == nil { - return 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 r.Parameters + return *r.HRef } // GetHTML returns the HTML field. -func (r *RepositoryRulesetLink) GetHTML() *RulesetLink { +func (r *RepositoryRulesetLinks) GetHTML() *RepositoryRulesetLink { if r == nil { return nil } @@ -21287,79 +24887,31 @@ func (r *RepositoryRulesetLink) GetHTML() *RulesetLink { } // GetSelf returns the Self field. -func (r *RepositoryRulesetLink) GetSelf() *RulesetLink { +func (r *RepositoryRulesetLinks) GetSelf() *RepositoryRulesetLink { if r == nil { return nil } return r.Self } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetMaxFilePathLengthRule) GetParameters() *RuleMaxFilePathLengthParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetMaxFileSizeRule) GetParameters() *RuleMaxFileSizeParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetMergeQueueRule) GetParameters() *MergeQueueRuleParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetPatternRule) GetParameters() *RulePatternParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetPullRequestRule) GetParameters() *PullRequestRuleParameters { - if r == nil { - return nil - } - return r.Parameters -} - -// GetRefName returns the RefName field. -func (r *RepositoryRulesetRefCondition) GetRefName() *RulesetRefConditionParameters { - if r == nil { - return nil - } - return r.RefName -} - -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetRequiredDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { - if r == nil { - return nil +// 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 r.Parameters + return *r.Protected } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetRequiredStatusChecksRule) GetParameters() *RequiredStatusChecksRuleParameters { - if r == nil { - return 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 r.Parameters + return *r.Source } // GetBranchNamePattern returns the BranchNamePattern field. -func (r *RepositoryRulesetRule) GetBranchNamePattern() *RepositoryRulesetPatternRule { +func (r *RepositoryRulesetRules) GetBranchNamePattern() *PatternRuleParameters { if r == nil { return nil } @@ -21367,7 +24919,7 @@ func (r *RepositoryRulesetRule) GetBranchNamePattern() *RepositoryRulesetPattern } // GetCodeScanning returns the CodeScanning field. -func (r *RepositoryRulesetRule) GetCodeScanning() *RepositoryRulesetCodeScanningRule { +func (r *RepositoryRulesetRules) GetCodeScanning() *CodeScanningRuleParameters { if r == nil { return nil } @@ -21375,7 +24927,7 @@ func (r *RepositoryRulesetRule) GetCodeScanning() *RepositoryRulesetCodeScanning } // GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern field. -func (r *RepositoryRulesetRule) GetCommitAuthorEmailPattern() *RepositoryRulesetPatternRule { +func (r *RepositoryRulesetRules) GetCommitAuthorEmailPattern() *PatternRuleParameters { if r == nil { return nil } @@ -21383,7 +24935,7 @@ func (r *RepositoryRulesetRule) GetCommitAuthorEmailPattern() *RepositoryRuleset } // GetCommitMessagePattern returns the CommitMessagePattern field. -func (r *RepositoryRulesetRule) GetCommitMessagePattern() *RepositoryRulesetPatternRule { +func (r *RepositoryRulesetRules) GetCommitMessagePattern() *PatternRuleParameters { if r == nil { return nil } @@ -21391,7 +24943,7 @@ func (r *RepositoryRulesetRule) GetCommitMessagePattern() *RepositoryRulesetPatt } // GetCommitterEmailPattern returns the CommitterEmailPattern field. -func (r *RepositoryRulesetRule) GetCommitterEmailPattern() *RepositoryRulesetPatternRule { +func (r *RepositoryRulesetRules) GetCommitterEmailPattern() *PatternRuleParameters { if r == nil { return nil } @@ -21399,7 +24951,7 @@ func (r *RepositoryRulesetRule) GetCommitterEmailPattern() *RepositoryRulesetPat } // GetCreation returns the Creation field. -func (r *RepositoryRulesetRule) GetCreation() *RepositoryRulesetRuleType { +func (r *RepositoryRulesetRules) GetCreation() *EmptyRuleParameters { if r == nil { return nil } @@ -21407,7 +24959,7 @@ func (r *RepositoryRulesetRule) GetCreation() *RepositoryRulesetRuleType { } // GetDeletion returns the Deletion field. -func (r *RepositoryRulesetRule) GetDeletion() *RepositoryRulesetRuleType { +func (r *RepositoryRulesetRules) GetDeletion() *EmptyRuleParameters { if r == nil { return nil } @@ -21415,7 +24967,7 @@ func (r *RepositoryRulesetRule) GetDeletion() *RepositoryRulesetRuleType { } // GetFileExtensionRestriction returns the FileExtensionRestriction field. -func (r *RepositoryRulesetRule) GetFileExtensionRestriction() *RepositoryRulesetFileExtensionRestrictionRule { +func (r *RepositoryRulesetRules) GetFileExtensionRestriction() *FileExtensionRestrictionRuleParameters { if r == nil { return nil } @@ -21423,7 +24975,7 @@ func (r *RepositoryRulesetRule) GetFileExtensionRestriction() *RepositoryRuleset } // GetFilePathRestriction returns the FilePathRestriction field. -func (r *RepositoryRulesetRule) GetFilePathRestriction() *RepositoryRulesetFilePathRestrictionRule { +func (r *RepositoryRulesetRules) GetFilePathRestriction() *FilePathRestrictionRuleParameters { if r == nil { return nil } @@ -21431,7 +24983,7 @@ func (r *RepositoryRulesetRule) GetFilePathRestriction() *RepositoryRulesetFileP } // GetMaxFilePathLength returns the MaxFilePathLength field. -func (r *RepositoryRulesetRule) GetMaxFilePathLength() *RepositoryRulesetMaxFilePathLengthRule { +func (r *RepositoryRulesetRules) GetMaxFilePathLength() *MaxFilePathLengthRuleParameters { if r == nil { return nil } @@ -21439,7 +24991,7 @@ func (r *RepositoryRulesetRule) GetMaxFilePathLength() *RepositoryRulesetMaxFile } // GetMaxFileSize returns the MaxFileSize field. -func (r *RepositoryRulesetRule) GetMaxFileSize() *RepositoryRulesetMaxFileSizeRule { +func (r *RepositoryRulesetRules) GetMaxFileSize() *MaxFileSizeRuleParameters { if r == nil { return nil } @@ -21447,7 +24999,7 @@ func (r *RepositoryRulesetRule) GetMaxFileSize() *RepositoryRulesetMaxFileSizeRu } // GetMergeQueue returns the MergeQueue field. -func (r *RepositoryRulesetRule) GetMergeQueue() *RepositoryRulesetMergeQueueRule { +func (r *RepositoryRulesetRules) GetMergeQueue() *MergeQueueRuleParameters { if r == nil { return nil } @@ -21455,7 +25007,7 @@ func (r *RepositoryRulesetRule) GetMergeQueue() *RepositoryRulesetMergeQueueRule } // GetNonFastForward returns the NonFastForward field. -func (r *RepositoryRulesetRule) GetNonFastForward() *RepositoryRulesetRuleType { +func (r *RepositoryRulesetRules) GetNonFastForward() *EmptyRuleParameters { if r == nil { return nil } @@ -21463,7 +25015,7 @@ func (r *RepositoryRulesetRule) GetNonFastForward() *RepositoryRulesetRuleType { } // GetPullRequest returns the PullRequest field. -func (r *RepositoryRulesetRule) GetPullRequest() *RepositoryRulesetPullRequestRule { +func (r *RepositoryRulesetRules) GetPullRequest() *PullRequestRuleParameters { if r == nil { return nil } @@ -21471,7 +25023,7 @@ func (r *RepositoryRulesetRule) GetPullRequest() *RepositoryRulesetPullRequestRu } // GetRequiredDeployments returns the RequiredDeployments field. -func (r *RepositoryRulesetRule) GetRequiredDeployments() *RepositoryRulesetRequiredDeploymentsRule { +func (r *RepositoryRulesetRules) GetRequiredDeployments() *RequiredDeploymentsRuleParameters { if r == nil { return nil } @@ -21479,7 +25031,7 @@ func (r *RepositoryRulesetRule) GetRequiredDeployments() *RepositoryRulesetRequi } // GetRequiredLinearHistory returns the RequiredLinearHistory field. -func (r *RepositoryRulesetRule) GetRequiredLinearHistory() *RepositoryRulesetRuleType { +func (r *RepositoryRulesetRules) GetRequiredLinearHistory() *EmptyRuleParameters { if r == nil { return nil } @@ -21487,7 +25039,7 @@ func (r *RepositoryRulesetRule) GetRequiredLinearHistory() *RepositoryRulesetRul } // GetRequiredSignatures returns the RequiredSignatures field. -func (r *RepositoryRulesetRule) GetRequiredSignatures() *RepositoryRulesetRuleType { +func (r *RepositoryRulesetRules) GetRequiredSignatures() *EmptyRuleParameters { if r == nil { return nil } @@ -21495,7 +25047,7 @@ func (r *RepositoryRulesetRule) GetRequiredSignatures() *RepositoryRulesetRuleTy } // GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (r *RepositoryRulesetRule) GetRequiredStatusChecks() *RepositoryRulesetRequiredStatusChecksRule { +func (r *RepositoryRulesetRules) GetRequiredStatusChecks() *RequiredStatusChecksRuleParameters { if r == nil { return nil } @@ -21503,7 +25055,7 @@ func (r *RepositoryRulesetRule) GetRequiredStatusChecks() *RepositoryRulesetRequ } // GetTagNamePattern returns the TagNamePattern field. -func (r *RepositoryRulesetRule) GetTagNamePattern() *RepositoryRulesetPatternRule { +func (r *RepositoryRulesetRules) GetTagNamePattern() *PatternRuleParameters { if r == nil { return nil } @@ -21511,7 +25063,7 @@ func (r *RepositoryRulesetRule) GetTagNamePattern() *RepositoryRulesetPatternRul } // GetUpdate returns the Update field. -func (r *RepositoryRulesetRule) GetUpdate() *RepositoryRulesetUpdateRule { +func (r *RepositoryRulesetRules) GetUpdate() *UpdateRuleParameters { if r == nil { return nil } @@ -21519,7 +25071,7 @@ func (r *RepositoryRulesetRule) GetUpdate() *RepositoryRulesetUpdateRule { } // GetWorkflows returns the Workflows field. -func (r *RepositoryRulesetRule) GetWorkflows() *RepositoryRulesetWorkflowsRule { +func (r *RepositoryRulesetRules) GetWorkflows() *WorkflowsRuleParameters { if r == nil { return nil } @@ -21527,7 +25079,7 @@ func (r *RepositoryRulesetRule) GetWorkflows() *RepositoryRulesetWorkflowsRule { } // GetConditionType returns the ConditionType field. -func (r *RepositoryRulesetUpdatedConditionsEdited) GetConditionType() *RepositoryRulesetEditedSource { +func (r *RepositoryRulesetUpdatedCondition) GetConditionType() *RepositoryRulesetChangeSource { if r == nil { return nil } @@ -21535,7 +25087,7 @@ func (r *RepositoryRulesetUpdatedConditionsEdited) GetConditionType() *Repositor } // GetExclude returns the Exclude field. -func (r *RepositoryRulesetUpdatedConditionsEdited) GetExclude() *RepositoryRulesetEditedSources { +func (r *RepositoryRulesetUpdatedCondition) GetExclude() *RepositoryRulesetChangeSources { if r == nil { return nil } @@ -21543,7 +25095,7 @@ func (r *RepositoryRulesetUpdatedConditionsEdited) GetExclude() *RepositoryRules } // GetInclude returns the Include field. -func (r *RepositoryRulesetUpdatedConditionsEdited) GetInclude() *RepositoryRulesetEditedSources { +func (r *RepositoryRulesetUpdatedCondition) GetInclude() *RepositoryRulesetChangeSources { if r == nil { return nil } @@ -21551,7 +25103,7 @@ func (r *RepositoryRulesetUpdatedConditionsEdited) GetInclude() *RepositoryRules } // GetTarget returns the Target field. -func (r *RepositoryRulesetUpdatedConditionsEdited) GetTarget() *RepositoryRulesetEditedSource { +func (r *RepositoryRulesetUpdatedCondition) GetTarget() *RepositoryRulesetChangeSource { if r == nil { return nil } @@ -21559,35 +25111,35 @@ func (r *RepositoryRulesetUpdatedConditionsEdited) GetTarget() *RepositoryRulese } // GetChanges returns the Changes field. -func (r *RepositoryRulesetUpdatedRules) GetChanges() *RepositoryRulesetEditedRuleChanges { +func (r *RepositoryRulesetUpdatedConditions) GetChanges() *RepositoryRulesetUpdatedCondition { if r == nil { return nil } return r.Changes } -// GetRule returns the Rule field. -func (r *RepositoryRulesetUpdatedRules) GetRule() *RepositoryRulesetRule { +// GetCondition returns the Condition field. +func (r *RepositoryRulesetUpdatedConditions) GetCondition() *RepositoryRulesetConditions { if r == nil { return nil } - return r.Rule + return r.Condition } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetUpdateRule) GetParameters() *UpdateAllowsFetchAndMergeRuleParameters { +// GetChanges returns the Changes field. +func (r *RepositoryRulesetUpdatedRules) GetChanges() *RepositoryRulesetChangedRule { if r == nil { return nil } - return r.Parameters + return r.Changes } -// GetParameters returns the Parameters field. -func (r *RepositoryRulesetWorkflowsRule) GetParameters() *RequiredWorkflowsRuleParameters { +// GetRule returns the Rule field. +func (r *RepositoryRulesetUpdatedRules) GetRule() *RepositoryRule { if r == nil { return nil } - return r.Parameters + return r.Rule } // GetCommit returns the Commit field. @@ -21998,12 +25550,12 @@ func (r *RequiredStatusChecksRuleParameters) GetDoNotEnforceOnCreate() bool { return *r.DoNotEnforceOnCreate } -// 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 +// 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 *r.TotalCount + return *r.From } // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. @@ -22078,188 +25630,68 @@ func (r *Rule) GetSeverity() string { return *r.Severity } -// GetRestrictedFilePaths returns the RestrictedFilePaths field if it's non-nil, zero value otherwise. -func (r *RuleFileParameters) GetRestrictedFilePaths() []string { - if r == nil || r.RestrictedFilePaths == nil { - return nil - } - return *r.RestrictedFilePaths -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (r *RulePatternParameters) GetName() string { - if r == nil || r.Name == nil { - return "" - } - return *r.Name -} - -// GetNegate returns the Negate field if it's non-nil, zero value otherwise. -func (r *RulePatternParameters) GetNegate() bool { - if r == nil || r.Negate == nil { - return false - } - return *r.Negate -} - -// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. -func (r *RuleRequiredStatusChecks) GetIntegrationID() int64 { - if r == nil || r.IntegrationID == nil { - return 0 - } - return *r.IntegrationID -} - -// GetRef returns the Ref field if it's non-nil, zero value otherwise. -func (r *RuleRequiredWorkflow) GetRef() string { - if r == nil || r.Ref == nil { - return "" - } - return *r.Ref -} - -// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. -func (r *RuleRequiredWorkflow) GetRepositoryID() int64 { - if r == nil || r.RepositoryID == 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.RepositoryID -} - -// GetSha returns the Sha field if it's non-nil, zero value otherwise. -func (r *RuleRequiredWorkflow) GetSha() string { - if r == nil || r.Sha == nil { - return "" - } - return *r.Sha + return *r.MinimumApprovals } -// GetConditions returns the Conditions field. -func (r *Ruleset) GetConditions() *RulesetConditions { +// GetReviewer returns the Reviewer field. +func (r *RulesetRequiredReviewer) GetReviewer() *RulesetReviewer { if r == nil { return nil } - return r.Conditions -} - -// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetCreatedAt() Timestamp { - if r == nil || r.CreatedAt == nil { - return Timestamp{} - } - return *r.CreatedAt + return r.Reviewer } // GetID returns the ID field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetID() int64 { +func (r *RulesetReviewer) GetID() int64 { if r == nil || r.ID == nil { return 0 } return *r.ID } -// GetLinks returns the Links field. -func (r *Ruleset) GetLinks() *RulesetLinks { - if r == nil { - return nil - } - return r.Links -} - -// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetNodeID() string { - if r == nil || r.NodeID == nil { - return "" - } - return *r.NodeID -} - -// GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetSourceType() string { - if r == nil || r.SourceType == nil { - return "" - } - return *r.SourceType -} - -// GetTarget returns the Target field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetTarget() string { - if r == nil || r.Target == nil { - return "" - } - return *r.Target -} - -// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *Ruleset) GetUpdatedAt() Timestamp { - if r == nil || r.UpdatedAt == nil { - return Timestamp{} - } - return *r.UpdatedAt -} - -// GetRefName returns the RefName field. -func (r *RulesetConditions) GetRefName() *RulesetRefConditionParameters { - if r == nil { - return nil - } - return r.RefName -} - -// GetRepositoryID returns the RepositoryID field. -func (r *RulesetConditions) GetRepositoryID() *RulesetRepositoryIDsConditionParameters { - if r == nil { - return nil - } - return r.RepositoryID -} - -// GetRepositoryName returns the RepositoryName field. -func (r *RulesetConditions) GetRepositoryName() *RulesetRepositoryNamesConditionParameters { - if r == nil { - return nil - } - return r.RepositoryName -} - -// GetRepositoryProperty returns the RepositoryProperty field. -func (r *RulesetConditions) GetRepositoryProperty() *RulesetRepositoryPropertyConditionParameters { +// GetType returns the Type field. +func (r *RulesetReviewer) GetType() *RulesetReviewerType { if r == nil { return nil } - return r.RepositoryProperty + return r.Type } -// GetHRef returns the HRef field if it's non-nil, zero value otherwise. -func (r *RulesetLink) GetHRef() string { - if r == nil || r.HRef == nil { - return "" +// 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.HRef + return *r.IntegrationID } -// GetSelf returns the Self field. -func (r *RulesetLinks) GetSelf() *RulesetLink { - if r == nil { - return 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.Self + return *r.Ref } -// GetProtected returns the Protected field if it's non-nil, zero value otherwise. -func (r *RulesetRepositoryNamesConditionParameters) GetProtected() bool { - if r == nil || r.Protected == nil { - return false +// 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.Protected + return *r.RepositoryID } -// GetSource returns the Source field if it's non-nil, zero value otherwise. -func (r *RulesetRepositoryPropertyTargetParameters) GetSource() string { - if r == nil || r.Source == 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.Source + return *r.SHA } // GetBusy returns the Busy field if it's non-nil, zero value otherwise. @@ -22366,6 +25798,14 @@ func (r *RunnerGroup) GetDefault() bool { return *r.Default } +// GetHostedRunnersURL returns the HostedRunnersURL field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetHostedRunnersURL() string { + if r == nil || r.HostedRunnersURL == nil { + return "" + } + return *r.HostedRunnersURL +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetID() int64 { if r == nil || r.ID == nil { @@ -22390,6 +25830,14 @@ func (r *RunnerGroup) GetName() string { return *r.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (r *RunnerGroup) GetNetworkConfigurationID() string { + if r == nil || r.NetworkConfigurationID == nil { + return "" + } + return *r.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (r *RunnerGroup) GetRestrictedToWorkflows() bool { if r == nil || r.RestrictedToWorkflows == nil { @@ -22710,6 +26158,94 @@ func (s *ScanningAnalysis) GetWarning() string { return *s.Warning } +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseDisplayReference) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetDisplayName() string { + if s == nil || s.DisplayName == nil { + return "" + } + return *s.DisplayName +} + +// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetExternalID() string { + if s == nil || s.ExternalID == nil { + return "" + } + return *s.ExternalID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroupAttributes) GetID() string { + if s == nil || s.ID == nil { + return "" + } + return *s.ID +} + +// GetMeta returns the Meta field. +func (s *SCIMEnterpriseGroupAttributes) GetMeta() *SCIMEnterpriseMeta { + if s == nil { + return nil + } + return s.Meta +} + +// GetItemsPerPage returns the ItemsPerPage field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetItemsPerPage() int { + if s == nil || s.ItemsPerPage == nil { + return 0 + } + return *s.ItemsPerPage +} + +// GetStartIndex returns the StartIndex field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetStartIndex() int { + if s == nil || s.StartIndex == nil { + return 0 + } + return *s.StartIndex +} + +// GetTotalResults returns the TotalResults field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseGroups) GetTotalResults() int { + if s == nil || s.TotalResults == nil { + return 0 + } + return *s.TotalResults +} + +// GetCreated returns the Created field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetCreated() Timestamp { + if s == nil || s.Created == nil { + return Timestamp{} + } + return *s.Created +} + +// GetLastModified returns the LastModified field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetLastModified() Timestamp { + if s == nil || s.LastModified == nil { + return Timestamp{} + } + return *s.LastModified +} + +// GetLocation returns the Location field if it's non-nil, zero value otherwise. +func (s *SCIMEnterpriseMeta) GetLocation() string { + if s == nil || s.Location == nil { + return "" + } + return *s.Location +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (s *SCIMMeta) GetCreated() Timestamp { if s == nil || s.Created == nil { @@ -22830,6 +26366,30 @@ func (s *SCIMUserName) GetFormatted() string { return *s.Formatted } +// GetDisplay returns the Display field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetDisplay() string { + if s == nil || s.Display == nil { + return "" + } + return *s.Display +} + +// GetPrimary returns the Primary field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetPrimary() bool { + if s == nil || s.Primary == nil { + return false + } + return *s.Primary +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (s *SCIMUserRole) GetType() string { + if s == nil || s.Type == nil { + return "" + } + return *s.Type +} + // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanning) GetStatus() string { if s == nil || s.Status == nil { @@ -22846,6 +26406,22 @@ func (s *SecretScanningAlert) GetCreatedAt() Timestamp { return *s.CreatedAt } +// GetFirstLocationDetected returns the FirstLocationDetected field. +func (s *SecretScanningAlert) GetFirstLocationDetected() *SecretScanningAlertLocationDetails { + if s == nil { + return nil + } + return s.FirstLocationDetected +} + +// 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 *s.HasMoreLocations +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetHTMLURL() string { if s == nil || s.HTMLURL == nil { @@ -22854,6 +26430,14 @@ func (s *SecretScanningAlert) GetHTMLURL() string { return *s.HTMLURL } +// 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 *s.IsBase64Encoded +} + // GetLocationsURL returns the LocationsURL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetLocationsURL() string { if s == nil || s.LocationsURL == nil { @@ -22862,6 +26446,14 @@ func (s *SecretScanningAlert) GetLocationsURL() string { return *s.LocationsURL } +// 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 *s.MultiRepo +} + // GetNumber returns the Number field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetNumber() int { if s == nil || s.Number == nil { @@ -22870,6 +26462,14 @@ func (s *SecretScanningAlert) GetNumber() int { return *s.Number } +// 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 *s.PubliclyLeaked +} + // GetPushProtectionBypassed returns the PushProtectionBypassed field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetPushProtectionBypassed() bool { if s == nil || s.PushProtectionBypassed == nil { @@ -22894,6 +26494,38 @@ func (s *SecretScanningAlert) GetPushProtectionBypassedBy() *User { return s.PushProtectionBypassedBy } +// 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 *s.PushProtectionBypassRequestComment +} + +// 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 *s.PushProtectionBypassRequestHTMLURL +} + +// GetPushProtectionBypassRequestReviewer returns the PushProtectionBypassRequestReviewer field. +func (s *SecretScanningAlert) GetPushProtectionBypassRequestReviewer() *User { + if s == nil { + return nil + } + return s.PushProtectionBypassRequestReviewer +} + +// 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 *s.PushProtectionBypassRequestReviewerComment +} + // GetRepository returns the Repository field. func (s *SecretScanningAlert) GetRepository() *Repository { if s == nil { @@ -22982,6 +26614,14 @@ func (s *SecretScanningAlert) GetURL() string { return *s.URL } +// 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 *s.Validity +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (s *SecretScanningAlertEvent) GetAction() string { if s == nil || s.Action == nil { @@ -23179,23 +26819,159 @@ func (s *SecretScanningAlertLocationEvent) GetRepo() *Repository { if s == nil { return nil } - return s.Repo + return s.Repo +} + +// GetSender returns the Sender field. +func (s *SecretScanningAlertLocationEvent) GetSender() *User { + if s == nil { + return nil + } + return s.Sender +} + +// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlertUpdateOptions) GetResolution() string { + if s == nil || s.Resolution == nil { + return "" + } + return *s.Resolution +} + +// 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 "" + } + return *s.ResolutionComment +} + +// 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 *s.CustomPatternVersion +} + +// 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 *s.PatternConfigVersion +} + +// 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 *s.PatternConfigVersion +} + +// GetPatternConfigVersion returns the PatternConfigVersion field if it's non-nil, zero value otherwise. +func (s *SecretScanningPatternConfigsUpdateOptions) GetPatternConfigVersion() string { + if s == nil || s.PatternConfigVersion == nil { + return "" + } + return *s.PatternConfigVersion +} + +// 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 *s.AlertTotal +} + +// 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 *s.AlertTotalPercentage +} + +// 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 *s.Bypassrate +} + +// 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 *s.CustomPatternVersion +} + +// 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 *s.DefaultSetting +} + +// 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 *s.DisplayName +} + +// 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 *s.EnterpriseSetting +} + +// 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 *s.FalsePositiveRate +} + +// 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 *s.Setting } -// GetSender returns the Sender field. -func (s *SecretScanningAlertLocationEvent) GetSender() *User { - if s == nil { - return 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 s.Sender + return *s.Slug } -// GetResolution returns the Resolution field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertUpdateOptions) GetResolution() string { - if s == nil || s.Resolution == 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 *s.Resolution + return *s.TokenType } // GetStatus returns the Status field if it's non-nil, zero value otherwise. @@ -23214,6 +26990,22 @@ func (s *SecretScanningValidityChecks) GetStatus() string { return *s.Status } +// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetCompletedAt() Timestamp { + if s == nil || s.CompletedAt == nil { + return Timestamp{} + } + return *s.CompletedAt +} + +// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. +func (s *SecretsScan) GetStartedAt() Timestamp { + if s == nil || s.StartedAt == nil { + return Timestamp{} + } + return *s.StartedAt +} + // GetAuthor returns the Author field. func (s *SecurityAdvisory) GetAuthor() *User { if s == nil { @@ -23534,6 +27326,70 @@ func (s *SelectedReposList) GetTotalCount() int { return *s.TotalCount } +// 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 *s.EnabledRepositories +} + +// 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 *s.SelectedRepositoriesURL +} + +// GetEnabledRepositories returns the EnabledRepositories field if it's non-nil, zero value otherwise. +func (s *SelfHostedRunnersSettingsOrganizationOpt) GetEnabledRepositories() string { + if s == nil || s.EnabledRepositories == nil { + return "" + } + return *s.EnabledRepositories +} + +// GetDisableSelfHostedRunnersForAllOrgs returns the DisableSelfHostedRunnersForAllOrgs field if it's non-nil, zero value otherwise. +func (s *SelfHostRunnerPermissionsEnterprise) GetDisableSelfHostedRunnersForAllOrgs() bool { + if s == nil || s.DisableSelfHostedRunnersForAllOrgs == nil { + return false + } + return *s.DisableSelfHostedRunnersForAllOrgs +} + +// GetServerInstances returns the ServerInstances field. +func (s *ServerInstanceProperties) GetServerInstances() *ServerInstances { + if s == nil { + return nil + } + return s.ServerInstances +} + +// GetItems returns the Items field. +func (s *ServerInstances) GetItems() *ServiceInstanceItems { + if s == nil { + return nil + } + return s.Items +} + +// GetLastSync returns the LastSync field. +func (s *ServerItemProperties) GetLastSync() *LastLicenseSync { + if s == nil { + return nil + } + return s.LastSync +} + +// GetProperties returns the Properties field. +func (s *ServiceInstanceItems) GetProperties() *ServerItemProperties { + if s == nil { + return nil + } + return s.Properties +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { if s == nil || s.From == nil { @@ -23590,6 +27446,22 @@ func (s *SignatureVerification) GetVerified() bool { return *s.Verified } +// 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 *s.Provider +} + +// 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 *s.URL +} + // GetActor returns the Actor field. func (s *Source) GetActor() *User { if s == nil { @@ -23766,6 +27638,38 @@ func (s *SponsorshipTier) GetFrom() string { return *s.From } +// 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 *s.Hostname +} + +// 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 *s.Message +} + +// 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 *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 { @@ -23990,6 +27894,30 @@ func (s *StatusEvent) GetUpdatedAt() Timestamp { return *s.UpdatedAt } +// 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 *s.AfterID +} + +// 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 *s.BeforeID +} + +// 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 *s.ReplaceParent +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (s *Subscription) GetCreatedAt() Timestamp { if s == nil || s.CreatedAt == nil { @@ -24046,6 +27974,46 @@ func (s *Subscription) GetURL() string { return *s.URL } +// 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.Status +} + +// 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.Hostname +} + +// 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.Status +} + +// 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.Role +} + +// 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.Status +} + // GetMessage returns the Message field if it's non-nil, zero value otherwise. func (t *Tag) GetMessage() string { if t == nil || t.Message == nil { @@ -24174,6 +28142,14 @@ func (t *TaskStep) GetStatus() string { return *t.Status } +// 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 *t.Assignment +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (t *Team) GetDescription() string { if t == nil || t.Description == nil { @@ -24238,6 +28214,14 @@ func (t *Team) GetNodeID() string { return *t.NodeID } +// 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 *t.NotificationSetting +} + // GetOrganization returns the Organization field. func (t *Team) GetOrganization() *Organization { if t == nil { @@ -24926,14 +28910,6 @@ func (t *Timeline) GetPerformedViaGithubApp() *App { return t.PerformedViaGithubApp } -// GetProjectCard returns the ProjectCard field. -func (t *Timeline) GetProjectCard() *ProjectCard { - if t == nil { - return nil - } - return t.ProjectCard -} - // GetRename returns the Rename field. func (t *Timeline) GetRename() *Rename { if t == nil { @@ -25438,6 +29414,70 @@ func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { return *u.Visibility } +// GetEncryptedValue returns the EncryptedValue field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetEncryptedValue() string { + if u == nil || u.EncryptedValue == nil { + return "" + } + return *u.EncryptedValue +} + +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetKeyID() string { + if u == nil || u.KeyID == nil { + return "" + } + return *u.KeyID +} + +// GetRegistryType returns the RegistryType field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetRegistryType() string { + if u == nil || u.RegistryType == nil { + return "" + } + return *u.RegistryType +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetURL() string { + if u == nil || u.URL == nil { + return "" + } + return *u.URL +} + +// GetUsername returns the Username field if it's non-nil, zero value otherwise. +func (u *UpdateOrganizationPrivateRegistry) GetUsername() string { + if u == nil || u.Username == nil { + return "" + } + return *u.Username +} + +// GetVisibility returns the Visibility field. +func (u *UpdateOrganizationPrivateRegistry) GetVisibility() *PrivateRegistryVisibility { + if u == nil { + return nil + } + return u.Visibility +} + +// GetArchived returns the Archived field if it's non-nil, zero value otherwise. +func (u *UpdateProjectItemOptions) GetArchived() bool { + if u == nil || u.Archived == nil { + return false + } + return *u.Archived +} + +// GetForce returns the Force field if it's non-nil, zero value otherwise. +func (u *UpdateRef) GetForce() bool { + if u == nil || u.Force == nil { + return false + } + return *u.Force +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { if u == nil || u.AllowsPublicRepositories == nil { @@ -25454,6 +29494,14 @@ func (u *UpdateRunnerGroupRequest) GetName() string { return *u.Name } +// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise. +func (u *UpdateRunnerGroupRequest) GetNetworkConfigurationID() string { + if u == nil || u.NetworkConfigurationID == nil { + return "" + } + return *u.NetworkConfigurationID +} + // GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetRestrictedToWorkflows() bool { if u == nil || u.RestrictedToWorkflows == nil { @@ -25470,6 +29518,62 @@ func (u *UpdateRunnerGroupRequest) GetVisibility() string { return *u.Visibility } +// GetOrganizationName returns the OrganizationName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetOrganizationName() string { + if u == nil || u.OrganizationName == nil { + return "" + } + return *u.OrganizationName +} + +// GetRepositoryName returns the RepositoryName field if it's non-nil, zero value otherwise. +func (u *UsageItem) GetRepositoryName() string { + if u == nil || u.RepositoryName == nil { + return "" + } + return *u.RepositoryName +} + +// 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 *u.Day +} + +// 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 *u.Hour +} + +// 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 *u.Month +} + +// 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 *u.Year +} + +// GetAssignment returns the Assignment field if it's non-nil, zero value otherwise. +func (u *User) GetAssignment() string { + if u == nil || u.Assignment == nil { + return "" + } + return *u.Assignment +} + // GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise. func (u *User) GetAvatarURL() string { if u == nil || u.AvatarURL == nil { @@ -27158,6 +31262,70 @@ func (w *Workflows) GetTotalCount() int { return *w.TotalCount } +// 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 +} + +// 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 { + return false + } + return *w.DoNotEnforceOnCreate +} + // GetBillable returns the Billable field. func (w *WorkflowUsage) GetBillable() *WorkflowBillMap { if w == nil { diff --git a/vendor/github.com/google/go-github/v67/github/github.go b/vendor/github.com/google/go-github/v79/github/github.go similarity index 79% rename from vendor/github.com/google/go-github/v67/github/github.go rename to vendor/github.com/google/go-github/v79/github/github.go index 6f47635347..8e7d58ae67 100644 --- a/vendor/github.com/google/go-github/v67/github/github.go +++ b/vendor/github.com/google/go-github/v79/github/github.go @@ -19,6 +19,7 @@ import ( "net/http" "net/url" "reflect" + "regexp" "strconv" "strings" "sync" @@ -28,21 +29,23 @@ import ( ) const ( - Version = "v67.0.0" + Version = "v79.0.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" - headerRateReset = "X-RateLimit-Reset" - headerOTP = "X-GitHub-OTP" + 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" - headerTokenExpiration = "GitHub-Authentication-Token-Expiration" + headerTokenExpiration = "Github-Authentication-Token-Expiration" mediaTypeV3 = "application/vnd.github.v3+json" defaultMediaType = "application/octet-stream" @@ -51,8 +54,9 @@ 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" - // 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). @@ -67,10 +71,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" @@ -155,8 +156,9 @@ var errNonNilContext = errors.New("context must be non-nil") // 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. + 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. // 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 @@ -169,10 +171,22 @@ type Client struct { // User agent used when communicating with the GitHub API. 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. secondaryRateLimitReset time.Time // Secondary rate limit reset for the client as determined by the most recent API calls. + // If specified, Client will block requests for at most this duration in case of reaching a secondary + // rate limit + MaxSecondaryRateLimitRetryAfterDuration time.Duration + + // Whether to respect rate limit headers on endpoints that return 302 redirections to artifacts + RateLimitRedirectionalEndpoints bool + common service // Reuse a single struct instead of allocating one for each service on the heap. // Services used for talking to different parts of the GitHub API. @@ -183,6 +197,7 @@ type Client struct { Authorizations *AuthorizationsService Billing *BillingService Checks *ChecksService + Classroom *ClassroomService CodeScanning *CodeScanningService CodesOfConduct *CodesOfConductService Codespaces *CodespacesService @@ -203,6 +218,7 @@ type Client struct { Meta *MetaService Migrations *MigrationService Organizations *OrganizationsService + PrivateRegistries *PrivateRegistriesService Projects *ProjectsService PullRequests *PullRequestsService RateLimit *RateLimitService @@ -212,6 +228,7 @@ type Client struct { Search *SearchService SecretScanning *SecretScanningService SecurityAdvisories *SecurityAdvisoriesService + SubIssue *SubIssueService Teams *TeamsService Users *UsersService } @@ -292,9 +309,9 @@ type RawOptions struct { // 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) { +func addOptions(s string, opts any) (string, error) { v := reflect.ValueOf(opts) - if v.Kind() == reflect.Ptr && v.IsNil() { + if v.Kind() == reflect.Pointer && v.IsNil() { return s, nil } @@ -338,7 +355,9 @@ func (c *Client) WithAuthToken(token string) *Client { c2.client.Transport = roundTripperFunc( func(req *http.Request) (*http.Response, error) { req = req.Clone(req.Context()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + if token != "" { + req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token)) + } return transport.RoundTrip(req) }, ) @@ -395,6 +414,14 @@ func (c *Client) initialize() { if c.client == nil { 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(*http.Request, []*http.Request) error { + return http.ErrUseLastResponse + } if c.BaseURL == nil { c.BaseURL, _ = url.Parse(defaultBaseURL) } @@ -412,6 +439,7 @@ func (c *Client) initialize() { c.Authorizations = (*AuthorizationsService)(&c.common) c.Billing = (*BillingService)(&c.common) c.Checks = (*ChecksService)(&c.common) + c.Classroom = (*ClassroomService)(&c.common) c.CodeScanning = (*CodeScanningService)(&c.common) c.Codespaces = (*CodespacesService)(&c.common) c.CodesOfConduct = (*CodesOfConductService)(&c.common) @@ -432,6 +460,7 @@ func (c *Client) initialize() { c.Meta = (*MetaService)(&c.common) c.Migrations = (*MigrationService)(&c.common) c.Organizations = (*OrganizationsService)(&c.common) + c.PrivateRegistries = (*PrivateRegistriesService)(&c.common) c.Projects = (*ProjectsService)(&c.common) c.PullRequests = (*PullRequestsService)(&c.common) c.RateLimit = (*RateLimitService)(&c.common) @@ -441,6 +470,7 @@ 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) } @@ -450,11 +480,12 @@ 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, - secondaryRateLimitReset: c.secondaryRateLimitReset, + 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 { @@ -475,6 +506,7 @@ func NewClientWithEnvProxy() *Client { } // NewTokenClient returns a new GitHub API client authenticated with the provided token. +// // Deprecated: Use NewClient(nil).WithAuthToken(token) instead. func NewTokenClient(_ context.Context, token string) *Client { // This always returns a nil error. @@ -506,9 +538,9 @@ func WithVersion(version string) RequestOption { // 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) { +func (c *Client) NewRequest(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) + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) } u, err := c.BaseURL.Parse(urlStr) @@ -554,7 +586,7 @@ func (c *Client) NewRequest(method, urlStr string, body interface{}, opts ...Req // 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) + return nil, fmt.Errorf("baseURL must have a trailing slash, but %q does not", c.BaseURL) } u, err := c.BaseURL.Parse(urlStr) @@ -562,7 +594,7 @@ func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOp return nil, err } - req, err := http.NewRequest(http.MethodPost, u.String(), body) + req, err := http.NewRequest("POST", u.String(), body) if err != nil { return nil, err } @@ -586,7 +618,7 @@ func (c *Client) NewFormRequest(urlStr string, body io.Reader, opts ...RequestOp // 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) + return nil, fmt.Errorf("uploadURL must have a trailing slash, but %q does not", c.UploadURL) } u, err := c.UploadURL.Parse(urlStr) if err != nil { @@ -678,7 +710,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 @@ -752,11 +784,17 @@ func parseRate(r *http.Response) Rate { if remaining := r.Header.Get(headerRateRemaining); remaining != "" { rate.Remaining, _ = strconv.Atoi(remaining) } + if used := r.Header.Get(headerRateUsed); used != "" { + rate.Used, _ = strconv.Atoi(used) + } 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 != "" { + rate.Resource = resource + } return rate } @@ -803,69 +841,83 @@ func parseTokenExpiration(r *http.Response) Timestamp { type requestContext uint8 const ( - bypassRateLimitCheck requestContext = iota + // BypassRateLimitCheck prevents a pre-emptive check for exceeded primary rate limits + // Specify this by providing a context with this key, e.g. + // context.WithValue(context.Background(), github.BypassRateLimitCheck, true) + BypassRateLimitCheck requestContext = iota + SleepUntilPrimaryRateLimitResetWhenRateLimited ) -// 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 -// 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. +// 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 +// 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) { +func (c *Client) bareDo(ctx context.Context, caller *http.Client, req *http.Request) (*Response, error) { if ctx == nil { return nil, errNonNilContext } req = withContext(ctx, req) - rateLimitCategory := GetRateLimitCategory(req.Method, req.URL.Path) + rateLimitCategory := CoreCategory - 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 !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 + } } } - resp, err := c.client.Do(req) + resp, err := caller.Do(req) + var response *Response + if resp != nil { + response = newResponse(resp) + } + if err != nil { // If we got an error, and the context has been canceled, // the context's error is probably more useful. select { case <-ctx.Done(): - return nil, ctx.Err() + return response, ctx.Err() default: } // If the error type is *url.Error, sanitize its URL before returning. - if e, ok := err.(*url.Error); ok { + var e *url.Error + if errors.As(err, &e) { if url, err := url.Parse(e.URL); err == nil { e.URL = sanitizeURL(url).String() - return nil, e + return response, e } } - return nil, err + return response, err } - response := newResponse(resp) - - // 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() @@ -879,8 +931,8 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro // added to the AcceptedError and returned. // // Issue #1022 - aerr, ok := err.(*AcceptedError) - if ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { b, readErr := io.ReadAll(resp.Body) if readErr != nil { return response, readErr @@ -890,18 +942,23 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro err = aerr } - rateLimitError, ok := err.(*RateLimitError) - if ok && req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { + var rateLimitError *RateLimitError + if errors.As(err, &rateLimitError) && + req.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) != nil { if err := sleepUntilResetWithBuffer(req.Context(), rateLimitError.Rate.Reset.Time); err != nil { return response, err } // retry the request once when the rate limit has reset - return c.BareDo(context.WithValue(req.Context(), SleepUntilPrimaryRateLimitResetWhenRateLimited, nil), req) + return c.bareDo(context.WithValue(req.Context(), SleepUntilPrimaryRateLimitResetWhenRateLimited, nil), caller, req) } // 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 + } c.rateMu.Lock() c.secondaryRateLimitReset = time.Now().Add(*rerr.RetryAfter) c.rateMu.Unlock() @@ -910,6 +967,72 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro return response, err } +// 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 +// 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) +} + +// 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) +} + +var errInvalidLocation = errors.New("invalid or empty Location header in redirection response") + +// bareDoUntilFound has the exact same behavior as BareDo but only follows 301s, up to maxRedirects times. If it receives +// 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) + if err != nil { + var rerr *RedirectionError + if errors.As(err, &rerr) { + // If we receive a 302, transform potential relative locations into absolute and return it. + if rerr.StatusCode == http.StatusFound { + if rerr.Location == nil { + return nil, nil, errInvalidLocation + } + newURL := c.BaseURL.ResolveReference(rerr.Location) + return newURL, response, nil + } + // If permanent redirect response is returned, follow it + if maxRedirects > 0 && rerr.StatusCode == http.StatusMovedPermanently { + if rerr.Location == nil { + return nil, nil, errInvalidLocation + } + newURL := c.BaseURL.ResolveReference(rerr.Location) + newRequest := req.Clone(ctx) + newRequest.URL = newURL + return c.bareDoUntilFound(ctx, newRequest, maxRedirects-1) + } + // If we reached the maximum amount of redirections, return an error + if maxRedirects <= 0 && rerr.StatusCode == http.StatusMovedPermanently { + return nil, response, fmt.Errorf("reached the maximum amount of redirections: %w", err) + } + return nil, response, fmt.Errorf("unexpected redirection response: %w", err) + } + } + + // If we don't receive a redirection, forward the response and potential error + return nil, response, err +} + // Do sends an API request and returns the API response. The API response is // JSON decoded and stored in the value pointed to by v, or returned as an // error if an API error has occurred. If v implements the io.Writer interface, @@ -920,7 +1043,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro // // 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) { +func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*Response, error) { resp, err := c.BareDo(ctx, req) if err != nil { return resp, err @@ -1033,7 +1156,8 @@ GitHub API docs: https://docs.github.com/rest/#client-errors type ErrorResponse struct { Response *http.Response `json:"-"` // HTTP response that caused this error Message string `json:"message"` // error message - Errors []Error `json:"errors"` // more detail on individual errors + //nolint:sliceofpointers + Errors []Error `json:"errors"` // more detail on individual errors // Block is only populated on certain types of errors such as code 451. Block *ErrorBlock `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing @@ -1052,13 +1176,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) @@ -1066,8 +1190,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 } @@ -1124,15 +1248,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 } @@ -1158,8 +1282,8 @@ func (*AcceptedError) Error() string { // Is returns whether the provided error equals this error. func (ae *AcceptedError) Is(target error) bool { - v, ok := target.(*AcceptedError) - if !ok { + var v *AcceptedError + if !errors.As(target, &v) { return false } return bytes.Equal(ae.Raw, v.Raw) @@ -1178,15 +1302,15 @@ type AbuseRateLimitError struct { } func (r *AbuseRateLimitError) Error() string { - return fmt.Sprintf("%v %v: %d %v", + return fmt.Sprintf("%v %v: %v %v", r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), r.Response.StatusCode, r.Message) } // Is returns whether the provided error equals this error. func (r *AbuseRateLimitError) Is(target error) bool { - v, ok := target.(*AbuseRateLimitError) - if !ok { + var v *AbuseRateLimitError + if !errors.As(target, &v) { return false } @@ -1195,6 +1319,40 @@ func (r *AbuseRateLimitError) Is(target error) bool { compareHTTPResponse(r.Response, v.Response) } +// RedirectionError represents a response that returned a redirect status code: +// +// 301 (Moved Permanently) +// 302 (Found) +// 303 (See Other) +// 307 (Temporary Redirect) +// 308 (Permanent Redirect) +// +// If there was a valid Location header included, it will be parsed to a URL. You should use +// `BaseURL.ResolveReference()` to enrich it with the correct hostname where needed. +type RedirectionError struct { + Response *http.Response // HTTP response that caused this error + StatusCode int + Location *url.URL // location header of the redirection if present +} + +func (r *RedirectionError) Error() string { + 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 { + var v *RedirectionError + if !errors.As(target, &v) { + return false + } + + return r.StatusCode == v.StatusCode && + (r.Location == v.Location || // either both locations are nil or exactly the same pointer + 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 // exposed to the user. func sanitizeURL(uri *url.URL) *url.URL { @@ -1243,6 +1401,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 { @@ -1255,11 +1414,12 @@ 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]. // -// The error type will be *RateLimitError for rate limit exceeded errors, -// *AcceptedError for 202 Accepted status codes, -// and *TwoFactorAuthError for two-factor authentication errors. +// 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{} @@ -1301,6 +1461,25 @@ func CheckResponse(r *http.Response) error { abuseRateLimitError.RetryAfter = retryAfter } return abuseRateLimitError + // Check that the status code is a redirection and return a sentinel error that can be used to handle special cases + // where 302 is considered a successful result. + // This should never happen with the default `CheckRedirect`, because it would return a `url.Error` that should be handled upstream. + case r.StatusCode == http.StatusMovedPermanently || + r.StatusCode == http.StatusFound || + r.StatusCode == http.StatusSeeOther || + r.StatusCode == http.StatusTemporaryRedirect || + r.StatusCode == http.StatusPermanentRedirect: + + locationStr := r.Header.Get("Location") + var location *url.URL + if locationStr != "" { + location, _ = url.Parse(locationStr) + } + return &RedirectionError{ + Response: errorResponse.Response, + StatusCode: r.StatusCode, + Location: location, + } default: return errorResponse } @@ -1316,7 +1495,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 } @@ -1325,6 +1505,7 @@ func parseBoolResponse(err error) (bool, error) { return false, err } +// RateLimitCategory represents the enumeration of rate limit categories. type RateLimitCategory uint8 const ( @@ -1354,7 +1535,7 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { // https://docs.github.com/en/rest/search/search#search-code case strings.HasPrefix(path, "/search/code") && - method == http.MethodGet: + method == "GET": return CodeSearchCategory case strings.HasPrefix(path, "/search/"): @@ -1363,13 +1544,13 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { return GraphqlCategory case strings.HasPrefix(path, "/app-manifests/") && strings.HasSuffix(path, "/conversions") && - method == http.MethodPost: + method == "POST": return IntegrationManifestCategory // https://docs.github.com/rest/migrations/source-imports#start-an-import case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/import") && - method == http.MethodPut: + method == "PUT": return SourceImportCategory // https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data @@ -1383,7 +1564,7 @@ func GetRateLimitCategory(method, path string) RateLimitCategory { // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/dependency-graph/snapshots") && - method == http.MethodPost: + method == "POST": return DependencySnapshotsCategory // https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization @@ -1430,8 +1611,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/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#primary-rate-limit-for-oauth-apps +for more information. */ type UnauthenticatedRateLimitedTransport struct { // ClientID is the GitHub OAuth client ID of the current application, which @@ -1525,9 +1706,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 { @@ -1579,20 +1760,34 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri return resp, err } +// Ptr is a helper routine that allocates a new T value +// to store v and returns a pointer to it. +func Ptr[T any](v T) *T { + return &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 } // 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 } // 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 } // 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 } // roundTripperFunc creates a RoundTripper (transport). @@ -1601,3 +1796,18 @@ type roundTripperFunc func(*http.Request) (*http.Response, error) func (fn roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { return fn(r) } + +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) { + match := runIDFromURLRE.FindStringSubmatch(*e.DeploymentCallbackURL) + if len(match) != 2 { + return -1, errors.New("no match") + } + runID, err := strconv.ParseInt(match[1], 10, 64) + if err != nil { + return -1, err + } + return runID, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/gitignore.go b/vendor/github.com/google/go-github/v79/github/gitignore.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/gitignore.go rename to vendor/github.com/google/go-github/v79/github/gitignore.go diff --git a/vendor/github.com/google/go-github/v67/github/interactions.go b/vendor/github.com/google/go-github/v79/github/interactions.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/interactions.go rename to vendor/github.com/google/go-github/v79/github/interactions.go diff --git a/vendor/github.com/google/go-github/v67/github/interactions_orgs.go b/vendor/github.com/google/go-github/v79/github/interactions_orgs.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/interactions_orgs.go rename to vendor/github.com/google/go-github/v79/github/interactions_orgs.go index f0ba0b15f0..55f2548179 100644 --- a/vendor/github.com/google/go-github/v67/github/interactions_orgs.go +++ b/vendor/github.com/google/go-github/v79/github/interactions_orgs.go @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) organizationInteractions := new(InteractionRestriction) @@ -47,14 +46,13 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) - interaction := &InteractionRestriction{Limit: String(limit)} + interaction := &InteractionRestriction{Limit: Ptr(limit)} req, err := s.client.NewRequest("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) @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, org return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/interactions_repos.go b/vendor/github.com/google/go-github/v79/github/interactions_repos.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/interactions_repos.go rename to vendor/github.com/google/go-github/v79/github/interactions_repos.go index 9c044badd1..d99de494a9 100644 --- a/vendor/github.com/google/go-github/v67/github/interactions_repos.go +++ b/vendor/github.com/google/go-github/v79/github/interactions_repos.go @@ -22,7 +22,6 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) repositoryInteractions := new(InteractionRestriction) @@ -47,14 +46,13 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, 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: String(limit)} + interaction := &InteractionRestriction{Limit: Ptr(limit)} req, err := s.client.NewRequest("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) @@ -79,7 +77,6 @@ func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, ow return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/issue_import.go b/vendor/github.com/google/go-github/v79/github/issue_import.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/issue_import.go rename to vendor/github.com/google/go-github/v79/github/issue_import.go index 4f06371085..ea42db1ba9 100644 --- a/vendor/github.com/google/go-github/v67/github/issue_import.go +++ b/vendor/github.com/google/go-github/v79/github/issue_import.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" ) @@ -80,14 +81,13 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) i := new(IssueImportResponse) resp, err := s.client.Do(ctx, req, i) if err != nil { - aerr, ok := err.(*AcceptedError) - if ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, i); err != nil { return i, resp, err } @@ -111,7 +111,6 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) i := new(IssueImportResponse) @@ -135,7 +134,6 @@ func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo s return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeIssueImportAPI) var b bytes.Buffer diff --git a/vendor/github.com/google/go-github/v67/github/issues.go b/vendor/github.com/google/go-github/v79/github/issues.go similarity index 82% rename from vendor/github.com/google/go-github/v67/github/issues.go rename to vendor/github.com/google/go-github/v79/github/issues.go index a2652b3497..72d0dbae6b 100644 --- a/vendor/github.com/google/go-github/v67/github/issues.go +++ b/vendor/github.com/google/go-github/v79/github/issues.go @@ -29,10 +29,16 @@ type Issue struct { 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"` + 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#get-an-issue AuthorAssociation *string `json:"author_association,omitempty"` User *User `json:"user,omitempty"` Labels []*Label `json:"labels,omitempty"` @@ -55,6 +61,7 @@ type Issue struct { 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 @@ -89,6 +96,7 @@ type IssueRequest struct { StateReason *string `json:"state_reason,omitempty"` Milestone *int `json:"milestone,omitempty"` Assignees *[]string `json:"assignees,omitempty"` + Type *string `json:"type,omitempty"` } // IssueListOptions specifies the optional parameters to the IssuesService.List @@ -116,6 +124,10 @@ type IssueListOptions struct { // Since filters issues by time. Since time.Time `url:"since,omitempty"` + ListCursorOptions + + // Add ListOptions so offset pagination with integer type "page" query parameter is accepted + // since ListCursorOptions accepts "page" as string only. ListOptions } @@ -129,6 +141,18 @@ type PullRequestLinks struct { MergedAt *Timestamp `json:"merged_at,omitempty"` } +// IssueType represents the type of issue. +// For now it shows up when receiving an Issue event. +type IssueType struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + Color *string `json:"color,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + // 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 @@ -171,7 +195,6 @@ func (s *IssuesService) listIssues(ctx context.Context, u string, opts *IssueLis return nil, nil, err } - // TODO: remove custom Accept header when this API fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue @@ -220,6 +243,10 @@ type IssueListByRepoOptions struct { // Since filters issues by time. Since time.Time `url:"since,omitempty"` + ListCursorOptions + + // Add ListOptions so offset pagination with integer type "page" query parameter is accepted + // since ListCursorOptions accepts "page" as string only. ListOptions } @@ -228,7 +255,7 @@ type IssueListByRepoOptions struct { // 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) { +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 { @@ -240,7 +267,6 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var issues []*Issue @@ -257,14 +283,13 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin // 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) +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("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) @@ -281,7 +306,7 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb // 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) { +func (s *IssuesService) Create(ctx context.Context, owner, 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 { @@ -302,8 +327,8 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i // 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) +func (s *IssuesService) Edit(ctx context.Context, owner, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, issue) if err != nil { return nil, nil, err @@ -357,8 +382,8 @@ type LockIssueOptions struct { // 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) +func (s *IssuesService) Lock(ctx context.Context, owner, repo string, number int, opts *LockIssueOptions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/lock", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, err @@ -372,8 +397,8 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num // 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) +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("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/issues_assignees.go b/vendor/github.com/google/go-github/v79/github/issues_assignees.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/issues_assignees.go rename to vendor/github.com/google/go-github/v79/github/issues_assignees.go diff --git a/vendor/github.com/google/go-github/v67/github/issues_comments.go b/vendor/github.com/google/go-github/v79/github/issues_comments.go similarity index 80% rename from vendor/github.com/google/go-github/v67/github/issues_comments.go rename to vendor/github.com/google/go-github/v79/github/issues_comments.go index 74a4e60f7c..35069400de 100644 --- a/vendor/github.com/google/go-github/v67/github/issues_comments.go +++ b/vendor/github.com/google/go-github/v79/github/issues_comments.go @@ -22,6 +22,10 @@ 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". + // + // 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#get-an-issue-comment AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` @@ -55,12 +59,12 @@ type IssueListCommentsOptions struct { // //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 { @@ -72,7 +76,6 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*IssueComment @@ -89,15 +92,14 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str // GitHub API docs: https://docs.github.com/rest/issues/comments#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) 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) @@ -114,8 +116,8 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin // GitHub API docs: https://docs.github.com/rest/issues/comments#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) +func (s *IssuesService) CreateComment(ctx context.Context, owner, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err @@ -135,8 +137,8 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st // GitHub API docs: https://docs.github.com/rest/issues/comments#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) +func (s *IssuesService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { return nil, nil, err @@ -155,8 +157,8 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri // GitHub API docs: https://docs.github.com/rest/issues/comments#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) +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("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/issues_events.go b/vendor/github.com/google/go-github/v79/github/issues_events.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/issues_events.go rename to vendor/github.com/google/go-github/v79/github/issues_events.go index bba3b18031..8e234d7e02 100644 --- a/vendor/github.com/google/go-github/v67/github/issues_events.go +++ b/vendor/github.com/google/go-github/v79/github/issues_events.go @@ -85,7 +85,6 @@ type IssueEvent struct { Label *Label `json:"label,omitempty"` Rename *Rename `json:"rename,omitempty"` LockReason *string `json:"lock_reason,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` DismissedReview *DismissedReview `json:"dismissed_review,omitempty"` RequestedReviewer *User `json:"requested_reviewer,omitempty"` RequestedTeam *Team `json:"requested_team,omitempty"` diff --git a/vendor/github.com/google/go-github/v67/github/issues_labels.go b/vendor/github.com/google/go-github/v79/github/issues_labels.go similarity index 80% rename from vendor/github.com/google/go-github/v67/github/issues_labels.go rename to vendor/github.com/google/go-github/v79/github/issues_labels.go index b97b00f3e8..243670ec7e 100644 --- a/vendor/github.com/google/go-github/v67/github/issues_labels.go +++ b/vendor/github.com/google/go-github/v79/github/issues_labels.go @@ -30,7 +30,7 @@ func (l Label) String() string { // 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) { +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 { @@ -56,7 +56,7 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin // 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) { +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("GET", u, nil) if err != nil { @@ -77,7 +77,7 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, // 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) { +func (s *IssuesService) CreateLabel(ctx context.Context, owner, 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 { @@ -98,7 +98,7 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri // 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) { +func (s *IssuesService) EditLabel(ctx context.Context, owner, repo, 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 { @@ -119,7 +119,7 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string // 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) { +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("DELETE", u, nil) if err != nil { @@ -133,8 +133,8 @@ func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo stri // 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) +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 @@ -159,8 +159,8 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep // 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) +func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) req, err := s.client.NewRequest("POST", u, labels) if err != nil { return nil, nil, err @@ -180,8 +180,8 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo // 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) +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("DELETE", u, nil) if err != nil { return nil, err @@ -195,8 +195,8 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, r // 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) +func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner, repo string, number int, labels []string) ([]*Label, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/labels", owner, repo, number) req, err := s.client.NewRequest("PUT", u, labels) if err != nil { return nil, nil, err @@ -216,8 +216,8 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, // 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) +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("DELETE", u, nil) if err != nil { return nil, err @@ -231,8 +231,8 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, // 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) +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 diff --git a/vendor/github.com/google/go-github/v67/github/issues_milestones.go b/vendor/github.com/google/go-github/v79/github/issues_milestones.go similarity index 87% rename from vendor/github.com/google/go-github/v67/github/issues_milestones.go rename to vendor/github.com/google/go-github/v79/github/issues_milestones.go index 6c31bcd054..7478290299 100644 --- a/vendor/github.com/google/go-github/v67/github/issues_milestones.go +++ b/vendor/github.com/google/go-github/v79/github/issues_milestones.go @@ -57,7 +57,7 @@ type MilestoneListOptions struct { // GitHub API docs: https://docs.github.com/rest/issues/milestones#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 { @@ -83,8 +83,8 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s // GitHub API docs: https://docs.github.com/rest/issues/milestones#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) +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("GET", u, nil) if err != nil { return nil, nil, err @@ -104,7 +104,7 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str // GitHub API docs: https://docs.github.com/rest/issues/milestones#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, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) req, err := s.client.NewRequest("POST", u, milestone) if err != nil { @@ -125,8 +125,8 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo // GitHub API docs: https://docs.github.com/rest/issues/milestones#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) +func (s *IssuesService) EditMilestone(ctx context.Context, owner, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/milestones/%v", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, milestone) if err != nil { return nil, nil, err @@ -146,8 +146,8 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st // GitHub API docs: https://docs.github.com/rest/issues/milestones#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) +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("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/issues_timeline.go b/vendor/github.com/google/go-github/v79/github/issues_timeline.go similarity index 94% rename from vendor/github.com/google/go-github/v67/github/issues_timeline.go rename to vendor/github.com/google/go-github/v79/github/issues_timeline.go index 0aa589afe4..cea900ee6b 100644 --- a/vendor/github.com/google/go-github/v67/github/issues_timeline.go +++ b/vendor/github.com/google/go-github/v79/github/issues_timeline.go @@ -97,6 +97,14 @@ type Timeline struct { // reviewed // The pull request was reviewed. // + // review_requested + // The actor requested a review from a user or team. + // Reviewer and Requester/RequestedTeam will be populated. + // + // review_request_removed + // The actor removed a review request from a user or team. + // Reviewer and Requester/RequestedTeam will be populated. + // // subscribed // The actor subscribed to receive notifications for an issue. // @@ -134,8 +142,7 @@ type Timeline struct { Source *Source `json:"source,omitempty"` // An object containing rename details including 'from' and 'to' attributes. // Only provided for 'renamed' events. - Rename *Rename `json:"rename,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` + Rename *Rename `json:"rename,omitempty"` // The state of a submitted review. Can be one of: 'commented', // 'changes_requested' or 'approved'. // Only provided for 'reviewed' events. @@ -181,7 +188,6 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) diff --git a/vendor/github.com/google/go-github/v67/github/licenses.go b/vendor/github.com/google/go-github/v79/github/licenses.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/licenses.go rename to vendor/github.com/google/go-github/v79/github/licenses.go index 34b8a3d8af..60dfd71a19 100644 --- a/vendor/github.com/google/go-github/v67/github/licenses.go +++ b/vendor/github.com/google/go-github/v79/github/licenses.go @@ -84,7 +84,7 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // //meta:operation GET /licenses/{license} func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { - u := fmt.Sprintf("licenses/%s", licenseName) + u := fmt.Sprintf("licenses/%v", licenseName) req, err := s.client.NewRequest("GET", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/markdown.go b/vendor/github.com/google/go-github/v79/github/markdown.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/markdown.go rename to vendor/github.com/google/go-github/v79/github/markdown.go index fe3b31128d..0fd896c6c8 100644 --- a/vendor/github.com/google/go-github/v67/github/markdown.go +++ b/vendor/github.com/google/go-github/v79/github/markdown.go @@ -44,13 +44,13 @@ type markdownRenderRequest struct { // //meta:operation POST /markdown func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRenderRequest{Text: String(text)} + request := &markdownRenderRequest{Text: Ptr(text)} if opts != nil { if opts.Mode != "" { - request.Mode = String(opts.Mode) + request.Mode = Ptr(opts.Mode) } if opts.Context != "" { - request.Context = String(opts.Context) + request.Context = Ptr(opts.Context) } } diff --git a/vendor/github.com/google/go-github/v67/github/messages.go b/vendor/github.com/google/go-github/v79/github/messages.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/messages.go rename to vendor/github.com/google/go-github/v79/github/messages.go index 608c557cb0..21eb7c70c3 100644 --- a/vendor/github.com/google/go-github/v67/github/messages.go +++ b/vendor/github.com/google/go-github/v79/github/messages.go @@ -45,7 +45,7 @@ const ( 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{}, @@ -54,6 +54,8 @@ var ( "commit_comment": &CommitCommentEvent{}, "content_reference": &ContentReferenceEvent{}, "create": &CreateEvent{}, + "custom_property": &CustomPropertyEvent{}, + "custom_property_values": &CustomPropertyValuesEvent{}, "delete": &DeleteEvent{}, "dependabot_alert": &DependabotAlertEvent{}, "deploy_key": &DeployKeyEvent{}, @@ -84,9 +86,6 @@ var ( "page_build": &PageBuildEvent{}, "personal_access_token_request": &PersonalAccessTokenRequestEvent{}, "ping": &PingEvent{}, - "project": &ProjectEvent{}, - "project_card": &ProjectCardEvent{}, - "project_column": &ProjectColumnEvent{}, "projects_v2": &ProjectV2Event{}, "projects_v2_item": &ProjectV2ItemEvent{}, "public": &PublicEvent{}, @@ -96,6 +95,7 @@ var ( "pull_request_review_thread": &PullRequestReviewThreadEvent{}, "pull_request_target": &PullRequestTargetEvent{}, "push": &PushEvent{}, + "registry_package": &RegistryPackageEvent{}, "repository": &RepositoryEvent{}, "repository_dispatch": &RepositoryDispatchEvent{}, "repository_import": &RepositoryImportEvent{}, @@ -186,11 +186,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. @@ -249,9 +249,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) @@ -300,25 +300,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) @@ -344,7 +344,7 @@ func MessageTypes() []string { // 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/v67/github/meta.go b/vendor/github.com/google/go-github/v79/github/meta.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/meta.go rename to vendor/github.com/google/go-github/v79/github/meta.go index cc90b618b1..92c4bcff6f 100644 --- a/vendor/github.com/google/go-github/v67/github/meta.go +++ b/vendor/github.com/google/go-github/v79/github/meta.go @@ -52,6 +52,10 @@ 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 // Dependabot will originate from. Dependabot []string `json:"dependabot,omitempty"` @@ -129,7 +133,7 @@ func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Response, error) { u := "octocat" if message != "" { - u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) + u = fmt.Sprintf("%v?s=%v", u, url.QueryEscape(message)) } req, err := s.client.NewRequest("GET", u, nil) @@ -156,7 +160,7 @@ 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 // diff --git a/vendor/github.com/google/go-github/v67/github/migrations.go b/vendor/github.com/google/go-github/v79/github/migrations.go similarity index 87% rename from vendor/github.com/google/go-github/v67/github/migrations.go rename to vendor/github.com/google/go-github/v79/github/migrations.go index 5af8817050..14d014b614 100644 --- a/vendor/github.com/google/go-github/v67/github/migrations.go +++ b/vendor/github.com/google/go-github/v79/github/migrations.go @@ -55,6 +55,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,6 +77,14 @@ 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. @@ -82,8 +98,10 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos body := &startMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Bool(opts.LockRepositories) - body.ExcludeAttachments = Bool(opts.ExcludeAttachments) + body.LockRepositories = Ptr(opts.LockRepositories) + body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) + body.ExcludeReleases = Ptr(opts.ExcludeReleases) + body.Exclude = append(body.Exclude, opts.Exclude...) } req, err := s.client.NewRequest("POST", u, body) @@ -91,7 +109,6 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} @@ -120,7 +137,6 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*Migration @@ -146,7 +162,6 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &Migration{} @@ -172,7 +187,6 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) s.client.clientMu.Lock() @@ -181,7 +195,7 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, // 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 { + s.client.client.CheckRedirect = func(req *http.Request, _ []*http.Request) error { loc = req.URL.String() return errors.New("disable redirect") } @@ -211,7 +225,6 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) @@ -233,7 +246,6 @@ func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/migrations_source_import.go b/vendor/github.com/google/go-github/v79/github/migrations_source_import.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/migrations_source_import.go rename to vendor/github.com/google/go-github/v79/github/migrations_source_import.go diff --git a/vendor/github.com/google/go-github/v67/github/migrations_user.go b/vendor/github.com/google/go-github/v79/github/migrations_user.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/migrations_user.go rename to vendor/github.com/google/go-github/v79/github/migrations_user.go index 1f907cd4ec..49678fcc09 100644 --- a/vendor/github.com/google/go-github/v67/github/migrations_user.go +++ b/vendor/github.com/google/go-github/v79/github/migrations_user.go @@ -75,8 +75,8 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin body := &startUserMigration{Repositories: repos} if opts != nil { - body.LockRepositories = Bool(opts.LockRepositories) - body.ExcludeAttachments = Bool(opts.ExcludeAttachments) + body.LockRepositories = Ptr(opts.LockRepositories) + body.ExcludeAttachments = Ptr(opts.ExcludeAttachments) } req, err := s.client.NewRequest("POST", u, body) @@ -84,7 +84,6 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} @@ -113,7 +112,6 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) var m []*UserMigration @@ -139,7 +137,6 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} @@ -165,14 +162,13 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 return "", err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) m := &UserMigration{} 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 } @@ -201,7 +197,6 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) @@ -223,7 +218,6 @@ func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo st return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMigrationsPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/orgs.go b/vendor/github.com/google/go-github/v79/github/orgs.go similarity index 87% rename from vendor/github.com/google/go-github/v67/github/orgs.go rename to vendor/github.com/google/go-github/v79/github/orgs.go index 27c0f10284..c1f7bf0d02 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs.go +++ b/vendor/github.com/google/go-github/v79/github/orgs.go @@ -97,6 +97,24 @@ 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"` + // 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"` @@ -218,7 +236,6 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) organization := new(Organization) @@ -236,7 +253,7 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati // //meta:operation GET /organizations/{organization_id} func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { - u := fmt.Sprintf("organizations/%d", id) + u := fmt.Sprintf("organizations/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -263,7 +280,6 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeMemberAllowedRepoCreationTypePreview) o := new(Organization) diff --git a/vendor/github.com/google/go-github/v67/github/orgs_actions_allowed.go b/vendor/github.com/google/go-github/v79/github/orgs_actions_allowed.go similarity index 73% rename from vendor/github.com/google/go-github/v67/github/orgs_actions_allowed.go rename to vendor/github.com/google/go-github/v79/github/orgs_actions_allowed.go index b115e094a4..9c42df6459 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_actions_allowed.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_actions_allowed.go @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string return s2.GetActionsAllowed(ctx, org) } -// EditActionsAllowed sets the actions that are allowed in an organization. +// UpdateActionsAllowed sets the actions that are allowed in an organization. // -// Deprecated: please use `client.Actions.EditActionsAllowed` instead. +// Deprecated: please use `client.Actions.UpdateActionsAllowed` instead. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions/selected-actions -func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { +func (s *OrganizationsService) UpdateActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsAllowed(ctx, org, actionsAllowed) + return s2.UpdateActionsAllowed(ctx, org, actionsAllowed) } diff --git a/vendor/github.com/google/go-github/v67/github/orgs_actions_permissions.go b/vendor/github.com/google/go-github/v79/github/orgs_actions_permissions.go similarity index 70% rename from vendor/github.com/google/go-github/v67/github/orgs_actions_permissions.go rename to vendor/github.com/google/go-github/v79/github/orgs_actions_permissions.go index 97df1c967e..60abbeec3b 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_actions_permissions.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_actions_permissions.go @@ -21,14 +21,14 @@ func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org st return s2.GetActionsPermissions(ctx, org) } -// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// Deprecated: please use `client.Actions.EditActionsPermissions` instead. +// Deprecated: please use `client.Actions.UpdateActionsPermissions` instead. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization // //meta:operation PUT /orgs/{org}/actions/permissions -func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { +func (s *OrganizationsService) UpdateActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { s2 := (*ActionsService)(s) - return s2.EditActionsPermissions(ctx, org, actionsPermissions) + return s2.UpdateActionsPermissions(ctx, org, actionsPermissions) } diff --git a/vendor/github.com/google/go-github/v67/github/orgs_attestations.go b/vendor/github.com/google/go-github/v79/github/orgs_attestations.go similarity index 86% rename from vendor/github.com/google/go-github/v67/github/orgs_attestations.go rename to vendor/github.com/google/go-github/v79/github/orgs_attestations.go index 3d5793c18f..1a7a1d5c96 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_attestations.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_attestations.go @@ -14,11 +14,11 @@ import ( // with a given subject digest that are associated with repositories // owned by an organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-attestations +// GitHub API docs: https://docs.github.com/rest/orgs/attestations#list-attestations // //meta:operation GET /orgs/{org}/attestations/{subject_digest} func (s *OrganizationsService) ListAttestations(ctx context.Context, org, subjectDigest string, opts *ListOptions) (*AttestationsResponse, *Response, error) { - 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 { diff --git a/vendor/github.com/google/go-github/v67/github/orgs_audit_log.go b/vendor/github.com/google/go-github/v79/github/orgs_audit_log.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/orgs_audit_log.go rename to vendor/github.com/google/go-github/v79/github/orgs_audit_log.go index 025c5d0232..8aae4ef381 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_audit_log.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_audit_log.go @@ -43,19 +43,20 @@ 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. func (a *AuditEntry) UnmarshalJSON(data []byte) error { type entryAlias AuditEntry var v entryAlias @@ -67,7 +68,7 @@ func (a *AuditEntry) UnmarshalJSON(data []byte) error { if err != nil { return err } - definedFields := map[string]interface{}{} + definedFields := map[string]any{} if err := json.Unmarshal(rawDefinedFields, &definedFields); err != nil { return err } @@ -89,6 +90,7 @@ func (a *AuditEntry) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaler interface. func (a *AuditEntry) MarshalJSON() ([]byte, error) { type entryAlias AuditEntry v := entryAlias(*a) @@ -99,7 +101,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 } diff --git a/vendor/github.com/google/go-github/v67/github/orgs_codesecurity_configurations.go b/vendor/github.com/google/go-github/v79/github/orgs_codesecurity_configurations.go similarity index 60% rename from vendor/github.com/google/go-github/v67/github/orgs_codesecurity_configurations.go rename to vendor/github.com/google/go-github/v79/github/orgs_codesecurity_configurations.go index b25845a4e8..788f52ed1b 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_codesecurity_configurations.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_codesecurity_configurations.go @@ -16,12 +16,29 @@ 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"` +} + // CodeSecurityConfiguration represents a code security configuration. type CodeSecurityConfiguration struct { ID *int64 `json:"id,omitempty"` TargetType *string `json:"target_type,omitempty"` - Name *string `json:"name"` - Description *string `json:"description,omitempty"` + Name string `json:"name"` + Description string `json:"description"` AdvancedSecurity *string `json:"advanced_security,omitempty"` DependencyGraph *string `json:"dependency_graph,omitempty"` DependencyGraphAutosubmitAction *string `json:"dependency_graph_autosubmit_action,omitempty"` @@ -29,10 +46,17 @@ type CodeSecurityConfiguration struct { DependabotAlerts *string `json:"dependabot_alerts,omitempty"` DependabotSecurityUpdates *string `json:"dependabot_security_updates,omitempty"` CodeScanningDefaultSetup *string `json:"code_scanning_default_setup,omitempty"` + CodeScanningDefaultSetupOptions *CodeScanningDefaultSetupOptions `json:"code_scanning_default_setup_options,omitempty"` + CodeScanningDelegatedAlertDismissal *string `json:"code_scanning_delegated_alert_dismissal,omitempty"` + CodeScanningOptions *CodeScanningOptions `json:"code_scanning_options,omitempty"` + CodeSecurity *string `json:"code_security,omitempty"` SecretScanning *string `json:"secret_scanning,omitempty"` SecretScanningPushProtection *string `json:"secret_scanning_push_protection,omitempty"` SecretScanningValidityChecks *string `json:"secret_scanning_validity_checks,omitempty"` SecretScanningNonProviderPatterns *string `json:"secret_scanning_non_provider_patterns,omitempty"` + SecretScanningGenericSecrets *string `json:"secret_scanning_generic_secrets,omitempty"` + SecretScanningDelegatedAlertDismissal *string `json:"secret_scanning_delegated_alert_dismissal,omitempty"` + SecretProtection *string `json:"secret_protection,omitempty"` PrivateVulnerabilityReporting *string `json:"private_vulnerability_reporting,omitempty"` Enforcement *string `json:"enforcement,omitempty"` URL *string `json:"url,omitempty"` @@ -44,7 +68,7 @@ type CodeSecurityConfiguration struct { // CodeSecurityConfigurationWithDefaultForNewRepos represents a code security configuration with default for new repos param. type CodeSecurityConfigurationWithDefaultForNewRepos struct { Configuration *CodeSecurityConfiguration `json:"configuration"` - DefaultForNewRepos *string `json:"default_for_new_repos"` + DefaultForNewRepos *string `json:"default_for_new_repos,omitempty"` } // RepositoryCodeSecurityConfiguration represents a code security configuration for a repository. @@ -53,13 +77,65 @@ type RepositoryCodeSecurityConfiguration struct { Configuration *CodeSecurityConfiguration `json:"configuration,omitempty"` } -// GetCodeSecurityConfigurations gets code security configurations for an organization. +// ListOrgCodeSecurityConfigurationOptions specifies optional parameters to get security configurations for orgs. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListOrgCodeSecurityConfigurationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for security configurations before this cursor. + Before *string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for security configurations after this cursor. + After *string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage *int `url:"per_page,omitempty"` + + // The target type of the code security configurations to get. + // + // `target_type` defaults to all, can be one of `global`, `all` + TargetType *string `url:"target_type,omitempty"` +} + +// ListCodeSecurityConfigurationRepositoriesOptions specifies optional parameters to list repositories for security configurations for orgs and enterprises. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListCodeSecurityConfigurationRepositoriesOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for repositories before this cursor. + Before *string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for repositories after this cursor. + After *string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage *int `url:"per_page,omitempty"` + + // A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned. + // + // `status` defaults to all, can be one of `all`, `attached`, `attaching`, `removed`, `enforced`, `failed`, `updating`, `removed_by_enterprise` and also `detached` but only for the org endpoint. + Status *string `url:"status,omitempty"` +} + +// ListCodeSecurityConfigurations gets code security configurations for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-organization // //meta:operation GET /orgs/{org}/code-security/configurations -func (s *OrganizationsService) GetCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) ListCodeSecurityConfigurations(ctx context.Context, org string, opts *ListOrgCodeSecurityConfigurationOptions) ([]*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -79,10 +155,10 @@ func (s *OrganizationsService) GetCodeSecurityConfigurations(ctx context.Context // GitHub API docs: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration // //meta:operation POST /orgs/{org}/code-security/configurations -func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Context, org string, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations", org) - req, err := s.client.NewRequest("POST", u, c) + req, err := s.client.NewRequest("POST", u, config) if err != nil { return nil, nil, err } @@ -95,12 +171,12 @@ func (s *OrganizationsService) CreateCodeSecurityConfiguration(ctx context.Conte return configuration, resp, nil } -// GetDefaultCodeSecurityConfigurations gets default code security configurations for an organization. +// ListDefaultCodeSecurityConfigurations gets default code security configurations for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations // //meta:operation GET /orgs/{org}/code-security/configurations/defaults -func (s *OrganizationsService) GetDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfiguration, *Response, error) { +func (s *OrganizationsService) ListDefaultCodeSecurityConfigurations(ctx context.Context, org string) ([]*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { u := fmt.Sprintf("orgs/%v/code-security/configurations/defaults", org) req, err := s.client.NewRequest("GET", u, nil) @@ -108,7 +184,7 @@ func (s *OrganizationsService) GetDefaultCodeSecurityConfigurations(ctx context. return nil, nil, err } - var configurations []*CodeSecurityConfiguration + var configurations []*CodeSecurityConfigurationWithDefaultForNewRepos resp, err := s.client.Do(ctx, req, &configurations) if err != nil { return nil, resp, err @@ -142,8 +218,8 @@ func (s *OrganizationsService) DetachCodeSecurityConfigurationsFromRepositories( // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-a-code-security-configuration // //meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -163,10 +239,10 @@ func (s *OrganizationsService) GetCodeSecurityConfiguration(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/code-security/configurations#update-a-code-security-configuration // //meta:operation PATCH /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, id int64, c *CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, config CodeSecurityConfiguration) (*CodeSecurityConfiguration, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) - req, err := s.client.NewRequest("PATCH", u, c) + req, err := s.client.NewRequest("PATCH", u, config) if err != nil { return nil, nil, err } @@ -184,8 +260,8 @@ func (s *OrganizationsService) UpdateCodeSecurityConfiguration(ctx context.Conte // GitHub API docs: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration // //meta:operation DELETE /orgs/{org}/code-security/configurations/{configuration_id} -func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, id) +func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v", org, configurationID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -198,13 +274,13 @@ func (s *OrganizationsService) DeleteCodeSecurityConfiguration(ctx context.Conte return resp, nil } -// AttachCodeSecurityConfigurationsToRepositories attaches code security configurations to repositories for an organization. +// AttachCodeSecurityConfigurationToRepositories attaches code security configurations to repositories for an organization. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#attach-a-configuration-to-repositories // //meta:operation POST /orgs/{org}/code-security/configurations/{configuration_id}/attach -func (s *OrganizationsService) AttachCodeSecurityConfigurationsToRepositories(ctx context.Context, org string, id int64, scope string, repoIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, id) +func (s *OrganizationsService) AttachCodeSecurityConfigurationToRepositories(ctx context.Context, org string, configurationID int64, scope string, repoIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/attach", org, configurationID) type selectedRepoIDs struct { Scope string `json:"scope"` SelectedIDs []int64 `json:"selected_repository_ids,omitempty"` @@ -225,8 +301,8 @@ func (s *OrganizationsService) AttachCodeSecurityConfigurationsToRepositories(ct // GitHub API docs: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization // //meta:operation PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults -func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, id int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, id) +func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.Context, org string, configurationID int64, newReposParam string) (*CodeSecurityConfigurationWithDefaultForNewRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/defaults", org, configurationID) type configParam struct { DefaultForNewRepos string `json:"default_for_new_repos"` } @@ -234,33 +310,38 @@ func (s *OrganizationsService) SetDefaultCodeSecurityConfiguration(ctx context.C if err != nil { return nil, nil, err } - var c *CodeSecurityConfigurationWithDefaultForNewRepos - resp, err := s.client.Do(ctx, req, &c) + var config *CodeSecurityConfigurationWithDefaultForNewRepos + resp, err := s.client.Do(ctx, req, &config) if err != nil { return nil, resp, err } - return c, resp, nil + return config, resp, nil } -// GetRepositoriesForCodeSecurityConfiguration gets repositories associated with a code security configuration. +// ListCodeSecurityConfigurationRepositories gets repositories associated with a code security configuration. // // GitHub API docs: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration // //meta:operation GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories -func (s *OrganizationsService) GetRepositoriesForCodeSecurityConfiguration(ctx context.Context, org string, id int64) ([]*Repository, *Response, error) { - u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, id) +func (s *OrganizationsService) ListCodeSecurityConfigurationRepositories(ctx context.Context, org string, configurationID int64, opts *ListCodeSecurityConfigurationRepositoriesOptions) ([]*RepositoryAttachment, *Response, error) { + u := fmt.Sprintf("orgs/%v/code-security/configurations/%v/repositories", org, configurationID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - var repositories []*Repository - resp, err := s.client.Do(ctx, req, &repositories) + var attachments []*RepositoryAttachment + resp, err := s.client.Do(ctx, req, &attachments) if err != nil { return nil, resp, err } - return repositories, resp, nil + + return attachments, resp, nil } // GetCodeSecurityConfigurationForRepository gets code security configuration that manages a repository's code security settings. diff --git a/vendor/github.com/google/go-github/v67/github/orgs_credential_authorizations.go b/vendor/github.com/google/go-github/v79/github/orgs_credential_authorizations.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/orgs_credential_authorizations.go rename to vendor/github.com/google/go-github/v79/github/orgs_credential_authorizations.go index dca42433c3..326922c3bc 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_credential_authorizations.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_credential_authorizations.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // CredentialAuthorization represents a credential authorized through SAML SSO. @@ -78,7 +77,7 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, nil) + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } @@ -100,7 +99,7 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, //meta:operation DELETE /orgs/{org}/credential-authorizations/{credential_id} func (s *OrganizationsService) RemoveCredentialAuthorization(ctx context.Context, org string, credentialID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/credential-authorizations/%v", org, credentialID) - req, err := s.client.NewRequest(http.MethodDelete, u, nil) + req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } diff --git a/vendor/github.com/google/go-github/v67/github/orgs_custom_repository_roles.go b/vendor/github.com/google/go-github/v79/github/orgs_custom_repository_roles.go similarity index 85% rename from vendor/github.com/google/go-github/v67/github/orgs_custom_repository_roles.go rename to vendor/github.com/google/go-github/v79/github/orgs_custom_repository_roles.go index 2295e1b8a7..44408db141 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_custom_repository_roles.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_custom_repository_roles.go @@ -61,6 +61,29 @@ func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org stri return customRepoRoles, resp, nil } +// 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 +// +//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) + if err != nil { + return nil, nil, err + } + + resultingRole := new(CustomRepoRoles) + resp, err := s.client.Do(ctx, req, resultingRole) + if err != nil { + return nil, resp, err + } + + return resultingRole, resp, nil +} + // 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. // diff --git a/vendor/github.com/google/go-github/v67/github/orgs_hooks.go b/vendor/github.com/google/go-github/v79/github/orgs_hooks.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/orgs_hooks.go rename to vendor/github.com/google/go-github/v79/github/orgs_hooks.go index c2eef77c92..e3bb25e78f 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_hooks.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_hooks.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -42,7 +43,7 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // //meta:operation GET /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -67,6 +68,10 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64 // //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{ @@ -96,7 +101,7 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // //meta:operation PATCH /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err @@ -117,7 +122,7 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // //meta:operation POST /orgs/{org}/hooks/{hook_id}/pings func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v/pings", org, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -132,7 +137,7 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int6 // //meta:operation DELETE /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) + u := fmt.Sprintf("orgs/%v/hooks/%v", org, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/orgs_hooks_configuration.go b/vendor/github.com/google/go-github/v79/github/orgs_hooks_configuration.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/orgs_hooks_configuration.go rename to vendor/github.com/google/go-github/v79/github/orgs_hooks_configuration.go diff --git a/vendor/github.com/google/go-github/v67/github/orgs_hooks_deliveries.go b/vendor/github.com/google/go-github/v79/github/orgs_hooks_deliveries.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/orgs_hooks_deliveries.go rename to vendor/github.com/google/go-github/v79/github/orgs_hooks_deliveries.go diff --git a/vendor/github.com/google/go-github/v79/github/orgs_immutable_releases.go b/vendor/github.com/google/go-github/v79/github/orgs_immutable_releases.go new file mode 100644 index 0000000000..4e305947db --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/orgs_immutable_releases.go @@ -0,0 +1,174 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ImmutableReleaseSettings represents the response from the immutable releases settings endpoint. +type ImmutableReleaseSettings struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // SelectedRepositoriesURL provides the API URL for managing the repositories + // selected for immutable releases enforcement when EnforcedRepositories is set to "selected". + SelectedRepositoriesURL *string `json:"selected_repositories_url,omitempty"` +} + +// ImmutableReleasePolicy is for setting the immutable releases policy for repositories in an organization. +type ImmutableReleasePolicy struct { + // EnforcedRepositories specifies how immutable releases are enforced in the organization. Possible values include "all", "none", or "selected". + EnforcedRepositories *string `json:"enforced_repositories,omitempty"` + // An array of repository ids for which immutable releases enforcement should be applied. + // You can only provide a list of repository ids when the enforced_repositories is set to "selected" + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// setImmutableReleasesRepositoriesOptions represents the request body for setting repositories. +type setImmutableReleasesRepositoriesOptions struct { + SelectedRepositoryIDs []int64 `json:"selected_repository_ids"` +} + +// GetImmutableReleasesSettings returns the immutable releases configuration that applies to repositories within the given organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#get-immutable-releases-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) GetImmutableReleasesSettings(ctx context.Context, org string) (*ImmutableReleaseSettings, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var settings *ImmutableReleaseSettings + resp, err := s.client.Do(ctx, req, &settings) + if err != nil { + return nil, resp, err + } + + return settings, resp, nil +} + +// UpdateImmutableReleasesSettings sets immutable releases settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#set-immutable-releases-settings-for-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases +func (s *OrganizationsService) UpdateImmutableReleasesSettings(ctx context.Context, org string, opts ImmutableReleasePolicy) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases", org) + + req, err := s.client.NewRequest("PUT", u, opts) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// ListImmutableReleaseRepositories lists selected repositories for immutable releases enforcement in an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation GET /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) ListImmutableReleaseRepositories(ctx context.Context, org string, opts *ListOptions) (*ListRepositories, *Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repositories *ListRepositories + resp, err := s.client.Do(ctx, req, &repositories) + if err != nil { + return nil, resp, err + } + + return repositories, resp, nil +} + +// SetImmutableReleaseRepositories sets selected repositories for immutable releases enforcement. +// It requires the organization's immutable releases policy for enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#set-selected-repositories-for-immutable-releases-enforcement +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories +func (s *OrganizationsService) SetImmutableReleaseRepositories(ctx context.Context, org string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories", org) + + body := &setImmutableReleasesRepositoriesOptions{ + SelectedRepositoryIDs: repositoryIDs, + } + + req, err := s.client.NewRequest("PUT", u, body) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// EnableRepositoryForImmutableRelease enables a selected repository for immutable releases in an organization. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#enable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation PUT /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) EnableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisableRepositoryForImmutableRelease removes a repository from the organization's selected list for immutable releases enforcement. +// It requires enforced_repositories to be set to "selected". +// +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#disable-a-selected-repository-for-immutable-releases-in-an-organization +// +//meta:operation DELETE /orgs/{org}/settings/immutable-releases/repositories/{repository_id} +func (s *OrganizationsService) DisableRepositoryForImmutableRelease(ctx context.Context, org string, repoID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/settings/immutable-releases/repositories/%v", org, repoID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/orgs_issue_types.go b/vendor/github.com/google/go-github/v79/github/orgs_issue_types.go new file mode 100644 index 0000000000..a111dce3ff --- /dev/null +++ b/vendor/github.com/google/go-github/v79/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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var issueTypes []*IssueType + resp, err := s.client.Do(ctx, 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#create-issue-type-for-an-organization +// +//meta:operation POST /orgs/{org}/issue-types +func (s *OrganizationsService) CreateIssueType(ctx context.Context, org string, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { + u := fmt.Sprintf("orgs/%v/issue-types", org) + req, err := s.client.NewRequest("POST", u, opt) + if err != nil { + return nil, nil, err + } + + issueType := new(IssueType) + resp, err := s.client.Do(ctx, 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#update-issue-type-for-an-organization +// +//meta:operation PUT /orgs/{org}/issue-types/{issue_type_id} +func (s *OrganizationsService) UpdateIssueType(ctx context.Context, org string, issueTypeID int64, opt *CreateOrUpdateIssueTypesOptions) (*IssueType, *Response, error) { + u := fmt.Sprintf("orgs/%v/issue-types/%v", org, issueTypeID) + req, err := s.client.NewRequest("PUT", u, opt) + if err != nil { + return nil, nil, err + } + + issueType := new(IssueType) + resp, err := s.client.Do(ctx, 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#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("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/v67/github/orgs_members.go b/vendor/github.com/google/go-github/v79/github/orgs_members.go similarity index 99% rename from vendor/github.com/google/go-github/v67/github/orgs_members.go rename to vendor/github.com/google/go-github/v79/github/orgs_members.go index d818d7f9f8..002811c6ea 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_members.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_members.go @@ -69,7 +69,7 @@ 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 diff --git a/vendor/github.com/google/go-github/v79/github/orgs_network_configurations.go b/vendor/github.com/google/go-github/v79/github/orgs_network_configurations.go new file mode 100644 index 0000000000..82a819c204 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/orgs_network_configurations.go @@ -0,0 +1,236 @@ +// 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 + if err := validateNetworkSettingsID(networkIDs); err != nil { + return err + } + return nil +} + +// 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + configurations := &NetworkConfigurations{} + resp, err := s.client.Do(ctx, 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#create-a-hosted-compute-network-configuration-for-an-organization +// +//meta:operation POST /orgs/{org}/settings/network-configurations +func (s *OrganizationsService) CreateNetworkConfiguration(ctx context.Context, org string, createReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(createReq); err != nil { + return nil, nil, fmt.Errorf("validation failed: %w", err) + } + + u := fmt.Sprintf("orgs/%v/settings/network-configurations", org) + req, err := s.client.NewRequest("POST", u, createReq) + if err != nil { + return nil, nil, err + } + + configuration := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + configuration := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#update-a-hosted-compute-network-configuration-for-an-organization +// +//meta:operation PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id} +func (s *OrganizationsService) UpdateNetworkConfiguration(ctx context.Context, org, networkID string, updateReq NetworkConfigurationRequest) (*NetworkConfiguration, *Response, error) { + if err := validateNetworkConfigurationRequest(updateReq); err != nil { + 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("PATCH", u, updateReq) + if err != nil { + return nil, nil, err + } + + configuration := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#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("DELETE", u, nil) + if err != nil { + return nil, err + } + + configuration := &NetworkConfiguration{} + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + resource := &NetworkSettingsResource{} + resp, err := s.client.Do(ctx, req, resource) + if err != nil { + return nil, resp, err + } + return resource, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/orgs_organization_properties.go b/vendor/github.com/google/go-github/v79/github/orgs_organization_properties.go new file mode 100644 index 0000000000..ef997ec799 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/orgs_organization_properties.go @@ -0,0 +1,60 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// OrganizationCustomPropertyValues represents the custom property values for an organization. +type OrganizationCustomPropertyValues struct { + // List of custom property names and associated values to apply to the organization. + Properties []*CustomPropertyValue `json:"properties,omitempty"` +} + +// GetOrganizationCustomPropertyValues returns all custom property names and their values for an organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties-for-orgs#get-all-custom-property-values-for-an-organization +// +//meta:operation GET /organizations/{org}/org-properties/values +func (s *OrganizationsService) GetOrganizationCustomPropertyValues(ctx context.Context, org string) ([]*CustomPropertyValue, *Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var values []*CustomPropertyValue + resp, err := s.client.Do(ctx, req, &values) + if err != nil { + return nil, resp, err + } + + return values, resp, nil +} + +// CreateOrUpdateOrganizationCustomPropertyValues creates or updates custom property values for an organization. +// To remove a custom property value from an organization, set the property value to null. +// +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties-for-orgs#create-or-update-custom-property-values-for-an-organization +// +//meta:operation PATCH /organizations/{org}/org-properties/values +func (s *OrganizationsService) CreateOrUpdateOrganizationCustomPropertyValues(ctx context.Context, org string, values OrganizationCustomPropertyValues) (*Response, error) { + u := fmt.Sprintf("organizations/%v/org-properties/values", org) + req, err := s.client.NewRequest("PATCH", u, values) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/orgs_organization_roles.go b/vendor/github.com/google/go-github/v79/github/orgs_organization_roles.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/orgs_organization_roles.go rename to vendor/github.com/google/go-github/v79/github/orgs_organization_roles.go diff --git a/vendor/github.com/google/go-github/v67/github/orgs_outside_collaborators.go b/vendor/github.com/google/go-github/v79/github/orgs_outside_collaborators.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/orgs_outside_collaborators.go rename to vendor/github.com/google/go-github/v79/github/orgs_outside_collaborators.go index 56034d7260..72f885fed5 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_outside_collaborators.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_outside_collaborators.go @@ -57,7 +57,7 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#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) if err != nil { @@ -76,7 +76,7 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or // GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#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) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/orgs_packages.go b/vendor/github.com/google/go-github/v79/github/orgs_packages.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/orgs_packages.go rename to vendor/github.com/google/go-github/v79/github/orgs_packages.go diff --git a/vendor/github.com/google/go-github/v67/github/orgs_personal_access_tokens.go b/vendor/github.com/google/go-github/v79/github/orgs_personal_access_tokens.go similarity index 94% rename from vendor/github.com/google/go-github/v67/github/orgs_personal_access_tokens.go rename to vendor/github.com/google/go-github/v79/github/orgs_personal_access_tokens.go index af083744e8..8155ad402b 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_personal_access_tokens.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_personal_access_tokens.go @@ -7,8 +7,8 @@ package github import ( "context" + "errors" "fmt" - "net/http" "net/url" "strings" ) @@ -44,6 +44,12 @@ type PersonalAccessToken struct { // 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"` } @@ -94,7 +100,7 @@ func (s *OrganizationsService) ListFineGrainedPersonalAccessTokens(ctx context.C return nil, nil, err } - req, err := s.client.NewRequest(http.MethodGet, u, opts) + req, err := s.client.NewRequest("GET", u, opts) if err != nil { return nil, nil, err } @@ -125,7 +131,7 @@ type ReviewPersonalAccessTokenRequestOptions struct { func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID) - req, err := s.client.NewRequest(http.MethodPost, u, &opts) + req, err := s.client.NewRequest("POST", u, &opts) if err != nil { return nil, err } @@ -149,10 +155,14 @@ func addListFineGrainedPATOptions(s string, opts *ListFineGrainedPATOptions) (st 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, "&") diff --git a/vendor/github.com/google/go-github/v67/github/orgs_properties.go b/vendor/github.com/google/go-github/v79/github/orgs_properties.go similarity index 91% rename from vendor/github.com/google/go-github/v67/github/orgs_properties.go rename to vendor/github.com/google/go-github/v79/github/orgs_properties.go index d4fe5dfa07..0c23c91b22 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_properties.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_properties.go @@ -17,7 +17,11 @@ 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 type of the value for the property. Can be one of: string, single_select. + // 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"` // Whether the property is required. Required *bool `json:"required,omitempty"` @@ -42,8 +46,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. @@ -64,7 +75,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) @@ -195,7 +206,7 @@ func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, cu // GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#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 { diff --git a/vendor/github.com/google/go-github/v79/github/orgs_rules.go b/vendor/github.com/google/go-github/v79/github/orgs_rules.go new file mode 100644 index 0000000000..2b6a79387e --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/orgs_rules.go @@ -0,0 +1,147 @@ +// 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, 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("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{ + BypassActors: []*BypassActor{}, + } + + 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/v67/github/orgs_security_managers.go b/vendor/github.com/google/go-github/v79/github/orgs_security_managers.go similarity index 88% rename from vendor/github.com/google/go-github/v67/github/orgs_security_managers.go rename to vendor/github.com/google/go-github/v79/github/orgs_security_managers.go index 0803772732..b8562a2fd7 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_security_managers.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_security_managers.go @@ -12,6 +12,8 @@ import ( // ListSecurityManagerTeams lists all security manager teams for an organization. // +// Deprecated: Please use `client.Organizations.ListTeamsAssignedToOrgRole` instead. +// // GitHub API docs: https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams // //meta:operation GET /orgs/{org}/security-managers @@ -34,6 +36,8 @@ func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org // AddSecurityManagerTeam adds a team to the list of security managers for an organization. // +// Deprecated: Please use `client.Organizations.AssignOrgRoleToTeam` instead. +// // GitHub API docs: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team // //meta:operation PUT /orgs/{org}/security-managers/teams/{team_slug} @@ -49,6 +53,8 @@ func (s *OrganizationsService) AddSecurityManagerTeam(ctx context.Context, org, // 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 // //meta:operation DELETE /orgs/{org}/security-managers/teams/{team_slug} diff --git a/vendor/github.com/google/go-github/v67/github/orgs_users_blocking.go b/vendor/github.com/google/go-github/v79/github/orgs_users_blocking.go similarity index 86% rename from vendor/github.com/google/go-github/v67/github/orgs_users_blocking.go rename to vendor/github.com/google/go-github/v79/github/orgs_users_blocking.go index 62bd9116cd..60ee0f18ba 100644 --- a/vendor/github.com/google/go-github/v67/github/orgs_users_blocking.go +++ b/vendor/github.com/google/go-github/v79/github/orgs_users_blocking.go @@ -27,7 +27,6 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User @@ -44,7 +43,7 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, // GitHub API docs: https://docs.github.com/rest/orgs/blocking#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) @@ -52,7 +51,6 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s 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) @@ -65,7 +63,7 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s // GitHub API docs: https://docs.github.com/rest/orgs/blocking#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) @@ -73,7 +71,6 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s 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) @@ -84,7 +81,7 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s // GitHub API docs: https://docs.github.com/rest/orgs/blocking#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) @@ -92,7 +89,6 @@ func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v79/github/packages.go b/vendor/github.com/google/go-github/v79/github/packages.go new file mode 100644 index 0000000000..0ad0ed69ef --- /dev/null +++ b/vendor/github.com/google/go-github/v79/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/v79/github/private_registries.go b/vendor/github.com/google/go-github/v79/github/private_registries.go new file mode 100644 index 0000000000..ff8582c45d --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/private_registries.go @@ -0,0 +1,263 @@ +// Copyright 2025 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// PrivateRegistriesService handles communication with the private registries +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/private-registries +type PrivateRegistriesService service + +// PrivateRegistryType represents the type of private registry. +type PrivateRegistryType string + +const ( + PrivateRegistryTypeMavenRepository PrivateRegistryType = "maven_repository" + PrivateRegistryTypeNugetFeed PrivateRegistryType = "nuget_feed" + PrivateRegistryTypeGoProxyServer PrivateRegistryType = "goproxy_server" + PrivateRegistryTypeNpmRegistry PrivateRegistryType = "npm_registry" + PrivateRegistryTypeRubygemsServer PrivateRegistryType = "rubygems_server" + PrivateRegistryTypeCargoRegistry PrivateRegistryType = "cargo_registry" + PrivateRegistryTypeComposerRepository PrivateRegistryType = "composer_repository" + PrivateRegistryTypeDockerRegistry PrivateRegistryType = "docker_registry" + PrivateRegistryTypeGitSource PrivateRegistryType = "git_source" + PrivateRegistryTypeHelmRegistry PrivateRegistryType = "helm_registry" + PrivateRegistryTypeHexOrganization PrivateRegistryType = "hex_organization" + PrivateRegistryTypeHexRepository PrivateRegistryType = "hex_repository" + PrivateRegistryTypePubRepository PrivateRegistryType = "pub_repository" + PrivateRegistryTypePythonIndex PrivateRegistryType = "python_index" + PrivateRegistryTypeTerraformRegistry PrivateRegistryType = "terraform_registry" +) + +// PrivateRegistryVisibility represents the visibility of a private registry. +type PrivateRegistryVisibility string + +const ( + PrivateRegistryVisibilityPrivate PrivateRegistryVisibility = "private" + PrivateRegistryVisibilityAll PrivateRegistryVisibility = "all" + PrivateRegistryVisibilitySelected PrivateRegistryVisibility = "selected" +) + +// PrivateRegistry represents a private registry configuration. +type PrivateRegistry struct { + // Name of the private registry. + Name *string `json:"name,omitempty"` + // RegistryType is the type of private registry. You can find the list of supported types in PrivateRegistryType. + RegistryType *string `json:"registry_type,omitempty"` + // Username to use when authenticating with the private registry. + // This field is omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + // CreatedAt is the timestamp when the private registry was created. + CreatedAt *Timestamp `json:"created_at,omitempty"` + // UpdatedAt is the timestamp when the private registry was last updated. + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + // Visibility is the visibility of the private registry. Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` +} + +// PrivateRegistries represents a list of private registries. +type PrivateRegistries struct { + // TotalCount is the total number of private registries. + TotalCount *int `json:"total_count,omitempty"` + // Configurations is the list of private registry configurations. + Configurations []*PrivateRegistry `json:"configurations,omitempty"` +} + +// CreateOrganizationPrivateRegistry represents the payload to create a private registry. +type CreateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType string `json:"registry_type"` + + // URL is the URL of the private registry. + URL string `json:"url"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + EncryptedValue string `json:"encrypted_value"` + // KeyID is the ID of the public key used to encrypt the secret. + KeyID string `json:"key_id"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility PrivateRegistryVisibility `json:"visibility"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// UpdateOrganizationPrivateRegistry represents the payload to update a private registry. +type UpdateOrganizationPrivateRegistry struct { + // RegistryType is the type of private registry. + // You can find the list of supported types in PrivateRegistryType. + RegistryType *string `json:"registry_type,omitempty"` + + // URL is the URL of the private registry. + URL *string `json:"url,omitempty"` + + // The username to use when authenticating with the private registry. + // This field should be omitted if the private registry does not require a username for authentication. + Username *string `json:"username,omitempty"` + + // The value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) + // using the public key retrieved from the PrivateRegistriesService.GetOrganizationPrivateRegistriesPublicKey. + EncryptedValue *string `json:"encrypted_value,omitempty"` + // KeyID is the ID of the public key used to encrypt the secret. + KeyID *string `json:"key_id,omitempty"` + // Visibility is the visibility of the private registry. + // Possible values are: "private", "all", and "selected". + Visibility *PrivateRegistryVisibility `json:"visibility,omitempty"` + + // An array of repository IDs that can access the organization private registry. + // You can only provide a list of repository IDs when CreateOrganizationPrivateRegistry.Visibility is set to PrivateRegistryVisibilitySelected. + // This field should be omitted if visibility is set to PrivateRegistryVisibilityAll or PrivateRegistryVisibilityPrivate. + SelectedRepositoryIDs []int64 `json:"selected_repository_ids,omitempty"` +} + +// ListOrganizationPrivateRegistries lists private registries for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#list-private-registries-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries +func (s *PrivateRegistriesService) ListOrganizationPrivateRegistries(ctx context.Context, org string, opts *ListOptions) (*PrivateRegistries, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var privateRegistries PrivateRegistries + resp, err := s.client.Do(ctx, req, &privateRegistries) + if err != nil { + return nil, resp, err + } + return &privateRegistries, resp, nil +} + +// CreateOrganizationPrivateRegistry creates a private registry configuration with an encrypted value for an organization. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#create-a-private-registry-for-an-organization +// +//meta:operation POST /orgs/{org}/private-registries +func (s *PrivateRegistriesService) CreateOrganizationPrivateRegistry(ctx context.Context, org string, privateRegistry CreateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries", org) + + req, err := s.client.NewRequest("POST", u, privateRegistry) + if err != nil { + return nil, nil, err + } + + var result PrivateRegistry + resp, err := s.client.Do(ctx, req, &result) + if err != nil { + return nil, resp, err + } + return &result, resp, nil +} + +// GetOrganizationPrivateRegistriesPublicKey retrieves the public key for encrypting secrets for an organization's private registries. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#get-private-registries-public-key-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/public-key +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistriesPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/public-key", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var publicKey PublicKey + resp, err := s.client.Do(ctx, req, &publicKey) + if err != nil { + return nil, resp, err + } + return &publicKey, resp, nil +} + +// GetOrganizationPrivateRegistry gets a specific private registry for an organization. +// The `name` parameter is the name of the private registry to retrieve. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#get-a-private-registry-for-an-organization +// +//meta:operation GET /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) GetOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var privateRegistry PrivateRegistry + resp, err := s.client.Do(ctx, req, &privateRegistry) + if err != nil { + return nil, resp, err + } + + return &privateRegistry, resp, nil +} + +// UpdateOrganizationPrivateRegistry updates a specific private registry for an organization. +// The `name` parameter is the name of the private registry to update. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#update-a-private-registry-for-an-organization +// +//meta:operation PATCH /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) UpdateOrganizationPrivateRegistry(ctx context.Context, org, secretName string, privateRegistry UpdateOrganizationPrivateRegistry) (*PrivateRegistry, *Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("PATCH", u, privateRegistry) + if err != nil { + return nil, nil, err + } + + var updatedRegistry PrivateRegistry + resp, err := s.client.Do(ctx, req, &updatedRegistry) + if err != nil { + return nil, resp, err + } + + return &updatedRegistry, resp, nil +} + +// DeleteOrganizationPrivateRegistry deletes a specific private registry for an organization. +// The `name` parameter is the name of the private registry to delete. It is the same as PrivateRegistry.Name. +// +// GitHub API docs: https://docs.github.com/rest/private-registries/organization-configurations#delete-a-private-registry-for-an-organization +// +//meta:operation DELETE /orgs/{org}/private-registries/{secret_name} +func (s *PrivateRegistriesService) DeleteOrganizationPrivateRegistry(ctx context.Context, org, secretName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/private-registries/%v", org, secretName) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/projects.go b/vendor/github.com/google/go-github/v79/github/projects.go new file mode 100644 index 0000000000..af602bc565 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/projects.go @@ -0,0 +1,561 @@ +// 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" +) + +// ProjectsService handles communication with the project V2 +// methods of the GitHub API. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects +type ProjectsService service + +// 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"` +} + +func (p ProjectV2) String() string { return Stringify(p) } + +// ListProjectsPaginationOptions specifies optional parameters to list projects for user / organization. +// +// Note: Pagination is powered by before/after cursor-style pagination. After the initial call, +// inspect the returned *Response. Use resp.After as the opts.After value to request +// the next page, and resp.Before as the opts.Before value to request the previous +// page. Set either Before or After for a request; if both are +// supplied GitHub API will return an error. PerPage controls the number of items +// per page (max 100 per GitHub API docs). +type ListProjectsPaginationOptions struct { + // A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. + Before *string `url:"before,omitempty"` + + // A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. + After *string `url:"after,omitempty"` + + // For paginated result sets, the number of results to include per page. + PerPage *int `url:"per_page,omitempty"` +} + +// ListProjectsOptions specifies optional parameters to list projects for user / organization. +type ListProjectsOptions struct { + ListProjectsPaginationOptions + + // Q is an optional query string to limit results to projects of the specified type. + Query *string `url:"q,omitempty"` +} + +// ProjectV2TextContent represents text content in a project field option or iteration. +// It includes both HTML and raw text representations. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2TextContent struct { + HTML *string `json:"html,omitempty"` + Raw *string `json:"raw,omitempty"` +} + +// ProjectV2FieldOption represents an option for a project field of type single_select or multi_select. +// It defines the available choices that can be selected for dropdown-style fields. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldOption struct { + ID *string `json:"id,omitempty"` // The unique identifier for this option. + Color *string `json:"color,omitempty"` // The color associated with this option (e.g., "blue", "red"). + Description *ProjectV2TextContent `json:"description,omitempty"` // An optional description for this option. + Name *ProjectV2TextContent `json:"name,omitempty"` // The display name of the option. +} + +// ProjectV2FieldIteration represents an iteration within a project field of type iteration. +// It defines a specific time-bound period that can be associated with project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldIteration struct { + ID *string `json:"id,omitempty"` // The unique identifier for the iteration. + Title *ProjectV2TextContent `json:"title,omitempty"` // The title of the iteration. + StartDate *string `json:"start_date,omitempty"` // The start date of the iteration in ISO 8601 format. + Duration *int `json:"duration,omitempty"` // The duration of the iteration in seconds. +} + +// ProjectV2FieldConfiguration represents the configuration for a project field of type iteration. +// It defines settings such as duration and start day for iterations within the project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2FieldConfiguration struct { + Duration *int `json:"duration,omitempty"` // The duration of the iteration field in seconds. + StartDay *int `json:"start_day,omitempty"` // The start day for the iteration. + Iterations []*ProjectV2FieldIteration `json:"iterations,omitempty"` // The list of iterations associated with the configuration. +} + +// ProjectV2Field represents a field in a GitHub Projects V2 project. +// Fields define the structure and data types for project items. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields +type ProjectV2Field struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + DataType *string `json:"data_type,omitempty"` + ProjectURL *string `json:"project_url,omitempty"` + Options []*ProjectV2FieldOption `json:"options,omitempty"` + Configuration *ProjectV2FieldConfiguration `json:"configuration,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// ListOrganizationProjects lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-projects-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2 +func (s *ProjectsService) ListOrganizationProjects(ctx context.Context, org string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(ctx, req, &projects) + if err != nil { + return nil, resp, err + } + return projects, resp, nil +} + +// GetOrganizationProject gets a Projects V2 project for an organization by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#get-project-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number} +func (s *ProjectsService) GetOrganizationProject(ctx context.Context, org string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v", org, projectNumber) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + project := new(ProjectV2) + resp, err := s.client.Do(ctx, req, project) + if err != nil { + return nil, resp, err + } + return project, resp, nil +} + +// ListUserProjects lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-projects-for-user +// +//meta:operation GET /users/{username}/projectsV2 +func (s *ProjectsService) ListUserProjects(ctx context.Context, username string, opts *ListProjectsOptions) ([]*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2", username) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var projects []*ProjectV2 + resp, err := s.client.Do(ctx, req, &projects) + if err != nil { + return nil, resp, err + } + return projects, resp, nil +} + +// GetUserProject gets a Projects V2 project for a user by ID. +// +// GitHub API docs: https://docs.github.com/rest/projects/projects#get-project-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number} +func (s *ProjectsService) GetUserProject(ctx context.Context, username string, projectNumber int) (*ProjectV2, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v", username, projectNumber) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + project := new(ProjectV2) + resp, err := s.client.Do(ctx, req, project) + if err != nil { + return nil, resp, err + } + return project, resp, nil +} + +// ListOrganizationProjectFields lists Projects V2 for an organization. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#list-project-fields-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListOrganizationProjectFields(ctx context.Context, org string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(ctx, req, &fields) + if err != nil { + return nil, resp, err + } + return fields, resp, nil +} + +// ListUserProjectFields lists Projects V2 for a user. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#list-project-fields-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields +func (s *ProjectsService) ListUserProjectFields(ctx context.Context, user string, projectNumber int, opts *ListProjectsOptions) ([]*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields", user, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var fields []*ProjectV2Field + resp, err := s.client.Do(ctx, req, &fields) + if err != nil { + return nil, resp, err + } + return fields, resp, nil +} + +// GetOrganizationProjectField gets a single project field from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#get-project-field-for-organization +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetOrganizationProjectField(ctx context.Context, org string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/fields/%v", org, projectNumber, fieldID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + field := new(ProjectV2Field) + resp, err := s.client.Do(ctx, req, field) + if err != nil { + return nil, resp, err + } + return field, resp, nil +} + +// GetUserProjectField gets a single project field from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/fields#get-project-field-for-user +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/fields/{field_id} +func (s *ProjectsService) GetUserProjectField(ctx context.Context, user string, projectNumber int, fieldID int64) (*ProjectV2Field, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/fields/%v", user, projectNumber, fieldID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + field := new(ProjectV2Field) + resp, err := s.client.Do(ctx, req, field) + if err != nil { + return nil, resp, err + } + return field, resp, nil +} + +// ListProjectItemsOptions specifies optional parameters when listing project items. +// Note: Pagination uses before/after cursor-style pagination similar to ListProjectsOptions. +// "Fields" can be used to restrict which field values are returned (by their numeric IDs). +type ListProjectItemsOptions struct { + // Embed ListProjectsOptions to reuse pagination and query parameters. + ListProjectsOptions + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// GetProjectItemOptions specifies optional parameters when getting a project item. +type GetProjectItemOptions struct { + // Fields restricts which field values are returned by numeric field IDs. + Fields []int64 `url:"fields,omitempty,comma"` +} + +// AddProjectItemOptions represents the payload to add an item (issue or pull request) +// to a project. The Type must be either "Issue" or "PullRequest" (as per API docs) and +// ID is the numerical ID of that issue or pull request. +type AddProjectItemOptions struct { + Type string `json:"type,omitempty"` + ID int64 `json:"id,omitempty"` +} + +// UpdateProjectV2Field represents a field update for a project item. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-organization +type UpdateProjectV2Field struct { + // ID is the field ID to update. + ID int64 `json:"id"` + // Value is the new value to set for the field. The type depends on the field type. + // For text fields: string + // For number fields: float64 or int + // For single_select fields: string (option ID) + // For date fields: string (ISO 8601 date) + // For iteration fields: string (iteration ID) + // Note: Some field types (title, assignees, labels, etc.) are read-only or managed through other API endpoints. + Value any `json:"value"` +} + +// UpdateProjectItemOptions represents fields that can be modified for a project item. +// The GitHub API expects either archived status updates or field value updates. +type UpdateProjectItemOptions struct { + // Archived indicates whether the item should be archived (true) or unarchived (false). + // This is used for archive/unarchive operations. + Archived *bool `json:"archived,omitempty"` + // Fields contains field updates to apply to the project item. + // Each entry specifies a field ID and its new value. + Fields []*UpdateProjectV2Field `json:"fields,omitempty"` +} + +// ListOrganizationProjectItems lists items for an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#list-items-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) ListOrganizationProjectItems(ctx context.Context, org string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var items []*ProjectV2Item + resp, err := s.client.Do(ctx, req, &items) + if err != nil { + return nil, resp, err + } + return items, resp, nil +} + +// AddOrganizationProjectItem adds an issue or pull request item to an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#add-item-to-organization-owned-project +// +//meta:operation POST /orgs/{org}/projectsV2/{project_number}/items +func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items", org, projectNumber) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// GetOrganizationProjectItem gets a single item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#get-an-item-for-an-organization-owned-project +// +//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// UpdateOrganizationProjectItem updates an item in an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-organization +// +//meta:operation PATCH /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// DeleteOrganizationProjectItem deletes an item from an organization owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#delete-project-item-for-organization +// +//meta:operation DELETE /orgs/{org}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteOrganizationProjectItem(ctx context.Context, org string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/projectsV2/%v/items/%v", org, projectNumber, itemID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} + +// ListUserProjectItems lists items for a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#list-items-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) ListUserProjectItems(ctx context.Context, username string, projectNumber int, opts *ListProjectItemsOptions) ([]*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + var items []*ProjectV2Item + resp, err := s.client.Do(ctx, req, &items) + if err != nil { + return nil, resp, err + } + return items, resp, nil +} + +// AddUserProjectItem adds an issue or pull request item to a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#add-item-to-user-owned-project +// +//meta:operation POST /users/{username}/projectsV2/{project_number}/items +func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username string, projectNumber int, opts *AddProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items", username, projectNumber) + req, err := s.client.NewRequest("POST", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// GetUserProjectItem gets a single item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#get-an-item-for-a-user-owned-project +// +//meta:operation GET /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) GetUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *GetProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// UpdateUserProjectItem updates an item in a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-user +// +//meta:operation PATCH /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) UpdateUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64, opts *UpdateProjectItemOptions) (*ProjectV2Item, *Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + item := new(ProjectV2Item) + resp, err := s.client.Do(ctx, req, item) + if err != nil { + return nil, resp, err + } + return item, resp, nil +} + +// DeleteUserProjectItem deletes an item from a user owned project. +// +// GitHub API docs: https://docs.github.com/rest/projects/items#delete-project-item-for-user +// +//meta:operation DELETE /users/{username}/projectsV2/{project_number}/items/{item_id} +func (s *ProjectsService) DeleteUserProjectItem(ctx context.Context, username string, projectNumber int, itemID int64) (*Response, error) { + u := fmt.Sprintf("users/%v/projectsV2/%v/items/%v", username, projectNumber, itemID) + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v67/github/pulls.go b/vendor/github.com/google/go-github/v79/github/pulls.go similarity index 73% rename from vendor/github.com/google/go-github/v67/github/pulls.go rename to vendor/github.com/google/go-github/v79/github/pulls.go index 35ceda4467..aefd08a6dd 100644 --- a/vendor/github.com/google/go-github/v67/github/pulls.go +++ b/vendor/github.com/google/go-github/v79/github/pulls.go @@ -28,49 +28,57 @@ 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"` - Merged *bool `json:"merged,omitempty"` - Mergeable *bool `json:"mergeable,omitempty"` - MergeableState *string `json:"mergeable_state,omitempty"` - MergedBy *User `json:"merged_by,omitempty"` - MergeCommitSHA *string `json:"merge_commit_sha,omitempty"` - Rebaseable *bool `json:"rebaseable,omitempty"` - Comments *int `json:"comments,omitempty"` - Commits *int `json:"commits,omitempty"` - Additions *int `json:"additions,omitempty"` - Deletions *int `json:"deletions,omitempty"` - ChangedFiles *int `json:"changed_files,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"` - ReviewComments *int `json:"review_comments,omitempty"` - Assignee *User `json:"assignee,omitempty"` - Assignees []*User `json:"assignees,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` - AuthorAssociation *string `json:"author_association,omitempty"` - NodeID *string `json:"node_id,omitempty"` - RequestedReviewers []*User `json:"requested_reviewers,omitempty"` - AutoMerge *PullRequestAutoMerge `json:"auto_merge,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"` + 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#get-a-pull-request + AuthorAssociation *string `json:"author_association,omitempty"` + NodeID *string `json:"node_id,omitempty"` + RequestedReviewers []*User `json:"requested_reviewers,omitempty"` + AutoMerge *PullRequestAutoMerge `json:"auto_merge,omitempty"` + + // These fields are not populated by the List operation. + Merged *bool `json:"merged,omitempty"` + Mergeable *bool `json:"mergeable,omitempty"` + MergeableState *string `json:"mergeable_state,omitempty"` + Rebaseable *bool `json:"rebaseable,omitempty"` + MergedBy *User `json:"merged_by,omitempty"` + MergeCommitSHA *string `json:"merge_commit_sha,omitempty"` + Comments *int `json:"comments,omitempty"` + Commits *int `json:"commits,omitempty"` + Additions *int `json:"additions,omitempty"` + Deletions *int `json:"deletions,omitempty"` + ChangedFiles *int `json:"changed_files,omitempty"` + MaintainerCanModify *bool `json:"maintainer_can_modify,omitempty"` + ReviewComments *int `json:"review_comments,omitempty"` // RequestedTeams is populated as part of the PullRequestEvent. // See, https://docs.github.com/developers/webhooks-and-events/github-event-types#pullrequestevent for an example. @@ -134,7 +142,7 @@ type PullRequestListOptions struct { Sort string `url:"sort,omitempty"` // Direction in which to sort pull requests. Possible values are: asc, desc. - // If Sort is "created" or not specified, Default is "desc", otherwise Default + // If Sort is "created" or not specified, Default is "desc"; otherwise, Default // is "asc" Direction string `url:"direction,omitempty"` @@ -146,7 +154,7 @@ type PullRequestListOptions struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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 { @@ -167,10 +175,12 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin return pulls, resp, nil } -// ListPullRequestsWithCommit returns pull requests associated with a commit SHA. +// ListPullRequestsWithCommit returns pull requests associated with a commit SHA +// or branch name. // -// The results may include open and closed pull requests. -// By default, the PullRequestListOptions State filters for "open". +// The results may include open and closed pull requests. If the commit SHA is +// 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 // @@ -187,7 +197,6 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var pulls []*PullRequest resp, err := s.client.Do(ctx, req, &pulls) @@ -203,8 +212,8 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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) +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("GET", u, nil) if err != nil { return nil, nil, err @@ -224,8 +233,8 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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) +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("GET", u, nil) if err != nil { return "", nil, err @@ -237,7 +246,7 @@ 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 @@ -273,7 +282,7 @@ type NewPullRequest struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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, pull *NewPullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) req, err := s.client.NewRequest("POST", u, pull) if err != nil { @@ -315,14 +324,13 @@ type PullRequestBranchUpdateResponse struct { // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/update-branch", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeUpdatePullRequestBranchPreview) p := new(PullRequestBranchUpdateResponse) @@ -351,12 +359,12 @@ type pullRequestUpdate struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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, @@ -390,8 +398,8 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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 @@ -416,8 +424,8 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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 @@ -442,8 +450,8 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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) +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("GET", u, nil) if err != nil { return false, nil, err @@ -486,8 +494,8 @@ type pullRequestMergeRequest struct { // GitHub API docs: https://docs.github.com/rest/pulls/pulls#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{} if commitMessage != "" { diff --git a/vendor/github.com/google/go-github/v67/github/pulls_comments.go b/vendor/github.com/google/go-github/v79/github/pulls_comments.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/pulls_comments.go rename to vendor/github.com/google/go-github/v79/github/pulls_comments.go index a9ffe8d7cc..03b3c1d205 100644 --- a/vendor/github.com/google/go-github/v67/github/pulls_comments.go +++ b/vendor/github.com/google/go-github/v79/github/pulls_comments.go @@ -37,6 +37,10 @@ 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". + // + // 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#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"` @@ -78,7 +82,7 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri if number == 0 { u = fmt.Sprintf("repos/%v/%v/pulls/comments", owner, repo) } else { - u = fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u = fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) } u, err := addOptions(u, opts) if err != nil { @@ -90,7 +94,6 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -109,13 +112,12 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // //meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -134,12 +136,11 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err } - // TODO: remove custom Accept headers when their respective API fully launches. acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -165,7 +166,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, Body: body, InReplyTo: commentID, } - u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) if err != nil { return nil, nil, err @@ -187,7 +188,7 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // //meta:operation PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) if err != nil { return nil, nil, err @@ -208,7 +209,7 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // //meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) + u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/pulls_reviewers.go b/vendor/github.com/google/go-github/v79/github/pulls_reviewers.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/pulls_reviewers.go rename to vendor/github.com/google/go-github/v79/github/pulls_reviewers.go index 9dd60ae688..9d14247414 100644 --- a/vendor/github.com/google/go-github/v67/github/pulls_reviewers.go +++ b/vendor/github.com/google/go-github/v79/github/pulls_reviewers.go @@ -36,7 +36,7 @@ type removeReviewersRequest struct { // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("POST", u, &reviewers) if err != nil { return nil, nil, err @@ -57,7 +57,7 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // //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 := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -85,18 +85,15 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { // reviewers.Reviewers may be empty if the caller wants to remove teams, but not users. Unlike AddReviewers, // "reviewers" is a required param here. Reference: https://github.com/google/go-github/issues/3336 - removeRequest := removeReviewersRequest{ - NodeID: reviewers.NodeID, - Reviewers: reviewers.Reviewers, - TeamReviewers: reviewers.TeamReviewers, - } + // The type `removeReviewersRequest` is required because the struct tags are different from `ReviewersRequest`. + removeRequest := removeReviewersRequest(reviewers) if removeRequest.Reviewers == nil { // GitHub accepts the empty list, but rejects null. Removing `omitempty` is not enough - we also have to promote nil to []. removeRequest.Reviewers = []string{} } - u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, &removeRequest) if err != nil { return nil, err diff --git a/vendor/github.com/google/go-github/v67/github/pulls_reviews.go b/vendor/github.com/google/go-github/v79/github/pulls_reviews.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/pulls_reviews.go rename to vendor/github.com/google/go-github/v79/github/pulls_reviews.go index 27b8dc37d5..e8cf7a75b0 100644 --- a/vendor/github.com/google/go-github/v67/github/pulls_reviews.go +++ b/vendor/github.com/google/go-github/v79/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#get-a-review-for-a-pull-request AuthorAssociation *string `json:"author_association,omitempty"` } @@ -104,7 +108,7 @@ func (r PullRequestReviewDismissalRequest) String() string { // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -130,7 +134,7 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -152,7 +156,7 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // //meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -174,7 +178,7 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // //meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/comments", owner, repo, number, reviewID) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -234,7 +238,7 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews", owner, repo, number) req, err := s.client.NewRequest("POST", u, review) if err != nil { @@ -268,7 +272,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri opts := &struct { Body string `json:"body"` }{Body: body} - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v", owner, repo, number, reviewID) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { @@ -290,7 +294,7 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // //meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/events", owner, repo, number, reviewID) req, err := s.client.NewRequest("POST", u, review) if err != nil { @@ -312,7 +316,7 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // //meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) + u := fmt.Sprintf("repos/%v/%v/pulls/%v/reviews/%v/dismissals", owner, repo, number, reviewID) req, err := s.client.NewRequest("PUT", u, review) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/pulls_threads.go b/vendor/github.com/google/go-github/v79/github/pulls_threads.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/pulls_threads.go rename to vendor/github.com/google/go-github/v79/github/pulls_threads.go diff --git a/vendor/github.com/google/go-github/v67/github/rate_limit.go b/vendor/github.com/google/go-github/v79/github/rate_limit.go similarity index 85% rename from vendor/github.com/google/go-github/v67/github/rate_limit.go rename to vendor/github.com/google/go-github/v79/github/rate_limit.go index 5b01b573d8..6236eba8fb 100644 --- a/vendor/github.com/google/go-github/v67/github/rate_limit.go +++ b/vendor/github.com/google/go-github/v79/github/rate_limit.go @@ -12,14 +12,22 @@ type RateLimitService service // Rate represents the rate limit for the current client. type Rate struct { - // The number of requests per hour the client is currently limited to. + // The maximum number of requests that you can make per hour. Limit int `json:"limit"` - // The number of remaining requests the client can make this hour. + // The number of requests remaining in the current rate limit window. Remaining int `json:"remaining"` - // The time at which the current rate limit will reset. + // The number of requests you have made in the current rate limit window. + Used int `json:"used"` + + // The time at which the current rate limit window resets, in UTC epoch seconds. Reset Timestamp `json:"reset"` + + // 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 + Resource string `json:"resource,omitempty"` } func (r Rate) String() string { @@ -77,7 +85,7 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err }) // This resource is not subject to rate limits. - ctx = context.WithValue(ctx, bypassRateLimitCheck, true) + ctx = context.WithValue(ctx, BypassRateLimitCheck, true) resp, err := s.client.Do(ctx, req, response) if err != nil { return nil, resp, err diff --git a/vendor/github.com/google/go-github/v67/github/reactions.go b/vendor/github.com/google/go-github/v79/github/reactions.go similarity index 87% rename from vendor/github.com/google/go-github/v67/github/reactions.go rename to vendor/github.com/google/go-github/v79/github/reactions.go index 1aa7ac38f2..d659fa39c2 100644 --- a/vendor/github.com/google/go-github/v67/github/reactions.go +++ b/vendor/github.com/google/go-github/v79/github/reactions.go @@ -8,7 +8,6 @@ package github import ( "context" "fmt" - "net/http" ) // ReactionsService provides access to the reactions-related functions in the @@ -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". @@ -63,7 +62,7 @@ type ListCommentReactionOptions struct { // GitHub API docs: https://docs.github.com/rest/reactions/reactions#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 { @@ -75,7 +74,6 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -98,13 +96,12 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("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{} @@ -143,7 +140,7 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID // GitHub API docs: https://docs.github.com/rest/reactions/reactions#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 { @@ -155,7 +152,6 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -178,13 +174,12 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("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{} @@ -223,7 +218,7 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, // GitHub API docs: https://docs.github.com/rest/reactions/reactions#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 { @@ -235,7 +230,6 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -258,13 +252,12 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("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{} @@ -303,7 +296,7 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r // GitHub API docs: https://docs.github.com/rest/reactions/reactions#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 { @@ -315,7 +308,6 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) var m []*Reaction @@ -338,13 +330,12 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("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{} @@ -383,7 +374,7 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont // GitHub API docs: https://docs.github.com/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 { @@ -415,7 +406,7 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -459,7 +450,7 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont // GitHub API docs: https://docs.github.com/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 { @@ -490,7 +481,7 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -530,12 +521,11 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(c } func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) + req, err := s.client.NewRequest("DELETE", url, nil) if err != nil { return nil, err } - // TODO: remove custom Accept headers when APIs fully launch. req.Header.Set("Accept", mediaTypeReactionsPreview) return s.client.Do(ctx, req, nil) @@ -552,7 +542,7 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res 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: String(content)} + body := &Reaction{Content: Ptr(content)} req, err := s.client.NewRequest("POST", u, body) if err != nil { return nil, nil, err @@ -568,3 +558,53 @@ func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, rep return m, resp, nil } + +// ListReleaseReactions lists the reactions for a release. +// +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + req.Header.Set("Accept", mediaTypeReactionsPreview) + + var m []*Reaction + resp, err := s.client.Do(ctx, 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#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#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/v67/github/repos.go b/vendor/github.com/google/go-github/v79/github/repos.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/repos.go rename to vendor/github.com/google/go-github/v79/github/repos.go index 9faed401f8..0119a01b5c 100644 --- a/vendor/github.com/google/go-github/v67/github/repos.go +++ b/vendor/github.com/google/go-github/v79/github/repos.go @@ -27,59 +27,59 @@ type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. - Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions map[string]bool `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" - Topics []string `json:"topics,omitempty"` - CustomProperties map[string]interface{} `json:"custom_properties,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Description *string `json:"description,omitempty"` + Homepage *string `json:"homepage,omitempty"` + CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + MirrorURL *string `json:"mirror_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Language *string `json:"language,omitempty"` + Fork *bool `json:"fork,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + NetworkCount *int `json:"network_count,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. + StargazersCount *int `json:"stargazers_count,omitempty"` + SubscribersCount *int `json:"subscribers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. + Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. + Size *int `json:"size,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + Parent *Repository `json:"parent,omitempty"` + Source *Repository `json:"source,omitempty"` + TemplateRepository *Repository `json:"template_repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Permissions map[string]bool `json:"permissions,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]any `json:"custom_properties,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` // Only provided when using RepositoriesService.Get while in preview License *License `json:"license,omitempty"` @@ -303,7 +303,7 @@ type RepositoryListByUserOptions struct { Sort string `url:"sort,omitempty"` // The order to sort by. - // Default: asc when using full_name, otherwise desc. + // Default: asc when using full_name; otherwise, desc. // Can be one of: asc, desc Direction string `url:"direction,omitempty"` @@ -434,7 +434,6 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *R return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -536,6 +535,10 @@ type createRepoRequest struct { //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) { + if repo == nil { + return nil, nil, errors.New("repository must be provided") + } + var u string if org != "" { u = fmt.Sprintf("orgs/%v/repos", org) @@ -634,7 +637,6 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep return nil, nil, err } - // TODO: remove custom Accept header when the license support fully launches // https://docs.github.com/rest/licenses/#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, @@ -667,7 +669,6 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeCodesOfConductPreview) r := new(Repository) @@ -685,7 +686,7 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // //meta:operation GET /repositories/{repository_id} func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { - u := fmt.Sprintf("repositories/%d", id) + u := fmt.Sprintf("repositories/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -785,7 +786,6 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, return false, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) resp, err := s.client.Do(ctx, req, nil) @@ -806,7 +806,6 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) return s.client.Do(ctx, req, nil) @@ -825,7 +824,6 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredVulnerabilityAlertsPreview) return s.client.Do(ctx, req, nil) @@ -833,7 +831,7 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow // 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#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) { @@ -854,7 +852,7 @@ 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#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) { @@ -870,7 +868,7 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, // 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#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) { @@ -889,7 +887,7 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, // GitHub API docs: https://docs.github.com/rest/repos/repos#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 { @@ -922,7 +920,7 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string // GitHub API docs: https://docs.github.com/rest/repos/repos#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) if err != nil { @@ -943,7 +941,7 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r // GitHub API docs: https://docs.github.com/rest/repos/repos#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 { @@ -977,7 +975,7 @@ type RepositoryTag struct { // GitHub API docs: https://docs.github.com/rest/repos/repos#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 { @@ -1010,7 +1008,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 +1072,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 +1092,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 +1170,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 +1200,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"` @@ -1403,7 +1409,7 @@ type AutomatedSecurityFixes struct { // GitHub API docs: https://docs.github.com/rest/branches/branches#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 { @@ -1441,7 +1447,7 @@ func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status) + return nil, newResponse(resp), fmt.Errorf("unexpected status code: %v", resp.Status) } b := new(Branch) @@ -1495,7 +1501,6 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) p := new(Protection) @@ -1575,7 +1580,6 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) p := new(Protection) @@ -1618,7 +1622,6 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) p := new(SignaturesProtectedBranch) @@ -1645,7 +1648,6 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) r := new(SignaturesProtectedBranch) @@ -1671,7 +1673,6 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co return nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeSignaturePreview) return s.client.Do(ctx, req, nil) @@ -1752,7 +1753,6 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1779,7 +1779,6 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1811,7 +1810,6 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches req.Header.Set("Accept", mediaTypeRequiredApprovingReviewsPreview) r := new(PullRequestReviewsEnforcement) @@ -1921,7 +1919,6 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) topics := new(repositoryTopics) @@ -1951,7 +1948,6 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) t = new(repositoryTopics) @@ -2355,8 +2351,8 @@ func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, // isBranchNotProtected determines whether a branch is not protected // based on the error message returned by GitHub API. func isBranchNotProtected(err error) bool { - errorResponse, ok := err.(*ErrorResponse) - return ok && errorResponse.Message == githubBranchNotProtected + var errorResponse *ErrorResponse + return errors.As(err, &errorResponse) && errorResponse.Message == githubBranchNotProtected } // EnablePrivateReporting enables private reporting of vulnerabilities for a @@ -2426,3 +2422,99 @@ func (s *RepositoriesService) IsPrivateReportingEnabled(ctx context.Context, own resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var activities []*RepositoryActivity + resp, err := s.client.Do(ctx, req, &activities) + if err != nil { + return nil, resp, err + } + + return activities, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/repos_actions_access.go b/vendor/github.com/google/go-github/v79/github/repos_actions_access.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_actions_access.go rename to vendor/github.com/google/go-github/v79/github/repos_actions_access.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_actions_allowed.go b/vendor/github.com/google/go-github/v79/github/repos_actions_allowed.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_actions_allowed.go rename to vendor/github.com/google/go-github/v79/github/repos_actions_allowed.go diff --git a/vendor/github.com/google/go-github/v79/github/repos_actions_permissions.go b/vendor/github.com/google/go-github/v79/github/repos_actions_permissions.go new file mode 100644 index 0000000000..7e56c3f396 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/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 +type ActionsPermissionsRepository struct { + Enabled *bool `json:"enabled,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` + SHAPinningRequired *bool `json:"sha_pinning_required,omitempty"` +} + +func (a ActionsPermissionsRepository) String() string { + 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 +} + +// UpdateActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions +func (s *RepositoriesService) UpdateActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) + if err != nil { + 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 +} + +// UpdateDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) UpdateDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + 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 +} + +// GetArtifactAndLogRetentionPeriod gets the artifact and log retention period for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + arp := new(ArtifactPeriod) + resp, err := s.client.Do(ctx, 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#set-artifact-and-log-retention-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/artifact-and-log-retention +func (s *RepositoriesService) UpdateArtifactAndLogRetentionPeriod(ctx context.Context, owner, repo string, period ArtifactPeriodOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/artifact-and-log-retention", owner, repo) + req, err := s.client.NewRequest("PUT", u, period) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(WorkflowsPermissions) + resp, err := s.client.Do(ctx, 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#set-private-repo-fork-pr-workflow-settings-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-workflows-private-repos +func (s *RepositoriesService) UpdatePrivateRepoForkPRWorkflowSettings(ctx context.Context, owner, repo string, permissions *WorkflowsPermissionsOpt) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-workflows-private-repos", owner, repo) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// GetForkPRContributorApprovalPermissions gets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) GetForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string) (*ContributorApprovalPermissions, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + policy := new(ContributorApprovalPermissions) + resp, err := s.client.Do(ctx, req, policy) + if err != nil { + return nil, resp, err + } + + return policy, resp, nil +} + +// UpdateForkPRContributorApprovalPermissions sets the fork PR contributor approval policy for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-fork-pr-contributor-approval-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/fork-pr-contributor-approval +func (s *ActionsService) UpdateForkPRContributorApprovalPermissions(ctx context.Context, owner, repo string, policy ContributorApprovalPermissions) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/fork-pr-contributor-approval", owner, repo) + req, err := s.client.NewRequest("PUT", u, policy) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/google/go-github/v67/github/repos_attestations.go b/vendor/github.com/google/go-github/v79/github/repos_attestations.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/repos_attestations.go rename to vendor/github.com/google/go-github/v79/github/repos_attestations.go index 2e5425502c..c5f34cd4dc 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_attestations.go +++ b/vendor/github.com/google/go-github/v79/github/repos_attestations.go @@ -17,7 +17,7 @@ import ( // //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 { diff --git a/vendor/github.com/google/go-github/v67/github/repos_autolinks.go b/vendor/github.com/google/go-github/v79/github/repos_autolinks.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/repos_autolinks.go rename to vendor/github.com/google/go-github/v79/github/repos_autolinks.go index 6c209b2d5e..5bf2cede3c 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_autolinks.go +++ b/vendor/github.com/google/go-github/v79/github/repos_autolinks.go @@ -17,7 +17,7 @@ type AutolinkOptions struct { IsAlphanumeric *bool `json:"is_alphanumeric,omitempty"` } -// Autolink represents autolinks to external resources like JIRA issues and Zendesk tickets. +// Autolink represents autolinks to external resources like Jira issues and Zendesk tickets. type Autolink struct { ID *int64 `json:"id,omitempty"` KeyPrefix *string `json:"key_prefix,omitempty"` diff --git a/vendor/github.com/google/go-github/v67/github/repos_codeowners.go b/vendor/github.com/google/go-github/v79/github/repos_codeowners.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_codeowners.go rename to vendor/github.com/google/go-github/v79/github/repos_codeowners.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_collaborators.go b/vendor/github.com/google/go-github/v79/github/repos_collaborators.go similarity index 99% rename from vendor/github.com/google/go-github/v67/github/repos_collaborators.go rename to vendor/github.com/google/go-github/v79/github/repos_collaborators.go index d6c985359a..a46f452942 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_collaborators.go +++ b/vendor/github.com/google/go-github/v79/github/repos_collaborators.go @@ -130,7 +130,7 @@ type RepositoryAddCollaboratorOptions struct { // Permission specifies the permission to grant the user on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. diff --git a/vendor/github.com/google/go-github/v67/github/repos_comments.go b/vendor/github.com/google/go-github/v79/github/repos_comments.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/repos_comments.go rename to vendor/github.com/google/go-github/v79/github/repos_comments.go index 766a614cc1..3d02a1999e 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_comments.go +++ b/vendor/github.com/google/go-github/v79/github/repos_comments.go @@ -50,7 +50,6 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment @@ -79,7 +78,6 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) var comments []*RepositoryComment @@ -125,7 +123,6 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeReactionsPreview) c := new(RepositoryComment) diff --git a/vendor/github.com/google/go-github/v67/github/repos_commits.go b/vendor/github.com/google/go-github/v79/github/repos_commits.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/repos_commits.go rename to vendor/github.com/google/go-github/v79/github/repos_commits.go index cca7430cb5..36192cd3ed 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_commits.go +++ b/vendor/github.com/google/go-github/v79/github/repos_commits.go @@ -179,7 +179,7 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st // GitHub API docs: https://docs.github.com/rest/commits/commits#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) if err != nil { @@ -192,7 +192,7 @@ 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 @@ -237,7 +237,7 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // GitHub API docs: https://docs.github.com/rest/commits/commits#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) @@ -287,7 +287,7 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo case Patch: req.Header.Set("Accept", mediaTypeV3Patch) default: - return "", nil, fmt.Errorf("unsupported raw type %d", opts.Type) + return "", nil, fmt.Errorf("unsupported raw type %v", opts.Type) } var buf bytes.Buffer @@ -313,7 +313,6 @@ func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeListPullsOrBranchesForCommitPreview) var branchCommits []*BranchCommit resp, err := s.client.Do(ctx, req, &branchCommits) diff --git a/vendor/github.com/google/go-github/v67/github/repos_community_health.go b/vendor/github.com/google/go-github/v79/github/repos_community_health.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_community_health.go rename to vendor/github.com/google/go-github/v79/github/repos_community_health.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_contents.go b/vendor/github.com/google/go-github/v79/github/repos_contents.go similarity index 82% rename from vendor/github.com/google/go-github/v67/github/repos_contents.go rename to vendor/github.com/google/go-github/v79/github/repos_contents.go index 3a0c266b5e..2378cd2330 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_contents.go +++ b/vendor/github.com/google/go-github/v79/github/repos_contents.go @@ -62,7 +62,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"` } @@ -139,18 +139,25 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, 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) + fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts) + if err == nil && fileContent != nil { + content, err := fileContent.GetContent() + if err == nil && content != "" { + return io.NopCloser(strings.NewReader(content)), resp, nil + } + } + _, 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) + if contents.GetName() == filename { + if contents.GetDownloadURL() == "" { + return nil, resp, fmt.Errorf("no download link found for %v", filepath) } - - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) + dlReq, err := http.NewRequestWithContext(ctx, "GET", *contents.DownloadURL, nil) if err != nil { return nil, resp, err } @@ -163,7 +170,7 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, } } - return nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + return nil, resp, fmt.Errorf("no file named %v found in %v", filename, dir) } // DownloadContentsWithMeta is identical to DownloadContents but additionally @@ -181,18 +188,25 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, 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) + fileContent, _, resp, err := s.GetContents(ctx, owner, repo, filepath, opts) + if err == nil && fileContent != nil { + content, err := fileContent.GetContent() + if err == nil && content != "" { + return io.NopCloser(strings.NewReader(content)), fileContent, resp, nil + } + } + _, dirContents, resp, err := s.GetContents(ctx, owner, repo, dir, 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) + if contents.GetName() == filename { + if contents.GetDownloadURL() == "" { + return nil, contents, resp, fmt.Errorf("no download link found for %v", filepath) } - - dlReq, err := http.NewRequestWithContext(ctx, http.MethodGet, *contents.DownloadURL, nil) + dlReq, err := http.NewRequestWithContext(ctx, "GET", *contents.DownloadURL, nil) if err != nil { return nil, contents, resp, err } @@ -205,7 +219,7 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne } } - return nil, nil, resp, fmt.Errorf("no file named %s found in %s", filename, dir) + return nil, nil, resp, fmt.Errorf("no file named %v found in %v", filename, dir) } // GetContents can return either the metadata and content of a single file @@ -227,7 +241,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path } escapedPath := (&url.URL{Path: strings.TrimSuffix(path, "/")}).String() - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, escapedPath) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, escapedPath) u, err = addOptions(u, opts) if err != nil { return nil, nil, nil, err @@ -254,7 +268,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path return nil, directoryContent, resp, nil } - return nil, nil, resp, fmt.Errorf("unmarshalling 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 @@ -264,7 +278,7 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err @@ -286,7 +300,7 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // //meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) if err != nil { return nil, nil, err @@ -308,7 +322,7 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // //meta:operation DELETE /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) + u := fmt.Sprintf("repos/%v/%v/contents/%v", owner, repo, path) req, err := s.client.NewRequest("DELETE", u, opts) if err != nil { return nil, nil, err @@ -344,10 +358,19 @@ const ( //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 { + return s.getArchiveLinkWithRateLimit(ctx, u, maxRedirects) } + + return s.getArchiveLinkWithoutRateLimit(ctx, u, maxRedirects) +} + +func (s *RepositoriesService) getArchiveLinkWithoutRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err @@ -355,7 +378,7 @@ func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo st defer resp.Body.Close() if resp.StatusCode != http.StatusOK && 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")) @@ -365,3 +388,23 @@ func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo st return parsedURL, newResponse(resp), nil } + +func (s *RepositoriesService) getArchiveLinkWithRateLimit(ctx context.Context, u string, maxRedirects int) (*url.URL, *Response, error) { + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + url, resp, err := s.client.bareDoUntilFound(ctx, req, maxRedirects) + if err != nil { + return nil, resp, err + } + defer resp.Body.Close() + + // If we didn't receive a valid Location in a 302 response + if url == nil { + return nil, resp, fmt.Errorf("unexpected status code: %v", resp.Status) + } + + return url, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/repos_deployment_branch_policies.go b/vendor/github.com/google/go-github/v79/github/repos_deployment_branch_policies.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_deployment_branch_policies.go rename to vendor/github.com/google/go-github/v79/github/repos_deployment_branch_policies.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_deployment_protection_rules.go b/vendor/github.com/google/go-github/v79/github/repos_deployment_protection_rules.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_deployment_protection_rules.go rename to vendor/github.com/google/go-github/v79/github/repos_deployment_protection_rules.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_deployments.go b/vendor/github.com/google/go-github/v79/github/repos_deployments.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/repos_deployments.go rename to vendor/github.com/google/go-github/v79/github/repos_deployments.go index 6277ac2151..637067491b 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_deployments.go +++ b/vendor/github.com/google/go-github/v79/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,omitempty"` + Task *string `json:"task,omitempty"` + AutoMerge *bool `json:"auto_merge,omitempty"` + RequiredContexts *[]string `json:"required_contexts,omitempty"` + 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. @@ -122,7 +122,6 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -198,7 +197,6 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -224,7 +222,6 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) @@ -250,7 +247,6 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) diff --git a/vendor/github.com/google/go-github/v67/github/repos_environments.go b/vendor/github.com/google/go-github/v79/github/repos_environments.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/repos_environments.go rename to vendor/github.com/google/go-github/v79/github/repos_environments.go index ed81e3a1f9..7bc8394ac3 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_environments.go +++ b/vendor/github.com/google/go-github/v79/github/repos_environments.go @@ -62,8 +62,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 @@ -111,7 +111,7 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // //meta:operation GET /repos/{owner}/{repo}/environments func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments", owner, repo) + u := fmt.Sprintf("repos/%v/%v/environments", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -136,7 +136,7 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -157,10 +157,10 @@ func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, n func (c *CreateUpdateEnvironment) MarshalJSON() ([]byte, error) { type Alias CreateUpdateEnvironment if c.WaitTimer == nil { - c.WaitTimer = Int(0) + c.WaitTimer = Ptr(0) } if c.CanAdminsBypass == nil { - c.CanAdminsBypass = Bool(true) + c.CanAdminsBypass = Ptr(true) } return json.Marshal(&struct { *Alias @@ -194,7 +194,7 @@ type createUpdateEnvironmentNoEnterprise struct { // //meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("PUT", u, environment) if err != nil { @@ -242,7 +242,7 @@ func (s *RepositoriesService) createNewEnvNoEnterprise(ctx context.Context, u st // //meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) + u := fmt.Sprintf("repos/%v/%v/environments/%v", owner, repo, name) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { diff --git a/vendor/github.com/google/go-github/v67/github/repos_forks.go b/vendor/github.com/google/go-github/v79/github/repos_forks.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/repos_forks.go rename to vendor/github.com/google/go-github/v79/github/repos_forks.go index 60fb49da5a..cffc87e9b0 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_forks.go +++ b/vendor/github.com/google/go-github/v79/github/repos_forks.go @@ -8,6 +8,7 @@ package github import ( "context" "encoding/json" + "errors" "fmt" ) @@ -38,7 +39,6 @@ func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -83,7 +83,8 @@ func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string resp, err := s.client.Do(ctx, req, fork) if err != nil { // Persist AcceptedError's metadata to the Repository object. - if aerr, ok := err.(*AcceptedError); ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, fork); err != nil { return fork, resp, err } diff --git a/vendor/github.com/google/go-github/v67/github/repos_hooks.go b/vendor/github.com/google/go-github/v79/github/repos_hooks.go similarity index 89% rename from vendor/github.com/google/go-github/v67/github/repos_hooks.go rename to vendor/github.com/google/go-github/v79/github/repos_hooks.go index d221db21b6..bbadab8009 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_hooks.go +++ b/vendor/github.com/google/go-github/v79/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. @@ -83,6 +84,10 @@ type createHookRequest struct { // //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{ @@ -138,7 +143,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -158,7 +163,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err @@ -178,7 +183,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // //meta:operation DELETE /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -192,7 +197,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/pings func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/pings", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -206,7 +211,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/tests func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/hooks/%v/tests", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -248,7 +253,7 @@ func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, even // See: https://www.w3.org/TR/websub/#subscriber-sends-subscription-request func (s *RepositoriesService) createWebSubRequest(hubMode, owner, repo, event, callback string, secret []byte) (*http.Request, error) { topic := fmt.Sprintf( - "https://github.com/%s/%s/events/%s", + "https://github.com/%v/%v/events/%v", owner, repo, event, diff --git a/vendor/github.com/google/go-github/v67/github/repos_hooks_configuration.go b/vendor/github.com/google/go-github/v79/github/repos_hooks_configuration.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/repos_hooks_configuration.go rename to vendor/github.com/google/go-github/v79/github/repos_hooks_configuration.go index 9560bd7a4b..69d1f4060b 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_hooks_configuration.go +++ b/vendor/github.com/google/go-github/v79/github/repos_hooks_configuration.go @@ -16,7 +16,7 @@ type HookConfig struct { // Possible values are `json` and `form`, the field is not specified the default is `form` ContentType *string `json:"content_type,omitempty"` // The possible values are 0 and 1. - // Setting it to 1 will allow skip certificate verification for the host, + // Setting it to 1 will allow skipping certificate verification for the host, // potentially exposing to MitM attacks: https://en.wikipedia.org/wiki/Man-in-the-middle_attack InsecureSSL *string `json:"insecure_ssl,omitempty"` URL *string `json:"url,omitempty"` diff --git a/vendor/github.com/google/go-github/v67/github/repos_hooks_deliveries.go b/vendor/github.com/google/go-github/v79/github/repos_hooks_deliveries.go similarity index 88% rename from vendor/github.com/google/go-github/v67/github/repos_hooks_deliveries.go rename to vendor/github.com/google/go-github/v79/github/repos_hooks_deliveries.go index c8029f626b..526d82c6f7 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_hooks_deliveries.go +++ b/vendor/github.com/google/go-github/v79/github/repos_hooks_deliveries.go @@ -9,6 +9,7 @@ import ( "context" "encoding/json" "fmt" + "strings" ) // HookDelivery represents the data that is received from GitHub's Webhook Delivery API @@ -39,6 +40,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 +57,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,6 +73,11 @@ 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) } @@ -131,7 +152,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/v67/github/repos_invitations.go b/vendor/github.com/google/go-github/v79/github/repos_invitations.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_invitations.go rename to vendor/github.com/google/go-github/v79/github/repos_invitations.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_keys.go b/vendor/github.com/google/go-github/v79/github/repos_keys.go similarity index 88% rename from vendor/github.com/google/go-github/v67/github/repos_keys.go rename to vendor/github.com/google/go-github/v79/github/repos_keys.go index cc86f8bbd0..0d050c8030 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_keys.go +++ b/vendor/github.com/google/go-github/v79/github/repos_keys.go @@ -17,7 +17,7 @@ import ( // GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#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 { @@ -43,7 +43,7 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#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) @@ -65,7 +65,7 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str // GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#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, key *Key) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) req, err := s.client.NewRequest("POST", u, key) @@ -87,7 +87,7 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo // GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#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) diff --git a/vendor/github.com/google/go-github/v67/github/repos_lfs.go b/vendor/github.com/google/go-github/v79/github/repos_lfs.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_lfs.go rename to vendor/github.com/google/go-github/v79/github/repos_lfs.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_merging.go b/vendor/github.com/google/go-github/v79/github/repos_merging.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_merging.go rename to vendor/github.com/google/go-github/v79/github/repos_merging.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_pages.go b/vendor/github.com/google/go-github/v79/github/repos_pages.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/repos_pages.go rename to vendor/github.com/google/go-github/v79/github/repos_pages.go index 6b9ba76e44..92110f5983 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_pages.go +++ b/vendor/github.com/google/go-github/v79/github/repos_pages.go @@ -7,6 +7,7 @@ package github import ( "context" + "errors" "fmt" ) @@ -107,6 +108,10 @@ type createPagesRequest struct { // //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{ @@ -170,7 +175,35 @@ func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo strin 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#update-information-about-a-github-pages-site +// +//meta:operation PUT /repos/{owner}/{repo}/pages +func (s *RepositoriesService) UpdatePagesGHES(ctx context.Context, owner, repo string, opts *PagesUpdateWithoutCNAME) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) + + req, err := s.client.NewRequest("PUT", u, opts) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } return resp, nil } @@ -186,7 +219,6 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeEnablePagesAPIPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/repos_prereceive_hooks.go b/vendor/github.com/google/go-github/v79/github/repos_prereceive_hooks.go similarity index 82% rename from vendor/github.com/google/go-github/v67/github/repos_prereceive_hooks.go rename to vendor/github.com/google/go-github/v79/github/repos_prereceive_hooks.go index e97075d020..0951916d1b 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_prereceive_hooks.go +++ b/vendor/github.com/google/go-github/v79/github/repos_prereceive_hooks.go @@ -24,7 +24,7 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.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.18/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { @@ -39,7 +39,6 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) var hooks []*PreReceiveHook @@ -53,17 +52,16 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.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.18/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) h := new(PreReceiveHook) @@ -77,17 +75,16 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.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.18/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) h := new(PreReceiveHook) @@ -101,17 +98,16 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.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.18/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypePreReceiveHooksPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/repos_properties.go b/vendor/github.com/google/go-github/v79/github/repos_properties.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_properties.go rename to vendor/github.com/google/go-github/v79/github/repos_properties.go diff --git a/vendor/github.com/google/go-github/v67/github/repos_releases.go b/vendor/github.com/google/go-github/v79/github/repos_releases.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/repos_releases.go rename to vendor/github.com/google/go-github/v79/github/repos_releases.go index 7231db6d9e..b5cff73260 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_releases.go +++ b/vendor/github.com/google/go-github/v79/github/repos_releases.go @@ -45,6 +45,7 @@ type RepositoryRelease struct { TarballURL *string `json:"tarball_url,omitempty"` Author *User `json:"author,omitempty"` NodeID *string `json:"node_id,omitempty"` + Immutable *bool `json:"immutable,omitempty"` } func (r RepositoryRelease) String() string { @@ -79,6 +80,7 @@ type ReleaseAsset struct { BrowserDownloadURL *string `json:"browser_download_url,omitempty"` Uploader *User `json:"uploader,omitempty"` NodeID *string `json:"node_id,omitempty"` + Digest *string `json:"digest,omitempty"` } func (r ReleaseAsset) String() string { @@ -91,7 +93,7 @@ func (r ReleaseAsset) String() string { // //meta:operation GET /repos/{owner}/{repo}/releases func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -116,7 +118,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) return s.getSingleRelease(ctx, u) } @@ -126,7 +128,7 @@ func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string // //meta:operation GET /repos/{owner}/{repo}/releases/latest func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases/latest", owner, repo) return s.getSingleRelease(ctx, u) } @@ -136,7 +138,7 @@ func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/releases/tags/{tag} func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) + u := fmt.Sprintf("repos/%v/%v/releases/tags/%v", owner, repo, tag) return s.getSingleRelease(ctx, u) } @@ -146,7 +148,7 @@ func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, // //meta:operation POST /repos/{owner}/{repo}/releases/generate-notes func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) + u := fmt.Sprintf("repos/%v/%v/releases/generate-notes", owner, repo) req, err := s.client.NewRequest("POST", u, opts) if err != nil { return nil, nil, err @@ -202,7 +204,11 @@ type repositoryReleaseRequest struct { // //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) + if release == nil { + return nil, nil, errors.New("release must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases", owner, repo) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -238,7 +244,11 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str // //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) + if release == nil { + return nil, nil, errors.New("release must be provided") + } + + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) releaseReq := &repositoryReleaseRequest{ TagName: release.TagName, @@ -270,7 +280,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin // //meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -285,7 +295,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str // //meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/%v/assets", owner, repo, id) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -310,7 +320,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // //meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -333,15 +343,16 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // 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. Passing http.DefaultClient is recommended unless special circumstances -// exist, but it's possible to pass any http.Client. If nil is passed the -// redirectURL will be returned instead. +// 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) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { @@ -354,7 +365,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, r var loc string saveRedirect := 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 errors.New("disable redirect") } @@ -387,7 +398,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f return nil, err } req = withContext(ctx, req) - req.Header.Set("Accept", "*/*") + req.Header.Set("Accept", defaultMediaType) resp, err := followRedirectsClient.Do(req) if err != nil { return nil, err @@ -405,7 +416,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // //meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, release) if err != nil { @@ -426,7 +437,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo // //meta:operation DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { - u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) + u := fmt.Sprintf("repos/%v/%v/releases/assets/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { @@ -442,7 +453,11 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep // //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) + 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 diff --git a/vendor/github.com/google/go-github/v79/github/repos_rules.go b/vendor/github.com/google/go-github/v79/github/repos_rules.go new file mode 100644 index 0000000000..8c1f4980e3 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/repos_rules.go @@ -0,0 +1,248 @@ +// 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, opts *ListOptions) (*BranchRules, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) + + 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 rules *BranchRules + resp, err := s.client.Do(ctx, req, &rules) + if err != nil { + return nil, resp, err + } + + return rules, resp, nil +} + +// 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#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("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{ + BypassActors: []*BypassActor{}, + } + + 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/v67/github/repos_stats.go b/vendor/github.com/google/go-github/v79/github/repos_stats.go similarity index 97% rename from vendor/github.com/google/go-github/v67/github/repos_stats.go rename to vendor/github.com/google/go-github/v79/github/repos_stats.go index 898693f786..b05bae6dae 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_stats.go +++ b/vendor/github.com/google/go-github/v79/github/repos_stats.go @@ -139,8 +139,8 @@ func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo } stat := &WeeklyStats{ Week: &Timestamp{time.Unix(int64(week[0]), 0)}, - Additions: Int(week[1]), - Deletions: Int(week[2]), + Additions: Ptr(week[1]), + Deletions: Ptr(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"` @@ -231,9 +231,9 @@ func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo str continue } card := &PunchCard{ - Day: Int(result[0]), - Hour: Int(result[1]), - Commits: Int(result[2]), + Day: Ptr(result[0]), + Hour: Ptr(result[1]), + Commits: Ptr(result[2]), } cards = append(cards, card) } diff --git a/vendor/github.com/google/go-github/v67/github/repos_statuses.go b/vendor/github.com/google/go-github/v79/github/repos_statuses.go similarity index 92% rename from vendor/github.com/google/go-github/v67/github/repos_statuses.go rename to vendor/github.com/google/go-github/v79/github/repos_statuses.go index e7b0304752..547cc1f12c 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_statuses.go +++ b/vendor/github.com/google/go-github/v79/github/repos_statuses.go @@ -43,7 +43,7 @@ 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 // @@ -70,14 +70,14 @@ 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 // //meta:operation POST /repos/{owner}/{repo}/statuses/{sha} -func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { +func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status RepoStatus) (*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref)) - req, err := s.client.NewRequest("POST", u, status) + req, err := s.client.NewRequest("POST", u, &status) if err != nil { return nil, nil, err } @@ -111,7 +111,7 @@ 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 // diff --git a/vendor/github.com/google/go-github/v67/github/repos_tags.go b/vendor/github.com/google/go-github/v79/github/repos_tags.go similarity index 73% rename from vendor/github.com/google/go-github/v67/github/repos_tags.go rename to vendor/github.com/google/go-github/v79/github/repos_tags.go index b6dc36e2a3..9c789cc82b 100644 --- a/vendor/github.com/google/go-github/v67/github/repos_tags.go +++ b/vendor/github.com/google/go-github/v79/github/repos_tags.go @@ -22,8 +22,9 @@ 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. +// +// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets // // GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository // @@ -45,8 +46,9 @@ 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#create-a-repository-ruleset // // GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository // @@ -68,8 +70,9 @@ 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#delete-a-repository-ruleset // // GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository // diff --git a/vendor/github.com/google/go-github/v67/github/repos_traffic.go b/vendor/github.com/google/go-github/v79/github/repos_traffic.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/repos_traffic.go rename to vendor/github.com/google/go-github/v79/github/repos_traffic.go diff --git a/vendor/github.com/google/go-github/v79/github/rules.go b/vendor/github.com/google/go-github/v79/github/rules.go new file mode 100644 index 0000000000..9c0df3192d --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/rules.go @@ -0,0 +1,1258 @@ +// 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 ( + "encoding/json" + "reflect" +) + +// RulesetTarget represents a GitHub ruleset target. +type RulesetTarget string + +// This is the set of GitHub ruleset targets. +const ( + RulesetTargetBranch RulesetTarget = "branch" + RulesetTargetTag RulesetTarget = "tag" + RulesetTargetPush RulesetTarget = "push" +) + +// RulesetSourceType represents a GitHub ruleset source type. +type RulesetSourceType string + +// This is the set of GitHub ruleset source types. +const ( + RulesetSourceTypeRepository RulesetSourceType = "Repository" + RulesetSourceTypeOrganization RulesetSourceType = "Organization" + RulesetSourceTypeEnterprise RulesetSourceType = "Enterprise" +) + +// RulesetEnforcement represents a GitHub ruleset enforcement. +type RulesetEnforcement string + +// This is the set of GitHub ruleset enforcements. +const ( + RulesetEnforcementDisabled RulesetEnforcement = "disabled" + RulesetEnforcementActive RulesetEnforcement = "active" + RulesetEnforcementEvaluate RulesetEnforcement = "evaluate" +) + +// BypassActorType represents a GitHub ruleset bypass actor type. +type BypassActorType string + +// This is the set of GitHub ruleset bypass actor types. +const ( + BypassActorTypeIntegration BypassActorType = "Integration" + BypassActorTypeOrganizationAdmin BypassActorType = "OrganizationAdmin" + BypassActorTypeRepositoryRole BypassActorType = "RepositoryRole" + BypassActorTypeTeam BypassActorType = "Team" + BypassActorTypeDeployKey BypassActorType = "DeployKey" +) + +// BypassMode represents a GitHub ruleset bypass mode. +type BypassMode string + +// This is the set of GitHub ruleset bypass modes. +const ( + BypassModeAlways BypassMode = "always" + BypassModeExempt BypassMode = "exempt" + BypassModeNever BypassMode = "never" + BypassModePullRequest BypassMode = "pull_request" +) + +// RepositoryRuleType represents a GitHub ruleset rule type. +type RepositoryRuleType string + +// This is the set of GitHub ruleset rule types. +const ( + RulesetRuleTypeCreation RepositoryRuleType = "creation" + RulesetRuleTypeUpdate RepositoryRuleType = "update" + RulesetRuleTypeDeletion RepositoryRuleType = "deletion" + RulesetRuleTypeRequiredLinearHistory RepositoryRuleType = "required_linear_history" + RulesetRuleTypeMergeQueue RepositoryRuleType = "merge_queue" + RulesetRuleTypeRequiredDeployments RepositoryRuleType = "required_deployments" + 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" + 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" +) + +// MergeGroupingStrategy models a GitHub merge grouping strategy. +type MergeGroupingStrategy string + +// This is the set of GitHub merge grouping strategies. +const ( + MergeGroupingStrategyAllGreen MergeGroupingStrategy = "ALLGREEN" + MergeGroupingStrategyHeadGreen MergeGroupingStrategy = "HEADGREEN" +) + +// 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 + +const ( + 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" +) + +// PatternRuleOperator models a GitHub pattern rule operator. +type PatternRuleOperator string + +// This is the set of GitHub pattern rule operators. +const ( + PatternRuleOperatorStartsWith PatternRuleOperator = "starts_with" + PatternRuleOperatorEndsWith PatternRuleOperator = "ends_with" + PatternRuleOperatorContains PatternRuleOperator = "contains" + PatternRuleOperatorRegex PatternRuleOperator = "regex" +) + +// CodeScanningAlertsThreshold models a GitHub code scanning alerts threshold. +type CodeScanningAlertsThreshold string + +// This is the set of GitHub code scanning alerts thresholds. +const ( + CodeScanningAlertsThresholdNone CodeScanningAlertsThreshold = "none" + CodeScanningAlertsThresholdErrors CodeScanningAlertsThreshold = "errors" + CodeScanningAlertsThresholdErrorsAndWarnings CodeScanningAlertsThreshold = "errors_and_warnings" + CodeScanningAlertsThresholdAll CodeScanningAlertsThreshold = "all" +) + +// CodeScanningSecurityAlertsThreshold models a GitHub code scanning security alerts threshold. +type CodeScanningSecurityAlertsThreshold string + +// This is the set of GitHub code scanning security alerts thresholds. +const ( + CodeScanningSecurityAlertsThresholdNone CodeScanningSecurityAlertsThreshold = "none" + CodeScanningSecurityAlertsThresholdCritical CodeScanningSecurityAlertsThreshold = "critical" + CodeScanningSecurityAlertsThresholdHighOrHigher CodeScanningSecurityAlertsThreshold = "high_or_higher" + CodeScanningSecurityAlertsThresholdMediumOrHigher CodeScanningSecurityAlertsThreshold = "medium_or_higher" + CodeScanningSecurityAlertsThresholdAll CodeScanningSecurityAlertsThreshold = "all" +) + +// RepositoryRuleset represents a GitHub ruleset object. +type RepositoryRuleset 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,omitempty"` + 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"` +} + +// BypassActor represents the bypass actors from a ruleset. +type BypassActor struct { + ActorID *int64 `json:"actor_id,omitempty"` + ActorType *BypassActorType `json:"actor_type,omitempty"` + BypassMode *BypassMode `json:"bypass_mode,omitempty"` +} + +// RepositoryRulesetLinks represents the "_links" object in a Ruleset. +type RepositoryRulesetLinks struct { + Self *RepositoryRulesetLink `json:"self,omitempty"` + HTML *RepositoryRulesetLink `json:"html,omitempty"` +} + +// RepositoryRulesetLink represents a single link object from GitHub ruleset request _links. +type RepositoryRulesetLink struct { + HRef *string `json:"href,omitempty"` +} + +// 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"` + OrganizationProperty *RepositoryRulesetOrganizationPropertyConditionParameters `json:"organization_property,omitempty"` +} + +// RepositoryRulesetRefConditionParameters represents the conditions object for ref_names. +type RepositoryRulesetRefConditionParameters struct { + Include []string `json:"include"` + 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"` +} + +// RepositoryRulesetRepositoryNamesConditionParameters represents the conditions object for repository_name. +type RepositoryRulesetRepositoryNamesConditionParameters struct { + Include []string `json:"include"` + Exclude []string `json:"exclude"` + Protected *bool `json:"protected,omitempty"` +} + +// RepositoryRulesetRepositoryPropertyConditionParameters represents the conditions object for repository_property. +type RepositoryRulesetRepositoryPropertyConditionParameters struct { + Include []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"include"` + Exclude []*RepositoryRulesetRepositoryPropertyTargetParameters `json:"exclude"` +} + +// RepositoryRulesetRepositoryPropertyTargetParameters represents a repository_property name and values to be used for targeting. +type RepositoryRulesetRepositoryPropertyTargetParameters struct { + Name string `json:"name"` + PropertyValues []string `json:"property_values"` + Source *string `json:"source,omitempty"` +} + +// RepositoryRulesetOrganizationIDsConditionParameters represents the conditions object for organization_id. +type RepositoryRulesetOrganizationIDsConditionParameters struct { + OrganizationIDs []int64 `json:"organization_ids,omitempty"` +} + +// RepositoryRulesetOrganizationNamesConditionParameters represents the conditions object for organization_name. +type RepositoryRulesetOrganizationNamesConditionParameters struct { + Include []string `json:"include"` + Exclude []string `json:"exclude"` +} + +// RepositoryRule represents a GitHub ruleset rule object. +type RepositoryRule struct { + Type RepositoryRuleType `json:"type"` + Parameters any `json:"parameters,omitempty"` +} + +// RepositoryRulesetRules represents a GitHub ruleset rules object. +// This type doesn't have JSON annotations as it uses custom marshaling. +type RepositoryRulesetRules struct { + Creation *EmptyRuleParameters + Update *UpdateRuleParameters + Deletion *EmptyRuleParameters + RequiredLinearHistory *EmptyRuleParameters + MergeQueue *MergeQueueRuleParameters + RequiredDeployments *RequiredDeploymentsRuleParameters + RequiredSignatures *EmptyRuleParameters + PullRequest *PullRequestRuleParameters + RequiredStatusChecks *RequiredStatusChecksRuleParameters + NonFastForward *EmptyRuleParameters + CommitMessagePattern *PatternRuleParameters + CommitAuthorEmailPattern *PatternRuleParameters + CommitterEmailPattern *PatternRuleParameters + BranchNamePattern *PatternRuleParameters + TagNamePattern *PatternRuleParameters + FilePathRestriction *FilePathRestrictionRuleParameters + MaxFilePathLength *MaxFilePathLengthRuleParameters + FileExtensionRestriction *FileExtensionRestrictionRuleParameters + MaxFileSize *MaxFileSizeRuleParameters + Workflows *WorkflowsRuleParameters + CodeScanning *CodeScanningRuleParameters +} + +// 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 { + Creation []*BranchRuleMetadata + Update []*UpdateBranchRule + Deletion []*BranchRuleMetadata + RequiredLinearHistory []*BranchRuleMetadata + MergeQueue []*MergeQueueBranchRule + RequiredDeployments []*RequiredDeploymentsBranchRule + RequiredSignatures []*BranchRuleMetadata + PullRequest []*PullRequestBranchRule + RequiredStatusChecks []*RequiredStatusChecksBranchRule + NonFastForward []*BranchRuleMetadata + CommitMessagePattern []*PatternBranchRule + CommitAuthorEmailPattern []*PatternBranchRule + CommitterEmailPattern []*PatternBranchRule + BranchNamePattern []*PatternBranchRule + TagNamePattern []*PatternBranchRule + FilePathRestriction []*FilePathRestrictionBranchRule + MaxFilePathLength []*MaxFilePathLengthBranchRule + FileExtensionRestriction []*FileExtensionRestrictionBranchRule + MaxFileSize []*MaxFileSizeBranchRule + Workflows []*WorkflowsBranchRule + CodeScanning []*CodeScanningBranchRule +} + +// BranchRuleMetadata represents the metadata for a branch rule. +type BranchRuleMetadata struct { + RulesetSourceType RulesetSourceType `json:"ruleset_source_type"` + RulesetSource string `json:"ruleset_source"` + RulesetID int64 `json:"ruleset_id"` +} + +// UpdateBranchRule represents an update branch rule. +type UpdateBranchRule struct { + BranchRuleMetadata + Parameters UpdateRuleParameters `json:"parameters"` +} + +// MergeQueueBranchRule represents a merge queue branch rule. +type MergeQueueBranchRule struct { + BranchRuleMetadata + Parameters MergeQueueRuleParameters `json:"parameters"` +} + +// RequiredDeploymentsBranchRule represents a required deployments branch rule. +type RequiredDeploymentsBranchRule struct { + BranchRuleMetadata + Parameters RequiredDeploymentsRuleParameters `json:"parameters"` +} + +// PullRequestBranchRule represents a pull request branch rule. +type PullRequestBranchRule struct { + BranchRuleMetadata + Parameters PullRequestRuleParameters `json:"parameters"` +} + +// RequiredStatusChecksBranchRule represents a required status checks branch rule. +type RequiredStatusChecksBranchRule struct { + BranchRuleMetadata + Parameters RequiredStatusChecksRuleParameters `json:"parameters"` +} + +// PatternBranchRule represents a pattern branch rule. +type PatternBranchRule struct { + BranchRuleMetadata + Parameters PatternRuleParameters `json:"parameters"` +} + +// FilePathRestrictionBranchRule represents a file path restriction branch rule. +type FilePathRestrictionBranchRule struct { + BranchRuleMetadata + Parameters FilePathRestrictionRuleParameters `json:"parameters"` +} + +// MaxFilePathLengthBranchRule represents a max file path length branch rule. +type MaxFilePathLengthBranchRule struct { + BranchRuleMetadata + Parameters MaxFilePathLengthRuleParameters `json:"parameters"` +} + +// FileExtensionRestrictionBranchRule represents a file extension restriction branch rule. +type FileExtensionRestrictionBranchRule struct { + BranchRuleMetadata + Parameters FileExtensionRestrictionRuleParameters `json:"parameters"` +} + +// MaxFileSizeBranchRule represents a max file size branch rule. +type MaxFileSizeBranchRule struct { + BranchRuleMetadata + Parameters MaxFileSizeRuleParameters `json:"parameters"` +} + +// WorkflowsBranchRule represents a workflows branch rule. +type WorkflowsBranchRule struct { + BranchRuleMetadata + Parameters WorkflowsRuleParameters `json:"parameters"` +} + +// CodeScanningBranchRule represents a code scanning branch rule. +type CodeScanningBranchRule struct { + BranchRuleMetadata + Parameters CodeScanningRuleParameters `json:"parameters"` +} + +// EmptyRuleParameters represents the parameters for a rule with no options. +type EmptyRuleParameters struct{} + +// UpdateRuleParameters represents the update rule parameters. +type UpdateRuleParameters struct { + UpdateAllowsFetchAndMerge bool `json:"update_allows_fetch_and_merge,omitempty"` +} + +// MergeQueueRuleParameters represents the merge_queue rule parameters. +type MergeQueueRuleParameters struct { + CheckResponseTimeoutMinutes int `json:"check_response_timeout_minutes"` + GroupingStrategy MergeGroupingStrategy `json:"grouping_strategy"` + MaxEntriesToBuild int `json:"max_entries_to_build"` + MaxEntriesToMerge int `json:"max_entries_to_merge"` + MergeMethod MergeQueueMergeMethod `json:"merge_method"` + MinEntriesToMerge int `json:"min_entries_to_merge"` + MinEntriesToMergeWaitMinutes int `json:"min_entries_to_merge_wait_minutes"` +} + +// RequiredDeploymentsRuleParameters represents the required deployments rule parameters. +type RequiredDeploymentsRuleParameters struct { + RequiredDeploymentEnvironments []string `json:"required_deployment_environments"` +} + +// PullRequestRuleParameters represents the pull_request rule parameters. +type PullRequestRuleParameters struct { + AllowedMergeMethods []PullRequestMergeMethod `json:"allowed_merge_methods"` + AutomaticCopilotCodeReviewEnabled *bool `json:"automatic_copilot_code_review_enabled,omitempty"` + DismissStaleReviewsOnPush bool `json:"dismiss_stale_reviews_on_push"` + RequireCodeOwnerReview bool `json:"require_code_owner_review"` + RequireLastPushApproval bool `json:"require_last_push_approval"` + RequiredApprovingReviewCount int `json:"required_approving_review_count"` + RequiredReviewers []*RulesetRequiredReviewer `json:"required_reviewers,omitempty"` + RequiredReviewThreadResolution bool `json:"required_review_thread_resolution"` +} + +// RulesetRequiredReviewer represents required reviewer parameters for pull requests in rulesets. +type RulesetRequiredReviewer struct { + MinimumApprovals *int `json:"minimum_approvals,omitempty"` + FilePatterns []string `json:"file_patterns,omitempty"` + Reviewer *RulesetReviewer `json:"reviewer,omitempty"` +} + +// RulesetReviewer represents a reviewer in a ruleset required reviewer rule. +type RulesetReviewer struct { + ID *int64 `json:"id,omitempty"` + Type *RulesetReviewerType `json:"type,omitempty"` +} + +// RequiredStatusChecksRuleParameters represents the required status checks rule parameters. +type RequiredStatusChecksRuleParameters struct { + DoNotEnforceOnCreate *bool `json:"do_not_enforce_on_create,omitempty"` + RequiredStatusChecks []*RuleStatusCheck `json:"required_status_checks"` + StrictRequiredStatusChecksPolicy bool `json:"strict_required_status_checks_policy"` +} + +// RuleStatusCheck represents a status checks for the required status checks rule parameters. +type RuleStatusCheck struct { + Context string `json:"context"` + IntegrationID *int64 `json:"integration_id,omitempty"` +} + +// PatternRuleParameters represents the parameters for a pattern rule. +type PatternRuleParameters struct { + Name *string `json:"name,omitempty"` + // If Negate is true, the rule will fail if the pattern matches. + Negate *bool `json:"negate,omitempty"` + Operator PatternRuleOperator `json:"operator"` + Pattern string `json:"pattern"` +} + +// FilePathRestrictionRuleParameters represents the file path restriction rule parameters. +type FilePathRestrictionRuleParameters struct { + RestrictedFilePaths []string `json:"restricted_file_paths"` +} + +// MaxFilePathLengthRuleParameters represents the max file path length rule parameters. +type MaxFilePathLengthRuleParameters struct { + MaxFilePathLength int `json:"max_file_path_length"` +} + +// FileExtensionRestrictionRuleParameters represents the file extension restriction rule parameters. +type FileExtensionRestrictionRuleParameters struct { + RestrictedFileExtensions []string `json:"restricted_file_extensions"` +} + +// MaxFileSizeRuleParameters represents the max file size rule parameters. +type MaxFileSizeRuleParameters struct { + MaxFileSize int64 `json:"max_file_size"` +} + +// WorkflowsRuleParameters represents the workflows rule parameters. +type WorkflowsRuleParameters struct { + DoNotEnforceOnCreate *bool `json:"do_not_enforce_on_create,omitempty"` + Workflows []*RuleWorkflow `json:"workflows"` +} + +// RuleWorkflow represents a Workflow for the workflows rule parameters. +type RuleWorkflow struct { + Path string `json:"path"` + Ref *string `json:"ref,omitempty"` + RepositoryID *int64 `json:"repository_id,omitempty"` + SHA *string `json:"sha,omitempty"` +} + +// CodeScanningRuleParameters represents the code scanning rule parameters. +type CodeScanningRuleParameters struct { + CodeScanningTools []*RuleCodeScanningTool `json:"code_scanning_tools"` +} + +// RuleCodeScanningTool represents a single code scanning tool for the code scanning parameters. +type RuleCodeScanningTool struct { + AlertsThreshold CodeScanningAlertsThreshold `json:"alerts_threshold"` + SecurityAlertsThreshold CodeScanningSecurityAlertsThreshold `json:"security_alerts_threshold"` + Tool string `json:"tool"` +} + +// repositoryRulesetRuleWrapper is a helper type to marshal & unmarshal a ruleset rule. +type repositoryRulesetRuleWrapper struct { + Type RepositoryRuleType `json:"type"` + Parameters json.RawMessage `json:"parameters,omitempty"` +} + +// 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) + + if r.Creation != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCreation, r.Creation) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.Update != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeUpdate, r.Update) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.Deletion != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeDeletion, r.Deletion) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RequiredLinearHistory != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRequiredLinearHistory, r.RequiredLinearHistory) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.MergeQueue != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeMergeQueue, r.MergeQueue) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RequiredDeployments != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRequiredDeployments, r.RequiredDeployments) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RequiredSignatures != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRequiredSignatures, r.RequiredSignatures) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.PullRequest != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypePullRequest, r.PullRequest) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.RequiredStatusChecks != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeRequiredStatusChecks, r.RequiredStatusChecks) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.NonFastForward != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeNonFastForward, r.NonFastForward) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.CommitMessagePattern != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCommitMessagePattern, r.CommitMessagePattern) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.CommitAuthorEmailPattern != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCommitAuthorEmailPattern, r.CommitAuthorEmailPattern) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.CommitterEmailPattern != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCommitterEmailPattern, r.CommitterEmailPattern) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.BranchNamePattern != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeBranchNamePattern, r.BranchNamePattern) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.TagNamePattern != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeTagNamePattern, r.TagNamePattern) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.FilePathRestriction != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeFilePathRestriction, r.FilePathRestriction) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.MaxFilePathLength != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeMaxFilePathLength, r.MaxFilePathLength) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.FileExtensionRestriction != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeFileExtensionRestriction, r.FileExtensionRestriction) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.MaxFileSize != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeMaxFileSize, r.MaxFileSize) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.Workflows != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeWorkflows, r.Workflows) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + if r.CodeScanning != nil { + bytes, err := marshalRepositoryRulesetRule(RulesetRuleTypeCodeScanning, r.CodeScanning) + if err != nil { + return nil, err + } + rawRules = append(rawRules, json.RawMessage(bytes)) + } + + 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]() + + if paramsType.Kind() == reflect.Pointer && (reflect.ValueOf(params).IsNil() || reflect.ValueOf(params).Elem().IsZero()) { + return json.Marshal(repositoryRulesetRuleWrapper{Type: t}) + } + + bytes, err := json.Marshal(params) + if err != nil { + return nil, err + } + + return json.Marshal(repositoryRulesetRuleWrapper{Type: t, Parameters: json.RawMessage(bytes)}) +} + +// UnmarshalJSON is a custom JSON unmarshaler for RulesetRules. +func (r *RepositoryRulesetRules) UnmarshalJSON(data []byte) error { + var wrappers []*repositoryRulesetRuleWrapper + + if err := json.Unmarshal(data, &wrappers); err != nil { + return err + } + + for _, w := range wrappers { + switch w.Type { + case RulesetRuleTypeCreation: + r.Creation = &EmptyRuleParameters{} + case RulesetRuleTypeUpdate: + r.Update = &UpdateRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.Update); err != nil { + return err + } + } + case RulesetRuleTypeDeletion: + r.Deletion = &EmptyRuleParameters{} + case RulesetRuleTypeRequiredLinearHistory: + r.RequiredLinearHistory = &EmptyRuleParameters{} + case RulesetRuleTypeMergeQueue: + r.MergeQueue = &MergeQueueRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.MergeQueue); err != nil { + return err + } + } + case RulesetRuleTypeRequiredDeployments: + r.RequiredDeployments = &RequiredDeploymentsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RequiredDeployments); err != nil { + return err + } + } + case RulesetRuleTypeRequiredSignatures: + r.RequiredSignatures = &EmptyRuleParameters{} + case RulesetRuleTypePullRequest: + r.PullRequest = &PullRequestRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.PullRequest); err != nil { + return err + } + } + case RulesetRuleTypeRequiredStatusChecks: + r.RequiredStatusChecks = &RequiredStatusChecksRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.RequiredStatusChecks); err != nil { + return err + } + } + case RulesetRuleTypeNonFastForward: + r.NonFastForward = &EmptyRuleParameters{} + case RulesetRuleTypeCommitMessagePattern: + r.CommitMessagePattern = &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CommitMessagePattern); err != nil { + return err + } + } + case RulesetRuleTypeCommitAuthorEmailPattern: + r.CommitAuthorEmailPattern = &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CommitAuthorEmailPattern); err != nil { + return err + } + } + case RulesetRuleTypeCommitterEmailPattern: + r.CommitterEmailPattern = &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CommitterEmailPattern); err != nil { + return err + } + } + case RulesetRuleTypeBranchNamePattern: + r.BranchNamePattern = &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.BranchNamePattern); err != nil { + return err + } + } + case RulesetRuleTypeTagNamePattern: + r.TagNamePattern = &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.TagNamePattern); err != nil { + return err + } + } + case RulesetRuleTypeFilePathRestriction: + r.FilePathRestriction = &FilePathRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.FilePathRestriction); err != nil { + return err + } + } + case RulesetRuleTypeMaxFilePathLength: + r.MaxFilePathLength = &MaxFilePathLengthRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.MaxFilePathLength); err != nil { + return err + } + } + case RulesetRuleTypeFileExtensionRestriction: + r.FileExtensionRestriction = &FileExtensionRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.FileExtensionRestriction); err != nil { + return err + } + } + case RulesetRuleTypeMaxFileSize: + r.MaxFileSize = &MaxFileSizeRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.MaxFileSize); err != nil { + return err + } + } + case RulesetRuleTypeWorkflows: + r.Workflows = &WorkflowsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.Workflows); err != nil { + return err + } + } + case RulesetRuleTypeCodeScanning: + r.CodeScanning = &CodeScanningRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, r.CodeScanning); err != nil { + return err + } + } + } + } + + return nil +} + +// branchRuleWrapper is a helper type to unmarshal a branch rule. +type branchRuleWrapper struct { + Type RepositoryRuleType `json:"type"` + BranchRuleMetadata + Parameters json.RawMessage `json:"parameters,omitempty"` +} + +// UnmarshalJSON is a custom JSON unmarshaler for BranchRules. +func (r *BranchRules) UnmarshalJSON(data []byte) error { + var wrappers []*branchRuleWrapper + + if err := json.Unmarshal(data, &wrappers); err != nil { + return err + } + + for _, w := range wrappers { + switch w.Type { + case RulesetRuleTypeCreation: + r.Creation = append(r.Creation, &BranchRuleMetadata{RulesetSourceType: w.RulesetSourceType, RulesetSource: w.RulesetSource, RulesetID: w.RulesetID}) + case RulesetRuleTypeUpdate: + params := &UpdateRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.Update = append(r.Update, &UpdateBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeDeletion: + r.Deletion = append(r.Deletion, &BranchRuleMetadata{RulesetSourceType: w.RulesetSourceType, RulesetSource: w.RulesetSource, RulesetID: w.RulesetID}) + case RulesetRuleTypeRequiredLinearHistory: + r.RequiredLinearHistory = append(r.RequiredLinearHistory, &BranchRuleMetadata{RulesetSourceType: w.RulesetSourceType, RulesetSource: w.RulesetSource, RulesetID: w.RulesetID}) + case RulesetRuleTypeMergeQueue: + params := &MergeQueueRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.MergeQueue = append(r.MergeQueue, &MergeQueueBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeRequiredDeployments: + params := &RequiredDeploymentsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.RequiredDeployments = append(r.RequiredDeployments, &RequiredDeploymentsBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeRequiredSignatures: + r.RequiredSignatures = append(r.RequiredSignatures, &BranchRuleMetadata{RulesetSourceType: w.RulesetSourceType, RulesetSource: w.RulesetSource, RulesetID: w.RulesetID}) + case RulesetRuleTypePullRequest: + params := &PullRequestRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.PullRequest = append(r.PullRequest, &PullRequestBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeRequiredStatusChecks: + params := &RequiredStatusChecksRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.RequiredStatusChecks = append(r.RequiredStatusChecks, &RequiredStatusChecksBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeNonFastForward: + r.NonFastForward = append(r.NonFastForward, &BranchRuleMetadata{RulesetSourceType: w.RulesetSourceType, RulesetSource: w.RulesetSource, RulesetID: w.RulesetID}) + case RulesetRuleTypeCommitMessagePattern: + params := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CommitMessagePattern = append(r.CommitMessagePattern, &PatternBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeCommitAuthorEmailPattern: + params := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CommitAuthorEmailPattern = append(r.CommitAuthorEmailPattern, &PatternBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeCommitterEmailPattern: + params := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CommitterEmailPattern = append(r.CommitterEmailPattern, &PatternBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeBranchNamePattern: + params := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.BranchNamePattern = append(r.BranchNamePattern, &PatternBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeTagNamePattern: + params := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.TagNamePattern = append(r.TagNamePattern, &PatternBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeFilePathRestriction: + params := &FilePathRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.FilePathRestriction = append(r.FilePathRestriction, &FilePathRestrictionBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeMaxFilePathLength: + params := &MaxFilePathLengthRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.MaxFilePathLength = append(r.MaxFilePathLength, &MaxFilePathLengthBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeFileExtensionRestriction: + params := &FileExtensionRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.FileExtensionRestriction = append(r.FileExtensionRestriction, &FileExtensionRestrictionBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeMaxFileSize: + params := &MaxFileSizeRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.MaxFileSize = append(r.MaxFileSize, &MaxFileSizeBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeWorkflows: + params := &WorkflowsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.Workflows = append(r.Workflows, &WorkflowsBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + case RulesetRuleTypeCodeScanning: + params := &CodeScanningRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, params); err != nil { + return err + } + } + + r.CodeScanning = append(r.CodeScanning, &CodeScanningBranchRule{BranchRuleMetadata: w.BranchRuleMetadata, Parameters: *params}) + } + } + + return nil +} + +// UnmarshalJSON is a custom JSON unmarshaler for RulesetRule. +func (r *RepositoryRule) UnmarshalJSON(data []byte) error { + w := repositoryRulesetRuleWrapper{} + + if err := json.Unmarshal(data, &w); err != nil { + return err + } + + r.Type = w.Type + + switch r.Type { + case RulesetRuleTypeCreation: + r.Parameters = nil + case RulesetRuleTypeUpdate: + p := &UpdateRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeDeletion: + r.Parameters = nil + case RulesetRuleTypeRequiredLinearHistory: + r.Parameters = nil + case RulesetRuleTypeMergeQueue: + p := &MergeQueueRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeRequiredDeployments: + p := &RequiredDeploymentsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeRequiredSignatures: + r.Parameters = nil + case RulesetRuleTypePullRequest: + p := &PullRequestRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeRequiredStatusChecks: + p := &RequiredStatusChecksRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeNonFastForward: + r.Parameters = nil + case RulesetRuleTypeCommitMessagePattern: + p := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeCommitAuthorEmailPattern: + p := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeCommitterEmailPattern: + p := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeBranchNamePattern: + p := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeTagNamePattern: + p := &PatternRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeFilePathRestriction: + p := &FilePathRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeMaxFilePathLength: + p := &MaxFilePathLengthRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeFileExtensionRestriction: + p := &FileExtensionRestrictionRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeMaxFileSize: + p := &MaxFileSizeRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeWorkflows: + p := &WorkflowsRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + case RulesetRuleTypeCodeScanning: + p := &CodeScanningRuleParameters{} + + if w.Parameters != nil { + if err := json.Unmarshal(w.Parameters, p); err != nil { + return err + } + } + + r.Parameters = p + } + + return nil +} diff --git a/vendor/github.com/google/go-github/v67/github/scim.go b/vendor/github.com/google/go-github/v79/github/scim.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/scim.go rename to vendor/github.com/google/go-github/v79/github/scim.go index 4b34c1663c..8e89796a48 100644 --- a/vendor/github.com/google/go-github/v67/github/scim.go +++ b/vendor/github.com/google/go-github/v79/github/scim.go @@ -19,7 +19,8 @@ type SCIMService service // SCIMUserAttributes represents supported SCIM User attributes. // -// GitHub API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes +// GitHub Enterprise Cloud API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes +// GitHub Enterprise Server API docs: https://docs.github.com/en/enterprise-server@latest/rest/enterprise-admin/scim?apiVersion=2022-11-28#supported-scim-user-attributes type SCIMUserAttributes struct { UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) Name SCIMUserName `json:"name"` // (Required.) @@ -28,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"` @@ -48,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"` diff --git a/vendor/github.com/google/go-github/v67/github/search.go b/vendor/github.com/google/go-github/v79/github/search.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/search.go rename to vendor/github.com/google/go-github/v79/github/search.go index 54bc6d5e1f..9b9f937033 100644 --- a/vendor/github.com/google/go-github/v67/github/search.go +++ b/vendor/github.com/google/go-github/v79/github/search.go @@ -92,6 +92,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"` @@ -300,7 +301,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,29 +311,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) 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": + case "topics": // Accept header for search repositories based on topics preview endpoint - // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeTopicsPreview) - case searchType == "repositories": + case "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 diff --git a/vendor/github.com/google/go-github/v67/github/secret_scanning.go b/vendor/github.com/google/go-github/v79/github/secret_scanning.go similarity index 52% rename from vendor/github.com/google/go-github/v67/github/secret_scanning.go rename to vendor/github.com/google/go-github/v79/github/secret_scanning.go index 2744926286..248abadc69 100644 --- a/vendor/github.com/google/go-github/v67/github/secret_scanning.go +++ b/vendor/github.com/google/go-github/v79/github/secret_scanning.go @@ -16,24 +16,34 @@ 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"` + 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"` } // SecretScanningAlertLocation represents the location for a secret scanning alert. @@ -68,6 +78,22 @@ type SecretScanningAlertListOptions struct { // 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. @@ -89,6 +115,56 @@ type SecretScanningAlertUpdateOptions struct { // 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"` +} + +// 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. @@ -96,7 +172,7 @@ type SecretScanningAlertUpdateOptions struct { // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. // -// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise // //meta:operation GET /enterprises/{enterprise}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { @@ -256,3 +332,52 @@ func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner return locations, resp, nil } + +// CreatePushProtectionBypass creates a push protection bypass for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#create-a-push-protection-bypass +// +//meta:operation POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses +func (s *SecretScanningService) CreatePushProtectionBypass(ctx context.Context, owner, repo string, request PushProtectionBypassRequest) (*PushProtectionBypass, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/push-protection-bypasses", owner, repo) + + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + var pushProtectionBypass *PushProtectionBypass + resp, err := s.client.Do(ctx, req, &pushProtectionBypass) + if err != nil { + return nil, resp, err + } + return pushProtectionBypass, resp, nil +} + +// GetScanHistory fetches the secret scanning history for a given repository. +// +// To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with +// the repo scope or security_events scope and gitHub advanced security or secret scanning must be enabled. +// +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#get-secret-scanning-scan-history-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/scan-history +func (s *SecretScanningService) GetScanHistory(ctx context.Context, owner, repo string) (*SecretScanningScanHistory, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/secret-scanning/scan-history", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var secretScanningHistory *SecretScanningScanHistory + resp, err := s.client.Do(ctx, req, &secretScanningHistory) + if err != nil { + return nil, resp, err + } + + return secretScanningHistory, resp, nil +} diff --git a/vendor/github.com/google/go-github/v79/github/secret_scanning_pattern_configs.go b/vendor/github.com/google/go-github/v79/github/secret_scanning_pattern_configs.go new file mode 100644 index 0000000000..5eb51c4597 --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/secret_scanning_pattern_configs.go @@ -0,0 +1,165 @@ +// 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"` +} + +// SecretScanningPatternConfigsUpdateOptions specifies optional parameters to +// the SecretScanningService.UpdatePatternConfigsForEnterprise method and +// the SecretScanningService.UpdatePatternConfigsForOrg method. +type SecretScanningPatternConfigsUpdateOptions 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(ctx, 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#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var patternConfigs *SecretScanningPatternConfigs + resp, err := s.client.Do(ctx, 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#update-enterprise-pattern-configurations +// +//meta:operation PATCH /enterprises/{enterprise}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("enterprises/%v/secret-scanning/pattern-configurations", enterprise) + + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(ctx, 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#update-organization-pattern-configurations +// +//meta:operation PATCH /orgs/{org}/secret-scanning/pattern-configurations +func (s *SecretScanningService) UpdatePatternConfigsForOrg(ctx context.Context, org string, opts *SecretScanningPatternConfigsUpdateOptions) (*SecretScanningPatternConfigsUpdate, *Response, error) { + u := fmt.Sprintf("orgs/%v/secret-scanning/pattern-configurations", org) + + req, err := s.client.NewRequest("PATCH", u, opts) + if err != nil { + return nil, nil, err + } + + var patternConfigsUpdate *SecretScanningPatternConfigsUpdate + resp, err := s.client.Do(ctx, req, &patternConfigsUpdate) + if err != nil { + return nil, resp, err + } + + return patternConfigsUpdate, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/security_advisories.go b/vendor/github.com/google/go-github/v79/github/security_advisories.go similarity index 96% rename from vendor/github.com/google/go-github/v67/github/security_advisories.go rename to vendor/github.com/google/go-github/v79/github/security_advisories.go index b5a43f1aac..9d1e251319 100644 --- a/vendor/github.com/google/go-github/v67/github/security_advisories.go +++ b/vendor/github.com/google/go-github/v79/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 type SecurityAdvisoriesService service // SecurityAdvisorySubmission represents the Security Advisory Submission. @@ -139,7 +144,7 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, resp, err := s.client.Do(ctx, req, nil) if err != nil { - if _, ok := err.(*AcceptedError); ok { + if errors.As(err, new(*AcceptedError)) { return resp, nil } @@ -166,7 +171,8 @@ func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Conte fork := new(Repository) resp, err := s.client.Do(ctx, req, fork) if err != nil { - if aerr, ok := err.(*AcceptedError); ok { + var aerr *AcceptedError + if errors.As(err, &aerr) { if err := json.Unmarshal(aerr.Raw, fork); err != nil { return fork, resp, err } @@ -263,7 +269,7 @@ func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Con // //meta:operation GET /advisories/{ghsa_id} func (s *SecurityAdvisoriesService) GetGlobalSecurityAdvisories(ctx context.Context, ghsaID string) (*GlobalSecurityAdvisory, *Response, error) { - url := fmt.Sprintf("advisories/%s", ghsaID) + url := fmt.Sprintf("advisories/%v", ghsaID) req, err := s.client.NewRequest("GET", url, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v67/github/strings.go b/vendor/github.com/google/go-github/v79/github/strings.go similarity index 82% rename from vendor/github.com/google/go-github/v67/github/strings.go rename to vendor/github.com/google/go-github/v79/github/strings.go index f5e61aa326..0158c9a1fd 100644 --- a/vendor/github.com/google/go-github/v67/github/strings.go +++ b/vendor/github.com/google/go-github/v79/github/strings.go @@ -11,12 +11,12 @@ import ( "reflect" ) -var timestampType = reflect.TypeOf(Timestamp{}) +var timestampType = reflect.TypeFor[Timestamp]() // 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 { +func Stringify(message any) string { var buf bytes.Buffer v := reflect.ValueOf(message) stringifyValue(&buf, v) @@ -26,7 +26,7 @@ func Stringify(message interface{}) 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 } @@ -35,10 +35,10 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) { switch v.Kind() { case reflect.String: - fmt.Fprintf(w, `"%s"`, v) + fmt.Fprintf(w, `"%v"`, v) case reflect.Slice: w.WriteByte('[') - for i := 0; i < v.Len(); i++ { + for i := range v.Len() { if i > 0 { w.WriteByte(' ') } @@ -55,16 +55,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/v79/github/sub_issue.go b/vendor/github.com/google/go-github/v79/github/sub_issue.go new file mode 100644 index 0000000000..2effcc5afb --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/sub_issue.go @@ -0,0 +1,140 @@ +// 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 +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#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("DELETE", u, subIssue) + if err != nil { + return nil, nil, err + } + + si := new(SubIssue) + resp, err := s.client.Do(ctx, 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#list-sub-issues +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues +func (s *SubIssueService) ListByIssue(ctx context.Context, owner, repo string, issueNumber int64, opts *IssueListOptions) ([]*SubIssue, *Response, error) { + 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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var subIssues []*SubIssue + resp, err := s.client.Do(ctx, 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#add-sub-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues +func (s *SubIssueService) Add(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues", owner, repo, issueNumber) + req, err := s.client.NewRequest("POST", u, subIssue) + if err != nil { + return nil, nil, err + } + + si := new(SubIssue) + resp, err := s.client.Do(ctx, 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#reprioritize-sub-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority +func (s *SubIssueService) Reprioritize(ctx context.Context, owner, repo string, issueNumber int64, subIssue SubIssueRequest) (*SubIssue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/issues/%v/sub_issues/priority", owner, repo, issueNumber) + req, err := s.client.NewRequest("PATCH", u, subIssue) + if err != nil { + return nil, nil, err + } + + si := new(SubIssue) + resp, err := s.client.Do(ctx, req, si) + if err != nil { + return nil, resp, err + } + + return si, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/teams.go b/vendor/github.com/google/go-github/v79/github/teams.go similarity index 95% rename from vendor/github.com/google/go-github/v67/github/teams.go rename to vendor/github.com/google/go-github/v79/github/teams.go index df248b6540..9e85137824 100644 --- a/vendor/github.com/google/go-github/v67/github/teams.go +++ b/vendor/github.com/google/go-github/v79/github/teams.go @@ -30,10 +30,6 @@ type Team struct { // Permission specifies the default permission for repositories owned by the team. Permission *string `json:"permission,omitempty"` - // Permissions identifies the permissions that a team has on a given - // repository. This is only populated when calling Repositories.ListTeams. - Permissions map[string]bool `json:"permissions,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 @@ -41,6 +37,9 @@ type Team struct { // Default is "secret". Privacy *string `json:"privacy,omitempty"` + // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". + NotificationSetting *string `json:"notification_setting,omitempty"` + MembersCount *int `json:"members_count,omitempty"` ReposCount *int `json:"repos_count,omitempty"` Organization *Organization `json:"organization,omitempty"` @@ -52,6 +51,15 @@ type Team struct { // LDAPDN is only available in GitHub Enterprise and when the team // membership is synchronized with LDAP. LDAPDN *string `json:"ldap_dn,omitempty"` + + // Permissions identifies the permissions that a team has on a given + // repository. This is only populated when calling Repositories.ListTeams. + Permissions map[string]bool `json:"permissions,omitempty"` + + // Assignment identifies how a team was assigned to an organization role. Its + // possible values are: "direct", "indirect", "mixed". This is only populated when + // calling the ListTeamsAssignedToOrgRole method. + Assignment *string `json:"assignment,omitempty"` } func (t Team) String() string { @@ -106,6 +114,8 @@ 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 // //meta:operation GET /orgs/{org}/teams/{team_slug} @@ -232,6 +242,8 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { // EditTeamByID edits a team, given an organization ID, selected by ID. // +// Deprecated: Use EditTeamBySlug instead. +// // GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team // //meta:operation PATCH /orgs/{org}/teams/{team_slug} @@ -290,6 +302,8 @@ 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#delete-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug} @@ -320,6 +334,8 @@ func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) ( // 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#list-child-teams // //meta:operation GET /orgs/{org}/teams/{team_slug}/teams @@ -372,6 +388,8 @@ 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 // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos @@ -387,7 +405,6 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -416,7 +433,6 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string return nil, nil, err } - // TODO: remove custom Accept header when topics API fully launches. req.Header.Set("Accept", mediaTypeTopicsPreview) var repos []*Repository @@ -432,6 +448,8 @@ 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 // //meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} @@ -484,7 +502,7 @@ type TeamAddTeamRepoOptions struct { // Permission specifies the permission to grant the team on this repository. // Possible values are: // pull - team members can pull, but not push to or administer this repository - // push - team members can pull and push, but not administer this repository + // push - team members can push and pull, but not administer this repository // admin - team members can pull, push and administer this repository // maintain - team members can manage the repository without access to sensitive or destructive actions. // triage - team members can proactively manage issues and pull requests without write access. @@ -497,6 +515,8 @@ type TeamAddTeamRepoOptions struct { // 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 // //meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} @@ -531,6 +551,8 @@ func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, // 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 // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} @@ -589,10 +611,12 @@ 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. +// // GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects -func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*Project, *Response, error) { +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) @@ -600,10 +624,9 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - var projects []*Project + var projects []*ProjectV2 resp, err := s.client.Do(ctx, req, &projects) if err != nil { return nil, resp, err @@ -617,7 +640,7 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i // GitHub API docs: https://docs.github.com/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) ([]*Project, *Response, error) { +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) @@ -625,10 +648,9 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - var projects []*Project + var projects []*ProjectV2 resp, err := s.client.Do(ctx, req, &projects) if err != nil { return nil, resp, err @@ -640,20 +662,21 @@ 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. +// // GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project // //meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} -func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*Project, *Response, error) { +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) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &Project{} + projects := &ProjectV2{} resp, err := s.client.Do(ctx, req, &projects) if err != nil { return nil, resp, err @@ -668,17 +691,16 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID // GitHub API docs: https://docs.github.com/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) (*Project, *Response, error) { +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) if err != nil { return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) - projects := &Project{} + projects := &ProjectV2{} resp, err := s.client.Do(ctx, req, &projects) if err != nil { return nil, resp, err @@ -703,6 +725,8 @@ 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. +// // GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions // //meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} @@ -713,7 +737,6 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -733,7 +756,6 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -746,6 +768,8 @@ 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. +// // GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team // //meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} @@ -756,7 +780,6 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -779,7 +802,6 @@ func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug st return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeProjectsPreview) return s.client.Do(ctx, req, nil) @@ -834,6 +856,8 @@ 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 // //meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings @@ -880,6 +904,8 @@ 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 // //meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings @@ -982,7 +1008,7 @@ type ListExternalGroupsOptions struct { // ListExternalGroups lists external groups in an organization on GitHub. // -// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-available-to-an-organization // //meta:operation GET /orgs/{org}/external-groups func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) { diff --git a/vendor/github.com/google/go-github/v67/github/teams_discussion_comments.go b/vendor/github.com/google/go-github/v79/github/teams_discussion_comments.go similarity index 99% rename from vendor/github.com/google/go-github/v67/github/teams_discussion_comments.go rename to vendor/github.com/google/go-github/v79/github/teams_discussion_comments.go index eba6fdf46a..70bcbbc95b 100644 --- a/vendor/github.com/google/go-github/v67/github/teams_discussion_comments.go +++ b/vendor/github.com/google/go-github/v79/github/teams_discussion_comments.go @@ -167,8 +167,8 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // GitHub API docs: https://docs.github.com/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, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { - u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discsusionNumber) +func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discussionNumber int, comment 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) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v67/github/teams_discussions.go b/vendor/github.com/google/go-github/v79/github/teams_discussions.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/teams_discussions.go rename to vendor/github.com/google/go-github/v79/github/teams_discussions.go diff --git a/vendor/github.com/google/go-github/v67/github/teams_members.go b/vendor/github.com/google/go-github/v79/github/teams_members.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/teams_members.go rename to vendor/github.com/google/go-github/v79/github/teams_members.go diff --git a/vendor/github.com/google/go-github/v67/github/timestamp.go b/vendor/github.com/google/go-github/v79/github/timestamp.go similarity index 94% rename from vendor/github.com/google/go-github/v67/github/timestamp.go rename to vendor/github.com/google/go-github/v79/github/timestamp.go index dc1045cf74..71660193bb 100644 --- a/vendor/github.com/google/go-github/v67/github/timestamp.go +++ b/vendor/github.com/google/go-github/v79/github/timestamp.go @@ -10,7 +10,7 @@ import ( "time" ) -// Timestamp represents a time that can be unmarshalled from a JSON string +// Timestamp represents a time that can be unmarshaled from a JSON string // formatted as either an RFC3339 or Unix timestamp. This is necessary for some // fields since the GitHub API is inconsistent in how it represents times. All // exported methods of time.Time can be called on Timestamp. diff --git a/vendor/github.com/google/go-github/v67/github/users.go b/vendor/github.com/google/go-github/v79/github/users.go similarity index 94% rename from vendor/github.com/google/go-github/v67/github/users.go rename to vendor/github.com/google/go-github/v79/github/users.go index c1ab555247..87dcc9a44d 100644 --- a/vendor/github.com/google/go-github/v67/github/users.go +++ b/vendor/github.com/google/go-github/v79/github/users.go @@ -70,6 +70,14 @@ type User struct { // repository. These are only populated when calling Repositories.ListCollaborators. Permissions map[string]bool `json:"permissions,omitempty"` RoleName *string `json:"role_name,omitempty"` + + // Assignment identifies how a user was assigned to an organization role. Its + // possible values are: "direct", "indirect", "mixed". This is only populated when + // calling the ListUsersAssignedToOrgRole method. + Assignment *string `json:"assignment,omitempty"` + // 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"` } func (u User) String() string { @@ -111,7 +119,7 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, // //meta:operation GET /user/{account_id} func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { - u := fmt.Sprintf("user/%d", id) + u := fmt.Sprintf("user/%v", id) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err diff --git a/vendor/github.com/google/go-github/v67/github/users_administration.go b/vendor/github.com/google/go-github/v79/github/users_administration.go similarity index 88% rename from vendor/github.com/google/go-github/v67/github/users_administration.go rename to vendor/github.com/google/go-github/v79/github/users_administration.go index c0aa3b6493..ce87101f72 100644 --- a/vendor/github.com/google/go-github/v67/github/users_administration.go +++ b/vendor/github.com/google/go-github/v79/github/users_administration.go @@ -12,7 +12,7 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator // //meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -28,7 +28,7 @@ func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Resp // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#demote-a-site-administrator // //meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -42,14 +42,14 @@ func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Respo return s.client.Do(ctx, req, nil) } -// UserSuspendOptions represents the reason a user is being suspended. +// UserSuspendOptions represents the reason to suspend a user. type UserSuspendOptions struct { Reason *string `json:"reason,omitempty"` } // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { @@ -65,7 +65,7 @@ func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspe // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.15/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.18/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { diff --git a/vendor/github.com/google/go-github/v67/github/users_attestations.go b/vendor/github.com/google/go-github/v79/github/users_attestations.go similarity index 93% rename from vendor/github.com/google/go-github/v67/github/users_attestations.go rename to vendor/github.com/google/go-github/v79/github/users_attestations.go index 18f60298d8..d63634500b 100644 --- a/vendor/github.com/google/go-github/v67/github/users_attestations.go +++ b/vendor/github.com/google/go-github/v79/github/users_attestations.go @@ -18,7 +18,7 @@ import ( // //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 { diff --git a/vendor/github.com/google/go-github/v67/github/users_blocking.go b/vendor/github.com/google/go-github/v79/github/users_blocking.go similarity index 90% rename from vendor/github.com/google/go-github/v67/github/users_blocking.go rename to vendor/github.com/google/go-github/v79/github/users_blocking.go index 3f2af38f6c..39d89d34c6 100644 --- a/vendor/github.com/google/go-github/v67/github/users_blocking.go +++ b/vendor/github.com/google/go-github/v79/github/users_blocking.go @@ -27,7 +27,6 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) return nil, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) var blockedUsers []*User @@ -52,7 +51,6 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo return false, nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) resp, err := s.client.Do(ctx, req, nil) @@ -73,7 +71,6 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) @@ -92,7 +89,6 @@ func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, return nil, err } - // TODO: remove custom Accept header when this API fully launches. req.Header.Set("Accept", mediaTypeBlockUsersPreview) return s.client.Do(ctx, req, nil) diff --git a/vendor/github.com/google/go-github/v67/github/users_emails.go b/vendor/github.com/google/go-github/v79/github/users_emails.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/users_emails.go rename to vendor/github.com/google/go-github/v79/github/users_emails.go diff --git a/vendor/github.com/google/go-github/v67/github/users_followers.go b/vendor/github.com/google/go-github/v79/github/users_followers.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/users_followers.go rename to vendor/github.com/google/go-github/v79/github/users_followers.go diff --git a/vendor/github.com/google/go-github/v67/github/users_gpg_keys.go b/vendor/github.com/google/go-github/v79/github/users_gpg_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/users_gpg_keys.go rename to vendor/github.com/google/go-github/v79/github/users_gpg_keys.go diff --git a/vendor/github.com/google/go-github/v67/github/users_keys.go b/vendor/github.com/google/go-github/v79/github/users_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/users_keys.go rename to vendor/github.com/google/go-github/v79/github/users_keys.go diff --git a/vendor/github.com/google/go-github/v67/github/users_packages.go b/vendor/github.com/google/go-github/v79/github/users_packages.go similarity index 98% rename from vendor/github.com/google/go-github/v67/github/users_packages.go rename to vendor/github.com/google/go-github/v79/github/users_packages.go index 3ccf68a169..b813dd9d14 100644 --- a/vendor/github.com/google/go-github/v67/github/users_packages.go +++ b/vendor/github.com/google/go-github/v79/github/users_packages.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "net/url" ) // ListPackages lists the packages for a user. Passing the empty string for "user" will @@ -55,9 +56,9 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack 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) diff --git a/vendor/github.com/google/go-github/v79/github/users_social_accounts.go b/vendor/github.com/google/go-github/v79/github/users_social_accounts.go new file mode 100644 index 0000000000..30927cd8db --- /dev/null +++ b/vendor/github.com/google/go-github/v79/github/users_social_accounts.go @@ -0,0 +1,105 @@ +// 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"` +} + +// ListSocialAccounts lists all social accounts for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-the-authenticated-user +// +//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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var socialAccounts []*SocialAccount + resp, err := s.client.Do(ctx, 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#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("POST", u, accountURLs) + if err != nil { + return nil, nil, err + } + + var accounts []*SocialAccount + resp, err := s.client.Do(ctx, 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#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("DELETE", u, accountURLs) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// ListUserSocialAccounts lists all social accounts for a user. +// +// GitHub API docs: https://docs.github.com/rest/users/social-accounts#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("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var addedAccounts []*SocialAccount + resp, err := s.client.Do(ctx, req, &addedAccounts) + if err != nil { + return nil, resp, err + } + + return addedAccounts, resp, nil +} diff --git a/vendor/github.com/google/go-github/v67/github/users_ssh_signing_keys.go b/vendor/github.com/google/go-github/v79/github/users_ssh_signing_keys.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/users_ssh_signing_keys.go rename to vendor/github.com/google/go-github/v79/github/users_ssh_signing_keys.go diff --git a/vendor/github.com/google/go-github/v67/github/with_appengine.go b/vendor/github.com/google/go-github/v79/github/with_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/with_appengine.go rename to vendor/github.com/google/go-github/v79/github/with_appengine.go diff --git a/vendor/github.com/google/go-github/v67/github/without_appengine.go b/vendor/github.com/google/go-github/v79/github/without_appengine.go similarity index 100% rename from vendor/github.com/google/go-github/v67/github/without_appengine.go rename to vendor/github.com/google/go-github/v79/github/without_appengine.go diff --git a/vendor/modules.txt b/vendor/modules.txt index ac4bfd8d79..b979215e78 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -561,9 +561,9 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/go-github/v67 v67.0.0 -## explicit; go 1.21 -github.com/google/go-github/v67/github +# github.com/google/go-github/v79 v79.0.0 +## explicit; go 1.24.0 +github.com/google/go-github/v79/github # github.com/google/go-querystring v1.1.0 ## explicit; go 1.10 github.com/google/go-querystring/query diff --git a/website/docs/d/organization_projects.html.markdown b/website/docs/d/organization_projects.html.markdown new file mode 100644 index 0000000000..d091782dd9 --- /dev/null +++ b/website/docs/d/organization_projects.html.markdown @@ -0,0 +1,68 @@ +--- +layout: "github" +page_title: "GitHub: github_organization_projects" +description: |- + Get information about Projects V2 in an organization. +--- + +# github_organization_projects + +Use this data source to retrieve information about all Projects V2 in a specified GitHub organization. + +~> **Note**: This data source is only available when using GitHub Projects V2 (beta). Classic Projects are not supported. To use Projects V2, you need the proper organization permissions. + +## Example Usage + +```hcl +data "github_organization_projects" "example" { + organization = "my-organization" +} + +output "project_urls" { + value = [for project in data.github_organization_projects.example.projects : project.url] +} + +# Reference a specific project by title +locals { + my_project = [for project in data.github_organization_projects.example.projects : project if project.title == "My Project"][0] +} + +output "my_project_id" { + value = local.my_project.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `organization` - (Required) The name of the organization. + +## Attributes Reference + +* `projects` - A list of Projects V2 in the organization. Each project has the following attributes: + * `id` - The ID of the project. + * `node_id` - The GraphQL node ID of the project. + * `number` - The project number. + * `title` - The title of the project. + * `body` - The body/description of the project. + * `shortDescription` - The short description of the project. + * `public` - Whether the project is public. + * `closed` - Whether the project is closed. + * `creator` - The username of the user who created the project. + * `url` - The URL of the project. + * `created_at` - The timestamp when the project was created. + * `updated_at` - The timestamp when the project was last updated. + * `closed_at` - The timestamp when the project was closed (if applicable). + * `deleted_at` - The timestamp when the project was deleted (if applicable). + * `delete_by` - The username of the user who deleted the project (if applicable). + * `owner` - Details about the project owner: + * `login` - The login name of the owner. + * `id` - The ID of the owner. + * `node_id` - The GraphQL node ID of the owner. + * `avatar_url` - The avatar URL of the owner. + * `gravatar_id` - The Gravatar ID of the owner. + * `url` - The URL of the owner. + * `html_url` - The HTML URL of the owner. + * `type` - The type of the owner (User or Organization). + * `site_admin` - Whether the owner is a site administrator. \ No newline at end of file diff --git a/website/docs/d/project_fields.html.markdown b/website/docs/d/project_fields.html.markdown new file mode 100644 index 0000000000..39ec0d44a9 --- /dev/null +++ b/website/docs/d/project_fields.html.markdown @@ -0,0 +1,89 @@ +--- +layout: "github" +page_title: "GitHub: github_project_fields" +description: |- + Get information about fields in a GitHub Projects V2 project. +--- + +# github_project_fields + +Use this data source to retrieve information about all fields in a specified GitHub Projects V2 project. + +~> **Note**: This data source is only available when using GitHub Projects V2 (beta). Classic Projects are not supported. + +## Example Usage + +```hcl +# Get fields from an organization project +data "github_project_fields" "org_project" { + project_number = 1 + organization = "my-organization" +} + +# Get fields from a user project +data "github_project_fields" "user_project" { + project_number = 2 + username = "octocat" +} + +# Output field names and types +output "field_info" { + value = [ + for field in data.github_project_fields.org_project.fields : { + name = field.name + type = field.data_type + } + ] +} + +# Find a specific field by name +locals { + status_field = [ + for field in data.github_project_fields.org_project.fields : + field if field.name == "Status" + ][0] +} + +# Output the options for a select field +output "status_options" { + value = local.status_field.options[*].name +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_number` - (Required) The number of the project. +* `organization` - (Optional) The name of the organization that owns the project. Cannot be used with `username`. +* `username` - (Optional) The username that owns the project. Cannot be used with `organization`. + +~> **Note**: Either `organization` or `username` must be specified, but not both. + +## Attributes Reference + +* `fields` - A list of fields in the project. Each field has the following attributes: + * `id` - The ID of the field. + * `node_id` - The GraphQL node ID of the field. + * `name` - The name of the field. + * `data_type` - The data type of the field (e.g., "text", "number", "date", "single_select", "iteration"). + * `created_at` - The timestamp when the field was created. + * `updated_at` - The timestamp when the field was last updated. + * `options` - A list of options for single_select fields. Each option has the following attributes: + * `id` - The ID of the option. + * `node_id` - The GraphQL node ID of the option. + * `name` - The name of the option. + * `color` - The color of the option. + * `description` - The description of the option. + +## Field Types + +The following field types are available in Projects V2: + +* `text` - Single line text +* `number` - Numeric values +* `date` - Date values +* `single_select` - Single selection from predefined options +* `iteration` - Iteration/sprint planning field + +For `single_select` fields, the `options` attribute will contain the available choices. For other field types, the `options` attribute will be empty. \ No newline at end of file diff --git a/website/docs/d/user_projects.html.markdown b/website/docs/d/user_projects.html.markdown new file mode 100644 index 0000000000..0d68402855 --- /dev/null +++ b/website/docs/d/user_projects.html.markdown @@ -0,0 +1,68 @@ +--- +layout: "github" +page_title: "GitHub: github_user_projects" +description: |- + Get information about Projects V2 for a specific user. +--- + +# github_user_projects + +Use this data source to retrieve information about all Projects V2 for a specified GitHub user. + +~> **Note**: This data source is only available when using GitHub Projects V2 (beta). Classic Projects are not supported. + +## Example Usage + +```hcl +data "github_user_projects" "example" { + username = "octocat" +} + +output "project_titles" { + value = [for project in data.github_user_projects.example.projects : project.title] +} + +# Reference a specific project by title +locals { + work_project = [for project in data.github_user_projects.example.projects : project if project.title == "Work Tasks"][0] +} + +output "work_project_url" { + value = local.work_project.url +} +``` + +## Argument Reference + +The following arguments are supported: + +* `username` - (Required) The username to retrieve projects for. + +## Attributes Reference + +* `projects` - A list of Projects V2 for the user. Each project has the following attributes: + * `id` - The ID of the project. + * `node_id` - The GraphQL node ID of the project. + * `number` - The project number. + * `title` - The title of the project. + * `body` - The body/description of the project. + * `shortDescription` - The short description of the project. + * `public` - Whether the project is public. + * `closed` - Whether the project is closed. + * `creator` - The username of the user who created the project. + * `url` - The URL of the project. + * `created_at` - The timestamp when the project was created. + * `updated_at` - The timestamp when the project was last updated. + * `closed_at` - The timestamp when the project was closed (if applicable). + * `deleted_at` - The timestamp when the project was deleted (if applicable). + * `delete_by` - The username of the user who deleted the project (if applicable). + * `owner` - Details about the project owner: + * `login` - The login name of the owner. + * `id` - The ID of the owner. + * `node_id` - The GraphQL node ID of the owner. + * `avatar_url` - The avatar URL of the owner. + * `gravatar_id` - The Gravatar ID of the owner. + * `url` - The URL of the owner. + * `html_url` - The HTML URL of the owner. + * `type` - The type of the owner (User or Organization). + * `site_admin` - Whether the owner is a site administrator. \ No newline at end of file diff --git a/website/docs/r/project_card.html.markdown b/website/docs/r/project_card.html.markdown index 619d49ad09..e3bfb62acf 100644 --- a/website/docs/r/project_card.html.markdown +++ b/website/docs/r/project_card.html.markdown @@ -9,6 +9,8 @@ description: |- !> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. +~> **Migration:** Please use the [`github_project_item`](./project_item.html) resource for GitHub Projects V2 instead. + This resource allows you to create and manage cards for GitHub projects. ## Example Usage diff --git a/website/docs/r/project_item.html.markdown b/website/docs/r/project_item.html.markdown new file mode 100644 index 0000000000..f6163178eb --- /dev/null +++ b/website/docs/r/project_item.html.markdown @@ -0,0 +1,75 @@ +--- +layout: "github" +page_title: "GitHub: github_project_item" +description: |- + Creates and manages project items for GitHub Projects V2 +--- + +# github_project_item + +This resource allows you to create and manage items in GitHub Projects V2 (organization-level projects). + +~> **Note:** This resource replaces the deprecated `github_project_card` resource, which was used with the now-sunset GitHub Classic Projects. + +## Example Usage + +```hcl +resource "github_repository" "example" { + name = "example" + has_issues = true +} + +resource "github_issue" "example" { + repository = github_repository.example.name + title = "Example issue" + body = "This is an example issue" +} + +# Note: Use existing Projects V2 project number +# Projects V2 creation requires GraphQL API (not yet supported) +resource "github_project_item" "example" { + project_number = 123 # Replace with your existing Projects V2 number + content_id = github_issue.example.issue_id + content_type = "Issue" +} +``` + +## Example Usage with Archived Item + +```hcl +resource "github_project_item" "archived_example" { + project_number = 123 # Replace with your existing Projects V2 number + content_id = github_issue.example.issue_id + content_type = "Issue" + archived = true +} +``` + +## Argument Reference + +The following arguments are supported: + +* `project_number` - (Required) The number of the project (Projects V2). +* `content_id` - (Required) The ID of the issue or pull request to add to the project. +* `content_type` - (Required) Must be either `Issue` or `PullRequest`. +* `archived` - (Optional) Whether the item is archived. Defaults to `false`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `item_id` - The ID of the project item. +* `node_id` - The node ID of the project item. + +## Import + +A GitHub Project Item can be imported using the format `org/project_number/item_id`: + +``` +$ terraform import github_project_item.example myorg/123/456 +``` + +Where: +- `myorg` is the organization name +- `123` is the project number +- `456` is the item ID \ No newline at end of file