Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions lib/Github/Api/Apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
*/
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.
*
Expand All @@ -36,8 +29,6 @@ public function createInstallationToken($installationId, $userId = null)
$parameters['user_id'] = $userId;
}

$this->configurePreviewHeader();

return $this->post('/app/installations/'.$installationId.'/access_tokens', $parameters);
}

Expand All @@ -50,8 +41,6 @@ public function createInstallationToken($installationId, $userId = null)
*/
public function findInstallations()
{
$this->configurePreviewHeader();

return $this->get('/app/installations');
}

Expand All @@ -66,8 +55,6 @@ public function findInstallations()
*/
public function getInstallation($installationId)
{
$this->configurePreviewHeader();

return $this->get('/app/installations/'.$installationId);
}

Expand All @@ -82,8 +69,6 @@ public function getInstallation($installationId)
*/
public function getInstallationForOrganization($org)
{
$this->configurePreviewHeader();

return $this->get('/orgs/'.rawurldecode($org).'/installation');
}

Expand All @@ -99,8 +84,6 @@ public function getInstallationForOrganization($org)
*/
public function getInstallationForRepo($owner, $repo)
{
$this->configurePreviewHeader();

return $this->get('/repos/'.rawurldecode($owner).'/'.rawurldecode($repo).'/installation');
}

Expand All @@ -115,8 +98,6 @@ public function getInstallationForRepo($owner, $repo)
*/
public function getInstallationForUser($username)
{
$this->configurePreviewHeader();

return $this->get('/users/'.rawurldecode($username).'/installation');
}

Expand All @@ -129,8 +110,6 @@ public function getInstallationForUser($username)
*/
public function removeInstallation($installationId)
{
$this->configurePreviewHeader();

$this->delete('/app/installations/'.$installationId);
}

Expand All @@ -150,8 +129,6 @@ public function listRepositories($userId = null)
$parameters['user_id'] = $userId;
}

$this->configurePreviewHeader();

return $this->get('/installation/repositories', $parameters);
}

Expand All @@ -167,8 +144,6 @@ public function listRepositories($userId = null)
*/
public function addRepository($installationId, $repositoryId)
{
$this->configurePreviewHeader();

return $this->put('/installations/'.$installationId.'/repositories/'.$repositoryId);
}

Expand All @@ -184,8 +159,6 @@ public function addRepository($installationId, $repositoryId)
*/
public function removeRepository($installationId, $repositoryId)
{
$this->configurePreviewHeader();

return $this->delete('/installations/'.$installationId.'/repositories/'.$repositoryId);
}

