Skip to content

Commit 6a9e6fb

Browse files
authored
Merge pull request #593 from m1guelpf/patch-2
Support v4 API
2 parents 1d56183 + 9631d2a commit 6a9e6fb

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ For old version please check:
1313

1414
A simple Object Oriented wrapper for GitHub API, written with PHP5.
1515

16-
Uses [GitHub API v3](http://developer.github.com/v3/). The object API is very similar to the RESTful API.
16+
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.
1717

1818
## Features
1919

@@ -114,5 +114,6 @@ See the [`doc` directory](doc/) for more detailed documentation.
114114
- Thanks to [Rolf van de Krol](http://github.com/rolfvandekrol) for his countless contributions.
115115
- Thanks to [Nicolas Pastorino](http://github.com/jeanvoye) for his contribution on the Pull Request API.
116116
- Thanks to [Edoardo Rivello](http://github.com/erivello) for his contribution on the Gists API.
117+
- Thanks to [Miguel Piedrafita](https://github.com/m1guelpf) for his contribution to the v4 & Apps API.
117118

118119
Thanks to GitHub for the high quality API and documentation.

doc/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
Navigation
22
==========
33

4-
APIs:
4+
v4 API:
5+
* [GraphQL](graphql.md)
6+
7+
v3 APIs:
58
* [Applications](apps.md)
69
* [Authorizations](authorizations.md)
710
* [Commits](commits.md)
@@ -11,6 +14,7 @@ APIs:
1114
* [Enterprise](enterprise.md)
1215
* [Gists](gists.md)
1316
* [Comments](gists/comments.md)
17+
* [GraphQL](graphql.md)
1418
* [Issues](issues.md)
1519
* [Assignees](issue/assignees.md)
1620
* [Comments](issue/comments.md)

doc/graphql.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## GraphQL API
2+
[Back to the navigation](README.md)
3+
4+
Wraps [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/).
5+
6+
#### Execute a query
7+
8+
```php
9+
$rateLimits = $client->api('graphql')->execute($query);
10+
```

lib/Github/Api/GraphQL.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@
55
/**
66
* GraphQL API.
77
*
8-
* Part of the Github API Early-Access Program
8+
* Part of the Github v4 API
99
*
10-
* @link https://developer.github.com/early-access/graphql/
10+
* @link https://developer.github.com/v4/
1111
* @author Miguel Piedrafita <soy@miguelpiedrafita.com>
1212
*/
1313
class GraphQL extends AbstractApi
1414
{
15+
use AcceptHeaderTrait;
16+
1517
/**
1618
* @param string $query
1719
*
1820
* @return array
1921
*/
2022
public function execute($query)
2123
{
24+
$this->acceptHeaderValue = 'application/vnd.github.v4+json';
2225
$params = array(
2326
'query' => $query
2427
);

0 commit comments

Comments
 (0)