Uh oh!
There was an error while loading. Please reload this page.
feat(api_core): provide a 'raw_page' field for page_iterator.Page - #9486
Conversation
Some paginated response messages include additional fields that users may wish to inspect.
crwilcox
commented
Oct 17, 2019
Thanks @software-dov, any chance that this would be doable off of |
software-dov
commented
Oct 17, 2019
My two main concerns in no particular order are
With "ease of implementation" being a non-voting tie-breaker. Making the raw page (or transparently mapped attributes via getattr) visible from With the microgenerator surface, touching internal fields of the page forces you to do your own pagination, something like whileTrue:
response=client.paginated_method(request)
handle_page(response)
ifnotresponse.next_page_token:
breakrequest.page_token=response.next_page_tokenwhich doesn't look great to me. Again, modulo complications with flattening, this is the interface that exposing raw_page in the iterator would be forced to mimic. I guess I'm not sure I understand the circumstances where the topmost level raw_page is preferable to response=client.paginated_method(request)
forpinresponse.pages:
handle_page(p)
foreltinp:
handle_element(elt) |
software-dov
commented
Oct 22, 2019
Open review and design bump |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tseaver
left a comment
There was a problem hiding this comment.
LGTM pending greep CI (you can ignore the Cloud Build failure).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Some paginated response messages include additional fields that users
may wish to inspect. This change stores the raw page when constructing a page_iterator.Page and provides an accessor.
In addition to the new and modified unit tests, hand experimentation generates expected behavior:
prints individual pages.