-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
39 lines (31 loc) · 1.44 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use rdx\graphqlquery\Query;
require 'autoload.php';
header('Content-type: text/plain; charset=utf-8');
$query = Query::query('TestQueryWithEverything', ['smallPicSize' => 'int']);
$query->defineFragment('userStuff', 'User');
$query->userStuff->fields('id', 'name', 'path');
$query->fields('scope', 'friends', 'viewer');
$query->friends->attribute('names', ['marc', 'jeff']);
$query->friends->fields(['id', 'name', 'smallpic' => 'picture', 'picture']);
$query->friends->smallpic->attribute('size', Query::variable('smallPicSize', 'int'));
$query->friends->picture->alias('bigpic')->attribute('size', 50); // Alias 'picture' to 'bigpic', and add attribute
$query->viewer->fields('...userStuff', 'repos');
$query->viewer->repos
->attribute('public', true)
->attribute('limit', 10)
->attribute('order', ['field' => Query::enum('STARS'), 'direction' => Query::enum('DESC')]);
$query->viewer->repos->fields('id', 'path');
$query->viewer->repos->fragment('PublicRepo')->field('stars', 'popularity');
$query->viewer->repos->fragment('PrivateRepo')->fields(['status', 'popularity' => 'permissions', 'members']);
$query->viewer->repos->PrivateRepo->members->fields('...userStuff');
echo "====\n";
echo $query->build();
echo "====\n";
echo "\n\n";
$query = Query::mutation();
$query->field('moveProjectCard')->attribute('input', ['cardId' => 123, 'columnId' => 456]);
$query->moveProjectCard->fields('clientMutationId');
echo "====\n";
echo $query->build();
echo "====\n";