Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: pass x-goog-request-params header for streaming calls
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored Feb 7, 2020
1 parent 287b89b commit 983411e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 297 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
**/package-lock.json
.DS_Store
__pycache__
package-lock.json
__pycache__
58 changes: 33 additions & 25 deletions src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ export class RecaptchaEnterpriseServiceV1Beta1Client {
// identifiers to uniquely identify resources within the API.
// Create useful helper objects for these.
this._pathTemplates = {
projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'),
assessmentPathTemplate: new gaxModule.PathTemplate(
'projects/{project}/assessments/{assessment}'
),
keyPathTemplate: new gaxModule.PathTemplate(
'projects/{project}/keys/{key}'
),
projectPathTemplate: new gaxModule.PathTemplate('projects/{project}'),
};

// Some of the methods on this service return "paged" results,
Expand Down Expand Up @@ -901,9 +901,17 @@ export class RecaptchaEnterpriseServiceV1Beta1Client {
*/
listKeysStream(
request?: protosTypes.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest,
options?: gax.CallOptions | {}
options?: gax.CallOptions
): Transform {
request = request || {};
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers[
'x-goog-request-params'
] = gax.routingHeader.fromParams({
parent: request.parent || '',
});
const callSettings = new gax.CallSettings(options);
return this._descriptors.page.listKeys.createStream(
this._innerApiCalls.listKeys as gax.GaxCall,
Expand All @@ -915,29 +923,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client {
// -- Path templates --
// --------------------

/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project: string) {
return this._pathTemplates.projectPathTemplate.render({
project,
});
}

/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName: string) {
return this._pathTemplates.projectPathTemplate.match(projectName).project;
}

/**
* Return a fully-qualified assessment resource name string.
*
Expand Down Expand Up @@ -1012,6 +997,29 @@ export class RecaptchaEnterpriseServiceV1Beta1Client {
return this._pathTemplates.keyPathTemplate.match(keyName).key;
}

/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project: string) {
return this._pathTemplates.projectPathTemplate.render({
project,
});
}

/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName: string) {
return this._pathTemplates.projectPathTemplate.match(projectName).project;
}

/**
* Terminate the GRPC channel and close the client.
*
Expand Down
Loading

0 comments on commit 983411e

Please sign in to comment.