123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- /*
- * TODO:
- *
- * Rewrite this. Shouldnt be a test file, like its now.
- *
- * */
- define('BASE_PATH', realpath(dirname(__FILE__)));
- define('API_URL', 'https://git.giaever.org/api/v1');
- define('API_TOKEN', '');
- function my_autoloader($class)
- {
- $file = str_replace("\\", DIRECTORY_SEPARATOR, strtolower($class)) . ".php";
- echo $class . ' -> ' . $file . "\n";
- require_once BASE_PATH . DIRECTORY_SEPARATOR . $file;
- }
- spl_autoload_register('my_autoloader');
- try {
- $client = new \Client\GogsAPI(API_URL, API_TOKEN);
- $me = $client->user()->load();
- $you = $client->user("INF3910-3-CSS-IoT")->load();
- $mine = $me->get("/repos")->load();
- //$yours = $you->get("/repos")->load();
- //$me->get("/tokens")->load();
- } catch (\Lib\NotAuthorizedException $e) {
- die($e->getMessage());
- } catch (\Lib\HTTPUnexpectedResponse $e) {
- die($e->getMessage());
- }
- ?>
|