Skip to content

Support v4 API #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 25, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
6 changes: 5 additions & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Navigation
==========

APIs:
v4 API:
* [GraphQL](graphql.md)

v3 APIs:
* [Applications](apps.md)
* [Authorizations](authorizations.md)
* [Commits](commits.md)
Expand All @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions doc/graphql.md
Original file line number Diff line number Diff line change
@@ -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);
```
7 changes: 5 additions & 2 deletions lib/Github/Api/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
/**
* 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 <soy@miguelpiedrafita.com>
*/
class GraphQL extends AbstractApi
{
use AcceptHeaderTrait;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline after the semicolon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


/**
* @param string $query
*
* @return array
*/
public function execute($query)
{
$this->acceptHeaderValue = 'application/vnd.github.v4+json';
$params = array(
'query' => $query
);
Expand Down