Expand Down
6 changes: 0 additions & 6 deletions lib/Github/Api/CurrentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
class CurrentUser extends AbstractApi
{
use AcceptHeaderTrait;

public function show()
{
return $this->get('/user');
Expand Down Expand Up @@ -173,8 +171,6 @@ public function subscriptions()
*/
public function installations(array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';

return $this->get('/user/installations', array_merge(['page' => 1], $params));
}

Expand All @@ -186,8 +182,6 @@ public function installations(array $params = [])
*/
public function repositoriesByInstallation($installationId, array $params = [])
{
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';

return $this->get(sprintf('/user/installations/%s/repositories', $installationId), array_merge(['page' => 1], $params));
}
}
2 changes: 1 addition & 1 deletion lib/Github/Api/CurrentUser/Starring.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Starring extends AbstractApi
public function configure($bodyType = null)
{
if ('star' === $bodyType) {
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.star+json', $this->getApiVersion());
$this->acceptHeaderValue = 'application/vnd.github.star+json';
}

return $this;
Expand Down
11 changes: 0 additions & 11 deletions lib/Github/Api/Deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
class Deployment extends AbstractApi
{
use AcceptHeaderTrait;

/**
* List deployments for a particular repository.
*
Expand Down Expand Up @@ -107,15 +105,6 @@ public function updateStatus($username, $repository, $id, array $params)
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);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/Gist/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function configure($bodyType = null)
$bodyType = 'raw';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s+json', $bodyType);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/Gists.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function configure($bodyType = null)
$bodyType = 'raw';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $this->getApiVersion(), $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s', $bodyType);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/GitData/Blobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Blobs extends AbstractApi
public function configure($bodyType = null)
{
if ('raw' === $bodyType) {
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.raw', $this->getApiVersion());
$this->acceptHeaderValue = 'application/vnd.github.raw';
}

return $this;
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GraphQL extends AbstractApi
*
* @return array
*/
public function execute($query, array $variables = [], string $acceptHeaderValue = 'application/vnd.github.v4+json')
public function execute($query, array $variables = [], string $acceptHeaderValue = 'application/vnd.github+json')
{
$this->acceptHeaderValue = $acceptHeaderValue;
$params = [
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function configure($bodyType = null)
$bodyType = 'raw';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s+json', $bodyType);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/Issue/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function configure($bodyType = null)
$bodyType = 'full';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->getApiVersion(), $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s+json', $bodyType);

return $this;
}
Expand Down
10 changes: 0 additions & 10 deletions lib/Github/Api/Issue/Timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
namespace Github\Api\Issue;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;

class Timeline extends AbstractApi
{
use AcceptHeaderTrait;

public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.mockingbird-preview';

return $this;
}

/**
* Get all events for a specific issue.
*
Expand Down
10 changes: 0 additions & 10 deletions lib/Github/Api/Miscellaneous/CodeOfConduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
namespace Github\Api\Miscellaneous;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;

class CodeOfConduct extends AbstractApi
{
use AcceptHeaderTrait;

public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';

return $this;
}

/**
* List all codes of conduct.
*
Expand Down
17 changes: 0 additions & 17 deletions lib/Github/Api/Project/AbstractProjectApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,9 @@
namespace Github\Api\Project;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;

abstract class AbstractProjectApi extends AbstractApi
{
use AcceptHeaderTrait;

/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* @return $this
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';

return $this;
}

public function show($id, array $params = [])
{
return $this->get('/projects/'.rawurlencode($id), array_merge(['page' => 1], $params));
Expand Down
17 changes: 0 additions & 17 deletions lib/Github/Api/Project/Cards.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@
namespace Github\Api\Project;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;

class Cards extends AbstractApi
{
use AcceptHeaderTrait;

/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* @return $this
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';

return $this;
}

public function all($columnId, array $params = [])
{
return $this->get('/projects/columns/'.rawurlencode($columnId).'/cards', array_merge(['page' => 1], $params));
Expand Down
17 changes: 0 additions & 17 deletions lib/Github/Api/Project/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@
namespace Github\Api\Project;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\MissingArgumentException;

class Columns extends AbstractApi
{
use AcceptHeaderTrait;

/**
* Configure the accept header for Early Access to the projects api.
*
* @see https://developer.github.com/v3/repos/projects/#projects
*
* return self
*/
public function configure()
{
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';

return $this;
}

public function all($projectId, array $params = [])
{
return $this->get('/projects/'.rawurlencode($projectId).'/columns', array_merge(['page' => 1], $params));
Expand Down
6 changes: 1 addition & 5 deletions lib/Github/Api/PullRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class PullRequest extends AbstractApi
*/
public function configure($bodyType = null, $apiVersion = null)
{
if (null === $apiVersion) {
$apiVersion = $this->getApiVersion();
}

if (!in_array($bodyType, ['text', 'html', 'full', 'diff', 'patch'])) {
$bodyType = 'raw';
}
Expand All @@ -43,7 +39,7 @@ public function configure($bodyType = null, $apiVersion = null)
$bodyType .= '+json';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $apiVersion, $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s', $bodyType);

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Github/Api/PullRequest/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function configure($bodyType = null, $apiVersion = null)
$bodyType = 'raw';
}

$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $apiVersion, $bodyType);
$this->acceptHeaderValue = sprintf('application/vnd.github.%s+json', $bodyType);

return $this;
}
Expand Down
10 changes: 0 additions & 10 deletions lib/Github/Api/PullRequest/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Github\Api\PullRequest;

use Github\Api\AbstractApi;
use Github\Api\AcceptHeaderTrait;
use Github\Exception\InvalidArgumentException;
use Github\Exception\MissingArgumentException;

Expand All @@ -16,15 +15,6 @@
*/
class Review extends AbstractApi
{
use AcceptHeaderTrait;

public function configure()
{
trigger_deprecation('KnpLabs/php-github-api', '3.2', 'The "%s" is deprecated and will be removed.', __METHOD__);

return $this;
}

/**
* Get a listing of a pull request's reviews by the username, repository and pull request number.
*
Expand Down
Loading
Loading