mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-15 12:22:46 +09:00
Update to laravel 7
This commit is contained in:
114
vendor/knplabs/github-api/lib/Github/Api/Apps.php
vendored
114
vendor/knplabs/github-api/lib/Github/Api/Apps.php
vendored
@@ -9,6 +9,13 @@ namespace Github\Api;
|
||||
*/
|
||||
class Apps extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
private function configurePreviewHeader()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an access token for an installation.
|
||||
*
|
||||
@@ -27,7 +34,9 @@ class Apps extends AbstractApi
|
||||
$parameters['user_id'] = $userId;
|
||||
}
|
||||
|
||||
return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters);
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->post('/app/installations/'.$installationId.'/access_tokens', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,9 +48,90 @@ class Apps extends AbstractApi
|
||||
*/
|
||||
public function findInstallations()
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/app/installations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an installation of the application.
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#get-an-installation
|
||||
*
|
||||
* @param int $installationId An integration installation id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInstallation($installationId)
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/app/installations/'.$installationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an installation of the application for an organization.
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#get-an-organization-installation
|
||||
*
|
||||
* @param string $org An organization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInstallationForOrganization($org)
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/org/'.rawurldecode($org).'/installation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an installation of the application for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#get-a-repository-installation
|
||||
*
|
||||
* @param string $owner the owner of a repository
|
||||
* @param string $repo the name of the repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInstallationForRepo($owner, $repo)
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/repos/'.rawurldecode($owner).'/'.rawurldecode($repo).'/installation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an installation of the application for a user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#get-a-user-installation
|
||||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getInstallationForUser($username)
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/users/'.rawurldecode($username).'/installation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an installation of the application.
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#delete-an-installation
|
||||
*
|
||||
* @param int $installationId An integration installation id
|
||||
*/
|
||||
public function removeInstallation($installationId)
|
||||
{
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
$this->delete('/app/installations/'.$installationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* List repositories that are accessible to the authenticated installation.
|
||||
*
|
||||
@@ -58,6 +148,8 @@ class Apps extends AbstractApi
|
||||
$parameters['user_id'] = $userId;
|
||||
}
|
||||
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->get('/installation/repositories', $parameters);
|
||||
}
|
||||
|
||||
@@ -73,7 +165,9 @@ class Apps extends AbstractApi
|
||||
*/
|
||||
public function addRepository($installationId, $repositoryId)
|
||||
{
|
||||
return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->put('/installations/'.$installationId.'/repositories/'.$repositoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +182,20 @@ class Apps extends AbstractApi
|
||||
*/
|
||||
public function removeRepository($installationId, $repositoryId)
|
||||
{
|
||||
return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
|
||||
$this->configurePreviewHeader();
|
||||
|
||||
return $this->delete('/installations/'.$installationId.'/repositories/'.$repositoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently authenticated app.
|
||||
*
|
||||
* @link https://docs.github.com/en/rest/reference/apps#get-the-authenticated-app
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAuthenticatedApp()
|
||||
{
|
||||
return $this->get('/app');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user