File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,13 +22,14 @@ class Graphql extends AbstractPackage
2222 /**
2323 * Execute a query against the GraphQL API.
2424 *
25- * @param string $query The query to perform.
25+ * @param string $query The query to perform.
26+ * @param array $variables An optional array of variables to include in the request.
2627 *
2728 * @return string
2829 *
2930 * @since __DEPLOY_VERSION__
3031 */
31- public function execute ($ query )
32+ public function execute ($ query, array $ variables = array () )
3233 {
3334 // Build the request path.
3435 $ path = '/graphql ' ;
@@ -41,6 +42,11 @@ public function execute($query)
4142 'query ' => $ query ,
4243 );
4344
45+ if (!empty ($ variables ))
46+ {
47+ $ data ['variables ' ] = $ variables ;
48+ }
49+
4450 // Send the request.
4551 return $ this ->processResponse (
4652 $ this ->client ->post ($ this ->fetchUrl ($ path ), $ data , $ headers ),
You can’t perform that action at this time.
0 commit comments