Skip to content

Added pagination support for PullRequest #53

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

Merged
merged 1 commit into from
Jun 5, 2013

Conversation

lyrixx
Copy link
Contributor

@lyrixx lyrixx commented May 17, 2013

Made a better API than #44 and add tests

@lyrixx
Copy link
Contributor Author

lyrixx commented May 17, 2013

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

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
Copy link

dbu commented May 26, 2013

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
Copy link
Contributor Author

lyrixx commented Jun 4, 2013

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
Copy link
Contributor Author

lyrixx commented Jun 4, 2013

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

@dbu
Copy link

dbu commented Jun 5, 2013

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
Copy link

dbu commented Jun 5, 2013

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

@stloyd
Copy link
Contributor

stloyd commented Jun 5, 2013

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

@pilot
Copy link
Contributor

pilot commented Jun 5, 2013

@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
Copy link

dbu commented Jun 5, 2013

@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
Copy link
Contributor

pilot commented Jun 5, 2013

@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