X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fgenerator.php;h=223c1e3dc7c84c642be19ffb43d3857a30e4d07f;hb=HEAD;hp=9d962d4103076eaf99035926926b708639a1a6e7;hpb=5bb5547a9a7275ae61eff8e1a02cfa694e89feab;p=m6w6%2Fseekat diff --git a/examples/generator.php b/examples/generator.php index 9d962d4..223c1e3 100755 --- a/examples/generator.php +++ b/examples/generator.php @@ -1,28 +1,19 @@ #!/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 = $events->next(); + $next = Links\next($events); foreach ($events as $event) { - if ($event->event == "labeled") { + if ($event->event == "labeled" || $event->event == "unlabeled") { continue; } ++$count; @@ -37,7 +28,7 @@ $api(function($api) { $events = yield $next; } return $count; -})->done(function($count) { +})->onResolve(function($error, $count) { printf("Listed %d events\n", $count); });