X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=examples%2Fgistlog.php;h=3a1b8ec7922f5b351f303249bf20e6ced6611718;hb=cac6bea94e6cde142c951566fa6387ffa54eb3cb;hp=455b30d180d6e3a1ca67d5f345a1a1f1b8e82e1f;hpb=98264bf4807a1b82ee7d1584ebb73b4bbba58e6e;p=m6w6%2Fseekat diff --git a/examples/gistlog.php b/examples/gistlog.php index 455b30d..3a1b8ec 100755 --- a/examples/gistlog.php +++ b/examples/gistlog.php @@ -3,17 +3,25 @@ require __DIR__."/../vendor/autoload.php"; -$api = new seekat\API([ - "Authentication" => "token ".getenv("GUTHUB_TOKEN") -]); + +$log = new Monolog\Logger("seekat"); +$log->pushHandler(new Monolog\Handler\StreamHandler(STDERR, Monolog\Logger::DEBUG)); + +$api = new seekat\API( + seekat\API\Future\react(), + seekat\API\auth("token", getenv("GITHUB_TOKEN")), + null, null, $log +); $api(function($api) { $gists = yield $api->users->m6w6->gists(); while ($gists) { + $next = \seekat\API\Links\next($gists); + foreach ($gists as $gist) { foreach ($gist->files as $name => $file) { if ($name == "blog.md") { - $text = $file->as("raw")->raw();; + $text = $file->raw(); $head = $gist->description." ".$gist->created_at; echo "$head\n"; echo str_repeat("=", strlen($head))."\n\n"; @@ -25,6 +33,6 @@ $api(function($api) { } } - $gists = yield $gists->next(); + $gists = yield $next; } });