update to PHP-8.1
[m6w6/seekat] / examples / gistlog.php
index 455b30d180d6e3a1ca67d5f345a1a1f1b8e82e1f..43d4ce1f44781f1b9cbaf747c832cd3191cacd59 100755 (executable)
@@ -1,19 +1,16 @@
 #!/usr/bin/env php
 <?php
-
-require __DIR__."/../vendor/autoload.php";
-
-$api = new seekat\API([
-       "Authentication" => "token ".getenv("GUTHUB_TOKEN")
-]);
+$api = include "examples.inc";
 
 $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 +22,6 @@ $api(function($api) {
                        }
                }
 
-               $gists = yield $gists->next();
+               $gists = yield $next;
        }
 });