Skip to content
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

List* methods should not be paginated by default; create paginated versions #295

Open
theckman opened this issue Feb 27, 2021 · 3 comments
Milestone

Comments

@theckman
Copy link
Collaborator

theckman commented Feb 27, 2021

In v1 of the API we do not disambiguate between methods that do the pagination for us, and those that do it on our behalf. A good example is ListBusinessServices().

For v2 we should probably update ListBusinessServices() to not automatically do pagination, and create a ListBusinessServicesPaginated() version instead.

We should probably adopt this naming scheme in v1 for anything that we add that is going to do pagination on the behalf of the user. One example of us already doing this:

func (c *Client) ListServicesPaginated(ctx context.Context, o ListServiceOptions) ([]Service, error) {

@theckman
Copy link
Collaborator Author

theckman commented Jan 16, 2022

Others to fix:

go-pagerduty/ruleset.go

Lines 142 to 154 in 77a73c9

// ListRulesets gets all rulesets. This method currently handles pagination of
// the response, so all rulesets should be present.
//
// Please note that the automatic pagination will be removed in v2 of this
// package, so it's recommended to use ListRulesetsPaginated instead.
func (c *Client) ListRulesets() (*ListRulesetsResponse, error) {
rs, err := c.ListRulesetsPaginated(context.Background())
if err != nil {
return nil, err
}
return &ListRulesetsResponse{Rulesets: rs}, nil
}

go-pagerduty/ruleset.go

Lines 265 to 278 in 77a73c9

// ListRulesetRules gets all rules for a ruleset. This method currently handles pagination of
// the response, so all RuleseRule should be present.
//
// Please note that the automatic pagination will be removed in v2 of this
// package, so it's recommended to use ListRulesetRulesPaginated instead.
func (c *Client) ListRulesetRules(rulesetID string) (*ListRulesetRulesResponse, error) {
rsr, err := c.ListRulesetRulesPaginated(context.Background(), rulesetID)
if err != nil {
return nil, err
}
return &ListRulesetRulesResponse{Rules: rsr}, nil
}

@jparram
Copy link

jparram commented Apr 28, 2023

is there any way when using the cli to specify we want more than 25 results?

./pd service list -team-id TeamId

@andrewwatson
Copy link

is there any way when using the cli to specify we want more than 25 results?

./pd service list -team-id TeamId

No, but I did see another issue asking for that feature to be added....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants