use GithubService\Hydrator\HydratorException;
require_once "testBootstrap.php";
$injector = createProvider();
$reactor = \Amp\reactor();
$cache = new NullResponseCache();
$client = new ArtaxClient();
$client->setOption(ArtaxClient::OP_MS_CONNECT_TIMEOUT, 5000);
$client->setOption(ArtaxClient::OP_MS_KEEP_ALIVE_TIMEOUT, 1000);
$githubAPI = new GithubService($client, $reactor, $cache, "Danack/test");
$token = @file_get_contents("../../GithubToken.txt");
$oauthToken = null;
if ($token) {
    $oauthToken = new Oauth2Token($token);
}
try {
    $tagListRequest = $githubAPI->listRepoTags(null, "Danack", "GithubArtaxService");
    $tagList = $tagListRequest->execute();
    foreach ($tagList as $tag) {
        /** @var $tag \GithubService\Model\Tag */
        printf("tag name %s, commmit %s \n", $tag->name, $tag->commit->sha);
    }
    $emojiResult = $githubAPI->listEmojis(null)->execute();
    foreach ($emojiResult->emojis as $emoji) {
        echo $emoji->name . " \n";
    }
} catch (BadResponseException $bre) {
    echo "Bad response: " . $bre->getResponse()->getBody() . "\n";
    echo "Uri was: " . $bre->getResponse()->getOriginalRequest()->getUri() . "\n";
} catch (HydratorException $dme) {
    echo $dme->displayProblem();
}