X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fgenerator.php;h=223c1e3dc7c84c642be19ffb43d3857a30e4d07f;hb=HEAD;hp=d488e97b2ba6ab14a9ee64a66ea8ec87a82ea427;hpb=0dcd2b11631fcf57602514e13fae9d31bbb79000;p=m6w6%2Fseekat diff --git a/examples/generator.php b/examples/generator.php index d488e97..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(function() use($api) { +$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() use($api) { $events = yield $next; } return $count; -})->done(function($count) { +})->onResolve(function($error, $count) { printf("Listed %d events\n", $count); });