Update dependencies

This commit is contained in:
Jay Trees 2022-01-24 09:08:35 +01:00
parent 65344edc35
commit 592af77d5b
122 changed files with 2547 additions and 2423 deletions

View file

@ -11,6 +11,8 @@ use Github\Exception\MissingArgumentException;
*/
class Deployment extends AbstractApi
{
use AcceptHeaderTrait;
/**
* List deployments for a particular repository.
*
@ -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,6 +105,15 @@ class Deployment extends AbstractApi
throw new MissingArgumentException(['state']);
}
// 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);
}