Skip to content
Merged
Changes from 6 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
19 changes: 19 additions & 0 deletions lib/Github/Api/Apps.php
Original file line number Diff line number Diff line change
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;
}

/**
* 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));
}
}