-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat!: Add Copilot content exclusion set and enterprise endpoints #4527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tens1des
wants to merge
2
commits into
google:master
Choose a base branch
from
Tens1des:feat/copilot-content-exclusion-apis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+226
−7
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -390,25 +390,77 @@ func (s *CopilotService) ListOrganizationCodingAgentRepositories(ctx context.Con | |||||
| return result, resp, nil | ||||||
| } | ||||||
|
|
||||||
| // CopilotOrganizationContentExclusionDetails lists all Copilot content exclusion | ||||||
| // rules for an organization, keyed by repository full name. Each value is the | ||||||
| // list of file paths excluded from Copilot for that repository. | ||||||
| type CopilotOrganizationContentExclusionDetails map[string][]string | ||||||
| // CopilotContentExclusionDetails lists Copilot content exclusion path rules, | ||||||
| // keyed by repository identifier. Each value is the list of file paths excluded | ||||||
| // from Copilot for that repository. | ||||||
| // | ||||||
| // NOTE Breaking API change: renamed from CopilotOrganizationContentExclusionDetails. | ||||||
| type CopilotContentExclusionDetails map[string][]string | ||||||
|
|
||||||
| // CopilotContentExclusionUpdateResponse represents the response from setting | ||||||
| // Copilot content exclusion rules. | ||||||
| type CopilotContentExclusionUpdateResponse struct { | ||||||
| Message *string `json:"message,omitempty"` | ||||||
| } | ||||||
|
|
||||||
| // GetOrganizationContentExclusionDetails gets the Copilot content exclusion rules for an organization. | ||||||
| // | ||||||
| // GitHub API docs: https://docs.github.com/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#get-copilot-content-exclusion-rules-for-an-organization | ||||||
| // | ||||||
| //meta:operation GET /orgs/{org}/copilot/content_exclusion | ||||||
| func (s *CopilotService) GetOrganizationContentExclusionDetails(ctx context.Context, org string) (CopilotOrganizationContentExclusionDetails, *Response, error) { | ||||||
| func (s *CopilotService) GetOrganizationContentExclusionDetails(ctx context.Context, org string) (CopilotContentExclusionDetails, *Response, error) { | ||||||
| u := fmt.Sprintf("orgs/%v/copilot/content_exclusion", org) | ||||||
|
|
||||||
| req, err := s.client.NewRequest(ctx, "GET", u, nil) | ||||||
| if err != nil { | ||||||
| return nil, nil, err | ||||||
| } | ||||||
|
|
||||||
| details := CopilotOrganizationContentExclusionDetails{} | ||||||
| details := CopilotContentExclusionDetails{} | ||||||
| resp, err := s.client.Do(req, &details) | ||||||
| if err != nil { | ||||||
| return nil, resp, err | ||||||
| } | ||||||
|
|
||||||
| return details, resp, nil | ||||||
| } | ||||||
|
|
||||||
| // SetOrganizationContentExclusionDetails sets Copilot content exclusion path rules for an organization. | ||||||
| // | ||||||
| // GitHub API docs: https://docs.github.com/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#set-copilot-content-exclusion-rules-for-an-organization | ||||||
| // | ||||||
| //meta:operation PUT /orgs/{org}/copilot/content_exclusion | ||||||
| func (s *CopilotService) SetOrganizationContentExclusionDetails(ctx context.Context, org string, body CopilotContentExclusionDetails) (*CopilotContentExclusionUpdateResponse, *Response, error) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| u := fmt.Sprintf("orgs/%v/copilot/content_exclusion", org) | ||||||
|
|
||||||
| req, err := s.client.NewRequest(ctx, "PUT", u, body) | ||||||
| if err != nil { | ||||||
| return nil, nil, err | ||||||
| } | ||||||
|
|
||||||
| var result *CopilotContentExclusionUpdateResponse | ||||||
| resp, err := s.client.Do(req, &result) | ||||||
| if err != nil { | ||||||
| return nil, resp, err | ||||||
| } | ||||||
|
|
||||||
| return result, resp, nil | ||||||
| } | ||||||
|
|
||||||
| // GetEnterpriseContentExclusionDetails gets the Copilot content exclusion rules for an enterprise. | ||||||
| // | ||||||
| // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#get-copilot-content-exclusion-rules-for-an-enterprise | ||||||
| // | ||||||
| //meta:operation GET /enterprises/{enterprise}/copilot/content_exclusion | ||||||
| func (s *CopilotService) GetEnterpriseContentExclusionDetails(ctx context.Context, enterprise string) (CopilotContentExclusionDetails, *Response, error) { | ||||||
| u := fmt.Sprintf("enterprises/%v/copilot/content_exclusion", enterprise) | ||||||
|
|
||||||
| req, err := s.client.NewRequest(ctx, "GET", u, nil) | ||||||
| if err != nil { | ||||||
| return nil, nil, err | ||||||
| } | ||||||
|
|
||||||
| details := CopilotContentExclusionDetails{} | ||||||
| resp, err := s.client.Do(req, &details) | ||||||
| if err != nil { | ||||||
| return nil, resp, err | ||||||
|
|
@@ -417,6 +469,28 @@ func (s *CopilotService) GetOrganizationContentExclusionDetails(ctx context.Cont | |||||
| return details, resp, nil | ||||||
| } | ||||||
|
|
||||||
| // SetEnterpriseContentExclusionDetails sets Copilot content exclusion path rules for an enterprise. | ||||||
| // | ||||||
| // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/copilot/copilot-content-exclusion-management?apiVersion=2022-11-28#set-copilot-content-exclusion-rules-for-an-enterprise | ||||||
| // | ||||||
| //meta:operation PUT /enterprises/{enterprise}/copilot/content_exclusion | ||||||
| func (s *CopilotService) SetEnterpriseContentExclusionDetails(ctx context.Context, enterprise string, body CopilotContentExclusionDetails) (*CopilotContentExclusionUpdateResponse, *Response, error) { | ||||||
| u := fmt.Sprintf("enterprises/%v/copilot/content_exclusion", enterprise) | ||||||
|
|
||||||
| req, err := s.client.NewRequest(ctx, "PUT", u, body) | ||||||
| if err != nil { | ||||||
| return nil, nil, err | ||||||
| } | ||||||
|
|
||||||
| var result *CopilotContentExclusionUpdateResponse | ||||||
| resp, err := s.client.Do(req, &result) | ||||||
| if err != nil { | ||||||
| return nil, resp, err | ||||||
| } | ||||||
|
|
||||||
| return result, resp, nil | ||||||
| } | ||||||
|
|
||||||
| // AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. | ||||||
| // | ||||||
| // GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management?apiVersion=2022-11-28#add-teams-to-the-copilot-subscription-for-an-organization | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed: