From 7ae1983e25f5a85e9757375a79324c02687efc5a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:03:48 -0800 Subject: [PATCH 1/6] changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- protos/protos.json | 146 ++++++++++++++-- src/v1/recaptcha_enterprise_service_client.ts | 160 ++++++++---------- ...tcha_enterprise_service_v1_beta1_client.ts | 160 ++++++++---------- synth.metadata | 4 +- system-test/fixtures/sample/src/index.ts | 11 +- system-test/install.ts | 18 +- 6 files changed, 277 insertions(+), 222 deletions(-) diff --git a/protos/protos.json b/protos/protos.json index 199ef85..3c33b8d 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -31,7 +31,18 @@ "(google.api.http).post": "/v1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -40,7 +51,18 @@ "(google.api.http).post": "/v1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -48,21 +70,43 @@ "options": { "(google.api.http).post": "/v1/{parent=projects/*}/keys", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/keys", + "body": "key" + } + } + ] }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1/{parent=projects/*}/keys" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/keys" + } + } + ] }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/keys/*}" + } + } + ] }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -70,14 +114,29 @@ "options": { "(google.api.http).patch": "/v1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{key.name=projects/*/keys/*}", + "body": "key" + } + } + ] }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/keys/*}" + } + } + ] } } }, @@ -509,7 +568,18 @@ "(google.api.http).post": "/v1beta1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -518,7 +588,18 @@ "(google.api.http).post": "/v1beta1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -526,21 +607,43 @@ "options": { "(google.api.http).post": "/v1beta1/{parent=projects/*}/keys", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*}/keys", + "body": "key" + } + } + ] }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1beta1/{parent=projects/*}/keys" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{parent=projects/*}/keys" + } + } + ] }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1beta1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{name=projects/*/keys/*}" + } + } + ] }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -548,14 +651,29 @@ "options": { "(google.api.http).patch": "/v1beta1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta1/{key.name=projects/*/keys/*}", + "body": "key" + } + } + ] }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1beta1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta1/{name=projects/*/keys/*}" + } + } + ] } } }, diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index 7476f45..6fdef30 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -60,10 +60,8 @@ export class RecaptchaEnterpriseServiceClient { /** * Construct an instance of RecaptchaEnterpriseServiceClient. * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -83,34 +81,44 @@ export class RecaptchaEnterpriseServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. */ + constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. + // Ensure that options include the service address and port. const staticMembers = this .constructor as typeof RecaptchaEnterpriseServiceClient; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; + if (!opts) { + opts = {servicePath, port}; } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); + opts.clientConfig = opts.clientConfig || {}; - // Choose either gRPC or proto-over-HTTP implementation of google-gax. + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the RecaptchaEnterpriseServiceClient constructor. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this + .constructor as typeof RecaptchaEnterpriseServiceClient).scopes; this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -119,11 +127,6 @@ export class RecaptchaEnterpriseServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -265,7 +268,6 @@ export class RecaptchaEnterpriseServiceClient { /** * The DNS address for this API service. - * @returns {string} The DNS address for this service. */ static get servicePath() { return 'recaptchaenterprise.googleapis.com'; @@ -274,7 +276,6 @@ export class RecaptchaEnterpriseServiceClient { /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. - * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'recaptchaenterprise.googleapis.com'; @@ -282,7 +283,6 @@ export class RecaptchaEnterpriseServiceClient { /** * The port for this API service. - * @returns {number} The default port for this service. */ static get port() { return 443; @@ -291,7 +291,6 @@ export class RecaptchaEnterpriseServiceClient { /** * The scopes needed to make gRPC calls for every method defined * in this service. - * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; @@ -301,7 +300,8 @@ export class RecaptchaEnterpriseServiceClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. */ getProjectId( callback?: Callback @@ -364,11 +364,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1.Assessment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createAssessment(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ createAssessment( request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, @@ -466,11 +462,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.annotateAssessment(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, @@ -564,11 +556,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ createKey( request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, @@ -657,11 +645,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ getKey( request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, @@ -752,11 +736,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ updateKey( request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, @@ -845,11 +825,7 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ deleteKey( request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, @@ -945,14 +921,19 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * The client library will perform auto-pagination by default: it will call the API as many + * The client library support auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1.Key} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListKeysRequest]{@link google.cloud.recaptchaenterprise.v1.ListKeysRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1.ListKeysResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. */ listKeys( request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -1000,7 +981,18 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to {@link listKeys}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listKeys} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1016,13 +1008,6 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -1047,9 +1032,10 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Equivalent to `listKeys`, but returns an iterable object. + * Equivalent to {@link listKeys}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1064,18 +1050,7 @@ export class RecaptchaEnterpriseServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listKeysAsync(request); - * for await (const response of iterable) { - * // process response - * } + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -1201,10 +1176,9 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Terminate the gRPC channel and close the client. + * Terminate the GRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index c02a8bf..0f72c7b 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -60,10 +60,8 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * Construct an instance of RecaptchaEnterpriseServiceV1Beta1Client. * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). - * The common options are: + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -83,34 +81,44 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. */ + constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. + // Ensure that options include the service address and port. const staticMembers = this .constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; + if (!opts) { + opts = {servicePath, port}; } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); + opts.clientConfig = opts.clientConfig || {}; - // Choose either gRPC or proto-over-HTTP implementation of google-gax. + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the RecaptchaEnterpriseServiceV1Beta1Client constructor. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this + .constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client).scopes; this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -119,11 +127,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -265,7 +268,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The DNS address for this API service. - * @returns {string} The DNS address for this service. */ static get servicePath() { return 'recaptchaenterprise.googleapis.com'; @@ -274,7 +276,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. - * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'recaptchaenterprise.googleapis.com'; @@ -282,7 +283,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The port for this API service. - * @returns {number} The default port for this service. */ static get port() { return 443; @@ -291,7 +291,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The scopes needed to make gRPC calls for every method defined * in this service. - * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; @@ -301,7 +300,8 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. */ getProjectId( callback?: Callback @@ -364,11 +364,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1beta1.Assessment}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createAssessment(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ createAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, @@ -466,11 +462,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.annotateAssessment(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, @@ -567,11 +559,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.createKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ createKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, @@ -666,11 +654,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ getKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, @@ -767,11 +751,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.updateKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ updateKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, @@ -866,11 +846,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.deleteKey(request); + * The promise has a method named "cancel" which cancels the ongoing API call. */ deleteKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, @@ -969,14 +945,19 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * The client library will perform auto-pagination by default: it will call the API as many + * The client library support auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListKeysRequest]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. */ listKeys( request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1024,7 +1005,18 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * Equivalent to {@link listKeys}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listKeys} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1040,13 +1032,6 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1071,9 +1056,10 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Equivalent to `listKeys`, but returns an iterable object. + * Equivalent to {@link listKeys}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1088,18 +1074,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * const iterable = client.listKeysAsync(request); - * for await (const response of iterable) { - * // process response - * } + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1225,10 +1200,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Terminate the gRPC channel and close the client. + * Terminate the GRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/synth.metadata b/synth.metadata index 7164de1..49c7b73 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-recaptcha-enterprise.git", - "sha": "630d2aa2d0ac82055ce137c874bcf5998e3c4474" + "sha": "3c20aed6c6f2baf15cd6bbe3fdb1dfe2ba8141da" } }, { @@ -96,7 +96,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.41252956", "protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto", "protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto", "protos/protos.d.ts", @@ -104,7 +103,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.3671243477", "src/index.ts", "src/v1/index.ts", "src/v1/recaptcha_enterprise_service_client.ts", diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts index 84f769a..cc5f3b1 100644 --- a/system-test/fixtures/sample/src/index.ts +++ b/system-test/fixtures/sample/src/index.ts @@ -18,17 +18,8 @@ import {RecaptchaEnterpriseServiceClient} from '@google-cloud/recaptcha-enterprise'; -// check that the client class type name can be used -function doStuffWithRecaptchaEnterpriseServiceClient( - client: RecaptchaEnterpriseServiceClient -) { - client.close(); -} - function main() { - // check that the client instance can be created - const recaptchaEnterpriseServiceClient = new RecaptchaEnterpriseServiceClient(); - doStuffWithRecaptchaEnterpriseServiceClient(recaptchaEnterpriseServiceClient); + new RecaptchaEnterpriseServiceClient(); } main(); diff --git a/system-test/install.ts b/system-test/install.ts index 39d90f7..4c1ba3e 100644 --- a/system-test/install.ts +++ b/system-test/install.ts @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play'; import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; -describe('📦 pack-n-play test', () => { - it('TypeScript code', async function () { +describe('typescript consumer tests', () => { + it('should have correct type signature for typescript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), + packageDir: process.cwd(), // path to your module. sample: { - description: 'TypeScript user can use the type definitions', + description: 'typescript based user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.ts' ).toString(), }, }; - await packNTest(options); + await packNTest(options); // will throw upon error. }); - it('JavaScript code', async function () { + it('should have correct type signature for javascript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), + packageDir: process.cwd(), // path to your module. sample: { - description: 'JavaScript user can use the library', + description: 'typescript based user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.js' ).toString(), }, }; - await packNTest(options); + await packNTest(options); // will throw upon error. }); }); From 6d3f6fe918ff938b01fd974ad4b5f3c08457fe0a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:13:00 -0800 Subject: [PATCH 2/6] fix: do not modify options object, use defaultScopes docs: regenerated jsdoc comments with examples build: use gapic-generator-typescript v1.2.1 Note: these change require google-gax "^2.9.2". @alexander-fenster will make sure the google-gax version is bumped across libraries. PiperOrigin-RevId: 341102751 Source-Author: Google APIs Source-Date: Fri Nov 6 12:56:54 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: b759c563bacf9cd15749be4d2bdd276d3f48ee29 Source-Link: https://github.com/googleapis/googleapis/commit/b759c563bacf9cd15749be4d2bdd276d3f48ee29 --- src/v1/recaptcha_enterprise_service_client.ts | 160 ++++++++++-------- ...tcha_enterprise_service_v1_beta1_client.ts | 160 ++++++++++-------- synth.metadata | 4 +- system-test/fixtures/sample/src/index.ts | 11 +- system-test/install.ts | 18 +- 5 files changed, 207 insertions(+), 146 deletions(-) diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index 6fdef30..7476f45 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -60,8 +60,10 @@ export class RecaptchaEnterpriseServiceClient { /** * Construct an instance of RecaptchaEnterpriseServiceClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -81,44 +83,34 @@ export class RecaptchaEnterpriseServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} fallback - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. */ - constructor(opts?: ClientOptions) { - // Ensure that options include the service address and port. + // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RecaptchaEnterpriseServiceClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - if (!opts) { - opts = {servicePath, port}; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the RecaptchaEnterpriseServiceClient constructor. + // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = (this - .constructor as typeof RecaptchaEnterpriseServiceClient).scopes; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -127,6 +119,11 @@ export class RecaptchaEnterpriseServiceClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -268,6 +265,7 @@ export class RecaptchaEnterpriseServiceClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'recaptchaenterprise.googleapis.com'; @@ -276,6 +274,7 @@ export class RecaptchaEnterpriseServiceClient { /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. + * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'recaptchaenterprise.googleapis.com'; @@ -283,6 +282,7 @@ export class RecaptchaEnterpriseServiceClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -291,6 +291,7 @@ export class RecaptchaEnterpriseServiceClient { /** * The scopes needed to make gRPC calls for every method defined * in this service. + * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; @@ -300,8 +301,7 @@ export class RecaptchaEnterpriseServiceClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -364,7 +364,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1.Assessment}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createAssessment(request); */ createAssessment( request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, @@ -462,7 +466,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1.AnnotateAssessmentResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.annotateAssessment(request); */ annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, @@ -556,7 +564,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createKey(request); */ createKey( request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, @@ -645,7 +657,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getKey(request); */ getKey( request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, @@ -736,7 +752,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateKey(request); */ updateKey( request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, @@ -825,7 +845,11 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteKey(request); */ deleteKey( request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, @@ -921,19 +945,14 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1.Key} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListKeysRequest]{@link google.cloud.recaptchaenterprise.v1.ListKeysRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1.ListKeysResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listKeys( request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -981,18 +1000,7 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Equivalent to {@link listKeys}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listKeys} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1008,6 +1016,13 @@ export class RecaptchaEnterpriseServiceClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [Key]{@link google.cloud.recaptchaenterprise.v1.Key} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -1032,10 +1047,9 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Equivalent to {@link listKeys}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listKeys`, but returns an iterable object. * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1050,7 +1064,18 @@ export class RecaptchaEnterpriseServiceClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Key]{@link google.cloud.recaptchaenterprise.v1.Key}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listKeysAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, @@ -1176,9 +1201,10 @@ export class RecaptchaEnterpriseServiceClient { } /** - * Terminate the GRPC channel and close the client. + * Terminate the gRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index 0f72c7b..c02a8bf 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -60,8 +60,10 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * Construct an instance of RecaptchaEnterpriseServiceV1Beta1Client. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -81,44 +83,34 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} fallback - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. */ - constructor(opts?: ClientOptions) { - // Ensure that options include the service address and port. + // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - if (!opts) { - opts = {servicePath, port}; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the RecaptchaEnterpriseServiceV1Beta1Client constructor. + // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = (this - .constructor as typeof RecaptchaEnterpriseServiceV1Beta1Client).scopes; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -127,6 +119,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -268,6 +265,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'recaptchaenterprise.googleapis.com'; @@ -276,6 +274,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. + * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'recaptchaenterprise.googleapis.com'; @@ -283,6 +282,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -291,6 +291,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { /** * The scopes needed to make gRPC calls for every method defined * in this service. + * @returns {string[]} List of default scopes. */ static get scopes() { return ['https://www.googleapis.com/auth/cloud-platform']; @@ -300,8 +301,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -364,7 +364,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Assessment]{@link google.cloud.recaptchaenterprise.v1beta1.Assessment}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createAssessment(request); */ createAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, @@ -462,7 +466,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [AnnotateAssessmentResponse]{@link google.cloud.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.annotateAssessment(request); */ annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, @@ -559,7 +567,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createKey(request); */ createKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, @@ -654,7 +666,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getKey(request); */ getKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, @@ -751,7 +767,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateKey(request); */ updateKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, @@ -846,7 +866,11 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.deleteKey(request); */ deleteKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, @@ -945,19 +969,14 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListKeysRequest]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListKeysResponse]{@link google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listKeys( request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1005,18 +1024,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Equivalent to {@link listKeys}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listKeys} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1032,6 +1040,13 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Stream} * An object stream which emits an object representing [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1056,10 +1071,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Equivalent to {@link listKeys}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listKeys`, but returns an iterable object. * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -1074,7 +1088,18 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Key]{@link google.cloud.recaptchaenterprise.v1beta1.Key}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listKeysAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, @@ -1200,9 +1225,10 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } /** - * Terminate the GRPC channel and close the client. + * Terminate the gRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/synth.metadata b/synth.metadata index 49c7b73..ffe1ebb 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", - "internalRef": "327369997" + "sha": "b759c563bacf9cd15749be4d2bdd276d3f48ee29", + "internalRef": "341102751" } }, { diff --git a/system-test/fixtures/sample/src/index.ts b/system-test/fixtures/sample/src/index.ts index cc5f3b1..84f769a 100644 --- a/system-test/fixtures/sample/src/index.ts +++ b/system-test/fixtures/sample/src/index.ts @@ -18,8 +18,17 @@ import {RecaptchaEnterpriseServiceClient} from '@google-cloud/recaptcha-enterprise'; +// check that the client class type name can be used +function doStuffWithRecaptchaEnterpriseServiceClient( + client: RecaptchaEnterpriseServiceClient +) { + client.close(); +} + function main() { - new RecaptchaEnterpriseServiceClient(); + // check that the client instance can be created + const recaptchaEnterpriseServiceClient = new RecaptchaEnterpriseServiceClient(); + doStuffWithRecaptchaEnterpriseServiceClient(recaptchaEnterpriseServiceClient); } main(); diff --git a/system-test/install.ts b/system-test/install.ts index 4c1ba3e..39d90f7 100644 --- a/system-test/install.ts +++ b/system-test/install.ts @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play'; import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; -describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function () { +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'TypeScript user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.ts' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); - it('should have correct type signature for javascript users', async function () { + it('JavaScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'JavaScript user can use the library', ts: readFileSync( './system-test/fixtures/sample/src/index.js' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); }); From cf99b505f3ac19f0d0f67ab15d7ce4cd72d3d268 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:17:51 -0800 Subject: [PATCH 3/6] fix: better fallback feature detection, jsdoc update Use gapic-generator-typescript v1.2.2. PiperOrigin-RevId: 342778480 Source-Author: Google APIs Source-Date: Mon Nov 16 20:22:00 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: c6b1c72942991b1c605fe56a6041e06a86a9443e Source-Link: https://github.com/googleapis/googleapis/commit/c6b1c72942991b1c605fe56a6041e06a86a9443e --- protos/protos.json | 146 ++---------------- src/v1/recaptcha_enterprise_service_client.ts | 6 +- ...tcha_enterprise_service_v1_beta1_client.ts | 6 +- synth.metadata | 8 +- 4 files changed, 27 insertions(+), 139 deletions(-) diff --git a/protos/protos.json b/protos/protos.json index 3c33b8d..199ef85 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -31,18 +31,7 @@ "(google.api.http).post": "/v1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*}/assessments", - "body": "assessment" - } - }, - { - "(google.api.method_signature)": "parent,assessment" - } - ] + } }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -51,18 +40,7 @@ "(google.api.http).post": "/v1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{name=projects/*/assessments/*}:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,annotation" - } - ] + } }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -70,43 +48,21 @@ "options": { "(google.api.http).post": "/v1/{parent=projects/*}/keys", "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*}/keys", - "body": "key" - } - } - ] + } }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1/{parent=projects/*}/keys" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*}/keys" - } - } - ] + } }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/keys/*}" - } - } - ] + } }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -114,29 +70,14 @@ "options": { "(google.api.http).patch": "/v1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/{key.name=projects/*/keys/*}", - "body": "key" - } - } - ] + } }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/keys/*}" - } - } - ] + } } } }, @@ -568,18 +509,7 @@ "(google.api.http).post": "/v1beta1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1beta1/{parent=projects/*}/assessments", - "body": "assessment" - } - }, - { - "(google.api.method_signature)": "parent,assessment" - } - ] + } }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -588,18 +518,7 @@ "(google.api.http).post": "/v1beta1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1beta1/{name=projects/*/assessments/*}:annotate", - "body": "*" - } - }, - { - "(google.api.method_signature)": "name,annotation" - } - ] + } }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -607,43 +526,21 @@ "options": { "(google.api.http).post": "/v1beta1/{parent=projects/*}/keys", "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1beta1/{parent=projects/*}/keys", - "body": "key" - } - } - ] + } }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1beta1/{parent=projects/*}/keys" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1beta1/{parent=projects/*}/keys" - } - } - ] + } }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1beta1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1beta1/{name=projects/*/keys/*}" - } - } - ] + } }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -651,29 +548,14 @@ "options": { "(google.api.http).patch": "/v1beta1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1beta1/{key.name=projects/*/keys/*}", - "body": "key" - } - } - ] + } }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1beta1/{name=projects/*/keys/*}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1beta1/{name=projects/*/keys/*}" - } - } - ] + } } } }, diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index 7476f45..a48d9a9 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -84,7 +84,7 @@ export class RecaptchaEnterpriseServiceClient { * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. + * Follows the structure of `recaptcha_enterprise_service_client_config.json`. * @param {boolean} fallback - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) @@ -99,7 +99,9 @@ export class RecaptchaEnterpriseServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index c02a8bf..dc9c483 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -84,7 +84,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. + * Follows the structure of `recaptcha_enterprise_service_v1_beta1_client_config.json`. * @param {boolean} fallback - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) @@ -99,7 +99,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. diff --git a/synth.metadata b/synth.metadata index ffe1ebb..7164de1 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-recaptcha-enterprise.git", - "sha": "3c20aed6c6f2baf15cd6bbe3fdb1dfe2ba8141da" + "sha": "630d2aa2d0ac82055ce137c874bcf5998e3c4474" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "b759c563bacf9cd15749be4d2bdd276d3f48ee29", - "internalRef": "341102751" + "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", + "internalRef": "327369997" } }, { @@ -96,6 +96,7 @@ "README.md", "api-extractor.json", "linkinator.config.json", + "package-lock.json.41252956", "protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto", "protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto", "protos/protos.d.ts", @@ -103,6 +104,7 @@ "protos/protos.json", "renovate.json", "samples/README.md", + "samples/package-lock.json.3671243477", "src/index.ts", "src/v1/index.ts", "src/v1/recaptcha_enterprise_service_client.ts", From 6c6c23f9989edad6733f571a165add76714a23cc Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:19:38 -0800 Subject: [PATCH 4/6] fix: linting, updated jsdoc blocks Use gapic-generator-typescript v1.2.3. PiperOrigin-RevId: 342976840 Source-Author: Google APIs Source-Date: Tue Nov 17 17:04:11 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: c979fbeb80d1b940790a69183629d799e4c05b4c Source-Link: https://github.com/googleapis/googleapis/commit/c979fbeb80d1b940790a69183629d799e4c05b4c --- src/v1/recaptcha_enterprise_service_client.ts | 86 ++++++++++--------- ...tcha_enterprise_service_v1_beta1_client.ts | 86 ++++++++++--------- 2 files changed, 92 insertions(+), 80 deletions(-) diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index a48d9a9..6418a2d 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -30,6 +30,11 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1/recaptcha_enterprise_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './recaptcha_enterprise_service_client_config.json'; const version = require('../../../package.json').version; @@ -83,9 +88,9 @@ export class RecaptchaEnterpriseServiceClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * Follows the structure of `recaptcha_enterprise_service_client_config.json`. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -99,6 +104,7 @@ export class RecaptchaEnterpriseServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; + // eslint-disable-next-line no-undef const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); @@ -320,7 +326,7 @@ export class RecaptchaEnterpriseServiceClient { // ------------------- createAssessment( request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IAssessment, @@ -333,7 +339,7 @@ export class RecaptchaEnterpriseServiceClient { >; createAssessment( request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1.IAssessment, | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest @@ -375,7 +381,7 @@ export class RecaptchaEnterpriseServiceClient { createAssessment( request: protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1.IAssessment, | protos.google.cloud.recaptchaenterprise.v1.ICreateAssessmentRequest @@ -401,12 +407,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -421,7 +427,7 @@ export class RecaptchaEnterpriseServiceClient { } annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, @@ -434,7 +440,7 @@ export class RecaptchaEnterpriseServiceClient { >; annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest @@ -477,7 +483,7 @@ export class RecaptchaEnterpriseServiceClient { annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentResponse, | protos.google.cloud.recaptchaenterprise.v1.IAnnotateAssessmentRequest @@ -503,12 +509,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -523,7 +529,7 @@ export class RecaptchaEnterpriseServiceClient { } createKey( request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IKey, @@ -533,7 +539,7 @@ export class RecaptchaEnterpriseServiceClient { >; createKey( request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest @@ -575,7 +581,7 @@ export class RecaptchaEnterpriseServiceClient { createKey( request: protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.ICreateKeyRequest @@ -598,12 +604,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -618,7 +624,7 @@ export class RecaptchaEnterpriseServiceClient { } getKey( request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IKey, @@ -628,7 +634,7 @@ export class RecaptchaEnterpriseServiceClient { >; getKey( request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest @@ -668,7 +674,7 @@ export class RecaptchaEnterpriseServiceClient { getKey( request: protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.IGetKeyRequest @@ -691,12 +697,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -711,7 +717,7 @@ export class RecaptchaEnterpriseServiceClient { } updateKey( request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IKey, @@ -721,7 +727,7 @@ export class RecaptchaEnterpriseServiceClient { >; updateKey( request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest @@ -763,7 +769,7 @@ export class RecaptchaEnterpriseServiceClient { updateKey( request: protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1.IKey, | protos.google.cloud.recaptchaenterprise.v1.IUpdateKeyRequest @@ -786,12 +792,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -806,7 +812,7 @@ export class RecaptchaEnterpriseServiceClient { } deleteKey( request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.protobuf.IEmpty, @@ -816,7 +822,7 @@ export class RecaptchaEnterpriseServiceClient { >; deleteKey( request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.protobuf.IEmpty, | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest @@ -856,7 +862,7 @@ export class RecaptchaEnterpriseServiceClient { deleteKey( request: protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.protobuf.IEmpty, | protos.google.cloud.recaptchaenterprise.v1.IDeleteKeyRequest @@ -879,12 +885,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -900,7 +906,7 @@ export class RecaptchaEnterpriseServiceClient { listKeys( request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1.IKey[], @@ -910,7 +916,7 @@ export class RecaptchaEnterpriseServiceClient { >; listKeys( request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse @@ -959,7 +965,7 @@ export class RecaptchaEnterpriseServiceClient { listKeys( request: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, | protos.google.cloud.recaptchaenterprise.v1.IListKeysResponse @@ -982,12 +988,12 @@ export class RecaptchaEnterpriseServiceClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1028,7 +1034,7 @@ export class RecaptchaEnterpriseServiceClient { */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -1081,7 +1087,7 @@ export class RecaptchaEnterpriseServiceClient { */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index dc9c483..b223a96 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -30,6 +30,11 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1beta1/recaptcha_enterprise_service_v1_beta1_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './recaptcha_enterprise_service_v1_beta1_client_config.json'; const version = require('../../../package.json').version; @@ -83,9 +88,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * Follows the structure of `recaptcha_enterprise_service_v1_beta1_client_config.json`. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -99,6 +104,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; + // eslint-disable-next-line no-undef const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); @@ -320,7 +326,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { // ------------------- createAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, @@ -333,7 +339,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; createAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest @@ -375,7 +381,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { createAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IAssessment, | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateAssessmentRequest @@ -401,12 +407,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -421,7 +427,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, @@ -434,7 +440,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest @@ -477,7 +483,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { annotateAssessment( request: protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentResponse, | protos.google.cloud.recaptchaenterprise.v1beta1.IAnnotateAssessmentRequest @@ -503,12 +509,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -523,7 +529,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } createKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IKey, @@ -536,7 +542,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; createKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest @@ -578,7 +584,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { createKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.ICreateKeyRequest @@ -604,12 +610,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -624,7 +630,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } getKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IKey, @@ -637,7 +643,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; getKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest @@ -677,7 +683,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { getKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.IGetKeyRequest @@ -703,12 +709,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -723,7 +729,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } updateKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IKey, @@ -736,7 +742,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; updateKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest @@ -778,7 +784,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { updateKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.recaptchaenterprise.v1beta1.IKey, | protos.google.cloud.recaptchaenterprise.v1beta1.IUpdateKeyRequest @@ -804,12 +810,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -824,7 +830,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { } deleteKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.protobuf.IEmpty, @@ -837,7 +843,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; deleteKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.protobuf.IEmpty, | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest @@ -877,7 +883,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { deleteKey( request: protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.protobuf.IEmpty, | protos.google.cloud.recaptchaenterprise.v1beta1.IDeleteKeyRequest @@ -903,12 +909,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -924,7 +930,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { listKeys( request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.recaptchaenterprise.v1beta1.IKey[], @@ -934,7 +940,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { >; listKeys( request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse @@ -983,7 +989,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { listKeys( request: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, | protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysResponse @@ -1006,12 +1012,12 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1052,7 +1058,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { */ listKeysStream( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -1105,7 +1111,7 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { */ listKeysAsync( request?: protos.google.cloud.recaptchaenterprise.v1beta1.IListKeysRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; From 51996df9c3dbdb10b3ccde1bbc22a4bc3bc3a1fe Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:22:47 -0800 Subject: [PATCH 5/6] fix: use optional chaining for window.fetch feature detection Use gapic-generator-typescript v1.2.4. Committer: @alexander-fenster PiperOrigin-RevId: 343136730 Source-Author: Google APIs Source-Date: Wed Nov 18 12:49:25 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 2cda8d285b66c14da57363201b7e4efbca47d034 Source-Link: https://github.com/googleapis/googleapis/commit/2cda8d285b66c14da57363201b7e4efbca47d034 --- src/v1/recaptcha_enterprise_service_client.ts | 3 +-- src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index 6418a2d..01d6eec 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -104,10 +104,9 @@ export class RecaptchaEnterpriseServiceClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - // eslint-disable-next-line no-undef const fallback = opts?.fallback ?? - (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index b223a96..f1935ba 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -104,10 +104,9 @@ export class RecaptchaEnterpriseServiceV1Beta1Client { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - // eslint-disable-next-line no-undef const fallback = opts?.fallback ?? - (typeof window !== 'undefined' && typeof window.fetch !== 'undefined'); + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. From dfe55835b120c55c5625fd58fd91a5c3319bc236 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Thu, 19 Nov 2020 01:24:49 -0800 Subject: [PATCH 6/6] fix: mark window as global for linter Use gapic-generator-typescript v1.2.5. Committer: @alexander-fenster PiperOrigin-RevId: 343187793 Source-Author: Google APIs Source-Date: Wed Nov 18 17:10:02 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5587028631d4d743fd906c4eb4e4e4649a7ee5ce Source-Link: https://github.com/googleapis/googleapis/commit/5587028631d4d743fd906c4eb4e4e4649a7ee5ce --- protos/protos.json | 146 ++++++++++++++++-- src/v1/recaptcha_enterprise_service_client.ts | 1 + ...tcha_enterprise_service_v1_beta1_client.ts | 1 + synth.metadata | 8 +- 4 files changed, 137 insertions(+), 19 deletions(-) diff --git a/protos/protos.json b/protos/protos.json index 199ef85..3c33b8d 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -31,7 +31,18 @@ "(google.api.http).post": "/v1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -40,7 +51,18 @@ "(google.api.http).post": "/v1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -48,21 +70,43 @@ "options": { "(google.api.http).post": "/v1/{parent=projects/*}/keys", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/keys", + "body": "key" + } + } + ] }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1/{parent=projects/*}/keys" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/keys" + } + } + ] }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/keys/*}" + } + } + ] }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -70,14 +114,29 @@ "options": { "(google.api.http).patch": "/v1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{key.name=projects/*/keys/*}", + "body": "key" + } + } + ] }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/keys/*}" + } + } + ] } } }, @@ -509,7 +568,18 @@ "(google.api.http).post": "/v1beta1/{parent=projects/*}/assessments", "(google.api.http).body": "assessment", "(google.api.method_signature)": "parent,assessment" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*}/assessments", + "body": "assessment" + } + }, + { + "(google.api.method_signature)": "parent,assessment" + } + ] }, "AnnotateAssessment": { "requestType": "AnnotateAssessmentRequest", @@ -518,7 +588,18 @@ "(google.api.http).post": "/v1beta1/{name=projects/*/assessments/*}:annotate", "(google.api.http).body": "*", "(google.api.method_signature)": "name,annotation" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{name=projects/*/assessments/*}:annotate", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,annotation" + } + ] }, "CreateKey": { "requestType": "CreateKeyRequest", @@ -526,21 +607,43 @@ "options": { "(google.api.http).post": "/v1beta1/{parent=projects/*}/keys", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{parent=projects/*}/keys", + "body": "key" + } + } + ] }, "ListKeys": { "requestType": "ListKeysRequest", "responseType": "ListKeysResponse", "options": { "(google.api.http).get": "/v1beta1/{parent=projects/*}/keys" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{parent=projects/*}/keys" + } + } + ] }, "GetKey": { "requestType": "GetKeyRequest", "responseType": "Key", "options": { "(google.api.http).get": "/v1beta1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta1/{name=projects/*/keys/*}" + } + } + ] }, "UpdateKey": { "requestType": "UpdateKeyRequest", @@ -548,14 +651,29 @@ "options": { "(google.api.http).patch": "/v1beta1/{key.name=projects/*/keys/*}", "(google.api.http).body": "key" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta1/{key.name=projects/*/keys/*}", + "body": "key" + } + } + ] }, "DeleteKey": { "requestType": "DeleteKeyRequest", "responseType": "google.protobuf.Empty", "options": { "(google.api.http).delete": "/v1beta1/{name=projects/*/keys/*}" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta1/{name=projects/*/keys/*}" + } + } + ] } } }, diff --git a/src/v1/recaptcha_enterprise_service_client.ts b/src/v1/recaptcha_enterprise_service_client.ts index 01d6eec..fac4270 100644 --- a/src/v1/recaptcha_enterprise_service_client.ts +++ b/src/v1/recaptcha_enterprise_service_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, diff --git a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts index f1935ba..8e3b770 100644 --- a/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts +++ b/src/v1beta1/recaptcha_enterprise_service_v1_beta1_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, diff --git a/synth.metadata b/synth.metadata index 7164de1..5c370ce 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-recaptcha-enterprise.git", - "sha": "630d2aa2d0ac82055ce137c874bcf5998e3c4474" + "sha": "3c20aed6c6f2baf15cd6bbe3fdb1dfe2ba8141da" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", - "internalRef": "327369997" + "sha": "5587028631d4d743fd906c4eb4e4e4649a7ee5ce", + "internalRef": "343187793" } }, { @@ -96,7 +96,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.41252956", "protos/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto", "protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto", "protos/protos.d.ts", @@ -104,7 +103,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.3671243477", "src/index.ts", "src/v1/index.ts", "src/v1/recaptcha_enterprise_service_client.ts",