Giter Club home page Giter Club logo

Comments (4)

A973C avatar A973C commented on May 24, 2024

I've tried with the following PHP code (based on docs examples):

$client     = new Github\Client();
$gists      = $client->api('gists');
$paginator  = new Github\ResultPager( $client );
$parameters = array('Github'); //Username
$result     = $paginator->fetchAll($gists, 'gists', $parameters);

And I have this error message:

Warning: call_user_func_array() expects parameter 1 to be a valid
callback, class 'Github\Api\Gists' does not have a method 'gists' in
/XXXX/lib/Github/ResultPager.php on line 74 Fatal error: Call to a
member function getPagination() on a non-object in
/XXXXX/lib/Github/ResultPager.php on line 92

What's wrong with my code, please?

from php-github-api.

A973C avatar A973C commented on May 24, 2024

OK, for those who wants to play with Gists, you can use Guzzle (https://github.com/guzzle/guzzle) as framework and use official functions from Github API. Now I have pagination with my Gists!

from php-github-api.

gj1118 avatar gj1118 commented on May 24, 2024

@A973C I am trying the same thing and I am hitting the same error. Would you mind sharing your working code , please..

Thanks

from php-github-api.

Spreeuw avatar Spreeuw commented on May 24, 2024

For anyone with the same question, the answer is you should call all in the $paginator, not gists as in the OP:

$client     = new Github\Client();
$gists      = $client->api('gists');
$per_page   = 5;
$paginator  = new Github\ResultPager($client, $per_page);

// first page
$result     = $paginator->fetch($gists, 'all');

// next page
$result     = $paginator->fetchNext();

from php-github-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.