diff --git a/src/Service/Resource.php b/src/Service/Resource.php index ecf402b18..4331f21a3 100644 --- a/src/Service/Resource.php +++ b/src/Service/Resource.php @@ -48,6 +48,9 @@ class Resource /** @var string $rootUrl */ private $rootUrl; + /** @var string $apiVersion */ + protected $apiVersion; + /** @var \Google\Client $client */ private $client; @@ -235,6 +238,13 @@ public function call($name, $arguments, $expectedClass = null) return $request; } + // If the class which is extending from this one contains + // an Api Version, add it to the header + if ($this->apiVersion) { + $request = $request + ->withHeaders('X-Goog-Api-Version', $this->apiVersion); + } + return $this->client->execute($request, $expectedClass); }