feat: Add organizations endpoint

This commit is contained in:
Michael Gerdemann
2020-01-19 14:57:54 +01:00
parent d527b06af7
commit 6e6b0b6a29
10 changed files with 719 additions and 36 deletions

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Avency\Gitea\Endpoint\Organizations;
use Avency\Gitea\Client;
/**
* Organizations Users Trait
*/
trait UsersTrait
{
/**
* @return array
*/
public function getCurrentUserOrganizations(): array
{
$response = $this->client->request('/user/orgs');
return \GuzzleHttp\json_decode($response->getBody(), true);
}
/**
* @param string $username
* @return array
*/
public function getUserOrganizations(string $username): array
{
$response = $this->client->request('/users/' . $username . '/orgs');
return \GuzzleHttp\json_decode($response->getBody(), true);
}
}