Skip to content

Commit 5071f3e

Browse files
AAllportacrobat
authored andcommitted
Added header for apps (KnpLabs#823)
* 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
1 parent 5096859 commit 5071f3e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/Github/Api/Apps.php

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
*/
1010
class Apps extends AbstractApi
1111
{
12+
use AcceptHeaderTrait;
13+
14+
private function configurePreviewHeader()
15+
{
16+
$this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json';
17+
}
18+
1219
/**
1320
* Create an access token for an installation.
1421
*
@@ -27,6 +34,8 @@ public function createInstallationToken($installationId, $userId = null)
2734
$parameters['user_id'] = $userId;
2835
}
2936

37+
$this->configurePreviewHeader();
38+
3039
return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters);
3140
}
3241

@@ -39,6 +48,8 @@ public function createInstallationToken($installationId, $userId = null)
3948
*/
4049
public function findInstallations()
4150
{
51+
$this->configurePreviewHeader();
52+
4253
return $this->get('/app/installations');
4354
}
4455

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

72+
$this->configurePreviewHeader();
73+
6174
return $this->get('/installation/repositories', $parameters);
6275
}
6376

@@ -73,6 +86,8 @@ public function listRepositories($userId = null)
7386
*/
7487
public function addRepository($installationId, $repositoryId)
7588
{
89+
$this->configurePreviewHeader();
90+
7691
return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
7792
}
7893

@@ -88,6 +103,8 @@ public function addRepository($installationId, $repositoryId)
88103
*/
89104
public function removeRepository($installationId, $repositoryId)
90105
{
106+
$this->configurePreviewHeader();
107+
91108
return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId));
92109
}
93110
}

0 commit comments

Comments
 (0)