X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fgenerator.php;h=88b69cd004c9eddc6bd2e1b84520f0cfec7def8f;hb=cac6bea94e6cde142c951566fa6387ffa54eb3cb;hp=acee8a5f48870e1d6a393464d1af60d782dcc73f;hpb=2451d97f1cb7b97e445b4dd839835b8673a4d0fc;p=m6w6%2Fseekat diff --git a/examples/generator.php b/examples/generator.php index acee8a5..88b69cd 100755 --- a/examples/generator.php +++ b/examples/generator.php @@ -11,13 +11,13 @@ $log->pushHandler((new Monolog\Handler\StreamHandler(STDERR))->setLevel(Monolog\ $cli = new http\Client("curl", "seekat"); -$api = new API([ +$api = new API(API\Future\amp(), [ "Authorization" => "token ".getenv("GITHUB_TOKEN") ], null, $cli, $log); $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 +38,7 @@ $api(function($api) { $events = yield $next; } return $count; -})->done(function($count) { +})->onResolve(function($error, $count) { printf("Listed %d events\n", $count); });