Update to laravel 7

This commit is contained in:
KodeStar
2022-03-10 11:54:29 +00:00
parent 61a5a1a8b0
commit f9a19fce91
7170 changed files with 274189 additions and 283773 deletions

View File

@@ -2,6 +2,14 @@
namespace Github\Api;
use Github\Api\Repository\Actions\Artifacts;
use Github\Api\Repository\Actions\Secrets;
use Github\Api\Repository\Actions\SelfHostedRunners;
use Github\Api\Repository\Actions\WorkflowJobs;
use Github\Api\Repository\Actions\WorkflowRuns;
use Github\Api\Repository\Actions\Workflows;
use Github\Api\Repository\Checks\CheckRuns;
use Github\Api\Repository\Checks\CheckSuites;
use Github\Api\Repository\Collaborators;
use Github\Api\Repository\Comments;
use Github\Api\Repository\Commits;
@@ -11,6 +19,7 @@ use Github\Api\Repository\Downloads;
use Github\Api\Repository\Forks;
use Github\Api\Repository\Hooks;
use Github\Api\Repository\Labels;
use Github\Api\Repository\Pages;
use Github\Api\Repository\Projects;
use Github\Api\Repository\Protection;
use Github\Api\Repository\Releases;
@@ -31,22 +40,6 @@ class Repo extends AbstractApi
{
use AcceptHeaderTrait;
/**
* Search repositories by keyword.
*
* @deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
* @link http://developer.github.com/v3/search/#search-repositories
*
* @param string $keyword the search query
* @param array $params
*
* @return array list of found repositories
*/
public function find($keyword, array $params = [])
{
return $this->get('/legacy/repos/search/'.rawurlencode($keyword), array_merge(['start_page' => 1], $params));
}
/**
* List all public repositories.
*
@@ -62,7 +55,7 @@ class Repo extends AbstractApi
return $this->get('/repositories');
}
return $this->get('/repositories?since='.rawurldecode($id));
return $this->get('/repositories', ['since' => $id]);
}
/**
@@ -169,7 +162,7 @@ class Repo extends AbstractApi
*/
public function showById($id)
{
return $this->get('/repositories/'.rawurlencode($id));
return $this->get('/repositories/'.$id);
}
/**
@@ -181,13 +174,14 @@ class Repo extends AbstractApi
* @param string $description repository description
* @param string $homepage homepage url
* @param bool $public `true` for public, `false` for private
* @param null|string $organization username of organization if applicable
* @param string|null $organization username of organization if applicable
* @param bool $hasIssues `true` to enable issues for this repository, `false` to disable them
* @param bool $hasWiki `true` to enable the wiki for this repository, `false` to disable it
* @param bool $hasDownloads `true` to enable downloads for this repository, `false` to disable them
* @param int $teamId The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.
* @param bool $autoInit `true` to create an initial commit with empty README, `false` for no initial commit
* @param bool $hasProjects `true` to enable projects for this repository or false to disable them.
* @param string|null $visibility
*
* @return array returns repository data
*/
@@ -202,7 +196,8 @@ class Repo extends AbstractApi
$hasDownloads = false,
$teamId = null,
$autoInit = false,
$hasProjects = true
$hasProjects = true,
$visibility = null
) {
$path = null !== $organization ? '/orgs/'.$organization.'/repos' : '/user/repos';
@@ -210,7 +205,8 @@ class Repo extends AbstractApi
'name' => $name,
'description' => $description,
'homepage' => $homepage,
'private' => !$public,
'private' => ($visibility ?? ($public ? 'public' : 'private')) === 'private',
'visibility' => $visibility ?? ($public ? 'public' : 'private'),
'has_issues' => $hasIssues,
'has_wiki' => $hasWiki,
'has_downloads' => $hasDownloads,
@@ -264,16 +260,43 @@ class Repo extends AbstractApi
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param string $format one of formats: "raw", "html", or "v3+json"
* @param string $dir The alternate path to look for a README file
* @param array $params additional query params like "ref" to fetch readme for branch/tag
*
* @return string|array the readme content
*/
public function readme($username, $repository, $format = 'raw')
public function readme($username, $repository, $format = 'raw', $dir = null, $params = [])
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme';
if (null !== $dir) {
$path .= '/'.rawurlencode($dir);
}
return $this->get($path, $params, [
'Accept' => "application/vnd.github.$format",
]);
}
/**
* Create a repository dispatch event.
*
* @link https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
*
* @param string $username the user who owns the repository
* @param string $repository the name of the repository
* @param string $eventType A custom webhook event name
*
* @return mixed null on success, array on error with 'message'
*/
public function dispatch($username, $repository, $eventType, array $clientPayload)
{
return $this->post(\sprintf('/repos/%s/%s/dispatches', rawurlencode($username), rawurlencode($repository)), [
'event_type' => $eventType,
'client_payload' => $clientPayload,
]);
}
/**
* Manage the collaborators of a repository.
*
@@ -283,7 +306,7 @@ class Repo extends AbstractApi
*/
public function collaborators()
{
return new Collaborators($this->client);
return new Collaborators($this->getClient());
}
/**
@@ -295,7 +318,7 @@ class Repo extends AbstractApi
*/
public function comments()
{
return new Comments($this->client);
return new Comments($this->getClient());
}
/**
@@ -307,7 +330,71 @@ class Repo extends AbstractApi
*/
public function commits()
{
return new Commits($this->client);
return new Commits($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/checks#check-runs
*/
public function checkRuns(): CheckRuns
{
return new CheckRuns($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/checks#check-suites
*/
public function checkSuites(): CheckSuites
{
return new CheckSuites($this->getClient());
}
/**
* @link https://developer.github.com/v3/actions/artifacts/#artifacts
*/
public function artifacts(): Artifacts
{
return new Artifacts($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflows
*/
public function workflows(): Workflows
{
return new Workflows($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-runs
*/
public function workflowRuns(): WorkflowRuns
{
return new WorkflowRuns($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#workflow-jobs
*/
public function workflowJobs(): WorkflowJobs
{
return new WorkflowJobs($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#self-hosted-runners
*/
public function selfHostedRunners(): SelfHostedRunners
{
return new SelfHostedRunners($this->getClient());
}
/**
* @link https://docs.github.com/en/rest/reference/actions#secrets
*/
public function secrets(): Secrets
{
return new Secrets($this->getClient());
}
/**
@@ -319,7 +406,7 @@ class Repo extends AbstractApi
*/
public function contents()
{
return new Contents($this->client);
return new Contents($this->getClient());
}
/**
@@ -331,7 +418,7 @@ class Repo extends AbstractApi
*/
public function downloads()
{
return new Downloads($this->client);
return new Downloads($this->getClient());
}
/**
@@ -343,7 +430,7 @@ class Repo extends AbstractApi
*/
public function releases()
{
return new Releases($this->client);
return new Releases($this->getClient());
}
/**
@@ -355,7 +442,7 @@ class Repo extends AbstractApi
*/
public function keys()
{
return new DeployKeys($this->client);
return new DeployKeys($this->getClient());
}
/**
@@ -367,7 +454,7 @@ class Repo extends AbstractApi
*/
public function forks()
{
return new Forks($this->client);
return new Forks($this->getClient());
}
/**
@@ -379,7 +466,7 @@ class Repo extends AbstractApi
*/
public function stargazers()
{
return new Stargazers($this->client);
return new Stargazers($this->getClient());
}
/**
@@ -391,7 +478,7 @@ class Repo extends AbstractApi
*/
public function hooks()
{
return new Hooks($this->client);
return new Hooks($this->getClient());
}
/**
@@ -403,7 +490,7 @@ class Repo extends AbstractApi
*/
public function labels()
{
return new Labels($this->client);
return new Labels($this->getClient());
}
/**
@@ -415,7 +502,7 @@ class Repo extends AbstractApi
*/
public function statuses()
{
return new Statuses($this->client);
return new Statuses($this->getClient());
}
/**
@@ -426,17 +513,18 @@ class Repo extends AbstractApi
* @param string $username the username
* @param string $repository the name of the repository
* @param string $branch the name of the branch
* @param array $parameters parameters for the query string
*
* @return array list of the repository branches
*/
public function branches($username, $repository, $branch = null)
public function branches($username, $repository, $branch = null, array $parameters = [])
{
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches';
if (null !== $branch) {
$url .= '/'.rawurlencode($branch);
}
return $this->get($url);
return $this->get($url, $parameters);
}
/**
@@ -448,7 +536,7 @@ class Repo extends AbstractApi
*/
public function protection()
{
return new Protection($this->client);
return new Protection($this->getClient());
}
/**
@@ -516,22 +604,6 @@ class Repo extends AbstractApi
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams');
}
/**
* @deprecated see subscribers method
*
* @param string $username
* @param string $repository
* @param int $page
*
* @return array
*/
public function watchers($username, $repository, $page = 1)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/watchers', [
'page' => $page,
]);
}
/**
* @param string $username
* @param string $repository
@@ -557,7 +629,7 @@ class Repo extends AbstractApi
* @param string $head The head to merge. This can be a branch name or a commit SHA1.
* @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.
*
* @return array|null
* @return array|string
*/
public function merge($username, $repository, $base, $head, $message = null)
{
@@ -576,22 +648,58 @@ class Repo extends AbstractApi
/**
* @param string $username
* @param string $repository
* @param array $parameters
*
* @return array
*/
public function milestones($username, $repository)
public function milestones($username, $repository, array $parameters = [])
{
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones');
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones', $parameters);
}
/**
* @link https://docs.github.com/en/rest/reference/repos#enable-automated-security-fixes
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function enableAutomatedSecurityFixes(string $username, string $repository)
{
$this->acceptHeaderValue = 'application/vnd.github.london-preview+json';
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/automated-security-fixes');
}
/**
* @link https://docs.github.com/en/rest/reference/repos#disable-automated-security-fixes
*
* @param string $username
* @param string $repository
*
* @return array|string
*/
public function disableAutomatedSecurityFixes(string $username, string $repository)
{
$this->acceptHeaderValue = 'application/vnd.github.london-preview+json';
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/automated-security-fixes');
}
public function projects()
{
return new Projects($this->client);
return new Projects($this->getClient());
}
public function traffic()
{
return new Traffic($this->client);
return new Traffic($this->getClient());
}
public function pages()
{
return new Pages($this->getClient());
}
/**
@@ -608,6 +716,24 @@ class Repo extends AbstractApi
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/events', ['page' => $page]);
}
/**
* Get the community profile metrics for a repository.
*
* @link https://developer.github.com/v3/repos/community/#retrieve-community-profile-metrics
*
* @param string $username
* @param string $repository
*
* @return array
*/
public function communityProfile($username, $repository)
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.black-panther-preview+json';
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/profile');
}
/**
* Get the contents of a repository's code of conduct.
*
@@ -677,9 +803,21 @@ class Repo extends AbstractApi
*/
public function transfer($username, $repository, $newOwner, $teamId = [])
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.nightshade-preview+json';
return $this->post('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/transfer', ['new_owner' => $newOwner, 'team_id' => $teamId]);
}
/**
* Create a repository using a template.
*
* @link https://developer.github.com/v3/repos/#create-a-repository-using-a-template
*
* @return array
*/
public function createFromTemplate(string $templateOwner, string $templateRepo, array $parameters = [])
{
//This api is in preview mode, so set the correct accept-header
$this->acceptHeaderValue = 'application/vnd.github.baptiste-preview+json';
return $this->post('/repos/'.rawurldecode($templateOwner).'/'.rawurldecode($templateRepo).'/generate', $parameters);
}
}