|
@@ -13,13 +13,12 @@ use Gogs\Lib\Curl\Exception as ApiException;
|
|
|
|
|
|
define('API_URL', 'https://git.giaever.org/api/v1');
|
|
|
define('API_TOKEN', '142efbfd6fbdf147f03d289f8b22a438eaa1b5d1');
|
|
|
-//define("API_TOKEN", 'e14b9eff0749b6f0c4cadf4bb72b83d44578ae28');
|
|
|
|
|
|
|
|
|
try {
|
|
|
$client = new Gogs\API\Client(API_URL, API_TOKEN);
|
|
|
|
|
|
- $me = $client->user("")->load();
|
|
|
+ $me = $client->user()->load();
|
|
|
|
|
|
$user_search = $client->users()->search(array(
|
|
|
"name" => "tester2"
|
|
@@ -48,6 +47,7 @@ try {
|
|
|
|
|
|
} catch(ApiException\HTTPUnexpectedResponse $e) {
|
|
|
|
|
|
+ echo $e;
|
|
|
// Repo exists, get it!
|
|
|
$repo = $me->repo("gogs-php-api-client-test");
|
|
|
|
|
@@ -61,10 +61,11 @@ try {
|
|
|
foreach($me->organizations()->load()->all() as $org)
|
|
|
var_dump("ORG", $org->username);
|
|
|
|
|
|
- echo sprintf(
|
|
|
- "org->username: %s\norg->org_username: %s\norg->user_username: %s\n",
|
|
|
- $org->username, $org->org_username, $org->user_username
|
|
|
- );
|
|
|
+ if (isset($org))
|
|
|
+ echo sprintf(
|
|
|
+ "org->username: %s\norg->org_username: %s\norg->user_username: %s\n",
|
|
|
+ $org->username, $org->org_username, $org->user_username
|
|
|
+ );
|
|
|
|
|
|
// Requires ADMIN rights to the authenticated user
|
|
|
#try {
|