123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- require "./src/gpac.php";
- use Gogs\Lib\Curl\Exception as ApiException;
- define('API_URL', 'https://git.giaever.org/api/v1');
- define('API_TOKEN', '142efbfd6fbdf147f03d289f8b22a438eaa1b5d1');
- try {
- $client = new Gogs\API\Client(API_URL, API_TOKEN);
- $me = $client->user()->load();
- $tester = "tester";
- if (API_TOKEN == "142efbfd6fbdf147f03d289f8b22a438eaa1b5d1")
- $tester = "joachimmg";
- $repos = $me->repos()->load();
-
- echo "Create data under specified user";
- $repo = $repos->create(
- "test-test-test-" . $repos->load()->len(),
- "This is repo #" . $repos->load()->len(),
- false,
- true
- );
- echo sprintf("* Created repo: '%s'", $repo->name);
- echo "\nNow having repos\n";
- foreach($repos->load()->sort_by()->all() as $key => $repo)
- $repo->delete();
- echo "\n\n\nLOG:\n" . join("\n", $client->get_log());
- die();
- } catch (ApiException\NotAuthorizedException $e) {
- die("NOT AUTH: " . $e->getMessage());
- } catch (ApiException\HTTPUnexpectedResponse $e) {
- die($e);
- } catch (Exception $e) {
- die($e);
- }
- ?>
|