Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added header for apps #823

Merged
merged 10 commits into from Nov 1, 2019
19 changes: 19 additions & 0 deletions lib/Github/Api/Apps.php
Expand Up @@ -9,6 +9,15 @@
*/
class Apps extends AbstractApi
{
use AcceptHeaderTrait;

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

return $this;
}
AAllport marked this conversation as resolved.
Show resolved Hide resolved

/**
* Create an access token for an installation.
*
Expand All @@ -27,6 +36,8 @@ public function createInstallationToken($installationId, $userId = null)
$parameters['user_id'] = $userId;
}

$this->configure();

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

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

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

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

$this->configure();

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

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

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

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

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