From 6f4806846346f0aa3ba8b9f274a39b75116874dc Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Thu, 31 Oct 2019 15:58:49 +0000 Subject: [PATCH 1/8] Added header for apps --- lib/Github/Api/Apps.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 1467d2aaf43..89bad3ede4c 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -9,6 +9,16 @@ */ 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. * From 3e4447959a746a99fb8ba485c0ad616a9ba7e43d Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Thu, 31 Oct 2019 16:18:40 +0000 Subject: [PATCH 2/8] Removed blank line --- lib/Github/Api/Apps.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 89bad3ede4c..37f649f71e1 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -18,7 +18,6 @@ public function configure() return $this; } - /** * Create an access token for an installation. * From 6b10eda53e378c1bbdc52c6a0a06e0cfcc721569 Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 15:52:30 +0000 Subject: [PATCH 3/8] Made config calls private --- lib/Github/Api/Apps.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 37f649f71e1..36c5c7862e1 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -11,11 +11,9 @@ class Apps extends AbstractApi { use AcceptHeaderTrait; - public function configure() + private function configure() { $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; - - return $this; } /** @@ -36,6 +34,7 @@ public function createInstallationToken($installationId, $userId = null) $parameters['user_id'] = $userId; } + $this->configure(); return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters); } @@ -48,6 +47,7 @@ public function createInstallationToken($installationId, $userId = null) */ public function findInstallations() { + $this->configure(); return $this->get('/app/installations'); } @@ -67,6 +67,7 @@ public function listRepositories($userId = null) $parameters['user_id'] = $userId; } + $this->configure(); return $this->get('/installation/repositories', $parameters); } @@ -82,6 +83,7 @@ public function listRepositories($userId = null) */ public function addRepository($installationId, $repositoryId) { + $this->configure(); return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } @@ -97,6 +99,7 @@ public function addRepository($installationId, $repositoryId) */ public function removeRepository($installationId, $repositoryId) { + $this->configure(); return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } } From 24e14b5befd0bb7242373da4e78d48bc564e19d5 Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 15:53:35 +0000 Subject: [PATCH 4/8] :expressionless: StyleCI --- lib/Github/Api/Apps.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 36c5c7862e1..4b4b8c35ec7 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -35,6 +35,7 @@ public function createInstallationToken($installationId, $userId = null) } $this->configure(); + return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters); } @@ -48,6 +49,7 @@ public function createInstallationToken($installationId, $userId = null) public function findInstallations() { $this->configure(); + return $this->get('/app/installations'); } @@ -68,6 +70,7 @@ public function listRepositories($userId = null) } $this->configure(); + return $this->get('/installation/repositories', $parameters); } @@ -84,6 +87,7 @@ public function listRepositories($userId = null) public function addRepository($installationId, $repositoryId) { $this->configure(); + return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } @@ -100,6 +104,7 @@ public function addRepository($installationId, $repositoryId) public function removeRepository($installationId, $repositoryId) { $this->configure(); + return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } } From fcb5354f751b688fb639062524e0a5d9d0e77a4c Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 15:56:33 +0000 Subject: [PATCH 5/8] Made configure public to pass tests --- lib/Github/Api/Apps.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 4b4b8c35ec7..c02d98ad93a 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -11,9 +11,11 @@ class Apps extends AbstractApi { use AcceptHeaderTrait; - private function configure() + public function configure() { $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; + + return $this; } /** From a45e652d775a9b58a9f4af9433c1b6970f3b1a9d Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 15:57:13 +0000 Subject: [PATCH 6/8] Style --- lib/Github/Api/Apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index c02d98ad93a..6b5ebc7fb1c 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -14,7 +14,7 @@ class Apps extends AbstractApi public function configure() { $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; - + return $this; } From 31b69eaed78267dd1930412c30cdb7bd0184e74a Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 21:34:50 +0000 Subject: [PATCH 7/8] Function rename and made final --- lib/Github/Api/Apps.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index 6b5ebc7fb1c..f3aaf048c6a 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -11,11 +11,9 @@ class Apps extends AbstractApi { use AcceptHeaderTrait; - public function configure() + final public function configurePreviewHeader() { $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; - - return $this; } /** @@ -36,7 +34,7 @@ public function createInstallationToken($installationId, $userId = null) $parameters['user_id'] = $userId; } - $this->configure(); + $this->configurePreviewHeader(); return $this->post('/app/installations/'.rawurlencode($installationId).'/access_tokens', $parameters); } @@ -50,7 +48,7 @@ public function createInstallationToken($installationId, $userId = null) */ public function findInstallations() { - $this->configure(); + $this->configurePreviewHeader(); return $this->get('/app/installations'); } @@ -71,7 +69,7 @@ public function listRepositories($userId = null) $parameters['user_id'] = $userId; } - $this->configure(); + $this->configurePreviewHeader(); return $this->get('/installation/repositories', $parameters); } @@ -88,7 +86,7 @@ public function listRepositories($userId = null) */ public function addRepository($installationId, $repositoryId) { - $this->configure(); + $this->configurePreviewHeader(); return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } @@ -105,7 +103,7 @@ public function addRepository($installationId, $repositoryId) */ public function removeRepository($installationId, $repositoryId) { - $this->configure(); + $this->configurePreviewHeader(); return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); } From 12f9fcf10bc83b757fd9bff9fa290195a55bc8d1 Mon Sep 17 00:00:00 2001 From: Adam Allport Date: Fri, 1 Nov 2019 21:52:40 +0000 Subject: [PATCH 8/8] Update lib/Github/Api/Apps.php --- lib/Github/Api/Apps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Apps.php b/lib/Github/Api/Apps.php index f3aaf048c6a..feaddb9d9cc 100644 --- a/lib/Github/Api/Apps.php +++ b/lib/Github/Api/Apps.php @@ -11,7 +11,7 @@ class Apps extends AbstractApi { use AcceptHeaderTrait; - final public function configurePreviewHeader() + private function configurePreviewHeader() { $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; }