From 78c873269485987d065c32e0c18e93230b888551 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 16:30:13 +0200 Subject: [PATCH 1/9] GraphQL Out of Beta --- lib/Github/Api/GraphQL.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index 90974015463..448c59846b5 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -5,9 +5,9 @@ /** * GraphQL API. * - * Part of the Github API Early-Access Program + * Part of the Github v4 API * - * @link https://developer.github.com/early-access/graphql/ + * @link https://developer.github.com/v4/ * @author Miguel Piedrafita */ class GraphQL extends AbstractApi From 56814d0ea43a3bb157a74b52f22ee5f5e2942dd5 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 16:33:43 +0200 Subject: [PATCH 2/9] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ccdbdb0965..ab28d5dabb0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For old version please check: A simple Object Oriented wrapper for GitHub API, written with PHP5. -Uses [GitHub API v3](http://developer.github.com/v3/). The object API is very similar to the RESTful API. +Uses [GitHub API v3](http://developer.github.com/v3/) & supports [GitHub API v4](http://developer.github.com/v4). The object API (v3) is very similar to the RESTful API. ## Features @@ -114,5 +114,6 @@ See the [`doc` directory](doc/) for more detailed documentation. - Thanks to [Rolf van de Krol](http://github.com/rolfvandekrol) for his countless contributions. - Thanks to [Nicolas Pastorino](http://github.com/jeanvoye) for his contribution on the Pull Request API. - Thanks to [Edoardo Rivello](http://github.com/erivello) for his contribution on the Gists API. +- Thanks to [Miguel Piedrafita](https://github.com/m1guelpf) for his contribution to the v4 & Apps API. Thanks to GitHub for the high quality API and documentation. From 8b686a46b91d1c601747d19f055058444338ddcc Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 18:23:55 +0200 Subject: [PATCH 3/9] Add GraphQL to docs index --- doc/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index ebc64840d37..e961752f881 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,7 +1,10 @@ Navigation ========== -APIs: +v4 API: +* [GraphQL](graphql.md) + +v3 APIs: * [Authorizations](authorizations.md) * [Commits](commits.md) * Current User @@ -10,6 +13,7 @@ APIs: * [Enterprise](enterprise.md) * [Gists](gists.md) * [Comments](gists/comments.md) +* [GraphQL](graphql.md) * [Integrations](integrations.md) * [Issues](issues.md) * [Assignees](issue/assignees.md) From 26121e46f7daa14545a4d0f9a69d88050446a0d1 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 18:26:28 +0200 Subject: [PATCH 4/9] Add GraphQL Docs --- doc/graphql.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/graphql.md diff --git a/doc/graphql.md b/doc/graphql.md new file mode 100644 index 00000000000..85def0f556b --- /dev/null +++ b/doc/graphql.md @@ -0,0 +1,10 @@ +## GraphQL API +[Back to the navigation](README.md) + +Wraps [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/). + +#### Execute a query + +```php +$rateLimits = $client->api('graphql')->execute($query); +``` From 5f4b52497042cffabb08940cdccb35d1f0a93581 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 19:10:59 +0200 Subject: [PATCH 5/9] Set header to accept v4 API --- lib/Github/Api/GraphQL.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index 448c59846b5..d7ae1367348 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -2,6 +2,7 @@ namespace Github\Api; +use AcceptHeaderTrait; /** * GraphQL API. * @@ -12,6 +13,7 @@ */ class GraphQL extends AbstractApi { + use AcceptHeaderTrait; /** * @param string $query * @@ -19,6 +21,7 @@ class GraphQL extends AbstractApi */ public function execute($query) { + $this->acceptHeader = 'application/vnd.github.v4+json'; $params = array( 'query' => $query ); From 5f0660408970a7b62bd2d36cb1539317f4ec7b3c Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 22 May 2017 19:12:19 +0200 Subject: [PATCH 6/9] StyleCI --- lib/Github/Api/GraphQL.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index d7ae1367348..b6e4ca6e95b 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -3,6 +3,7 @@ namespace Github\Api; use AcceptHeaderTrait; + /** * GraphQL API. * @@ -21,7 +22,7 @@ class GraphQL extends AbstractApi */ public function execute($query) { - $this->acceptHeader = 'application/vnd.github.v4+json'; + $this->acceptHeader = 'application/vnd.github.v4+json'; $params = array( 'query' => $query ); From 849899e8331d10db711d3c3455576f3ab01b35b6 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 23 May 2017 09:38:20 +0200 Subject: [PATCH 7/9] cs --- lib/Github/Api/GraphQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index b6e4ca6e95b..ca60aa70276 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -22,7 +22,7 @@ class GraphQL extends AbstractApi */ public function execute($query) { - $this->acceptHeader = 'application/vnd.github.v4+json'; + $this->acceptHeaderValue = 'application/vnd.github.v4+json'; $params = array( 'query' => $query ); From 08d95b474ab952e08ab5b0857d836c008221c55d Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 23 May 2017 22:00:42 +0200 Subject: [PATCH 8/9] Remove unused code --- lib/Github/Api/GraphQL.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index ca60aa70276..f1c0334a29a 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -2,8 +2,6 @@ namespace Github\Api; -use AcceptHeaderTrait; - /** * GraphQL API. * From 9631d2a87402568963e540c62cb222530cc1c5e1 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 24 May 2017 08:30:16 +0200 Subject: [PATCH 9/9] cs --- lib/Github/Api/GraphQL.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index f1c0334a29a..6a112099e4c 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -13,6 +13,7 @@ class GraphQL extends AbstractApi { use AcceptHeaderTrait; + /** * @param string $query *