From 21feb10975cfb82879402fb6452c6c792dae55df Mon Sep 17 00:00:00 2001 From: Niels Theen Date: Fri, 6 Nov 2020 00:32:30 +0100 Subject: [PATCH] Adding GitHub authentication to GraphQL documentation --- doc/graphql.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/graphql.md b/doc/graphql.md index 89080b24227..4151012342c 100644 --- a/doc/graphql.md +++ b/doc/graphql.md @@ -9,6 +9,16 @@ Wraps [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/). $rateLimits = $client->api('graphql')->execute($query); ``` +#### Authentication + +To use [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/) requests must [authenticated]((../security.md)). + +```php +$client->authenticate($token, null, Github\Client::AUTH_ACCESS_TOKEN); + +$result = $client->api('graphql')->execute($query); +``` + #### Use variables [Variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) allow specifying of requested data without dynamical change of a query on a client side. @@ -28,5 +38,7 @@ $variables = [ 'organizationLogin' => 'KnpLabs' ]; +$client->authenticate('', null, Github\Client::AUTH_ACCESS_TOKEN); + $orgInfo = $client->api('graphql')->execute($query, $variables); -``` \ No newline at end of file +```