mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-18 05:42:41 +09:00
Update to laravel 7
This commit is contained in:
@@ -23,12 +23,12 @@ class Comments extends AbstractApi
|
||||
* @param string|null $bodyType
|
||||
* @param string|null $apiVersion
|
||||
*
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
public function configure($bodyType = null, $apiVersion = null)
|
||||
{
|
||||
if ($apiVersion !== 'squirrel-girl-preview') {
|
||||
$apiVersion = $this->client->getApiVersion();
|
||||
$apiVersion = $this->getApiVersion();
|
||||
}
|
||||
|
||||
if (!in_array($bodyType, ['text', 'html', 'full'])) {
|
||||
@@ -57,7 +57,7 @@ class Comments extends AbstractApi
|
||||
public function all($username, $repository, $pullRequest = null, array $params = [])
|
||||
{
|
||||
if (null !== $pullRequest) {
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments');
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/comments');
|
||||
}
|
||||
|
||||
$parameters = array_merge([
|
||||
@@ -81,7 +81,7 @@ class Comments extends AbstractApi
|
||||
*/
|
||||
public function show($username, $repository, $comment)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ class Comments extends AbstractApi
|
||||
throw new MissingArgumentException(['commit_id', 'path', 'position']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments', $params);
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/comments', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ class Comments extends AbstractApi
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment), $params);
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,6 +148,6 @@ class Comments extends AbstractApi
|
||||
*/
|
||||
public function remove($username, $repository, $comment)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.$comment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class Review extends AbstractApi
|
||||
|
||||
public function configure()
|
||||
{
|
||||
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -37,6 +39,10 @@ class Review extends AbstractApi
|
||||
*/
|
||||
public function all($username, $repository, $pullRequest, array $params = [])
|
||||
{
|
||||
if (!empty($params)) {
|
||||
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.');
|
||||
}
|
||||
|
||||
$parameters = array_merge([
|
||||
'page' => 1,
|
||||
'per_page' => 30,
|
||||
@@ -93,7 +99,7 @@ class Review extends AbstractApi
|
||||
*/
|
||||
public function comments($username, $repository, $pullRequest, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/reviews/'.rawurlencode($id).'/comments');
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/comments');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +177,35 @@ class Review extends AbstractApi
|
||||
}
|
||||
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/dismissals', [
|
||||
'message' => $message,
|
||||
'message' => $message,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a pull request review by the username, repository, pull request number and the review id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#update-a-pull-request-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
* @param string $body a mandatory dismissal message
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function update($username, $repository, $pullRequest, $id, $body)
|
||||
{
|
||||
if (!is_string($body)) {
|
||||
throw new InvalidArgumentException(sprintf('"body" must be a valid string ("%s" given).', gettype($body)));
|
||||
}
|
||||
|
||||
if (empty($body)) {
|
||||
throw new InvalidArgumentException('"body" is mandatory and cannot be empty');
|
||||
}
|
||||
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id, [
|
||||
'body' => $body,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ class ReviewRequest extends AbstractApi
|
||||
|
||||
public function configure()
|
||||
{
|
||||
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -29,6 +31,10 @@ class ReviewRequest extends AbstractApi
|
||||
*/
|
||||
public function all($username, $repository, $pullRequest, array $params = [])
|
||||
{
|
||||
if (!empty($params)) {
|
||||
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "$params" parameter is deprecated, to paginate the results use the "ResultPager" instead.');
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', $params);
|
||||
}
|
||||
|
||||
@@ -39,12 +45,13 @@ class ReviewRequest extends AbstractApi
|
||||
* @param string $repository
|
||||
* @param int $pullRequest
|
||||
* @param array $reviewers
|
||||
* @param array $teamReviewers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function create($username, $repository, $pullRequest, array $reviewers)
|
||||
public function create($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,11 +61,12 @@ class ReviewRequest extends AbstractApi
|
||||
* @param string $repository
|
||||
* @param int $pullRequest
|
||||
* @param array $reviewers
|
||||
* @param array $teamReviewers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function remove($username, $repository, $pullRequest, array $reviewers)
|
||||
public function remove($username, $repository, $pullRequest, array $reviewers = [], array $teamReviewers = [])
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers, 'team_reviewers' => $teamReviewers]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user