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

User should be able to paginate a supported API operation from the API's Request type. #36

jasdel opened this issue Nov 11, 2017 · 1 comment


Copy link

jasdel commented Nov 11, 2017

Add the ability to paginate a request from the API's typed request.

One way this can be refactored is to breakout the pagination from a callback to a pattern similar to bufio's scanner.

This is an example using MediaLive's ListInput's API.


err = svc.ListInputsPages(&medialive.ListInputsInput{},
    func(page *medialive.ListInputsOutput, lastPage bool) bool {
        log.Println("Received", len(page.Inputs), "inputs in page")
        Inputs = append(Inputs, page.Inputs...)
        return true

Proposed V2

req := svc.ListInputsRequest(&medialive.ListInputsInput{})
pager := req.Paginate()

for pager.Next() {
    page := pager.Page()
    Inputs = append(Inputs, page.Inputs...)
if err := pager.Err(); err != nil {
   panic("paging failed, " + err.Error())
Copy link
Contributor Author

jasdel commented Jun 26, 2018

This issue was resolved in PR #119

@jasdel jasdel closed this as completed Jun 26, 2018
SDK API Request method refactor automation moved this from To Do to Done Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No open projects

No branches or pull requests

1 participant