Skip to content

Commit

Permalink
Added header for apps (#823)
Browse files Browse the repository at this point in the history
* Added header for apps

* Removed blank line

* Made config calls private

* 😑 StyleCI

* Made configure public to pass tests

* Style

* Function rename and made final

* Update lib/Github/Api/Apps.php
  • Loading branch information
AAllport authored and acrobat committed Nov 1, 2019
1 parent 5096859 commit 5071f3e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Github/Api/Apps.php
Expand Up @@ -9,6 +9,13 @@
*/
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 @@ -27,6 +34,8 @@ public function createInstallationToken($installationId, $userId = null)
$parameters['user_id'] = $userId;
}

$this->configurePreviewHeader();

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

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

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

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

$this->configurePreviewHeader();

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

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

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

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

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

0 comments on commit 5071f3e

Please sign in to comment.