mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 18:18:58 +00:00
Bump github.com/bradleyfalzon/ghinstallation/v2 from 2.9.0 to 2.10.0 (#397)
Bumps [github.com/bradleyfalzon/ghinstallation/v2](https://github.com/bradleyfalzon/ghinstallation) from 2.9.0 to 2.10.0. - [Release notes](https://github.com/bradleyfalzon/ghinstallation/releases) - [Commits](https://github.com/bradleyfalzon/ghinstallation/compare/v2.9.0...v2.10.0) --- updated-dependencies: - dependency-name: github.com/bradleyfalzon/ghinstallation/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
4
go.mod
4
go.mod
@@ -5,7 +5,7 @@ go 1.20
|
||||
require (
|
||||
code.gitea.io/sdk/gitea v0.17.1
|
||||
github.com/MichaelMure/go-term-markdown v0.1.4
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.9.0
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.10.0
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
|
||||
github.com/fatih/color v1.16.0
|
||||
github.com/google/go-github/v41 v41.0.0
|
||||
@@ -32,7 +32,7 @@ require (
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098 // indirect
|
||||
github.com/google/go-github/v57 v57.0.0 // indirect
|
||||
github.com/google/go-github/v60 v60.0.0 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
|
||||
|
||||
8
go.sum
8
go.sum
@@ -627,8 +627,8 @@ github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4x
|
||||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.9.0 h1:HmxIYqnxubRYcYGRc5v3wUekmo5Wv2uX3gukmWJ0AFk=
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.9.0/go.mod h1:wmkTDJf8CmVypxE8ijIStFnKoTa6solK5QfdmJrP9KI=
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.10.0 h1:XWuWBRFEpqVrHepQob9yPS3Xg4K3Wr9QCx4fu8HbUNg=
|
||||
github.com/bradleyfalzon/ghinstallation/v2 v2.10.0/go.mod h1:qoGA4DxWPaYTgVCrmEspVSjlTu4WYAiSxMIhorMRXXc=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
|
||||
@@ -773,8 +773,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg=
|
||||
github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg=
|
||||
github.com/google/go-github/v57 v57.0.0 h1:L+Y3UPTY8ALM8x+TV0lg+IEBI+upibemtBD8Q9u7zHs=
|
||||
github.com/google/go-github/v57 v57.0.0/go.mod h1:s0omdnye0hvK/ecLvpsGfJMiRt85PimQh4oygmLIxHw=
|
||||
github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8=
|
||||
github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk=
|
||||
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/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
|
||||
2
vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go
generated
vendored
2
vendor/github.com/bradleyfalzon/ghinstallation/v2/transport.go
generated
vendored
@@ -13,7 +13,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-github/v57/github"
|
||||
"github.com/google/go-github/v60/github"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
160
vendor/github.com/google/go-github/v57/github/orgs_audit_log.go
generated
vendored
160
vendor/github.com/google/go-github/v57/github/orgs_audit_log.go
generated
vendored
@@ -1,160 +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"
|
||||
)
|
||||
|
||||
// GetAuditLogOptions sets up optional parameters to query audit-log endpoint.
|
||||
type GetAuditLogOptions struct {
|
||||
Phrase *string `url:"phrase,omitempty"` // A search phrase. (Optional.)
|
||||
Include *string `url:"include,omitempty"` // Event type includes. Can be one of "web", "git", "all". Default: "web". (Optional.)
|
||||
Order *string `url:"order,omitempty"` // The order of audit log events. Can be one of "asc" or "desc". Default: "desc". (Optional.)
|
||||
|
||||
ListCursorOptions
|
||||
}
|
||||
|
||||
// HookConfig describes metadata about a webhook configuration.
|
||||
type HookConfig struct {
|
||||
ContentType *string `json:"content_type,omitempty"`
|
||||
InsecureSSL *string `json:"insecure_ssl,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
|
||||
// Secret is returned obfuscated by GitHub, but it can be set for outgoing requests.
|
||||
Secret *string `json:"secret,omitempty"`
|
||||
}
|
||||
|
||||
// ActorLocation contains information about reported location for an actor.
|
||||
type ActorLocation struct {
|
||||
CountryCode *string `json:"country_code,omitempty"`
|
||||
}
|
||||
|
||||
// PolicyOverrideReason contains user-supplied information about why a policy was overridden.
|
||||
type PolicyOverrideReason struct {
|
||||
Code *string `json:"code,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// AuditEntry describes the fields that may be represented by various audit-log "action" entries.
|
||||
// For a list of actions see - https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions
|
||||
type AuditEntry struct {
|
||||
ActorIP *string `json:"actor_ip,omitempty"`
|
||||
Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`.
|
||||
Active *bool `json:"active,omitempty"`
|
||||
ActiveWas *bool `json:"active_was,omitempty"`
|
||||
Actor *string `json:"actor,omitempty"` // The actor who performed the action.
|
||||
ActorLocation *ActorLocation `json:"actor_location,omitempty"`
|
||||
BlockedUser *string `json:"blocked_user,omitempty"`
|
||||
Business *string `json:"business,omitempty"`
|
||||
CancelledAt *Timestamp `json:"cancelled_at,omitempty"`
|
||||
CompletedAt *Timestamp `json:"completed_at,omitempty"`
|
||||
Conclusion *string `json:"conclusion,omitempty"`
|
||||
Config *HookConfig `json:"config,omitempty"`
|
||||
ConfigWas *HookConfig `json:"config_was,omitempty"`
|
||||
ContentType *string `json:"content_type,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
DeployKeyFingerprint *string `json:"deploy_key_fingerprint,omitempty"`
|
||||
DocumentID *string `json:"_document_id,omitempty"`
|
||||
Emoji *string `json:"emoji,omitempty"`
|
||||
EnvironmentName *string `json:"environment_name,omitempty"`
|
||||
Event *string `json:"event,omitempty"`
|
||||
Events []string `json:"events,omitempty"`
|
||||
EventsWere []string `json:"events_were,omitempty"`
|
||||
Explanation *string `json:"explanation,omitempty"`
|
||||
ExternalIdentityNameID *string `json:"external_identity_nameid,omitempty"`
|
||||
ExternalIdentityUsername *string `json:"external_identity_username,omitempty"`
|
||||
Fingerprint *string `json:"fingerprint,omitempty"`
|
||||
HashedToken *string `json:"hashed_token,omitempty"`
|
||||
HeadBranch *string `json:"head_branch,omitempty"`
|
||||
HeadSHA *string `json:"head_sha,omitempty"`
|
||||
HookID *int64 `json:"hook_id,omitempty"`
|
||||
IsHostedRunner *bool `json:"is_hosted_runner,omitempty"`
|
||||
JobName *string `json:"job_name,omitempty"`
|
||||
JobWorkflowRef *string `json:"job_workflow_ref,omitempty"`
|
||||
LimitedAvailability *bool `json:"limited_availability,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
OAuthApplicationID *int64 `json:"oauth_application_id,omitempty"`
|
||||
OldUser *string `json:"old_user,omitempty"`
|
||||
OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
|
||||
OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"`
|
||||
OperationType *string `json:"operation_type,omitempty"`
|
||||
Org *string `json:"org,omitempty"`
|
||||
OrgID *int64 `json:"org_id,omitempty"`
|
||||
OverriddenCodes []string `json:"overridden_codes,omitempty"`
|
||||
Permission *string `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`.
|
||||
PreviousVisibility *string `json:"previous_visibility,omitempty"`
|
||||
ProgrammaticAccessType *string `json:"programmatic_access_type,omitempty"`
|
||||
PullRequestID *int64 `json:"pull_request_id,omitempty"`
|
||||
PullRequestTitle *string `json:"pull_request_title,omitempty"`
|
||||
PullRequestURL *string `json:"pull_request_url,omitempty"`
|
||||
ReadOnly *string `json:"read_only,omitempty"`
|
||||
Reasons []*PolicyOverrideReason `json:"reasons,omitempty"`
|
||||
Repo *string `json:"repo,omitempty"`
|
||||
Repository *string `json:"repository,omitempty"`
|
||||
RepositoryPublic *bool `json:"repository_public,omitempty"`
|
||||
RunAttempt *int64 `json:"run_attempt,omitempty"`
|
||||
RunnerGroupID *int64 `json:"runner_group_id,omitempty"`
|
||||
RunnerGroupName *string `json:"runner_group_name,omitempty"`
|
||||
RunnerID *int64 `json:"runner_id,omitempty"`
|
||||
RunnerLabels []string `json:"runner_labels,omitempty"`
|
||||
RunnerName *string `json:"runner_name,omitempty"`
|
||||
RunNumber *int64 `json:"run_number,omitempty"`
|
||||
SecretsPassed []string `json:"secrets_passed,omitempty"`
|
||||
SourceVersion *string `json:"source_version,omitempty"`
|
||||
StartedAt *Timestamp `json:"started_at,omitempty"`
|
||||
TargetLogin *string `json:"target_login,omitempty"`
|
||||
TargetVersion *string `json:"target_version,omitempty"`
|
||||
Team *string `json:"team,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).
|
||||
TokenID *int64 `json:"token_id,omitempty"`
|
||||
TokenScopes *string `json:"token_scopes,omitempty"`
|
||||
Topic *string `json:"topic,omitempty"`
|
||||
TransportProtocolName *string `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data.
|
||||
TransportProtocol *int `json:"transport_protocol,omitempty"` // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data.
|
||||
TriggerID *int64 `json:"trigger_id,omitempty"`
|
||||
User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available).
|
||||
UserAgent *string `json:"user_agent,omitempty"`
|
||||
Visibility *string `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`.
|
||||
WorkflowID *int64 `json:"workflow_id,omitempty"`
|
||||
WorkflowRunID *int64 `json:"workflow_run_id,omitempty"`
|
||||
|
||||
Data *AuditEntryData `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// AuditEntryData represents additional information stuffed into a `data` field.
|
||||
type AuditEntryData struct {
|
||||
OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change
|
||||
OldLogin *string `json:"old_login,omitempty"` // The previous name of the organization, for a name change
|
||||
}
|
||||
|
||||
// GetAuditLog gets the audit-log entries for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/audit-log
|
||||
func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/audit-log", 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 auditEntries []*AuditEntry
|
||||
resp, err := s.client.Do(ctx, req, &auditEntries)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return auditEntries, resp, nil
|
||||
}
|
||||
@@ -29,6 +29,14 @@ func (a ActionsPermissionsEnterprise) String() string {
|
||||
return Stringify(a)
|
||||
}
|
||||
|
||||
// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions
|
||||
type DefaultWorkflowPermissionEnterprise struct {
|
||||
DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"`
|
||||
CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"`
|
||||
}
|
||||
|
||||
// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise
|
||||
@@ -205,3 +213,46 @@ func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, ent
|
||||
|
||||
return p, resp, nil
|
||||
}
|
||||
|
||||
// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise
|
||||
//
|
||||
//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow
|
||||
func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) {
|
||||
u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
permissions := new(DefaultWorkflowPermissionEnterprise)
|
||||
resp, err := s.client.Do(ctx, req, permissions)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return permissions, resp, nil
|
||||
}
|
||||
|
||||
// EditDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise
|
||||
//
|
||||
//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow
|
||||
func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) {
|
||||
u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise)
|
||||
req, err := s.client.NewRequest("PUT", u, permissions)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
p := new(DefaultWorkflowPermissionEnterprise)
|
||||
resp, err := s.client.Do(ctx, req, p)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return p, resp, nil
|
||||
}
|
||||
@@ -42,6 +42,14 @@ 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
|
||||
@@ -218,3 +226,46 @@ func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, act
|
||||
|
||||
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
|
||||
}
|
||||
@@ -63,8 +63,8 @@ type JITRunnerConfig struct {
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig
|
||||
func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, owner string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", owner)
|
||||
func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", org)
|
||||
req, err := s.client.NewRequest("POST", u, request)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -247,8 +247,8 @@ func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, r
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/actions/runners/downloads
|
||||
func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner)
|
||||
func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, org string) ([]*RunnerApplicationDownload, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/downloads", org)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -268,8 +268,8 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/actions/runners/registration-token
|
||||
func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner)
|
||||
func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, org string) (*RegistrationToken, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", org)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
@@ -290,8 +290,8 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/actions/runners
|
||||
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners", owner)
|
||||
func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListOptions) (*Runners, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners", org)
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -316,8 +316,8 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/actions/runners/{runner_id}
|
||||
func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
||||
func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Runner, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -337,8 +337,8 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/actions/runners/remove-token
|
||||
func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner)
|
||||
func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org string) (*RemoveToken, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", org)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
@@ -359,8 +359,8 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owne
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/actions/runners/{runner_id}
|
||||
func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID)
|
||||
func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
@@ -138,6 +138,17 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string
|
||||
return s.listSecrets(ctx, url, opts)
|
||||
}
|
||||
|
||||
// ListRepoOrgSecrets lists all organization secrets available in a repository
|
||||
// without revealing their encrypted values.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets
|
||||
//
|
||||
//meta:operation GET /repos/{owner}/{repo}/actions/organization-secrets
|
||||
func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/actions/organization-secrets", owner, repo)
|
||||
return s.listSecrets(ctx, url, opts)
|
||||
}
|
||||
|
||||
// ListOrgSecrets lists all secrets available in an organization
|
||||
// without revealing their encrypted values.
|
||||
//
|
||||
@@ -59,6 +59,16 @@ func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo stri
|
||||
return s.listVariables(ctx, url, opts)
|
||||
}
|
||||
|
||||
// ListRepoOrgVariables lists all organization variables available in a repository.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-organization-variables
|
||||
//
|
||||
//meta:operation GET /repos/{owner}/{repo}/actions/organization-variables
|
||||
func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) {
|
||||
url := fmt.Sprintf("repos/%v/%v/actions/organization-variables", owner, repo)
|
||||
return s.listVariables(ctx, url, opts)
|
||||
}
|
||||
|
||||
// ListOrgVariables lists all variables available in an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/variables#list-organization-variables
|
||||
@@ -94,6 +94,32 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin
|
||||
return jobs, resp, nil
|
||||
}
|
||||
|
||||
// ListWorkflowJobsAttempt lists jobs for a workflow run Attempt.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt
|
||||
//
|
||||
//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, 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
|
||||
}
|
||||
|
||||
jobs := new(Jobs)
|
||||
resp, err := s.client.Do(ctx, req, &jobs)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return jobs, resp, nil
|
||||
}
|
||||
|
||||
// GetWorkflowJobByID gets a specific job in a workflow run by ID.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run
|
||||
@@ -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.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -22,7 +22,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.10/rest/enterprise-admin/orgs#create-an-organization
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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,7 +61,7 @@ type RenameOrgResponse struct {
|
||||
|
||||
// RenameOrg renames an organization in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -70,7 +70,7 @@ func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName
|
||||
|
||||
// RenameOrgByName renames an organization in GitHub Enterprise using its current name.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -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.10/rest/enterprise-admin/admin-stats#get-all-statistics
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics
|
||||
//
|
||||
//meta:operation GET /enterprise/stats/all
|
||||
func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
|
||||
@@ -10,26 +10,22 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// createUserRequest is a subset of User and is used internally
|
||||
// by CreateUser to pass only the known fields for the endpoint.
|
||||
type createUserRequest struct {
|
||||
Login *string `json:"login,omitempty"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
// CreateUserRequest represents the fields sent to the `CreateUser` endpoint.
|
||||
// Note that `Login` is a required field.
|
||||
type CreateUserRequest struct {
|
||||
Login string `json:"login"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
Suspended *bool `json:"suspended,omitempty"`
|
||||
}
|
||||
|
||||
// CreateUser creates a new user in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user
|
||||
//
|
||||
//meta:operation POST /admin/users
|
||||
func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*User, *Response, error) {
|
||||
func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) {
|
||||
u := "admin/users"
|
||||
|
||||
userReq := &createUserRequest{
|
||||
Login: &login,
|
||||
Email: &email,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, userReq)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -46,7 +42,7 @@ func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*Us
|
||||
|
||||
// DeleteUser deletes a user in GitHub Enterprise.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-user
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user
|
||||
//
|
||||
//meta:operation DELETE /admin/users/{username}
|
||||
func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) {
|
||||
@@ -99,7 +95,7 @@ type UserAuthorization struct {
|
||||
|
||||
// CreateUserImpersonation creates an impersonation OAuth token.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -121,7 +117,7 @@ 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.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -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.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token
|
||||
// GitHub API docs: https://docs.github.com/enterprise-server@3.11/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) {
|
||||
@@ -7,6 +7,8 @@ package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -389,11 +391,21 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sarifID := new(SarifID)
|
||||
resp, err := s.client.Do(ctx, req, sarifID)
|
||||
if err != nil {
|
||||
// This will always return an error without unmarshalling 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.
|
||||
// However, if the error is AcceptedError, decode it below before
|
||||
// returning from this function and closing the response body.
|
||||
var acceptedError *AcceptedError
|
||||
if !errors.As(err, &acceptedError) {
|
||||
return nil, resp, err
|
||||
}
|
||||
sarifID := new(SarifID)
|
||||
decErr := json.Unmarshal(acceptedError.Raw, sarifID)
|
||||
if decErr != nil {
|
||||
return nil, resp, decErr
|
||||
}
|
||||
|
||||
return sarifID, resp, nil
|
||||
}
|
||||
311
vendor/github.com/google/go-github/v60/github/copilot.go
generated
vendored
Normal file
311
vendor/github.com/google/go-github/v60/github/copilot.go
generated
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// CopilotService provides access to the Copilot-related functions
|
||||
// in the GitHub API.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/en/rest/copilot/
|
||||
type CopilotService service
|
||||
|
||||
// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription.
|
||||
type CopilotOrganizationDetails struct {
|
||||
SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"`
|
||||
PublicCodeSuggestions string `json:"public_code_suggestions"`
|
||||
CopilotChat string `json:"copilot_chat"`
|
||||
SeatManagementSetting string `json:"seat_management_setting"`
|
||||
}
|
||||
|
||||
// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization.
|
||||
type CopilotSeatBreakdown struct {
|
||||
Total int `json:"total"`
|
||||
AddedThisCycle int `json:"added_this_cycle"`
|
||||
PendingCancellation int `json:"pending_cancellation"`
|
||||
PendingInvitation int `json:"pending_invitation"`
|
||||
ActiveThisCycle int `json:"active_this_cycle"`
|
||||
InactiveThisCycle int `json:"inactive_this_cycle"`
|
||||
}
|
||||
|
||||
// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization.
|
||||
type ListCopilotSeatsResponse struct {
|
||||
TotalSeats int64 `json:"total_seats"`
|
||||
Seats []*CopilotSeatDetails `json:"seats"`
|
||||
}
|
||||
|
||||
// CopilotSeatDetails represents the details of a Copilot for Business seat.
|
||||
type CopilotSeatDetails struct {
|
||||
// Assignee can either be a User, Team, or Organization.
|
||||
Assignee interface{} `json:"assignee"`
|
||||
AssigningTeam *Team `json:"assigning_team,omitempty"`
|
||||
PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"`
|
||||
LastActivityAt *Timestamp `json:"last_activity_at,omitempty"`
|
||||
LastActivityEditor *string `json:"last_activity_editor,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at"`
|
||||
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
// SeatAssignments represents the number of seats assigned.
|
||||
type SeatAssignments struct {
|
||||
SeatsCreated int `json:"seats_created"`
|
||||
}
|
||||
|
||||
// SeatCancellations represents the number of seats cancelled.
|
||||
type SeatCancellations struct {
|
||||
SeatsCancelled int `json:"seats_cancelled"`
|
||||
}
|
||||
|
||||
func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error {
|
||||
// Using an alias to avoid infinite recursion when calling json.Unmarshal
|
||||
type alias CopilotSeatDetails
|
||||
var seatDetail alias
|
||||
|
||||
if err := json.Unmarshal(data, &seatDetail); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cp.AssigningTeam = seatDetail.AssigningTeam
|
||||
cp.PendingCancellationDate = seatDetail.PendingCancellationDate
|
||||
cp.LastActivityAt = seatDetail.LastActivityAt
|
||||
cp.LastActivityEditor = seatDetail.LastActivityEditor
|
||||
cp.CreatedAt = seatDetail.CreatedAt
|
||||
cp.UpdatedAt = seatDetail.UpdatedAt
|
||||
|
||||
switch v := seatDetail.Assignee.(type) {
|
||||
case map[string]interface{}:
|
||||
jsonData, err := json.Marshal(seatDetail.Assignee)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if v["type"] == nil {
|
||||
return fmt.Errorf("assignee type field is not set")
|
||||
}
|
||||
|
||||
if t, ok := v["type"].(string); ok && t == "User" {
|
||||
user := &User{}
|
||||
if err := json.Unmarshal(jsonData, user); err != nil {
|
||||
return err
|
||||
}
|
||||
cp.Assignee = user
|
||||
} else if t, ok := v["type"].(string); ok && t == "Team" {
|
||||
team := &Team{}
|
||||
if err := json.Unmarshal(jsonData, team); err != nil {
|
||||
return err
|
||||
}
|
||||
cp.Assignee = team
|
||||
} else if t, ok := v["type"].(string); ok && t == "Organization" {
|
||||
organization := &Organization{}
|
||||
if err := json.Unmarshal(jsonData, organization); err != nil {
|
||||
return err
|
||||
}
|
||||
cp.Assignee = organization
|
||||
} else {
|
||||
return fmt.Errorf("unsupported assignee type %v", v["type"])
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("unsupported assignee type %T", v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUser gets the User from the CopilotSeatDetails if the assignee is a user.
|
||||
func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok }
|
||||
|
||||
// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team.
|
||||
func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok }
|
||||
|
||||
// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization.
|
||||
func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) {
|
||||
o, ok := cp.Assignee.(*Organization)
|
||||
return o, ok
|
||||
}
|
||||
|
||||
// GetCopilotBilling gets Copilot for Business billing information and settings for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/copilot/billing
|
||||
func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing", org)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var copilotDetails *CopilotOrganizationDetails
|
||||
resp, err := s.client.Do(ctx, req, &copilotDetails)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return copilotDetails, resp, nil
|
||||
}
|
||||
|
||||
// ListCopilotSeats lists Copilot for Business seat assignments for an organization.
|
||||
//
|
||||
// To paginate through all seats, populate 'Page' with the number of the last page.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/copilot/billing/seats
|
||||
func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var copilotSeats *ListCopilotSeatsResponse
|
||||
resp, err := s.client.Do(ctx, req, &copilotSeats)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return copilotSeats, resp, nil
|
||||
}
|
||||
|
||||
// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/copilot/billing/selected_teams
|
||||
func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org)
|
||||
|
||||
body := struct {
|
||||
SelectedTeams []string `json:"selected_teams"`
|
||||
}{
|
||||
SelectedTeams: teamNames,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var seatAssignments *SeatAssignments
|
||||
resp, err := s.client.Do(ctx, req, &seatAssignments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return seatAssignments, resp, nil
|
||||
}
|
||||
|
||||
// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams
|
||||
func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org)
|
||||
|
||||
body := struct {
|
||||
SelectedTeams []string `json:"selected_teams"`
|
||||
}{
|
||||
SelectedTeams: teamNames,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var seatCancellations *SeatCancellations
|
||||
resp, err := s.client.Do(ctx, req, &seatCancellations)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return seatCancellations, resp, nil
|
||||
}
|
||||
|
||||
// AddCopilotUsers adds users to the Copilot for Business subscription for an organization
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/copilot/billing/selected_users
|
||||
func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org)
|
||||
|
||||
body := struct {
|
||||
SelectedUsernames []string `json:"selected_usernames"`
|
||||
}{
|
||||
SelectedUsernames: users,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var seatAssignments *SeatAssignments
|
||||
resp, err := s.client.Do(ctx, req, &seatAssignments)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return seatAssignments, resp, nil
|
||||
}
|
||||
|
||||
// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users
|
||||
func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org)
|
||||
|
||||
body := struct {
|
||||
SelectedUsernames []string `json:"selected_usernames"`
|
||||
}{
|
||||
SelectedUsernames: users,
|
||||
}
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, body)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var seatCancellations *SeatCancellations
|
||||
resp, err := s.client.Do(ctx, req, &seatCancellations)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return seatCancellations, resp, nil
|
||||
}
|
||||
|
||||
// GetSeatDetails gets Copilot for Business seat assignment details for a user.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/members/{username}/copilot
|
||||
func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var seatDetails *CopilotSeatDetails
|
||||
resp, err := s.client.Do(ctx, req, &seatDetails)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return seatDetails, resp, nil
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Dependency reprensents the vulnerable dependency.
|
||||
// Dependency represents the vulnerable dependency.
|
||||
type Dependency struct {
|
||||
Package *VulnerabilityPackage `json:"package,omitempty"`
|
||||
ManifestPath *string `json:"manifest_path,omitempty"`
|
||||
@@ -23,7 +23,7 @@ type AdvisoryCVSS struct {
|
||||
VectorString *string `json:"vector_string,omitempty"`
|
||||
}
|
||||
|
||||
// AdvisoryCWEs reprensent the advisory pertaining to Common Weakness Enumeration.
|
||||
// AdvisoryCWEs represent the advisory pertaining to Common Weakness Enumeration.
|
||||
type AdvisoryCWEs struct {
|
||||
CWEID *string `json:"cwe_id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
@@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API.
|
||||
|
||||
Usage:
|
||||
|
||||
import "github.com/google/go-github/v57/github" // with go modules enabled (GO111MODULE=on or outside GOPATH)
|
||||
import "github.com/google/go-github/v60/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
|
||||
@@ -16,6 +16,7 @@ type EnterpriseSecurityAnalysisSettings struct {
|
||||
SecretScanningEnabledForNewRepositories *bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"`
|
||||
SecretScanningPushProtectionEnabledForNewRepositories *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"`
|
||||
SecretScanningPushProtectionCustomLink *string `json:"secret_scanning_push_protection_custom_link,omitempty"`
|
||||
SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"`
|
||||
}
|
||||
|
||||
// GetCodeSecurityAndAnalysis gets code security and analysis features for an enterprise.
|
||||
@@ -394,6 +394,7 @@ type EditChange struct {
|
||||
Repo *EditRepo `json:"repository,omitempty"`
|
||||
Owner *EditOwner `json:"owner,omitempty"`
|
||||
DefaultBranch *EditDefaultBranch `json:"default_branch,omitempty"`
|
||||
Topics *EditTopics `json:"topics,omitempty"`
|
||||
}
|
||||
|
||||
// EditTitle represents a pull-request title change.
|
||||
@@ -438,6 +439,11 @@ type RepoName struct {
|
||||
From *string `json:"from,omitempty"`
|
||||
}
|
||||
|
||||
// EditTopics represents a change of repository topics.
|
||||
type EditTopics struct {
|
||||
From []string `json:"from,omitempty"`
|
||||
}
|
||||
|
||||
// EditSHA represents a sha change of a pull-request.
|
||||
type EditSHA struct {
|
||||
From *string `json:"from,omitempty"`
|
||||
@@ -1321,43 +1327,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"`
|
||||
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]string `json:"custom_properties,omitempty"`
|
||||
}
|
||||
|
||||
// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
|
||||
@@ -1389,7 +1396,7 @@ type ReleaseEvent struct {
|
||||
|
||||
// RepositoryEvent is triggered when a repository is created, archived, unarchived,
|
||||
// renamed, edited, transferred, made public, or made private. Organization hooks are
|
||||
// also trigerred when a repository is deleted.
|
||||
// also triggered when a repository is deleted.
|
||||
// The Webhook event name is "repository".
|
||||
//
|
||||
// Events of this type are not visible in timelines, they are only used to
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = "v57.0.0"
|
||||
Version = "v60.0.0"
|
||||
|
||||
defaultAPIVersion = "2022-11-28"
|
||||
defaultBaseURL = "https://api.github.com/"
|
||||
@@ -186,6 +186,7 @@ type Client struct {
|
||||
CodeScanning *CodeScanningService
|
||||
CodesOfConduct *CodesOfConductService
|
||||
Codespaces *CodespacesService
|
||||
Copilot *CopilotService
|
||||
Dependabot *DependabotService
|
||||
DependencyGraph *DependencyGraphService
|
||||
Emojis *EmojisService
|
||||
@@ -220,6 +221,8 @@ type service struct {
|
||||
}
|
||||
|
||||
// Client returns the http.Client used by this GitHub client.
|
||||
// This should only be used for requests to the GitHub API because
|
||||
// request headers will contain an authorization token.
|
||||
func (c *Client) Client() *http.Client {
|
||||
c.clientMu.Lock()
|
||||
defer c.clientMu.Unlock()
|
||||
@@ -315,7 +318,11 @@ func addOptions(s string, opts interface{}) (string, error) {
|
||||
// an http.Client that will perform the authentication for you (such as that
|
||||
// provided by the golang.org/x/oauth2 library).
|
||||
func NewClient(httpClient *http.Client) *Client {
|
||||
c := &Client{client: httpClient}
|
||||
if httpClient == nil {
|
||||
httpClient = &http.Client{}
|
||||
}
|
||||
httpClient2 := *httpClient
|
||||
c := &Client{client: &httpClient2}
|
||||
c.initialize()
|
||||
return c
|
||||
}
|
||||
@@ -408,6 +415,7 @@ func (c *Client) initialize() {
|
||||
c.CodeScanning = (*CodeScanningService)(&c.common)
|
||||
c.Codespaces = (*CodespacesService)(&c.common)
|
||||
c.CodesOfConduct = (*CodesOfConductService)(&c.common)
|
||||
c.Copilot = (*CopilotService)(&c.common)
|
||||
c.Dependabot = (*DependabotService)(&c.common)
|
||||
c.DependencyGraph = (*DependencyGraphService)(&c.common)
|
||||
c.Emojis = (*EmojisService)(&c.common)
|
||||
@@ -442,15 +450,18 @@ func (c *Client) copy() *Client {
|
||||
c.clientMu.Lock()
|
||||
// can't use *c here because that would copy mutexes by value.
|
||||
clone := Client{
|
||||
client: c.client,
|
||||
client: &http.Client{},
|
||||
UserAgent: c.UserAgent,
|
||||
BaseURL: c.BaseURL,
|
||||
UploadURL: c.UploadURL,
|
||||
secondaryRateLimitReset: c.secondaryRateLimitReset,
|
||||
}
|
||||
c.clientMu.Unlock()
|
||||
if clone.client == nil {
|
||||
clone.client = &http.Client{}
|
||||
if c.client != nil {
|
||||
clone.client.Transport = c.client.Transport
|
||||
clone.client.CheckRedirect = c.client.CheckRedirect
|
||||
clone.client.Jar = c.client.Jar
|
||||
clone.client.Timeout = c.client.Timeout
|
||||
}
|
||||
c.rateMu.Lock()
|
||||
copy(clone.rateLimits[:], c.rateLimits[:])
|
||||
@@ -893,7 +904,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro
|
||||
// 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,
|
||||
// the raw response body will be written to v, without attempting to first
|
||||
// decode it. If v is nil, and no error hapens, the response is returned as is.
|
||||
// decode it. If v is nil, and no error happens, the response is returned as is.
|
||||
// If rate limit is exceeded and reset time is in the future, Do returns
|
||||
// *RateLimitError immediately without making a network API call.
|
||||
//
|
||||
@@ -1303,6 +1314,8 @@ const (
|
||||
codeScanningUploadCategory
|
||||
actionsRunnerRegistrationCategory
|
||||
scimCategory
|
||||
dependencySnapshotsCategory
|
||||
codeSearchCategory
|
||||
|
||||
categories // An array of this length will be able to contain all rate limit categories.
|
||||
)
|
||||
@@ -1315,6 +1328,12 @@ func category(method, path string) rateLimitCategory {
|
||||
// NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too,
|
||||
// because no API found for this category.
|
||||
return coreCategory
|
||||
|
||||
// https://docs.github.com/en/rest/search/search#search-code
|
||||
case strings.HasPrefix(path, "/search/code") &&
|
||||
method == http.MethodGet:
|
||||
return codeSearchCategory
|
||||
|
||||
case strings.HasPrefix(path, "/search/"):
|
||||
return searchCategory
|
||||
case path == "/graphql":
|
||||
@@ -1337,6 +1356,12 @@ func category(method, path string) rateLimitCategory {
|
||||
// https://docs.github.com/enterprise-cloud@latest/rest/scim
|
||||
case strings.HasPrefix(path, "/scim/"):
|
||||
return scimCategory
|
||||
|
||||
// https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository
|
||||
case strings.HasPrefix(path, "/repos/") &&
|
||||
strings.HasSuffix(path, "/dependency-graph/snapshots") &&
|
||||
method == http.MethodPost:
|
||||
return dependencySnapshotsCategory
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,10 +122,11 @@ type IssueListOptions struct {
|
||||
// PullRequestLinks object is added to the Issue object when it's an issue included
|
||||
// in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR.
|
||||
type PullRequestLinks struct {
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
DiffURL *string `json:"diff_url,omitempty"`
|
||||
PatchURL *string `json:"patch_url,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
HTMLURL *string `json:"html_url,omitempty"`
|
||||
DiffURL *string `json:"diff_url,omitempty"`
|
||||
PatchURL *string `json:"patch_url,omitempty"`
|
||||
MergedAt *Timestamp `json:"merged_at,omitempty"`
|
||||
}
|
||||
|
||||
// List the issues for the authenticated user. If all is true, list issues
|
||||
@@ -18,6 +18,9 @@ type IssueEvent struct {
|
||||
// The User that generated this event.
|
||||
Actor *User `json:"actor,omitempty"`
|
||||
|
||||
// The action corresponding to the event.
|
||||
Action string `json:"action,omitempty"`
|
||||
|
||||
// Event identifies the actual type of Event that occurred. Possible
|
||||
// values are:
|
||||
//
|
||||
@@ -74,6 +77,7 @@ type IssueEvent struct {
|
||||
Issue *Issue `json:"issue,omitempty"`
|
||||
|
||||
// Only present on certain events; see above.
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
Assignee *User `json:"assignee,omitempty"`
|
||||
Assigner *User `json:"assigner,omitempty"`
|
||||
CommitID *string `json:"commit_id,omitempty"`
|
||||
@@ -95,6 +95,8 @@ type Organization struct {
|
||||
SecretScanningEnabledForNewRepos *bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"`
|
||||
// SecretScanningPushProtectionEnabledForNewRepos toggles whether secret scanning push protection is enabled on new repositories.
|
||||
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"`
|
||||
|
||||
// API URLs
|
||||
URL *string `json:"url,omitempty"`
|
||||
142
vendor/github.com/google/go-github/v60/github/orgs_audit_log.go
generated
vendored
Normal file
142
vendor/github.com/google/go-github/v60/github/orgs_audit_log.go
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
// 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"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// GetAuditLogOptions sets up optional parameters to query audit-log endpoint.
|
||||
type GetAuditLogOptions struct {
|
||||
Phrase *string `url:"phrase,omitempty"` // A search phrase. (Optional.)
|
||||
Include *string `url:"include,omitempty"` // Event type includes. Can be one of "web", "git", "all". Default: "web". (Optional.)
|
||||
Order *string `url:"order,omitempty"` // The order of audit log events. Can be one of "asc" or "desc". Default: "desc". (Optional.)
|
||||
|
||||
ListCursorOptions
|
||||
}
|
||||
|
||||
// ActorLocation contains information about reported location for an actor.
|
||||
type ActorLocation struct {
|
||||
CountryCode *string `json:"country_code,omitempty"`
|
||||
}
|
||||
|
||||
// AuditEntry describes the fields that may be represented by various audit-log "action" entries.
|
||||
// There are many other fields that may be present depending on the action. You can access those
|
||||
// in AdditionalFields.
|
||||
// For a list of actions see - https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions
|
||||
type AuditEntry struct {
|
||||
Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`.
|
||||
Actor *string `json:"actor,omitempty"` // The actor who performed the action.
|
||||
ActorID *int64 `json:"actor_id,omitempty"`
|
||||
ActorLocation *ActorLocation `json:"actor_location,omitempty"`
|
||||
Business *string `json:"business,omitempty"`
|
||||
BusinessID *int64 `json:"business_id,omitempty"`
|
||||
CreatedAt *Timestamp `json:"created_at,omitempty"`
|
||||
DocumentID *string `json:"_document_id,omitempty"`
|
||||
ExternalIdentityNameID *string `json:"external_identity_nameid,omitempty"`
|
||||
ExternalIdentityUsername *string `json:"external_identity_username,omitempty"`
|
||||
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).
|
||||
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"`
|
||||
|
||||
// All fields that are not explicitly defined in the struct are captured here.
|
||||
AdditionalFields map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
func (a *AuditEntry) UnmarshalJSON(data []byte) error {
|
||||
type entryAlias AuditEntry
|
||||
var v entryAlias
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rawDefinedFields, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
definedFields := map[string]interface{}{}
|
||||
if err := json.Unmarshal(rawDefinedFields, &definedFields); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &v.AdditionalFields); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for key, val := range v.AdditionalFields {
|
||||
if _, ok := definedFields[key]; ok || val == nil {
|
||||
delete(v.AdditionalFields, key)
|
||||
}
|
||||
}
|
||||
|
||||
*a = AuditEntry(v)
|
||||
if len(v.AdditionalFields) == 0 {
|
||||
a.AdditionalFields = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *AuditEntry) MarshalJSON() ([]byte, error) {
|
||||
type entryAlias AuditEntry
|
||||
v := entryAlias(*a)
|
||||
defBytes, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(a.AdditionalFields) == 0 {
|
||||
return defBytes, err
|
||||
}
|
||||
resMap := map[string]interface{}{}
|
||||
if err := json.Unmarshal(defBytes, &resMap); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for key, val := range a.AdditionalFields {
|
||||
if val == nil {
|
||||
continue
|
||||
}
|
||||
if _, ok := resMap[key]; ok {
|
||||
return nil, fmt.Errorf("unexpected field in AdditionalFields: %v", key)
|
||||
}
|
||||
resMap[key] = val
|
||||
}
|
||||
return json.Marshal(resMap)
|
||||
}
|
||||
|
||||
// GetAuditLog gets the audit-log entries for an organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/audit-log
|
||||
func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/audit-log", 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 auditEntries []*AuditEntry
|
||||
resp, err := s.client.Do(ctx, req, &auditEntries)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return auditEntries, resp, nil
|
||||
}
|
||||
@@ -8,6 +8,7 @@ package github
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ListPackages lists the packages for an organization.
|
||||
@@ -38,11 +39,13 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt
|
||||
|
||||
// GetPackage gets a package by name from an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}
|
||||
func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName))
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -59,11 +62,13 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType,
|
||||
|
||||
// DeletePackage deletes a package from an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}
|
||||
func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName))
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -74,11 +79,13 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy
|
||||
|
||||
// RestorePackage restores a package to an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restore
|
||||
func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, url.PathEscape(packageName))
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -89,11 +96,13 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT
|
||||
|
||||
// PackageGetAllVersions gets all versions of a package in an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions
|
||||
func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, url.PathEscape(packageName))
|
||||
u, err := addOptions(u, opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -115,11 +124,13 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p
|
||||
|
||||
// PackageGetVersion gets a specific version of a package in an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}
|
||||
func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -136,11 +147,13 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa
|
||||
|
||||
// PackageDeleteVersion deletes a package version from an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}
|
||||
func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID)
|
||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -151,11 +164,13 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa
|
||||
|
||||
// PackageRestoreVersion restores a package version to an organization.
|
||||
//
|
||||
// Note that packageName is escaped for the URL path so that you don't need to.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization
|
||||
//
|
||||
//meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore
|
||||
func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID)
|
||||
u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, url.PathEscape(packageName), packageVersionID)
|
||||
req, err := s.client.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -39,7 +39,7 @@ type CustomPropertyValue struct {
|
||||
|
||||
// GetAllCustomProperties gets all custom properties that are defined for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-all-custom-properties-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/properties/schema
|
||||
func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org string) ([]*CustomProperty, *Response, error) {
|
||||
@@ -61,7 +61,7 @@ func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org s
|
||||
|
||||
// CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-properties-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization
|
||||
//
|
||||
//meta:operation PATCH /orgs/{org}/properties/schema
|
||||
func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Context, org string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) {
|
||||
@@ -89,7 +89,7 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex
|
||||
|
||||
// GetCustomProperty gets a custom property that is defined for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-a-custom-property-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization
|
||||
//
|
||||
//meta:operation GET /orgs/{org}/properties/schema/{custom_property_name}
|
||||
func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name string) (*CustomProperty, *Response, error) {
|
||||
@@ -111,7 +111,7 @@ func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name
|
||||
|
||||
// CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-a-custom-property-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization
|
||||
//
|
||||
//meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name}
|
||||
func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) {
|
||||
@@ -133,7 +133,7 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context,
|
||||
|
||||
// RemoveCustomProperty removes a custom property that is defined for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#remove-a-custom-property-for-an-organization
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization
|
||||
//
|
||||
//meta:operation DELETE /orgs/{org}/properties/schema/{custom_property_name}
|
||||
func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, customPropertyName string) (*Response, error) {
|
||||
@@ -149,7 +149,7 @@ func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, cu
|
||||
|
||||
// ListCustomPropertyValues lists all custom property values for repositories in the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#list-custom-property-values-for-organization-repositories
|
||||
// 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) {
|
||||
@@ -175,15 +175,15 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org
|
||||
|
||||
// CreateOrUpdateRepoCustomPropertyValues creates new or updates existing custom property values across multiple repositories for the specified organization.
|
||||
//
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-property-values-for-organization-repositories
|
||||
// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories
|
||||
//
|
||||
//meta:operation PATCH /orgs/{org}/properties/values
|
||||
func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomProperty) (*Response, error) {
|
||||
func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomPropertyValue) (*Response, error) {
|
||||
u := fmt.Sprintf("orgs/%v/properties/values", org)
|
||||
|
||||
params := struct {
|
||||
RepositoryNames []string `json:"repository_names"`
|
||||
Properties []*CustomProperty `json:"properties"`
|
||||
RepositoryNames []string `json:"repository_names"`
|
||||
Properties []*CustomPropertyValue `json:"properties"`
|
||||
}{
|
||||
RepositoryNames: repoNames,
|
||||
Properties: properties,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user