mirror of
https://github.com/avency/Gitea.git
synced 2025-10-28 18:24:58 +01:00
feat: add further Repo endpoints
This commit is contained in:
@ -24,6 +24,8 @@ class Client
|
||||
const AUTH_TOKEN = 'token';
|
||||
const AUTH_BASIC_AUTH = 'basic_auth';
|
||||
|
||||
const BASE_URI = '/api/v1';
|
||||
|
||||
/**
|
||||
* @var \GuzzleHttp\Client
|
||||
*/
|
||||
@ -75,9 +77,14 @@ class Client
|
||||
*/
|
||||
public function request(string $uri = '', string $method = 'GET', array $options = []): ResponseInterface
|
||||
{
|
||||
$uri = self::BASE_URI . $uri;
|
||||
|
||||
if (!empty($this->config['query']) && isset($options['query'])) {
|
||||
$options['query'] = array_merge($this->config['query'], $options['query']);
|
||||
} else if (!empty($this->config['query'])) {
|
||||
$options['query'] = $this->config['query'];
|
||||
}
|
||||
|
||||
return $this->httpClient->request($method, $uri, $options);
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ use Avency\Gitea\Client;
|
||||
*/
|
||||
class Admin extends AbstractEndpoint implements EndpointInterface
|
||||
{
|
||||
const BASE_URI = 'api/v1/admin';
|
||||
const BASE_URI = '/admin';
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
|
||||
@ -11,7 +11,7 @@ use Avency\Gitea\Client;
|
||||
*/
|
||||
class Miscellaneous extends AbstractEndpoint implements EndpointInterface
|
||||
{
|
||||
const BASE_URI = 'api/v1';
|
||||
const BASE_URI = '';
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
|
||||
@ -14,7 +14,11 @@ use Avency\Gitea\Endpoint\Repositories\GitTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\HooksTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\KeysTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\PullsTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\ReleasesTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\RepositoryTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\StatusesTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\SubscriptionTrait;
|
||||
use Avency\Gitea\Endpoint\Repositories\TopicsTrait;
|
||||
|
||||
/**
|
||||
* Repositories endpoint
|
||||
@ -30,9 +34,13 @@ class Repositories extends AbstractEndpoint implements EndpointInterface
|
||||
use HooksTrait;
|
||||
use KeysTrait;
|
||||
use PullsTrait;
|
||||
use ReleasesTrait;
|
||||
use RepositoryTrait;
|
||||
use StatusesTrait;
|
||||
use SubscriptionTrait;
|
||||
use TopicsTrait;
|
||||
|
||||
const BASE_URI = 'api/v1/repos';
|
||||
const BASE_URI = '/repos';
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
|
||||
38
Classes/Endpoint/Repositories/BranchesTrait.php
Normal file
38
Classes/Endpoint/Repositories/BranchesTrait.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Branches Trait
|
||||
*/
|
||||
trait BranchesTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getBranches(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/branches');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param $branch
|
||||
* @return array
|
||||
*/
|
||||
public function getBranche(string $owner, string $repositoryName, string $branch): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/branches/' . $branch);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
69
Classes/Endpoint/Repositories/CollaboratorsTrait.php
Normal file
69
Classes/Endpoint/Repositories/CollaboratorsTrait.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Collaborators Trait
|
||||
*/
|
||||
trait CollaboratorsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getCollaborators(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/collaborators');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $collaborator
|
||||
* @return bool
|
||||
*/
|
||||
public function checkCollaborator(string $owner, string $repositoryName, string $collaborator): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/collaborators/' . $collaborator);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $collaborator
|
||||
* @param string $permission
|
||||
* @return bool
|
||||
*/
|
||||
public function addCollaborator(string $owner, string $repositoryName, string $collaborator, string $permission = 'write'): bool
|
||||
{
|
||||
$options['json'] = [
|
||||
'permission' => $permission
|
||||
];
|
||||
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/collaborators/' . $collaborator, 'PUT', $options);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $collaborator
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteCollaborator(string $owner, string $repositoryName, string $collaborator): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/collaborators/' . $collaborator, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
52
Classes/Endpoint/Repositories/CommitsTrait.php
Normal file
52
Classes/Endpoint/Repositories/CommitsTrait.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Commits Trait
|
||||
*/
|
||||
trait CommitsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string|null $sha
|
||||
* @param int|null $page
|
||||
* @return array
|
||||
*/
|
||||
public function getCommits(string $owner, string $repositoryName, string $sha = null, int $page = null): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'sha' => $sha,
|
||||
'page' => $page
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/commits', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $ref
|
||||
* @param int|null $page
|
||||
* @return array
|
||||
*/
|
||||
public function getCommitStatuses(string $owner, string $repositoryName, string $ref, int $page = null): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'page' => $page
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/commits/' . $ref . '/statuses', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
250
Classes/Endpoint/Repositories/ContentsTrait.php
Normal file
250
Classes/Endpoint/Repositories/ContentsTrait.php
Normal file
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Contents Trait
|
||||
*/
|
||||
trait ContentsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string|null $ref
|
||||
* @return array
|
||||
*/
|
||||
public function getContents(string $owner, string $repositoryName, string $ref = null): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'ref' => $ref
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/contents');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $filepath
|
||||
* @param string|null $ref
|
||||
* @return array
|
||||
*/
|
||||
public function getContent(string $owner, string $repositoryName, string $filepath, string $ref = null): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'ref' => $ref
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/contents/' . $filepath);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $filepath
|
||||
* @param string $sha
|
||||
* @param string $content
|
||||
* @param string|null $authorEmail
|
||||
* @param string|null $authorName
|
||||
* @param string|null $branch
|
||||
* @param string|null $committerEmail
|
||||
* @param string|null $committerName
|
||||
* @param \DateTime|null $authorDate
|
||||
* @param \DateTime|null $committerDate
|
||||
* @param string|null $message
|
||||
* @param string|null $newBranch
|
||||
* @return array
|
||||
*/
|
||||
public function updateContent(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $filepath,
|
||||
string $sha,
|
||||
string $content,
|
||||
string $authorEmail = null,
|
||||
string $authorName = null,
|
||||
string $branch = null,
|
||||
string $committerEmail = null,
|
||||
string $committerName = null,
|
||||
\DateTime $authorDate = null,
|
||||
\DateTime $committerDate = null,
|
||||
string $message = null,
|
||||
string $newBranch = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'sha' => $sha,
|
||||
'content' => base64_encode($content),
|
||||
'author' => [
|
||||
'email' => $authorEmail,
|
||||
'name' => $authorName,
|
||||
],
|
||||
'branch' => $branch,
|
||||
'committer' => [
|
||||
'email' => $committerEmail,
|
||||
'name' => $committerName,
|
||||
],
|
||||
'dates' => [
|
||||
'author' => $authorDate ? $authorDate->format(\DateTime::ATOM) : null,
|
||||
'committer' => $committerDate ? $committerDate->format(\DateTime::ATOM) : null,
|
||||
],
|
||||
'message' => $message,
|
||||
'new_branch' => $newBranch,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/contents/' . $filepath, 'PUT', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $filepath
|
||||
* @param string $content
|
||||
* @param string|null $authorEmail
|
||||
* @param string|null $authorName
|
||||
* @param string|null $branch
|
||||
* @param string|null $committerEmail
|
||||
* @param string|null $committerName
|
||||
* @param \DateTime|null $authorDate
|
||||
* @param \DateTime|null $committerDate
|
||||
* @param string|null $message
|
||||
* @param string|null $newBranch
|
||||
* @return array
|
||||
*/
|
||||
public function addContent(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $filepath,
|
||||
string $content,
|
||||
string $authorEmail = null,
|
||||
string $authorName = null,
|
||||
string $branch = null,
|
||||
string $committerEmail = null,
|
||||
string $committerName = null,
|
||||
\DateTime $authorDate = null,
|
||||
\DateTime $committerDate = null,
|
||||
string $message = null,
|
||||
string $newBranch = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'content' => base64_encode($content),
|
||||
'author' => [
|
||||
'email' => $authorEmail,
|
||||
'name' => $authorName,
|
||||
],
|
||||
'branch' => $branch,
|
||||
'committer' => [
|
||||
'email' => $committerEmail,
|
||||
'name' => $committerName,
|
||||
],
|
||||
'dates' => [
|
||||
'author' => $authorDate ? $authorDate->format(\DateTime::ATOM) : null,
|
||||
'committer' => $committerDate ? $committerDate->format(\DateTime::ATOM) : null,
|
||||
],
|
||||
'message' => $message,
|
||||
'new_branch' => $newBranch,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/contents/' . $filepath, 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $filepath
|
||||
* @param string $sha
|
||||
* @param string $content
|
||||
* @param string|null $authorEmail
|
||||
* @param string|null $authorName
|
||||
* @param string|null $branch
|
||||
* @param string|null $committerEmail
|
||||
* @param string|null $committerName
|
||||
* @param \DateTime|null $authorDate
|
||||
* @param \DateTime|null $committerDate
|
||||
* @param string|null $message
|
||||
* @param string|null $newBranch
|
||||
* @return array
|
||||
*/
|
||||
public function deleteContent(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $filepath,
|
||||
string $sha,
|
||||
string $authorEmail = null,
|
||||
string $authorName = null,
|
||||
string $branch = null,
|
||||
string $committerEmail = null,
|
||||
string $committerName = null,
|
||||
\DateTime $authorDate = null,
|
||||
\DateTime $committerDate = null,
|
||||
string $message = null,
|
||||
string $newBranch = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'sha' => $sha,
|
||||
'author' => [
|
||||
'email' => $authorEmail,
|
||||
'name' => $authorName,
|
||||
],
|
||||
'branch' => $branch,
|
||||
'committer' => [
|
||||
'email' => $committerEmail,
|
||||
'name' => $committerName,
|
||||
],
|
||||
'dates' => [
|
||||
'author' => $authorDate ? $authorDate->format(\DateTime::ATOM) : null,
|
||||
'committer' => $committerDate ? $committerDate->format(\DateTime::ATOM) : null,
|
||||
],
|
||||
'message' => $message,
|
||||
'new_branch' => $newBranch,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/contents/' . $filepath, 'DELETE', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $filepath
|
||||
* @return array
|
||||
*/
|
||||
public function getEditorConfig(string $owner, string $repositoryName, string $filepath): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/editorconfig/' . $filepath);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return string
|
||||
*/
|
||||
public function getRawContent(string $owner, string $repositoryName, string $filepath): string
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/raw/' . $filepath);
|
||||
|
||||
return (string)$response->getBody();
|
||||
}
|
||||
}
|
||||
43
Classes/Endpoint/Repositories/ForksTrait.php
Normal file
43
Classes/Endpoint/Repositories/ForksTrait.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Forks Trait
|
||||
*/
|
||||
trait ForksTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getForks(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/forks');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string|null $organisation
|
||||
* @return array
|
||||
*/
|
||||
public function createFork(string $owner, string $repositoryName, string $organisation = null): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'organization' => $organisation
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/forks', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
107
Classes/Endpoint/Repositories/GitTrait.php
Normal file
107
Classes/Endpoint/Repositories/GitTrait.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Git Trait
|
||||
*/
|
||||
trait GitTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @return array
|
||||
*/
|
||||
public function getBlob(string $owner, string $repositoryName, string $sha): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/blobs/' . $sha);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @return array
|
||||
*/
|
||||
public function getCommit(string $owner, string $repositoryName, string $sha): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/commits/' . $sha);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getRefs(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/refs');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $ref
|
||||
* @return array
|
||||
*/
|
||||
public function getRef(string $owner, string $repositoryName, string $ref): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/refs/' . $ref);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @return array
|
||||
*/
|
||||
public function getTag(string $owner, string $repositoryName, string $sha): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/tags/' . $sha);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @param bool|null $recursive
|
||||
* @param int|null $page
|
||||
* @param int|null $perPage
|
||||
* @return array
|
||||
*/
|
||||
public function getTree(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $sha,
|
||||
bool $recursive = null,
|
||||
int $page = null,
|
||||
int $perPage = null
|
||||
): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'recursive' => $recursive,
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/git/trees/' . $sha, 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
191
Classes/Endpoint/Repositories/HooksTrait.php
Normal file
191
Classes/Endpoint/Repositories/HooksTrait.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Hooks Trait
|
||||
*/
|
||||
trait HooksTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getHooks(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $type
|
||||
* @param array $config
|
||||
* @param bool|null $active
|
||||
* @param string|null $branchFilter
|
||||
* @param array|null $events
|
||||
* @return array
|
||||
*/
|
||||
public function addHook(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
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 . '/' . $owner . '/' . $repositoryName . '/hooks', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getGitHooks(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/git');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getGitHook(string $owner, string $repositoryName, int $id): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/git/' . $id);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteGitHook(string $owner, string $repositoryName, int $id): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/git/' . $id, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @param string $content
|
||||
* @return array
|
||||
*/
|
||||
public function updateGitHook(string $owner, string $repositoryName, int $id, string $content): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'content' => $content
|
||||
];
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/git/' . $id, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getHook(string $owner, string $repositoryName, int $id): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/' . $id);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteHook(string $owner, string $repositoryName, int $id): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/' . $id, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @param array|null $config
|
||||
* @param bool|null $active
|
||||
* @param string|null $branchFilter
|
||||
* @param array|null $events
|
||||
* @return array
|
||||
*/
|
||||
public function updateHook(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $id,
|
||||
array $config = null,
|
||||
bool $active = null,
|
||||
string $branchFilter = null,
|
||||
array $events = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'config' => $config,
|
||||
'active' => $active,
|
||||
'branch_filter' => $branchFilter,
|
||||
'events' => $events,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/' . $id, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function testHook(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $id
|
||||
): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/hooks/' . $id . '/tests', 'POST');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
86
Classes/Endpoint/Repositories/KeysTrait.php
Normal file
86
Classes/Endpoint/Repositories/KeysTrait.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Keys Trait
|
||||
*/
|
||||
trait KeysTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int|null $keyId
|
||||
* @param string|null $fingerprint
|
||||
* @return array
|
||||
*/
|
||||
public function getKeys(string $owner, string $repositoryName, int $keyId = null, string $fingerprint = null): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'key_id' => $keyId,
|
||||
'fingerprint' => $fingerprint
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/keys', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $title
|
||||
* @param string $key
|
||||
* @param bool|null $readOnly
|
||||
* @return array
|
||||
*/
|
||||
public function addKey(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $title,
|
||||
string $key,
|
||||
bool $readOnly = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'title' => $title,
|
||||
'key' => $key,
|
||||
'read_only' => $readOnly,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/keys', 'POST', $options);
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $keyId
|
||||
* @return array
|
||||
*/
|
||||
public function getKey(string $owner, string $repositoryName, int $keyId): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/keys/' . $keyId);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $keyId
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteKey(string $owner, string $repositoryName, int $keyId): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/keys/' . $keyId, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
205
Classes/Endpoint/Repositories/PullsTrait.php
Normal file
205
Classes/Endpoint/Repositories/PullsTrait.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Pulls Trait
|
||||
*/
|
||||
trait PullsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int|null $page
|
||||
* @param string|null $state
|
||||
* @param string|null $sort
|
||||
* @param int|null $milestone
|
||||
* @param array|null $lables
|
||||
* @return array
|
||||
*/
|
||||
public function getPulls(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $page = null,
|
||||
string $state = null,
|
||||
string $sort = null,
|
||||
int $milestone = null,
|
||||
array $lables = null
|
||||
): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'page' => $page,
|
||||
'state' => $state,
|
||||
'sort' => $sort,
|
||||
'milestone' => $milestone,
|
||||
'lables' => $lables,
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $assignee
|
||||
* @param string $base
|
||||
* @param string $head
|
||||
* @param array|null $assignees
|
||||
* @param string|null $title
|
||||
* @param string|null $body
|
||||
* @param \DateTime|null $dueDate
|
||||
* @param array|null $labels
|
||||
* @param int|null $milestone
|
||||
* @return array
|
||||
*/
|
||||
public function createPull(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $assignee,
|
||||
string $base,
|
||||
string $head,
|
||||
string $title,
|
||||
array $assignees = null,
|
||||
string $body = null,
|
||||
\DateTime $dueDate = null,
|
||||
array $labels = null,
|
||||
int $milestone = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'assignee' => $assignee,
|
||||
'base' => $base,
|
||||
'head' => $head,
|
||||
'assignees' => $assignees,
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
'due_date' => $dueDate ? $dueDate->format(\DateTime::ATOM) : null,
|
||||
'labels' => $labels,
|
||||
'milestone' => $milestone,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $index
|
||||
* @return array
|
||||
*/
|
||||
public function getPull(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $index
|
||||
): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls/' . $index, 'GET');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $index
|
||||
* @param string|null $assignee
|
||||
* @param string|null $title
|
||||
* @param string|null $state
|
||||
* @param array|null $assignees
|
||||
* @param string|null $body
|
||||
* @param \DateTime|null $dueDate
|
||||
* @param bool|null $unsetDueDate
|
||||
* @param array|null $labels
|
||||
* @param int|null $milestone
|
||||
* @return array
|
||||
*/
|
||||
public function updatePull(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $index,
|
||||
string $assignee = null,
|
||||
string $title = null,
|
||||
string $state = null,
|
||||
array $assignees = null,
|
||||
string $body = null,
|
||||
\DateTime $dueDate = null,
|
||||
bool $unsetDueDate = null,
|
||||
array $labels = null,
|
||||
int $milestone = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'assignee' => $assignee,
|
||||
'assignees' => $assignees,
|
||||
'title' => $title,
|
||||
'state' => $state,
|
||||
'body' => $body,
|
||||
'due_date' => $dueDate ? $dueDate->format(\DateTime::ATOM) : null,
|
||||
'unsetDueDate' => $unsetDueDate,
|
||||
'labels' => $labels,
|
||||
'milestone' => $milestone,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls/' . $index, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $index
|
||||
* @return bool
|
||||
*/
|
||||
public function checkMerged(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $index
|
||||
): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls/' . $index . '/merge', 'GET');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $index
|
||||
* @param string $do
|
||||
* @param string|null $mergeMessage
|
||||
* @param string|null $mergeTitle
|
||||
* @return bool
|
||||
*/
|
||||
public function mergePull(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $index,
|
||||
string $do,
|
||||
string $mergeMessage = null,
|
||||
string $mergeTitle = null
|
||||
): bool
|
||||
{
|
||||
$options['json'] = [
|
||||
'Do' => $do,
|
||||
'MergeMessageField' => $mergeMessage,
|
||||
'MergeTitleField' => $mergeTitle,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/pulls/' . $index . '/merge', 'POST', $options);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
184
Classes/Endpoint/Repositories/ReleasesTrait.php
Normal file
184
Classes/Endpoint/Repositories/ReleasesTrait.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Releases Trait
|
||||
*/
|
||||
trait ReleasesTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getReleases(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $tagName
|
||||
* @param string|null $body
|
||||
* @param bool|null $draft
|
||||
* @param string|null $name
|
||||
* @param bool|null $prerelease
|
||||
* @param string|null $targetCommitish
|
||||
* @return array
|
||||
*/
|
||||
public function createRelease(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $tagName,
|
||||
string $body = null,
|
||||
bool $draft = null,
|
||||
string $name = null,
|
||||
bool $prerelease = null,
|
||||
string $targetCommitish = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'tag_name' => $tagName,
|
||||
'body' => $body,
|
||||
'draft' => $draft,
|
||||
'name' => $name,
|
||||
'prerelease' => $prerelease,
|
||||
'target_commitish' => $targetCommitish,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getRelease(string $owner, string $repositoryName, int $id): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteRelease(string $owner, string $repositoryName, int $id): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @param string|null $tagName
|
||||
* @param string|null $body
|
||||
* @param bool|null $draft
|
||||
* @param string|null $name
|
||||
* @param bool|null $prerelease
|
||||
* @param string|null $targetCommitish
|
||||
* @return array
|
||||
*/
|
||||
public function updateRelease(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
int $id,
|
||||
string $tagName = null,
|
||||
string $body = null,
|
||||
bool $draft = null,
|
||||
string $name = null,
|
||||
bool $prerelease = null,
|
||||
string $targetCommitish = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'tag_name' => $tagName,
|
||||
'body' => $body,
|
||||
'draft' => $draft,
|
||||
'name' => $name,
|
||||
'prerelease' => $prerelease,
|
||||
'target_commitish' => $targetCommitish,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getReleaseAssets(string $owner, string $repositoryName, int $id): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id . '/assets');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getReleaseAsset(string $owner, string $repositoryName, int $id, int $assetId): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id . '/assets/' . $assetId);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteReleaseAsset(string $owner, string $repositoryName, int $id, int $assetId): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id . '/assets/' . $assetId, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param int $id
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
public function updateReleaseAsset(string $owner, string $repositoryName, int $id, int $assetId, string $name): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'name' => $name
|
||||
];
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/releases/' . $id . '/assets/' . $assetId, 'PATCH', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
@ -248,4 +248,116 @@ trait RepositoryTrait
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return string
|
||||
*/
|
||||
public function getSigningKeyGPG(string $owner, string $repositoryName): string
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/signing-key.gpg');
|
||||
|
||||
return (string)$response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getStargazers(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/stargazers');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getTags(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/tags');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getTimes(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/times');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
public function getById(int $id): array
|
||||
{
|
||||
$response = $this->client->request('/repositories/' . $id);
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $searchTerm
|
||||
* @return array
|
||||
*/
|
||||
public function topicsSearch(string $searchTerm): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'q' => $searchTerm
|
||||
];
|
||||
|
||||
$response = $this->client->request('/topics/search', 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param bool $autoInit
|
||||
* @param string $description
|
||||
* @param string $gitignores
|
||||
* @param string $issueLabels
|
||||
* @param string $license
|
||||
* @param bool $private
|
||||
* @param string $readme
|
||||
* @return array
|
||||
*/
|
||||
public function create(
|
||||
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('/user/repos', 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
|
||||
76
Classes/Endpoint/Repositories/StatusesTrait.php
Normal file
76
Classes/Endpoint/Repositories/StatusesTrait.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Statuses Trait
|
||||
*/
|
||||
trait StatusesTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @param int|null $page
|
||||
* @param int|null $sort
|
||||
* @param int|null $state
|
||||
* @return array
|
||||
*/
|
||||
public function getStatuses(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $sha,
|
||||
int $page = null,
|
||||
int $sort = null,
|
||||
int $state = null
|
||||
): array
|
||||
{
|
||||
$options['query'] = [
|
||||
'page' => $page,
|
||||
'sort' => $sort,
|
||||
'state' => $state,
|
||||
];
|
||||
$options['query'] = $this->removeNullValues($options['query']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/statuses/' . $sha, 'GET', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $sha
|
||||
* @param string $state // pending, success, error, failure, warning
|
||||
* @param string|null $description
|
||||
* @param string|null $context
|
||||
* @param string|null $targetUrl
|
||||
* @return array
|
||||
*/
|
||||
public function createStatus(
|
||||
string $owner,
|
||||
string $repositoryName,
|
||||
string $sha,
|
||||
string $state,
|
||||
string $description = null,
|
||||
string $context = null,
|
||||
string $targetUrl = null
|
||||
): array
|
||||
{
|
||||
$options['json'] = [
|
||||
'state' => $state,
|
||||
'description' => $description,
|
||||
'context' => $context,
|
||||
'target_url' => $targetUrl,
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/statuses/' . $sha, 'POST', $options);
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
}
|
||||
61
Classes/Endpoint/Repositories/SubscriptionTrait.php
Normal file
61
Classes/Endpoint/Repositories/SubscriptionTrait.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Subscription Trait
|
||||
*/
|
||||
trait SubscriptionTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getSubscribers(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/subscribers');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function checkSubscription(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/subscription');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function addSubscription(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/subscription', 'PUT');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteSubscription(string $owner, string $repositoryName): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/subscription', 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
69
Classes/Endpoint/Repositories/TopicsTrait.php
Normal file
69
Classes/Endpoint/Repositories/TopicsTrait.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Avency\Gitea\Endpoint\Repositories;
|
||||
|
||||
use Avency\Gitea\Client;
|
||||
|
||||
/**
|
||||
* Repositories Topics Trait
|
||||
*/
|
||||
trait TopicsTrait
|
||||
{
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @return array
|
||||
*/
|
||||
public function getTopics(string $owner, string $repositoryName): array
|
||||
{
|
||||
$response = $this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/topics');
|
||||
|
||||
return \GuzzleHttp\json_decode($response->getBody(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param array $topics
|
||||
* @return bool
|
||||
*/
|
||||
public function replaceTopics(string $owner, string $repositoryName, array $topics): bool
|
||||
{
|
||||
$options['json'] = [
|
||||
'topics' => $topics
|
||||
];
|
||||
$options['json'] = $this->removeNullValues($options['json']);
|
||||
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/topics', 'PUT', $options);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $topic
|
||||
* @return bool
|
||||
*/
|
||||
public function addTopic(string $owner, string $repositoryName, string $topic): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/topics/' . $topic, 'PUT');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $owner
|
||||
* @param string $repositoryName
|
||||
* @param string $topic
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteTopic(string $owner, string $repositoryName, string $topic): bool
|
||||
{
|
||||
$this->client->request(self::BASE_URI . '/' . $owner . '/' . $repositoryName . '/topics/' . $topic, 'DELETE');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
436
README.md
436
README.md
@ -80,236 +80,236 @@ This project is licensed under the MIT License - see the
|
||||
|
||||
#### Admin
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
✅ | GET | /admin/orgs
|
||||
✅ | POST | /admin/users
|
||||
✅ | DELETE | /admin/users/{username}
|
||||
✅ | PATCH | /admin/users/{username}
|
||||
✅ | POST | /admin/users/{username}/keys
|
||||
✅ | DELETE | /admin/users/{username}/keys/{id}
|
||||
✅ | POST | /admin/users/{username}/orgs
|
||||
✅ | POST | /admin/users/{username}/repos
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
✅ | GET | /admin/orgs |
|
||||
✅ | POST | /admin/users |
|
||||
✅ | DELETE | /admin/users/{username} |
|
||||
✅ | PATCH | /admin/users/{username} |
|
||||
✅ | POST | /admin/users/{username}/keys |
|
||||
✅ | DELETE | /admin/users/{username}/keys/{id} |
|
||||
✅ | POST | /admin/users/{username}/orgs |
|
||||
✅ | POST | /admin/users/{username}/repos |
|
||||
|
||||
#### Miscellaneous
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
✅ | POST | /markdown
|
||||
✅ | POST | /markdown/raw
|
||||
✅ | GET | /signing-key.gpg
|
||||
✅ | GET | /version
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
✅ | POST | /markdown |
|
||||
✅ | POST | /markdown/raw |
|
||||
✅ | GET | /signing-key.gpg |
|
||||
✅ | GET | /version |
|
||||
|
||||
#### Organization
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
❌ | 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
|
||||
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 |
|
||||
|
||||
#### Issue
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
❌ | GET | /repos/issues/search
|
||||
❌ | GET | /repos/{owner}/{repo}/issues
|
||||
❌ | POST | /repos/{owner}/{repo}/issues
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/comments
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/comments/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/issues/comments/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/comments/{id}/reactions
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/comments/{id}/reactions
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/comments/{id}/reactions
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/issues/{index}
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/comments
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/comments
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/deadline
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/labels
|
||||
❌ | PUT | /repos/{owner}/{repo}/issues/{index}/labels
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/labels
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/labels
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/labels/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/reactions
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/reactions
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/reactions
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/stopwatch/delete
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/stopwatch/start
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/stopwatch/stop
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/subscriptions
|
||||
❌ | PUT | /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/subscriptions/{user}
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/times
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/times
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/times
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/times/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/labels
|
||||
❌ | POST | /repos/{owner}/{repo}/labels
|
||||
❌ | GET | /repos/{owner}/{repo}/labels/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/labels/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/labels/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/milestones
|
||||
❌ | POST | /repos/{owner}/{repo}/milestones
|
||||
❌ | GET | /repos/{owner}/{repo}/milestones/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/milestones/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/milestones/{id}
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
❌ | GET | /repos/issues/search |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/comments |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/comments/{id} |
|
||||
❌ | PATCH | /repos/{owner}/{repo}/issues/comments/{id} |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/comments/{id}/reactions |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/comments/{id}/reactions |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/comments/{id}/reactions |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index} |
|
||||
❌ | PATCH | /repos/{owner}/{repo}/issues/{index} |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/comments |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/comments |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/deadline |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/labels |
|
||||
❌ | PUT | /repos/{owner}/{repo}/issues/{index}/labels |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/labels |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/labels |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/labels/{id} |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/reactions |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/reactions |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/reactions |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/stopwatch/delete |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/stopwatch/start |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/stopwatch/stop |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/subscriptions |
|
||||
❌ | PUT | /repos/{owner}/{repo}/issues/{index}/subscriptions/{user} |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/subscriptions/{user} |
|
||||
❌ | GET | /repos/{owner}/{repo}/issues/{index}/times |
|
||||
❌ | POST | /repos/{owner}/{repo}/issues/{index}/times |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/times |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/issues/{index}/times/{id} |
|
||||
❌ | GET | /repos/{owner}/{repo}/labels |
|
||||
❌ | POST | /repos/{owner}/{repo}/labels |
|
||||
❌ | GET | /repos/{owner}/{repo}/labels/{id} |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/labels/{id} |
|
||||
❌ | PATCH | /repos/{owner}/{repo}/labels/{id} |
|
||||
❌ | GET | /repos/{owner}/{repo}/milestones |
|
||||
❌ | POST | /repos/{owner}/{repo}/milestones |
|
||||
❌ | GET | /repos/{owner}/{repo}/milestones/{id} |
|
||||
❌ | DELETE | /repos/{owner}/{repo}/milestones/{id} |
|
||||
❌ | PATCH | /repos/{owner}/{repo}/milestones/{id} |
|
||||
|
||||
#### Repository
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
✅ | POST | /repos/migrate
|
||||
✅ | GET | /repos/search
|
||||
✅ | GET | /repos/{owner}/{repo}
|
||||
✅ | DELETE | /repos/{owner}/{repo}
|
||||
✅ | PATCH | /repos/{owner}/{repo}
|
||||
❌ | GET | /repos/{owner}/{repo}/archive/{archive}
|
||||
❌ | GET | /repos/{owner}/{repo}/branches
|
||||
❌ | GET | /repos/{owner}/{repo}/branches/{branch}
|
||||
❌ | GET | /repos/{owner}/{repo}/collaborators
|
||||
❌ | GET | /repos/{owner}/{repo}/collaborators/{collaborator}
|
||||
❌ | PUT | /repos/{owner}/{repo}/collaborators/{collaborator}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/collaborators/{collaborator}
|
||||
❌ | GET | /repos/{owner}/{repo}/commits
|
||||
❌ | GET | /repos/{owner}/{repo}/commits/{ref}/statuses
|
||||
❌ | GET | /repos/{owner}/{repo}/contents
|
||||
❌ | GET | /repos/{owner}/{repo}/contents/{filepath}
|
||||
❌ | PUT | /repos/{owner}/{repo}/contents/{filepath}
|
||||
❌ | POST | /repos/{owner}/{repo}/contents/{filepath}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/contents/{filepath}
|
||||
❌ | GET | /repos/{owner}/{repo}/editorconfig/{filepath}
|
||||
❌ | GET | /repos/{owner}/{repo}/forks
|
||||
❌ | POST | /repos/{owner}/{repo}/forks
|
||||
❌ | GET | /repos/{owner}/{repo}/git/blobs/{sha}
|
||||
❌ | GET | /repos/{owner}/{repo}/git/commits/{sha}
|
||||
❌ | GET | /repos/{owner}/{repo}/git/refs
|
||||
❌ | GET | /repos/{owner}/{repo}/git/refs/{ref}
|
||||
❌ | GET | /repos/{owner}/{repo}/git/tags/{sha}
|
||||
❌ | GET | /repos/{owner}/{repo}/git/trees/{sha}
|
||||
❌ | GET | /repos/{owner}/{repo}/hooks
|
||||
❌ | POST | /repos/{owner}/{repo}/hooks
|
||||
❌ | GET | /repos/{owner}/{repo}/hooks/git
|
||||
❌ | GET | /repos/{owner}/{repo}/hooks/git/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/hooks/git/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/hooks/git/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/hooks/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/hooks/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/hooks/{id}
|
||||
❌ | POST | /repos/{owner}/{repo}/hooks/{id}/tests
|
||||
❌ | GET | /repos/{owner}/{repo}/keys
|
||||
❌ | POST | /repos/{owner}/{repo}/keys
|
||||
❌ | GET | /repos/{owner}/{repo}/keys/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/keys/{id}
|
||||
❌ | POST | /repos/{owner}/{repo}/mirror-sync
|
||||
❌ | GET | /repos/{owner}/{repo}/pulls
|
||||
❌ | POST | /repos/{owner}/{repo}/pulls
|
||||
❌ | GET | /repos/{owner}/{repo}/pulls/{index}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/pulls/{index}
|
||||
❌ | GET | /repos/{owner}/{repo}/pulls/{index}/merge
|
||||
❌ | POST | /repos/{owner}/{repo}/pulls/{index}/merge
|
||||
❌ | GET | /repos/{owner}/{repo}/raw/{filepath}
|
||||
❌ | GET | /repos/{owner}/{repo}/releases
|
||||
❌ | POST | /repos/{owner}/{repo}/releases
|
||||
❌ | GET | /repos/{owner}/{repo}/releases/{id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/releases/{id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/releases/{id}
|
||||
❌ | GET | /repos/{owner}/{repo}/releases/{id}/assets
|
||||
❌ | POST | /repos/{owner}/{repo}/releases/{id}/assets
|
||||
❌ | GET | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}
|
||||
❌ | PATCH | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}
|
||||
❌ | GET | /repos/{owner}/{repo}/signing-key.gpg
|
||||
❌ | GET | /repos/{owner}/{repo}/stargazers
|
||||
❌ | GET | /repos/{owner}/{repo}/statuses/{sha}
|
||||
❌ | POST | /repos/{owner}/{repo}/statuses/{sha}
|
||||
❌ | GET | /repos/{owner}/{repo}/subscribers
|
||||
❌ | GET | /repos/{owner}/{repo}/subscription
|
||||
❌ | PUT | /repos/{owner}/{repo}/subscription
|
||||
❌ | DELETE | /repos/{owner}/{repo}/subscription
|
||||
❌ | GET | /repos/{owner}/{repo}/tags
|
||||
❌ | GET | /repos/{owner}/{repo}/times
|
||||
❌ | GET | /repos/{owner}/{repo}/topics
|
||||
❌ | PUT | /repos/{owner}/{repo}/topics
|
||||
❌ | PUT | /repos/{owner}/{repo}/topics/{topic}
|
||||
❌ | DELETE | /repos/{owner}/{repo}/topics/{topic}
|
||||
❌ | GET | /repositories/{id}
|
||||
❌ | GET | /topics/search
|
||||
❌ | POST | /user/repos
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
✅ | POST | /repos/migrate |
|
||||
✅ | GET | /repos/search |
|
||||
✅ | GET | /repos/{owner}/{repo} |
|
||||
✅ | DELETE | /repos/{owner}/{repo} |
|
||||
✅ | PATCH | /repos/{owner}/{repo} |
|
||||
⛔️ | GET | /repos/{owner}/{repo}/archive/{archive} | Not supported
|
||||
✅ | GET | /repos/{owner}/{repo}/branches |
|
||||
✅ | GET | /repos/{owner}/{repo}/branches/{branch} |
|
||||
✅ | GET | /repos/{owner}/{repo}/collaborators |
|
||||
✅ | GET | /repos/{owner}/{repo}/collaborators/{collaborator} |
|
||||
✅ | PUT | /repos/{owner}/{repo}/collaborators/{collaborator} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/collaborators/{collaborator} |
|
||||
✅ | GET | /repos/{owner}/{repo}/commits |
|
||||
✅ | GET | /repos/{owner}/{repo}/commits/{ref}/statuses |
|
||||
✅ | GET | /repos/{owner}/{repo}/contents |
|
||||
✅ | GET | /repos/{owner}/{repo}/contents/{filepath} |
|
||||
✅ | PUT | /repos/{owner}/{repo}/contents/{filepath} |
|
||||
✅ | POST | /repos/{owner}/{repo}/contents/{filepath} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/contents/{filepath} |
|
||||
✅ | GET | /repos/{owner}/{repo}/editorconfig/{filepath} |
|
||||
✅ | GET | /repos/{owner}/{repo}/forks |
|
||||
✅ | POST | /repos/{owner}/{repo}/forks |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/blobs/{sha} |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/commits/{sha} |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/refs |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/refs/{ref} |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/tags/{sha} |
|
||||
✅ | GET | /repos/{owner}/{repo}/git/trees/{sha} |
|
||||
✅ | GET | /repos/{owner}/{repo}/hooks |
|
||||
✅ | POST | /repos/{owner}/{repo}/hooks |
|
||||
✅ | GET | /repos/{owner}/{repo}/hooks/git |
|
||||
✅ | GET | /repos/{owner}/{repo}/hooks/git/{id} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/hooks/git/{id} |
|
||||
✅ | PATCH | /repos/{owner}/{repo}/hooks/git/{id} |
|
||||
✅ | GET | /repos/{owner}/{repo}/hooks/{id} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/hooks/{id} |
|
||||
✅ | PATCH | /repos/{owner}/{repo}/hooks/{id} |
|
||||
✅ | POST | /repos/{owner}/{repo}/hooks/{id}/tests |
|
||||
✅ | GET | /repos/{owner}/{repo}/keys |
|
||||
✅ | POST | /repos/{owner}/{repo}/keys |
|
||||
✅ | GET | /repos/{owner}/{repo}/keys/{id} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/keys/{id} |
|
||||
✅ | POST | /repos/{owner}/{repo}/mirror-sync |
|
||||
✅ | GET | /repos/{owner}/{repo}/pulls |
|
||||
✅ | POST | /repos/{owner}/{repo}/pulls |
|
||||
✅ | GET | /repos/{owner}/{repo}/pulls/{index} |
|
||||
✅ | PATCH | /repos/{owner}/{repo}/pulls/{index} |
|
||||
✅ | GET | /repos/{owner}/{repo}/pulls/{index}/merge |
|
||||
✅ | POST | /repos/{owner}/{repo}/pulls/{index}/merge |
|
||||
✅ | GET | /repos/{owner}/{repo}/raw/{filepath} |
|
||||
✅ | GET | /repos/{owner}/{repo}/releases |
|
||||
✅ | POST | /repos/{owner}/{repo}/releases |
|
||||
✅ | GET | /repos/{owner}/{repo}/releases/{id} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/releases/{id} |
|
||||
✅ | PATCH | /repos/{owner}/{repo}/releases/{id} |
|
||||
✅ | GET | /repos/{owner}/{repo}/releases/{id}/assets |
|
||||
⛔️ | POST | /repos/{owner}/{repo}/releases/{id}/assets | Not supported
|
||||
✅ | GET | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} |
|
||||
✅ | PATCH | /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id} |
|
||||
✅ | GET | /repos/{owner}/{repo}/signing-key.gpg |
|
||||
✅ | GET | /repos/{owner}/{repo}/stargazers |
|
||||
✅ | GET | /repos/{owner}/{repo}/statuses/{sha} |
|
||||
✅ | POST | /repos/{owner}/{repo}/statuses/{sha} |
|
||||
✅ | GET | /repos/{owner}/{repo}/subscribers |
|
||||
✅ | GET | /repos/{owner}/{repo}/subscription |
|
||||
✅ | PUT | /repos/{owner}/{repo}/subscription |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/subscription |
|
||||
✅ | GET | /repos/{owner}/{repo}/tags |
|
||||
✅ | GET | /repos/{owner}/{repo}/times |
|
||||
✅ | GET | /repos/{owner}/{repo}/topics |
|
||||
✅ | PUT | /repos/{owner}/{repo}/topics |
|
||||
✅ | PUT | /repos/{owner}/{repo}/topics/{topic} |
|
||||
✅ | DELETE | /repos/{owner}/{repo}/topics/{topic} |
|
||||
✅ | GET | /repositories/{id} |
|
||||
✅ | GET | /topics/search |
|
||||
✅ | POST | /user/repos |
|
||||
|
||||
#### User
|
||||
|
||||
Status | Method | Endpoint
|
||||
--- | --- | ---
|
||||
❌ | GET | /repos/{owner}/{repo}/times/{user}
|
||||
❌ | GET | /user
|
||||
❌ | GET | /user/emails
|
||||
❌ | POST | /user/emails
|
||||
❌ | DELETE | /user/emails
|
||||
❌ | GET | /user/followers
|
||||
❌ | GET | /user/following
|
||||
❌ | GET | /user/following/{username}
|
||||
❌ | PUT | /user/following/{username}
|
||||
❌ | DELETE | /user/following/{username}
|
||||
❌ | GET | /user/gpg_keys
|
||||
❌ | POST | /user/gpg_keys
|
||||
❌ | GET | /user/gpg_keys/{id}
|
||||
❌ | DELETE | /user/gpg_keys/{id}
|
||||
❌ | GET | /user/keys
|
||||
❌ | POST | /user/keys
|
||||
❌ | GET | /user/keys/{id}
|
||||
❌ | DELETE | /user/keys/{id}
|
||||
❌ | GET | /user/repos
|
||||
❌ | POST | /user/repos
|
||||
❌ | GET | /user/starred
|
||||
❌ | GET | /user/starred/{owner}/{repo}
|
||||
❌ | PUT | /user/starred/{owner}/{repo}
|
||||
❌ | DELETE | /user/starred/{owner}/{repo}
|
||||
❌ | GET | /user/stopwatches
|
||||
❌ | GET | /user/subscriptions
|
||||
❌ | GET | /user/teams
|
||||
❌ | GET | /user/times
|
||||
❌ | GET | /users/search
|
||||
❌ | GET | /users/{follower}/following/{followee}
|
||||
❌ | GET | /users/{username}
|
||||
❌ | GET | /users/{username}/followers
|
||||
❌ | GET | /users/{username}/following
|
||||
❌ | GET | /users/{username}/gpg_keys
|
||||
❌ | GET | /users/{username}/heatmap
|
||||
❌ | GET | /users/{username}/keys
|
||||
❌ | GET | /users/{username}/repos
|
||||
❌ | GET | /users/{username}/starred
|
||||
❌ | GET | /users/{username}/subscriptions
|
||||
❌ | GET | /users/{username}/tokens
|
||||
❌ | POST | /users/{username}/tokens
|
||||
❌ | DELETE | /users/{username}/tokens/{token}
|
||||
Status | Method | Endpoint | Comment
|
||||
--- | --- | --- | ---
|
||||
❌ | GET | /repos/{owner}/{repo}/times/{user} |
|
||||
❌ | GET | /user |
|
||||
❌ | GET | /user/emails |
|
||||
❌ | POST | /user/emails |
|
||||
❌ | DELETE | /user/emails |
|
||||
❌ | GET | /user/followers |
|
||||
❌ | GET | /user/following |
|
||||
❌ | GET | /user/following/{username} |
|
||||
❌ | PUT | /user/following/{username} |
|
||||
❌ | DELETE | /user/following/{username} |
|
||||
❌ | GET | /user/gpg_keys |
|
||||
❌ | POST | /user/gpg_keys |
|
||||
❌ | GET | /user/gpg_keys/{id} |
|
||||
❌ | DELETE | /user/gpg_keys/{id} |
|
||||
❌ | GET | /user/keys |
|
||||
❌ | POST | /user/keys |
|
||||
❌ | GET | /user/keys/{id} |
|
||||
❌ | DELETE | /user/keys/{id} |
|
||||
❌ | GET | /user/repos |
|
||||
❌ | POST | /user/repos |
|
||||
❌ | GET | /user/starred |
|
||||
❌ | GET | /user/starred/{owner}/{repo} |
|
||||
❌ | PUT | /user/starred/{owner}/{repo} |
|
||||
❌ | DELETE | /user/starred/{owner}/{repo} |
|
||||
❌ | GET | /user/stopwatches |
|
||||
❌ | GET | /user/subscriptions |
|
||||
❌ | GET | /user/teams |
|
||||
❌ | GET | /user/times |
|
||||
❌ | GET | /users/search |
|
||||
❌ | GET | /users/{follower}/following/{followee} |
|
||||
❌ | GET | /users/{username} |
|
||||
❌ | GET | /users/{username}/followers |
|
||||
❌ | GET | /users/{username}/following |
|
||||
❌ | GET | /users/{username}/gpg_keys |
|
||||
❌ | GET | /users/{username}/heatmap |
|
||||
❌ | GET | /users/{username}/keys |
|
||||
❌ | GET | /users/{username}/repos |
|
||||
❌ | GET | /users/{username}/starred |
|
||||
❌ | GET | /users/{username}/subscriptions |
|
||||
❌ | GET | /users/{username}/tokens |
|
||||
❌ | POST | /users/{username}/tokens |
|
||||
❌ | DELETE | /users/{username}/tokens/{token} |
|
||||
|
||||
Reference in New Issue
Block a user