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. diff --git a/doc/README.md b/doc/README.md index d6ab57637dd..b1c99e97b22 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,7 +1,10 @@ Navigation ========== -APIs: +v4 API: +* [GraphQL](graphql.md) + +v3 APIs: * [Applications](apps.md) * [Authorizations](authorizations.md) * [Commits](commits.md) @@ -11,6 +14,7 @@ APIs: * [Enterprise](enterprise.md) * [Gists](gists.md) * [Comments](gists/comments.md) +* [GraphQL](graphql.md) * [Issues](issues.md) * [Assignees](issue/assignees.md) * [Comments](issue/comments.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); +``` diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index 90974015463..6a112099e4c 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -5,13 +5,15 @@ /** * 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 { + use AcceptHeaderTrait; + /** * @param string $query * @@ -19,6 +21,7 @@ class GraphQL extends AbstractApi */ public function execute($query) { + $this->acceptHeaderValue = 'application/vnd.github.v4+json'; $params = array( 'query' => $query );