Skip to content

Added pagination support for PullRequest - #53

Merged
pilot merged 1 commit into
KnpLabs:masterfrom
lyrixx:pr-pagination
Jun 5, 2013
Merged

pilot merged 1 commit into
KnpLabs:masterfrom
lyrixx:pr-pagination

Conversation

@lyrixx

@lyrixx lyrixx commented May 17, 2013

Copy link
Copy Markdown
Contributor

Made a better API than #44 and add tests

@lyrixx

lyrixx commented May 17, 2013

Copy link
Copy Markdown
Contributor Author

I implemented a small method to get all PR. Do you want I add this method to this PR:

private function getAllPrs($organisazion, $repositoryName, $status = null)
    {
        $prApi = $this->client->api('pull_request');
        $page = 1;
        $prs = array();
        do {
            $prs = array_merge($prs, $prApi->all($organisazion, $repositoryName, $status, $page, 100));
            $pagination = $this->client->getHttpClient()->getLastResponse()->getPagination();
            $next = isset($pagination['next']) ? $pagination['next'] : false;
            if (!$next) {
                break;
            }
            $url = parse_url($next);
            parse_str($url['query'], $qsa);
            $page = $qsa['page'];
        } while (true);

        return $prs;
    }

Of cource, I will adapt the code ;)

@justinburger

Copy link
Copy Markdown

Seems like the implementation can be done more globally, since most github API's support pagination now. For most people who don't want to deal with pagination, it would be nice to have a global option to up the per-page param. I've got a github enterprise server, so rate limits are not an issue. I'm betting most won't want to deal with pagination regardless.

@dbu dbu mentioned this pull request May 26, 2013
@dbu

dbu commented May 26, 2013

Copy link
Copy Markdown

this is similar but different (and better) then #49 about the repositories call - we should find a general solution to this. i commented in #55 and hope to get a discussion rolling what the correct solution would be.

@lyrixx

lyrixx commented Jun 4, 2013

Copy link
Copy Markdown
Contributor Author

Hello. I do not have to of time for this contribution. Sorry.
What is the state of all theses PR ? Should I close mine ?

@lyrixx

lyrixx commented Jun 4, 2013

Copy link
Copy Markdown
Contributor Author

And BTW, who is the current maintainer of this repository ?

@dbu

dbu commented Jun 5, 2013

Copy link
Copy Markdown

as it looks, whoever is the maintainer is not exactly active on this. i tried to get the attention of @KnpLabs on twitter and in github but so far no luck...

@dbu

dbu commented Jun 5, 2013

Copy link
Copy Markdown

but i propose you leave this PR open until the maintainer shows up and
decides which aproach he likes.

@stloyd

stloyd commented Jun 5, 2013

Copy link
Copy Markdown
Contributor

@pilot @cursedcoder Can you have a look at those? Thanks =)

@pilot

pilot commented Jun 5, 2013

Copy link
Copy Markdown
Contributor

@stloyd does this applicable?

pilot added a commit that referenced this pull request Jun 5, 2013
Added pagination support for PullRequest
@pilot
pilot merged commit 8a9ccca into KnpLabs:master Jun 5, 2013
@lyrixx
lyrixx deleted the pr-pagination branch June 5, 2013 08:26
@dbu

dbu commented Jun 5, 2013

Copy link
Copy Markdown

@pilot did you see the discussion in #55? with this solution, how will a client do pagination? count the results and guess that if he got the maximum there could be a next page and try that?

@pilot

pilot commented Jun 5, 2013

Copy link
Copy Markdown
Contributor

@dbu I saw and yep it's need to discus, let's leave this PR and move discussion to the #55

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