X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fgenerator.php;h=223c1e3dc7c84c642be19ffb43d3857a30e4d07f;hb=HEAD;hp=acee8a5f48870e1d6a393464d1af60d782dcc73f;hpb=2451d97f1cb7b97e445b4dd839835b8673a4d0fc;p=m6w6%2Fseekat diff --git a/examples/generator.php b/examples/generator.php index acee8a5..223c1e3 100755 --- a/examples/generator.php +++ b/examples/generator.php @@ -1,23 +1,13 @@ #!/usr/bin/env php pushHandler((new Monolog\Handler\StreamHandler(STDERR))->setLevel(Monolog\Logger::INFO)); - -$cli = new http\Client("curl", "seekat"); - -$api = new API([ - "Authorization" => "token ".getenv("GITHUB_TOKEN") -], null, $cli, $log); +$api = include "examples.inc"; $api(function($api) { $count = 0; - $events = yield $api->repos->m6w6->{"ext-http"}->issues->events(); + $events = yield $api->repos->m6w6->{"ext-pq"}->issues->events(); while ($events) { /* pro-actively queue the next request */ $next = Links\next($events); @@ -38,7 +28,7 @@ $api(function($api) { $events = yield $next; } return $count; -})->done(function($count) { +})->onResolve(function($error, $count) { printf("Listed %d events\n", $count); });