X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=examples%2Fgenerator.php;h=1fd81e60e1edf0296e241bf9556a7101ca26c28a;hp=acee8a5f48870e1d6a393464d1af60d782dcc73f;hb=e368287b3cd2dd40945ac8d1a1946bc32268007d;hpb=f4aa6beaf2e1f0dc9c877782cbbad5a989194517 diff --git a/examples/generator.php b/examples/generator.php index acee8a5..1fd81e6 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\react(), [ "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) { +})->when(function($error, $count) { printf("Listed %d events\n", $count); });