projects
/
m6w6
/
seekat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
add Amp\Loop example
[m6w6/seekat]
/
examples
/
promise.php
diff --git
a/examples/promise.php
b/examples/promise.php
index 81c7f10376696a83b734c47863f7946e5098eea3..e1f5b9d4fbd4a3311e322fe2706d6ffa11423928 100755
(executable)
--- a/
examples/promise.php
+++ b/
examples/promise.php
@@
-5,16
+5,13
@@
require_once __DIR__."/../vendor/autoload.php";
use seekat\API;
use seekat\API;
-$log = new Monolog\Logger("seekat");
-$log->pushHandler((new Monolog\Handler\StreamHandler(STDERR))->setLevel(Monolog\Logger::INFO));
+$api = new API(API\Future\amp(), API\auth("token", getenv("GITHUB_TOKEN")));
-$api = new API([
- "Authorization" => "token ".getenv("GITHUB_TOKEN")
-], null, null, $log);
-
-$api->users->m6w6->gists()->done(function($gists) {
+$api->users->m6w6->gists()->onResolve(function($error, $gists) {
+ $error and die($error);
foreach ($gists as $gist) {
foreach ($gists as $gist) {
- $gist->commits()->then(function($commits) use($gist) {
+ $gist->commits()->onResolve(function($error, $commits) use($gist) {
+ $error and die($error);
foreach ($commits as $i => $commit) {
if (!$i) {
printf("\nGist %s, %s:\n", $gist->id, $gist->description ?: "<no title>");
foreach ($commits as $i => $commit) {
if (!$i) {
printf("\nGist %s, %s:\n", $gist->id, $gist->description ?: "<no title>");
@@
-27,4
+24,4
@@
$api->users->m6w6->gists()->done(function($gists) {
}
});
}
});
-$api->send();
\ No newline at end of file
+$api->send();