mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 18:52:33 +01:00
feat: Add organizations endpoint
This commit is contained in:
34
Classes/Endpoint/Organizations/UsersTrait.php
Normal file
34
Classes/Endpoint/Organizations/UsersTrait.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user