-
Notifications
You must be signed in to change notification settings - Fork 452
fix(Firestore): use x-goog-request-params header #8267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This requires more research, mostly because when calling the I can fix this by supplying the $stream = $firestoreClient->listen([
'headers' => [
'x-goog-request-params' => [
'database=' . $database
]
]
]);But this is non-intuitive and error-prone. With minimal changes to the GAPIC layer, we could make this work by only supplying the "database" option: $stream = $firestoreClient->listen(['database' => $database]);And follow this up by generating a "PHPDoc" explaining the database option's usage, which would hopefully be enough to make this discoverable and implementable by developers: /**
* Listens to changes. This method is only available via gRPC or WebChannel
* (not REST).
*
* @example samples/V1/FirestoreClient/listen.php
*
* @param array $callOptions {
* Optional.
*
+ * @type string $datbase
+ * Set the database of the call, to be added as a routing header
* @type int $timeoutMillis
* Timeout to use for this call.
* }
*
* @return BidiStream
*
* @throws ApiException Thrown if the API call fails.
*/
public function listen(array $callOptions = []): BidiStream
{
+ $requestParamHeaders = [];
+ if (isset($callOptions['database'])) {
+ $requestParamHeaders['database'] = $callOptions['database'];
+ }
+ $requestParams = new \Google\ApiCore\RequestParamsHeaderDescriptor($requestParamHeaders);
+ $callOptions['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $callOptions['headers']) : $requestParams->getHeader();
return $this->startApiCall('Listen', null, $callOptions);
} |
|
LGTM |
…le-cloud-php into firestore-change-headers
listenBIDI streaming method, this is GAPIC only, but this call can still be made by supplying the routing headers manually