From bac1cd8f0d7abf5de00a93fb3817e31be6734b04 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Wed, 27 Sep 2017 16:30:59 +0200 Subject: [PATCH] Add a helper fromFile function to get GraphQL queries from a file --- lib/Github/Api/GraphQL.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Github/Api/GraphQL.php b/lib/Github/Api/GraphQL.php index a71bea4c8ea..eee542f3ad5 100644 --- a/lib/Github/Api/GraphQL.php +++ b/lib/Github/Api/GraphQL.php @@ -32,4 +32,15 @@ public function execute($query, array $variables = array()) return $this->post('/graphql', $params); } + + /** + * @param string $file + * @param array $variables + * + * @return array + */ + public function fromFile($file, array $variables = array()) + { + return $this->execute(file_get_contents($file), $variables); + } }