Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.5k
feat!: Add support for pagination options in rules API methods#3562
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -38,9 +38,14 @@ type rulesetClearBypassActors struct { | ||
| // GitHub API docs: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch | ||
| // | ||
| //meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} | ||
| func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string) (*BranchRules, *Response, error) { | ||
| func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string, opts *ListOptions) (*BranchRules, *Response, error) { | ||
| u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) | ||
| u, err := addOptions(u, opts) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| req, err := s.client.NewRequest("GET", u, nil) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| @@ -55,14 +60,28 @@ func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo | ||
| return rules, resp, nil | ||
| } | ||
| // RepositoryListRulesetsOptions specifies optional parameters to the | ||
| // RepositoriesService.GetAllRulesets method. | ||
| type RepositoryListRulesetsOptions struct { | ||
| // IncludesParents indicates whether to include rulesets configured at the organization or enterprise level that apply to the repository. | ||
| IncludesParents *bool `url:"includes_parents,omitempty"` | ||
| ListOptions | ||
| } | ||
| // GetAllRulesets gets all the repository rulesets for the specified repository. | ||
| // If includesParents is true, rulesets configured at the organization or enterprise level that apply to the repository will be returned. | ||
| // By default, this endpoint will include rulesets configured at the organization or enterprise level that apply to the repository. | ||
gmlewis marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| // To exclude those rulesets, set the `RepositoryListRulesetsOptions.IncludesParents` parameter to `false`. | ||
| // | ||
| // GitHub API docs: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets | ||
| // | ||
| //meta:operation GET /repos/{owner}/{repo}/rulesets | ||
| func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, includesParents bool) ([]*RepositoryRuleset, *Response, error) { | ||
| u := fmt.Sprintf("repos/%v/%v/rulesets?includes_parents=%v", owner, repo, includesParents) | ||
| func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, opts *RepositoryListRulesetsOptions) ([]*RepositoryRuleset, *Response, error) { | ||
| u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) | ||
| u, err := addOptions(u, opts) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
| req, err := s.client.NewRequest("GET", u, nil) | ||
| if err != nil { | ||
Uh oh!
There was an error while loading. Please reload this page.