Fish Trophy

chipx86 got a fish trophy!

Fish Trophy

Add initial support for paginators for Hosting Service requests.

Review Request #5885 — Created May 27, 2014 and submitted — Latest diff uploaded

Information

Review Board
master
880ed5a...

Reviewers

We have functions in HostingService subclasses that need to deal with
paginated data. Right now, they're all handling it in their own ways,
but as we move to wrapping more of these in the web API, it's helpful to
standardize them.

This introduces a set of paginators that can be used and subclassed by
the more specific HostingServices to provide a standardized API for
pagination of data.

APIPaginator is designed to perform API requests and handle pagination
through links returned through the payload or headers in some form.
Subclasses are expected to define how API requests are made and parsed.

ProxyPaginator attaches to another paginator (typically an APIPaginator)
and transforms the results. This allows, for instance, a
HostingServiceClient to return an APIPaginator with raw results, and a
HostingService to wrap it and return structured data derived from those
raw results.

Unit tests passed.

Tested this manually with an accompanying change to GitHub's
get_remote_repositories. I was able to page back and forth and get the
results. I also tested start= and per_page= with that.