Pagination differs in Installations API



When a list of objects is returned from a call to the Github API, they are returned in the following format

{ object 1 },
{ object 2 },

But the Installations API does not follow this format, and returns:

    { "totalCount": "X",
       "repositories": [
            { repository1 },
            { repository2 },

I discovered this while wondering why I did not get all the repositories (only 76 while I expected 200+) with this quite common statement (using the php-github-api):

$paginator = new ResultPager($this->client);
$result = $paginator->fetchAll($this->client->integration(), 'listRepositories', [ $user->getGithubId() ]);
return $result['repositories'];

What happens is that the ResultPager merges all the responses, thus only the last page is taken into account (`totalCount` and `repositories` are overwritten each time)

Thought the PHP lib could handle this case, I believe this is a problem with the API not following the same convention everywhere.

@jmilas @acrobat WDYT?


The paginator of the php-github-api does indeed merge the results when calling the fetchAll method.


Let’s wait for a response from github to see if we need to find another way of parsing the results!


Hi @bdelbasso @acrobat :wave:

The behavior you observed for that endpoint is indeed expected for now, so I recommend finding a way to handle the payload as returned by that API endpoint. I’ll also pass your feedback to the team to consider this, but I don’t expect us to change how that endpoint behaves as it would probably break all existing API consumers of that endpoint (which rely on it working as it is right now). Still, if/when there’s any updates on this – we’ll followup. Thanks for bringing this up! :bow:


Thanks for the info @izuzak!

I’ve created an issue on the knplabs/php-github-api to see what we can do about it

/cc @bdelbasso