mirror of
https://github.com/avency/Gitea.git
synced 2025-10-28 18:24:58 +01:00
feat: Add organizations endpoint
This commit is contained in:
@ -7,6 +7,7 @@ namespace Avency\Gitea;
|
||||
use Avency\Gitea\Endpoint\Admin;
|
||||
use Avency\Gitea\Endpoint\EndpointInterface;
|
||||
use Avency\Gitea\Endpoint\Miscellaneous;
|
||||
use Avency\Gitea\Endpoint\Organizations;
|
||||
use Avency\Gitea\Endpoint\Repositories;
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@ -16,6 +17,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||
*
|
||||
* @method Admin admin()
|
||||
* @method Miscellaneous miscellaneous()
|
||||
* @method Organizations organizations()
|
||||
* @method Repositories repositories()
|
||||
*/
|
||||
class Client
|
||||
|
||||
41
Classes/Endpoint/Organizations.php
Normal file
41
Classes/Endpoint/Organizations.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
use Avency\Gitea\Endpoint\Organizations\HooksTrait;
|
||||
use Avency\Gitea\Endpoint\Organizations\MembersTrait;
|
||||
use Avency\Gitea\Endpoint\Organizations\OrganizationTrait;
|
||||
use Avency\Gitea\Endpoint\Organizations\RepositoriesTrait;
|
||||
use Avency\Gitea\Endpoint\Organizations\TeamsTrait;
|
||||
use Avency\Gitea\Endpoint\Organizations\UsersTrait;
|
||||
|
||||
/**
|
||||
* Organizations endpoint
|
||||
*/
|
||||
class Organizations extends AbstractEndpoint implements EndpointInterface
|
||||
{
|
||||
use HooksTrait;
|
||||
use MembersTrait;
|
||||
use OrganizationTrait;
|
||||
use RepositoriesTrait;
|
||||
use TeamsTrait;
|
||||
use UsersTrait;
|
||||
|
||||
const BASE_URI = '/orgs';
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
}
|
||||
111
Classes/Endpoint/Organizations/HooksTrait.php
Normal file
111
Classes/Endpoint/Organizations/HooksTrait.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Organizations;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Organizations Hooks Trait
|
||||
*/
|
||||
trait HooksTrait
|
||||
{
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function getHooks(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/hooks');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $type
|
||||
* @param array $config
|
||||
* @param bool|null $active
|
||||
* @param string|null $branchFilter
|
||||
* @param array|null $events
|
||||
* @return array
|
||||
*/
|
||||
public function createHook(
|
||||
string $organization,
|
||||
string $type,
|
||||
array $config,
|
||||
bool $active = null,
|
||||
string $branchFilter = null,
|
||||
array $events = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'type' => $type,
|
||||
'config' => $config,
|
||||
'active' => $active,
|
||||
'branch_filter' => $branchFilter,
|
||||
'events' => $events,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/hooks', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getHook(string $organization, int $id): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/hooks/' . $id);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteHook(string $organization, int $id): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/hooks/' . $id, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
* @param bool $active
|
||||
* @param string|null $branchFilter
|
||||
* @param array|null $config
|
||||
* @param array|null $events
|
||||
* @return array
|
||||
*/
|
||||
public function updateHook(
|
||||
string $organization,
|
||||
int $id,
|
||||
bool $active,
|
||||
string $branchFilter = null,
|
||||
array $config = null,
|
||||
array $events = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'active' => $active,
|
||||
'branch_filter' => $branchFilter,
|
||||
'config' => $config,
|
||||
'events' => $events,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/hooks/' . $id, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
95
Classes/Endpoint/Organizations/MembersTrait.php
Normal file
95
Classes/Endpoint/Organizations/MembersTrait.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Organizations;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Organizations Members Trait
|
||||
*/
|
||||
trait MembersTrait
|
||||
{
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function getMembers(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/members');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function checkMember(string $organization, string $username): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/members/' . $username);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteMember(string $organization, string $username): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/members/' . $username, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function getPublicMembers(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/public_members');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPublicMember(string $organization, string $username): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/public_members/' . $username);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function addPublicMember(string $organization, string $username): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/public_members/' . $username, 'PUT');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function deletePublicMember(string $organization, string $username): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization . '/public_members/' . $username, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
106
Classes/Endpoint/Organizations/OrganizationTrait.php
Normal file
106
Classes/Endpoint/Organizations/OrganizationTrait.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Organizations;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Organizations Organization Trait
|
||||
*/
|
||||
trait OrganizationTrait
|
||||
{
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function get(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string|null $description
|
||||
* @param string|null $fullName
|
||||
* @param string|null $location
|
||||
* @param bool|null $repoAdminChangeTeamAccess
|
||||
* @param string|null $visibility
|
||||
* @param string|null $website
|
||||
* @return array
|
||||
*/
|
||||
public function create(
|
||||
string $username,
|
||||
string $description = null,
|
||||
string $fullName = null,
|
||||
string $location = null,
|
||||
bool $repoAdminChangeTeamAccess = null,
|
||||
string $visibility = null, // public, limited, private
|
||||
string $website = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'username' => $username,
|
||||
'description' => $description,
|
||||
'full_name' => $fullName,
|
||||
'location' => $location,
|
||||
'repo_admin_change_team_access' => $repoAdminChangeTeamAccess,
|
||||
'visibility' => $visibility,
|
||||
'website' => $website,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI, 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(string $organization): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $organization, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string|null $description
|
||||
* @param string|null $fullName
|
||||
* @param string|null $location
|
||||
* @param bool|null $repoAdminChangeTeamAccess
|
||||
* @param string|null $visibility
|
||||
* @param string|null $website
|
||||
* @return array
|
||||
*/
|
||||
public function update(
|
||||
string $organization,
|
||||
string $description = null,
|
||||
string $fullName = null,
|
||||
string $location = null,
|
||||
bool $repoAdminChangeTeamAccess = null,
|
||||
string $visibility = null, // public, limited, private
|
||||
string $website = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'description' => $description,
|
||||
'full_name' => $fullName,
|
||||
'location' => $location,
|
||||
'repo_admin_change_team_access' => $repoAdminChangeTeamAccess,
|
||||
'visibility' => $visibility,
|
||||
'website' => $website,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
65
Classes/Endpoint/Organizations/RepositoriesTrait.php
Normal file
65
Classes/Endpoint/Organizations/RepositoriesTrait.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Organizations;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Organizations Repositories Trait
|
||||
*/
|
||||
trait RepositoriesTrait
|
||||
{
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function getRepos(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/repos');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $name
|
||||
* @param bool|null $autoInit
|
||||
* @param string|null $description
|
||||
* @param string|null $gitignores
|
||||
* @param string|null $issueLabels
|
||||
* @param string|null $license
|
||||
* @param bool|null $private
|
||||
* @param string|null $readme
|
||||
* @return array
|
||||
*/
|
||||
public function createRepo(
|
||||
string $organization,
|
||||
string $name,
|
||||
bool $autoInit = null,
|
||||
string $description = null,
|
||||
string $gitignores = null,
|
||||
string $issueLabels = null,
|
||||
string $license = null,
|
||||
bool $private = null,
|
||||
string $readme = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'name' => $name,
|
||||
'auto_init' => $autoInit,
|
||||
'description' => $description,
|
||||
'gitignores' => $gitignores,
|
||||
'issue_labels' => $issueLabels,
|
||||
'license' => $license,
|
||||
'private' => $private,
|
||||
'readme' => $readme,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request('/org/' . $organization . '/repos', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
229
Classes/Endpoint/Organizations/TeamsTrait.php
Normal file
229
Classes/Endpoint/Organizations/TeamsTrait.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Organizations;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Organizations Teams Trait
|
||||
*/
|
||||
trait TeamsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $organization
|
||||
* @return array
|
||||
*/
|
||||
public function getTeams(string $organization): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/teams');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $name
|
||||
* @param bool|null $canCreateOrgRepo
|
||||
* @param string|null $description
|
||||
* @param bool|null $includesAllRepositories
|
||||
* @param string|null $permission
|
||||
* @param array|null $units
|
||||
* @return array
|
||||
*/
|
||||
public function createTeam(
|
||||
string $organization,
|
||||
string $name,
|
||||
bool $canCreateOrgRepo = null,
|
||||
string $description = null,
|
||||
bool $includesAllRepositories = null,
|
||||
string $permission = null, // read, write, admin
|
||||
array $units = null // repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.ext_wiki
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'name' => $name,
|
||||
'can_create_org_repo' => $canCreateOrgRepo,
|
||||
'description' => $description,
|
||||
'includes_all_repositories' => $includesAllRepositories,
|
||||
'permission' => $permission,
|
||||
'units' => $units,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/teams', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $organization
|
||||
* @param string $searchTerm
|
||||
* @param bool|null $includeDesc
|
||||
* @param int|null $limit
|
||||
* @param int|null $page
|
||||
* @return array
|
||||
*/
|
||||
public function searchTeams(
|
||||
string $organization,
|
||||
string $searchTerm,
|
||||
bool $includeDesc = null,
|
||||
int $limit = null,
|
||||
int $page = null
|
||||
): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'searchTerm' => $searchTerm,
|
||||
'includeDesc' => $includeDesc,
|
||||
'limit' => $limit,
|
||||
'page' => $page,
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $organization . '/teams/search', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getTeam(int $id): array
|
||||
{
|
||||
$response = $this->client->request('/teams/' . $id);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteTeam(int $id): bool
|
||||
{
|
||||
$this->client->request('/teams/' . $id, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $name
|
||||
* @param bool|null $canCreateOrgRepo
|
||||
* @param string|null $description
|
||||
* @param bool|null $includesAllRepositories
|
||||
* @param string|null $permission
|
||||
* @param array|null $units
|
||||
* @return array
|
||||
*/
|
||||
public function updateTeam(
|
||||
int $id,
|
||||
string $name,
|
||||
bool $canCreateOrgRepo = null,
|
||||
string $description = null,
|
||||
bool $includesAllRepositories = null,
|
||||
string $permission = null, // read, write, admin
|
||||
array $units = null // repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.ext_wiki
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'name' => $name,
|
||||
'can_create_org_repo' => $canCreateOrgRepo,
|
||||
'description' => $description,
|
||||
'includes_all_repositories' => $includesAllRepositories,
|
||||
'permission' => $permission,
|
||||
'units' => $units,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request('/teams/' . $id, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getTeamMembers(int $id): array
|
||||
{
|
||||
$response = $this->client->request('/teams/' . $id . '/members');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $username
|
||||
* @return array
|
||||
*/
|
||||
public function getTeamMember(int $id, string $username): array
|
||||
{
|
||||
$response = $this->client->request('/teams/' . $id . '/members/' . $username);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function addTeamMember(int $id, string $username): bool
|
||||
{
|
||||
$this->client->request('/teams/' . $id . '/members/' . $username, 'PUT');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $username
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteTeamMember(int $id, string $username): bool
|
||||
{
|
||||
$this->client->request('/teams/' . $id . '/members/' . $username, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getTeamRepositories(int $id): array
|
||||
{
|
||||
$response = $this->client->request('/teams/' . $id . '/repos');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param $organization
|
||||
* @param $repositoryName
|
||||
* @return bool
|
||||
*/
|
||||
public function addTeamRepository(int $id, $organization, $repositoryName): bool
|
||||
{
|
||||
$this->client->request('/teams/' . $id . '/repos/' . $organization . '/' . $repositoryName, 'PUT');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param $organization
|
||||
* @param $repositoryName
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteTeamRepository(int $id, $organization, $repositoryName): bool
|
||||
{
|
||||
$this->client->request('/teams/' . $id . '/repos/' . $organization . '/' . $repositoryName, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -26,13 +26,13 @@ trait ForksTrait
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string|null $organisation
|
||||
* @param string|null $organization
|
||||
* @return array
|
||||
*/
|
||||
public function createFork(string $owner, string $repositoryName, string $organisation = null): array
|
||||
public function createFork(string $owner, string $repositoryName, string $organization = null): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'organization' => $organisation
|
||||
'organization' => $organization
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
|
||||
66
README.md
66
README.md
@ -111,39 +111,39 @@ Status | Method | Endpoint | Comment
|
||||
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
❌ | POST | /org/{org}/repos |
|
||||
❌ | POST | /orgs |
|
||||
❌ | GET | /orgs/{org} |
|
||||
❌ | DELETE | /orgs/{org} |
|
||||
❌ | PATCH | /orgs/{org} |
|
||||
❌ | GET | /orgs/{org}/hooks |
|
||||
❌ | POST | /orgs/{org}/hooks/ |
|
||||
❌ | GET | /orgs/{org}/hooks/{id} |
|
||||
❌ | DELETE | /orgs/{org}/hooks/{id} |
|
||||
❌ | PATCH | /orgs/{org}/hooks/{id} |
|
||||
❌ | GET | /orgs/{org}/members |
|
||||
❌ | GET | /orgs/{org}/members/{username} |
|
||||
❌ | DELETE | /orgs/{org}/members/{username} |
|
||||
❌ | GET | /orgs/{org}/public_members |
|
||||
❌ | GET | /orgs/{org}/public_members/{username} |
|
||||
❌ | PUT | /orgs/{org}/public_members/{username} |
|
||||
❌ | DELETE | /orgs/{org}/public_members/{username} |
|
||||
❌ | GET | /orgs/{org}/repos |
|
||||
❌ | GET | /orgs/{org}/teams |
|
||||
❌ | POST | /orgs/{org}/teams |
|
||||
❌ | GET | /orgs/{org}/teams/search |
|
||||
❌ | GET | /teams/{id} |
|
||||
❌ | DELETE | /teams/{id} |
|
||||
❌ | PATCH | /teams/{id} |
|
||||
❌ | GET | /teams/{id}/members |
|
||||
❌ | GET | /teams/{id}/members/{username} |
|
||||
❌ | PUT | /teams/{id}/members/{username} |
|
||||
❌ | DELETE | /teams/{id}/members/{username} |
|
||||
❌ | GET | /teams/{id}/repos |
|
||||
❌ | PUT | /teams/{id}/repos/{org}/{repo} |
|
||||
❌ | DELETE | /teams/{id}/repos/{org}/{repo} |
|
||||
❌ | GET | /user/orgs |
|
||||
❌ | GET | /users/{username}/orgs |
|
||||
✅ | POST | /org/{org}/repos |
|
||||
✅ | POST | /orgs |
|
||||
✅ | GET | /orgs/{org} |
|
||||
✅ | DELETE | /orgs/{org} |
|
||||
✅ | PATCH | /orgs/{org} |
|
||||
✅ | GET | /orgs/{org}/hooks |
|
||||
✅ | POST | /orgs/{org}/hooks/ |
|
||||
✅ | GET | /orgs/{org}/hooks/{id} |
|
||||
✅ | DELETE | /orgs/{org}/hooks/{id} |
|
||||
✅ | PATCH | /orgs/{org}/hooks/{id} |
|
||||
✅ | GET | /orgs/{org}/members |
|
||||
✅ | GET | /orgs/{org}/members/{username} |
|
||||
✅ | DELETE | /orgs/{org}/members/{username} |
|
||||
✅ | GET | /orgs/{org}/public_members |
|
||||
✅ | GET | /orgs/{org}/public_members/{username} |
|
||||
✅ | PUT | /orgs/{org}/public_members/{username} |
|
||||
✅ | DELETE | /orgs/{org}/public_members/{username} |
|
||||
✅ | GET | /orgs/{org}/repos |
|
||||
✅ | GET | /orgs/{org}/teams |
|
||||
✅ | POST | /orgs/{org}/teams |
|
||||
✅ | GET | /orgs/{org}/teams/search |
|
||||
✅ | GET | /teams/{id} |
|
||||
✅ | DELETE | /teams/{id} |
|
||||
✅ | PATCH | /teams/{id} |
|
||||
✅ | GET | /teams/{id}/members |
|
||||
✅ | GET | /teams/{id}/members/{username} |
|
||||
✅ | PUT | /teams/{id}/members/{username} |
|
||||
✅ | DELETE | /teams/{id}/members/{username} |
|
||||
✅ | GET | /teams/{id}/repos |
|
||||
✅ | PUT | /teams/{id}/repos/{org}/{repo} |
|
||||
✅ | DELETE | /teams/{id}/repos/{org}/{repo} |
|
||||
✅ | GET | /user/orgs |
|
||||
✅ | GET | /users/{username}/orgs |
|
||||
|
||||
#### Issue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user