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

@@ -11,6 +11,8 @@ use Github\Exception\MissingArgumentException;
*/
class Deployment extends AbstractApi
{
use AcceptHeaderTrait;
/**
* List deployments for a particular repository.
*
@@ -38,7 +40,7 @@ class Deployment extends AbstractApi
*/
public function show($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id));
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id);
}
/**
@@ -66,6 +68,21 @@ class Deployment extends AbstractApi
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params);
}
/**
* Delete a deployment for the given username and repo.
*
* @link https://docs.github.com/en/rest/reference/repos#delete-a-deployment
*
* Important: Deployments can only be deleted when in inactive state
* @see updateStatus
*
* @return mixed null on success, array on error with 'message'
*/
public function remove(string $username, string $repository, int $id)
{
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id);
}
/**
* Updates a deployment by creating a new status update.
*
@@ -76,7 +93,7 @@ class Deployment extends AbstractApi
* @param int $id the deployment number
* @param array $params The information about the deployment update.
* Must include a "state" field of pending, success, error, or failure.
* May also be given a target_url and description, ßee link for more details.
* May also be given a target_url and description, see link for more details.
*
* @throws MissingArgumentException
*
@@ -88,7 +105,16 @@ class Deployment extends AbstractApi
throw new MissingArgumentException(['state']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params);
// adjust media-type per github docs
// https://docs.github.com/en/rest/reference/repos#create-a-deployment-status
if ($params['state'] === 'inactive') {
$this->acceptHeaderValue = 'application/vnd.github.ant-man-preview+json';
}
if ($params['state'] === 'in_progress' || $params['state'] === 'queued') {
$this->acceptHeaderValue = 'application/vnd.github.flash-preview+json';
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses', $params);
}
/**
@@ -102,6 +128,6 @@ class Deployment extends AbstractApi
*/
public function getStatuses($username, $repository, $id)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses');
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.$id.'/statuses');
}
}