mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 02:34:59 +01:00
35 lines
691 B
PHP
35 lines
691 B
PHP
<?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);
|
|
}
|
|
}
|