Skip to content

Add a ResultPager object to support pagination of all Api's - #61

Merged
docteurklein merged 21 commits into
KnpLabs:masterfrom
Future500BV:resultpager
Jul 30, 2013
Merged

docteurklein merged 21 commits into
KnpLabs:masterfrom
Future500BV:resultpager

Conversation

@ramondelafuente

Copy link
Copy Markdown
Contributor

This should fix #55. (close #49, close #53)

The docs have been updated to include a Pagination Support chapter that shows basic usage.

ramondelafuente and others added 18 commits May 27, 2013 15:37
The get method always prepends the baseurl before the requests path.
A check was added to allow for full URLS (starting with baseurl), for following
pagination links.
The api client supports the per_page github parameter for api calls.
Default is NULL and lets github decide the default (currently 30).

$client->setPerPage()
This is the first pass at adding a paginator class for github API requests.
It only works with fetchAll() at the moment, to demonstrate the usage.

Currently:
$paginator = new \Github\ResultPaginator( \Github\Client [client] );
$paginator->fetchAll( [api], [method], [parameters] );

Todo's include:
Paginator is not complete for all possible headers Next, Last, Previous, First
apiClient should be able to return a paginator (i.e. $client->getPaginator() )
CacheHttpClient does not work (does not return Link headers)
The get method always prepends the baseurl before the requests path.
A check was added to allow for full URLS (starting with baseurl), for following
pagination links.
The api client supports the per_page github parameter for api calls.
Default is NULL and lets github decide the default (currently 30).

$client->setPerPage()
This is the first pass at adding a paginator class for github API requests.
It only works with fetchAll() at the moment, to demonstrate the usage.

Currently:
$paginator = new \Github\ResultPaginator( \Github\Client [client] );
$paginator->fetchAll( [api], [method], [parameters] );

Todo's include:
Paginator is not complete for all possible headers Next, Last, Previous, First
apiClient should be able to return a paginator (i.e. $client->getPaginator() )
CacheHttpClient does not work (does not return Link headers)
path is empty in some test cases but strpos can't handle an empty needle so added check if path is not empty
Comment thread doc/result_pager.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing closing quote

@stof

stof commented Jul 11, 2013

Copy link
Copy Markdown
Contributor

you should update the coding standards to follow PSR-2

Comment thread doc/result_pager.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasPrevious ?

@ramondelafuente

Copy link
Copy Markdown
Contributor Author

@stof @docteurklein Thanks very much for the feedback!

We'll be fixing all mentioned items in the morning (sorry for the obvious issues) except the ones responded on directly, which could be improved upon by discussion maybe...

Comment thread lib/Github/HttpClient/HttpClient.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&&

Updated coding standard to PSR-2
fixed CS issues and typos
updated docs
changed fetch() and fetchAll() signature to an array of parameters for flexibility in the future
@verschoof

Copy link
Copy Markdown

@cursedcoder @pilot wake up guys, accept some pull requests or deny them.. don't let them catch dust!
I would like to use this in my projects.. (now using a fork..(of a fork)). But some more people would like it I guess..

Doesn't KNPLabs have more collaborators?

@docteurklein

Copy link
Copy Markdown
Contributor

sure you took all comments in consideration ? then, ready to merge.

@pilot

pilot commented Jul 30, 2013

Copy link
Copy Markdown
Contributor

@verschoof apply small fix's and it will be merge

Added spaces after comma in an array
@verschoof

Copy link
Copy Markdown

@pilot Alright! Good to merge!

docteurklein added a commit that referenced this pull request Jul 30, 2013
Add a ResultPager object to support pagination of all Api's
@docteurklein
docteurklein merged commit 86d58f6 into KnpLabs:master Jul 30, 2013
@ramondelafuente
ramondelafuente deleted the resultpager branch July 30, 2013 12:17
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

Successfully merging this pull request may close these issues.

5 participants