Skip to content

Commit

Permalink
feat: Add the protected apiVersion property
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Apr 22, 2024
1 parent 633d41f commit 4f094af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Service/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class Resource
/** @var string $rootUrl */
private $rootUrl;

/** @var string $apiVersion */
protected $apiVersion;

/** @var \Google\Client $client */
private $client;

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 4f094af

Please sign in to comment.