@google-cloud/discoveryengine 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/protos/protos.d.ts +31 -316
  3. package/build/protos/protos.js +146 -593
  4. package/build/protos/protos.json +25 -1
  5. package/build/src/index.d.ts +1 -1
  6. package/build/src/index.js +1 -21
  7. package/build/src/v1/completion_service_client.d.ts +76 -76
  8. package/build/src/v1/completion_service_client.js +125 -262
  9. package/build/src/v1/control_service_client.d.ts +81 -81
  10. package/build/src/v1/control_service_client.js +96 -132
  11. package/build/src/v1/conversational_search_service_client.d.ts +143 -143
  12. package/build/src/v1/conversational_search_service_client.js +138 -226
  13. package/build/src/v1/data_store_service_client.d.ts +122 -122
  14. package/build/src/v1/data_store_service_client.js +134 -280
  15. package/build/src/v1/document_service_client.d.ts +120 -120
  16. package/build/src/v1/document_service_client.js +143 -300
  17. package/build/src/v1/engine_service_client.d.ts +103 -103
  18. package/build/src/v1/engine_service_client.js +134 -279
  19. package/build/src/v1/grounded_generation_service_client.d.ts +48 -48
  20. package/build/src/v1/grounded_generation_service_client.js +79 -100
  21. package/build/src/v1/project_service_client.d.ts +76 -76
  22. package/build/src/v1/project_service_client.js +108 -222
  23. package/build/src/v1/rank_service_client.d.ts +47 -47
  24. package/build/src/v1/rank_service_client.js +72 -85
  25. package/build/src/v1/recommendation_service_client.d.ts +47 -47
  26. package/build/src/v1/recommendation_service_client.js +70 -82
  27. package/build/src/v1/schema_service_client.d.ts +111 -111
  28. package/build/src/v1/schema_service_client.js +131 -273
  29. package/build/src/v1/search_service_client.d.ts +545 -545
  30. package/build/src/v1/search_service_client.js +90 -113
  31. package/build/src/v1/search_tuning_service_client.d.ts +77 -77
  32. package/build/src/v1/search_tuning_service_client.js +113 -235
  33. package/build/src/v1/serving_config_service_client.d.ts +48 -48
  34. package/build/src/v1/serving_config_service_client.js +69 -80
  35. package/build/src/v1/site_search_engine_service_client.d.ts +148 -148
  36. package/build/src/v1/site_search_engine_service_client.js +179 -378
  37. package/build/src/v1/user_event_service_client.d.ts +77 -77
  38. package/build/src/v1/user_event_service_client.js +121 -253
  39. package/build/src/v1alpha/acl_config_service_client.d.ts +49 -49
  40. package/build/src/v1alpha/acl_config_service_client.js +82 -106
  41. package/build/src/v1alpha/chunk_service_client.d.ts +88 -88
  42. package/build/src/v1alpha/chunk_service_client.js +92 -120
  43. package/build/src/v1alpha/completion_service_client.d.ts +77 -77
  44. package/build/src/v1alpha/completion_service_client.js +134 -280
  45. package/build/src/v1alpha/control_service_client.d.ts +85 -85
  46. package/build/src/v1alpha/control_service_client.js +105 -151
  47. package/build/src/v1alpha/conversational_search_service_client.d.ts +143 -143
  48. package/build/src/v1alpha/conversational_search_service_client.js +145 -237
  49. package/build/src/v1alpha/data_store_service_client.d.ts +126 -126
  50. package/build/src/v1alpha/data_store_service_client.js +151 -316
  51. package/build/src/v1alpha/document_service_client.d.ts +126 -126
  52. package/build/src/v1alpha/document_service_client.js +156 -328
  53. package/build/src/v1alpha/engine_service_client.d.ts +106 -106
  54. package/build/src/v1alpha/engine_service_client.js +155 -325
  55. package/build/src/v1alpha/estimate_billing_service_client.d.ts +76 -76
  56. package/build/src/v1alpha/estimate_billing_service_client.js +118 -243
  57. package/build/src/v1alpha/evaluation_service_client.d.ts +161 -161
  58. package/build/src/v1alpha/evaluation_service_client.js +143 -295
  59. package/build/src/v1alpha/grounded_generation_service_client.d.ts +48 -48
  60. package/build/src/v1alpha/grounded_generation_service_client.js +79 -100
  61. package/build/src/v1alpha/project_service_client.d.ts +78 -78
  62. package/build/src/v1alpha/project_service_client.js +126 -262
  63. package/build/src/v1alpha/rank_service_client.d.ts +47 -47
  64. package/build/src/v1alpha/rank_service_client.js +81 -104
  65. package/build/src/v1alpha/recommendation_service_client.d.ts +47 -47
  66. package/build/src/v1alpha/recommendation_service_client.js +79 -100
  67. package/build/src/v1alpha/sample_query_service_client.d.ts +123 -123
  68. package/build/src/v1alpha/sample_query_service_client.js +144 -301
  69. package/build/src/v1alpha/sample_query_set_service_client.d.ts +94 -94
  70. package/build/src/v1alpha/sample_query_set_service_client.js +106 -153
  71. package/build/src/v1alpha/schema_service_client.d.ts +112 -112
  72. package/build/src/v1alpha/schema_service_client.js +140 -292
  73. package/build/src/v1alpha/search_service_client.d.ts +327 -327
  74. package/build/src/v1alpha/search_service_client.js +88 -112
  75. package/build/src/v1alpha/search_tuning_service_client.d.ts +77 -77
  76. package/build/src/v1alpha/search_tuning_service_client.js +122 -253
  77. package/build/src/v1alpha/serving_config_service_client.d.ts +75 -75
  78. package/build/src/v1alpha/serving_config_service_client.js +97 -133
  79. package/build/src/v1alpha/site_search_engine_service_client.d.ts +151 -151
  80. package/build/src/v1alpha/site_search_engine_service_client.js +184 -387
  81. package/build/src/v1alpha/user_event_service_client.d.ts +78 -78
  82. package/build/src/v1alpha/user_event_service_client.js +130 -271
  83. package/build/src/v1beta/completion_service_client.d.ts +78 -78
  84. package/build/src/v1beta/completion_service_client.js +136 -279
  85. package/build/src/v1beta/control_service_client.d.ts +84 -84
  86. package/build/src/v1beta/control_service_client.js +103 -147
  87. package/build/src/v1beta/conversational_search_service_client.d.ts +142 -142
  88. package/build/src/v1beta/conversational_search_service_client.js +143 -233
  89. package/build/src/v1beta/data_store_service_client.d.ts +124 -124
  90. package/build/src/v1beta/data_store_service_client.js +141 -288
  91. package/build/src/v1beta/document_service_client.d.ts +124 -124
  92. package/build/src/v1beta/document_service_client.js +150 -309
  93. package/build/src/v1beta/engine_service_client.d.ts +106 -106
  94. package/build/src/v1beta/engine_service_client.js +153 -315
  95. package/build/src/v1beta/evaluation_service_client.d.ts +161 -161
  96. package/build/src/v1beta/evaluation_service_client.js +141 -285
  97. package/build/src/v1beta/grounded_generation_service_client.d.ts +49 -49
  98. package/build/src/v1beta/grounded_generation_service_client.js +86 -114
  99. package/build/src/v1beta/project_service_client.d.ts +76 -76
  100. package/build/src/v1beta/project_service_client.js +115 -231
  101. package/build/src/v1beta/rank_service_client.d.ts +47 -47
  102. package/build/src/v1beta/rank_service_client.js +79 -99
  103. package/build/src/v1beta/recommendation_service_client.d.ts +47 -47
  104. package/build/src/v1beta/recommendation_service_client.js +77 -96
  105. package/build/src/v1beta/sample_query_service_client.d.ts +123 -123
  106. package/build/src/v1beta/sample_query_service_client.js +142 -291
  107. package/build/src/v1beta/sample_query_set_service_client.d.ts +94 -94
  108. package/build/src/v1beta/sample_query_set_service_client.js +104 -149
  109. package/build/src/v1beta/schema_service_client.d.ts +111 -111
  110. package/build/src/v1beta/schema_service_client.js +138 -282
  111. package/build/src/v1beta/search_service_client.d.ts +665 -665
  112. package/build/src/v1beta/search_service_client.js +97 -128
  113. package/build/src/v1beta/search_tuning_service_client.d.ts +77 -77
  114. package/build/src/v1beta/search_tuning_service_client.js +120 -243
  115. package/build/src/v1beta/serving_config_service_client.d.ts +75 -75
  116. package/build/src/v1beta/serving_config_service_client.js +95 -129
  117. package/build/src/v1beta/site_search_engine_service_client.d.ts +151 -151
  118. package/build/src/v1beta/site_search_engine_service_client.js +186 -386
  119. package/build/src/v1beta/user_event_service_client.d.ts +78 -78
  120. package/build/src/v1beta/user_event_service_client.js +128 -261
  121. package/package.json +1 -1
@@ -97,26 +97,17 @@ class RankServiceClient {
97
97
  constructor(opts, gaxInstance) {
98
98
  // Ensure that options include all the required fields.
99
99
  const staticMembers = this.constructor;
100
- if (opts?.universe_domain &&
101
- opts?.universeDomain &&
102
- opts?.universe_domain !== opts?.universeDomain) {
100
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
103
101
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
104
102
  }
105
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
- : undefined;
108
- this._universeDomain =
109
- opts?.universeDomain ??
110
- opts?.universe_domain ??
111
- universeDomainEnvVar ??
112
- 'googleapis.com';
103
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
104
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
113
105
  this._servicePath = 'discoveryengine.' + this._universeDomain;
114
106
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
107
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
108
  const port = opts?.port || staticMembers.port;
117
109
  const clientConfig = opts?.clientConfig ?? {};
118
- const fallback = opts?.fallback ??
119
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
110
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
120
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
121
112
  // Request numeric enum values if REST transport is used.
122
113
  opts.numericEnums = true;
@@ -146,7 +137,10 @@ class RankServiceClient {
146
137
  }
147
138
  this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
148
139
  // Determine the client header string.
149
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
140
+ const clientHeader = [
141
+ `gax/${this._gaxModule.version}`,
142
+ `gapic/${version}`,
143
+ ];
150
144
  if (typeof process === 'object' && 'versions' in process) {
151
145
  clientHeader.push(`gl-node/${process.versions.node}`);
152
146
  }
@@ -232,10 +226,10 @@ class RankServiceClient {
232
226
  }
233
227
  // Put together the "service stub" for
234
228
  // google.cloud.discoveryengine.v1.RankService.
235
- this.rankServiceStub = this._gaxGrpc.createStub(this._opts.fallback
236
- ? this._protos.lookupService('google.cloud.discoveryengine.v1.RankService')
237
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
238
- this._protos.google.cloud.discoveryengine.v1.RankService, this._opts, this._providedCustomServicePath);
229
+ this.rankServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
230
+ this._protos.lookupService('google.cloud.discoveryengine.v1.RankService') :
231
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
+ this._protos.google.cloud.discoveryengine.v1.RankService, this._opts, this._providedCustomServicePath);
239
233
  // Iterate over each of the methods that the service provides
240
234
  // and create an API call method for each.
241
235
  const rankServiceStubMethods = ['rank'];
@@ -261,8 +255,7 @@ class RankServiceClient {
261
255
  * @returns {string} The DNS address for this service.
262
256
  */
263
257
  static get servicePath() {
264
- if (typeof process === 'object' &&
265
- typeof process.emitWarning === 'function') {
258
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
266
259
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
267
260
  }
268
261
  return 'discoveryengine.googleapis.com';
@@ -273,8 +266,7 @@ class RankServiceClient {
273
266
  * @returns {string} The DNS address for this service.
274
267
  */
275
268
  static get apiEndpoint() {
276
- if (typeof process === 'object' &&
277
- typeof process.emitWarning === 'function') {
269
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
278
270
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
279
271
  }
280
272
  return 'discoveryengine.googleapis.com';
@@ -302,7 +294,9 @@ class RankServiceClient {
302
294
  * @returns {string[]} List of default scopes.
303
295
  */
304
296
  static get scopes() {
305
- return ['https://www.googleapis.com/auth/cloud-platform'];
297
+ return [
298
+ 'https://www.googleapis.com/auth/cloud-platform'
299
+ ];
306
300
  }
307
301
  /**
308
302
  * Return the project ID used by this class.
@@ -328,13 +322,10 @@ class RankServiceClient {
328
322
  options = options || {};
329
323
  options.otherArgs = options.otherArgs || {};
330
324
  options.otherArgs.headers = options.otherArgs.headers || {};
331
- options.otherArgs.headers['x-goog-request-params'] =
332
- this._gaxModule.routingHeader.fromParams({
333
- ranking_config: request.rankingConfig ?? '',
334
- });
335
- this.initialize().catch(err => {
336
- throw err;
325
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
326
+ 'ranking_config': request.rankingConfig ?? '',
337
327
  });
328
+ this.initialize().catch(err => { throw err; });
338
329
  this._log.info('rank request %j', request);
339
330
  const wrappedCallback = callback
340
331
  ? (error, response, options, rawResponse) => {
@@ -342,65 +333,64 @@ class RankServiceClient {
342
333
  callback(error, response, options, rawResponse); // We verified callback above.
343
334
  }
344
335
  : undefined;
345
- return this.innerApiCalls
346
- .rank(request, options, wrappedCallback)
336
+ return this.innerApiCalls.rank(request, options, wrappedCallback)
347
337
  ?.then(([response, options, rawResponse]) => {
348
338
  this._log.info('rank response %j', response);
349
339
  return [response, options, rawResponse];
350
340
  });
351
341
  }
352
342
  /**
353
- * Gets information about a location.
354
- *
355
- * @param {Object} request
356
- * The request object that will be sent.
357
- * @param {string} request.name
358
- * Resource name for the location.
359
- * @param {object} [options]
360
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
361
- * @returns {Promise} - The promise which resolves to an array.
362
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
363
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
364
- * for more details and examples.
365
- * @example
366
- * ```
367
- * const [response] = await client.getLocation(request);
368
- * ```
369
- */
343
+ * Gets information about a location.
344
+ *
345
+ * @param {Object} request
346
+ * The request object that will be sent.
347
+ * @param {string} request.name
348
+ * Resource name for the location.
349
+ * @param {object} [options]
350
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
351
+ * @returns {Promise} - The promise which resolves to an array.
352
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
353
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
354
+ * for more details and examples.
355
+ * @example
356
+ * ```
357
+ * const [response] = await client.getLocation(request);
358
+ * ```
359
+ */
370
360
  getLocation(request, options, callback) {
371
361
  return this.locationsClient.getLocation(request, options, callback);
372
362
  }
373
363
  /**
374
- * Lists information about the supported locations for this service. Returns an iterable object.
375
- *
376
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
377
- * @param {Object} request
378
- * The request object that will be sent.
379
- * @param {string} request.name
380
- * The resource that owns the locations collection, if applicable.
381
- * @param {string} request.filter
382
- * The standard list filter.
383
- * @param {number} request.pageSize
384
- * The standard list page size.
385
- * @param {string} request.pageToken
386
- * The standard list page token.
387
- * @param {object} [options]
388
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
389
- * @returns {Object}
390
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
391
- * When you iterate the returned iterable, each element will be an object representing
392
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
393
- * so you can stop the iteration when you don't need more results.
394
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
395
- * for more details and examples.
396
- * @example
397
- * ```
398
- * const iterable = client.listLocationsAsync(request);
399
- * for await (const response of iterable) {
400
- * // process response
401
- * }
402
- * ```
403
- */
364
+ * Lists information about the supported locations for this service. Returns an iterable object.
365
+ *
366
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
367
+ * @param {Object} request
368
+ * The request object that will be sent.
369
+ * @param {string} request.name
370
+ * The resource that owns the locations collection, if applicable.
371
+ * @param {string} request.filter
372
+ * The standard list filter.
373
+ * @param {number} request.pageSize
374
+ * The standard list page size.
375
+ * @param {string} request.pageToken
376
+ * The standard list page token.
377
+ * @param {object} [options]
378
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
379
+ * @returns {Object}
380
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
381
+ * When you iterate the returned iterable, each element will be an object representing
382
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
383
+ * so you can stop the iteration when you don't need more results.
384
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
385
+ * for more details and examples.
386
+ * @example
387
+ * ```
388
+ * const iterable = client.listLocationsAsync(request);
389
+ * for await (const response of iterable) {
390
+ * // process response
391
+ * }
392
+ * ```
393
+ */
404
394
  listLocationsAsync(request, options) {
405
395
  return this.locationsClient.listLocationsAsync(request, options);
406
396
  }
@@ -2653,8 +2643,7 @@ class RankServiceClient {
2653
2643
  * @returns {string} A string representing the project.
2654
2644
  */
2655
2645
  matchProjectFromRankingConfigName(rankingConfigName) {
2656
- return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName)
2657
- .project;
2646
+ return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName).project;
2658
2647
  }
2659
2648
  /**
2660
2649
  * Parse the location from RankingConfig resource.
@@ -2664,8 +2653,7 @@ class RankServiceClient {
2664
2653
  * @returns {string} A string representing the location.
2665
2654
  */
2666
2655
  matchLocationFromRankingConfigName(rankingConfigName) {
2667
- return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName)
2668
- .location;
2656
+ return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName).location;
2669
2657
  }
2670
2658
  /**
2671
2659
  * Parse the ranking_config from RankingConfig resource.
@@ -2675,8 +2663,7 @@ class RankServiceClient {
2675
2663
  * @returns {string} A string representing the ranking_config.
2676
2664
  */
2677
2665
  matchRankingConfigFromRankingConfigName(rankingConfigName) {
2678
- return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName)
2679
- .ranking_config;
2666
+ return this.pathTemplates.rankingConfigPathTemplate.match(rankingConfigName).ranking_config;
2680
2667
  }
2681
2668
  /**
2682
2669
  * Terminate the gRPC channel and close the client.
@@ -2690,7 +2677,7 @@ class RankServiceClient {
2690
2677
  this._log.info('ending gRPC channel');
2691
2678
  this._terminated = true;
2692
2679
  stub.close();
2693
- this.locationsClient.close();
2680
+ this.locationsClient.close().catch(err => { throw err; });
2694
2681
  });
2695
2682
  }
2696
2683
  return Promise.resolve();
@@ -253,55 +253,55 @@ export declare class RecommendationServiceClient {
253
253
  recommend(request: protos.google.cloud.discoveryengine.v1.IRecommendRequest, options: CallOptions, callback: Callback<protos.google.cloud.discoveryengine.v1.IRecommendResponse, protos.google.cloud.discoveryengine.v1.IRecommendRequest | null | undefined, {} | null | undefined>): void;
254
254
  recommend(request: protos.google.cloud.discoveryengine.v1.IRecommendRequest, callback: Callback<protos.google.cloud.discoveryengine.v1.IRecommendResponse, protos.google.cloud.discoveryengine.v1.IRecommendRequest | null | undefined, {} | null | undefined>): void;
255
255
  /**
256
- * Gets information about a location.
257
- *
258
- * @param {Object} request
259
- * The request object that will be sent.
260
- * @param {string} request.name
261
- * Resource name for the location.
262
- * @param {object} [options]
263
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
264
- * @returns {Promise} - The promise which resolves to an array.
265
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
266
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
267
- * for more details and examples.
268
- * @example
269
- * ```
270
- * const [response] = await client.getLocation(request);
271
- * ```
272
- */
256
+ * Gets information about a location.
257
+ *
258
+ * @param {Object} request
259
+ * The request object that will be sent.
260
+ * @param {string} request.name
261
+ * Resource name for the location.
262
+ * @param {object} [options]
263
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
264
+ * @returns {Promise} - The promise which resolves to an array.
265
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
266
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
267
+ * for more details and examples.
268
+ * @example
269
+ * ```
270
+ * const [response] = await client.getLocation(request);
271
+ * ```
272
+ */
273
273
  getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;
274
274
  /**
275
- * Lists information about the supported locations for this service. Returns an iterable object.
276
- *
277
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
278
- * @param {Object} request
279
- * The request object that will be sent.
280
- * @param {string} request.name
281
- * The resource that owns the locations collection, if applicable.
282
- * @param {string} request.filter
283
- * The standard list filter.
284
- * @param {number} request.pageSize
285
- * The standard list page size.
286
- * @param {string} request.pageToken
287
- * The standard list page token.
288
- * @param {object} [options]
289
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
290
- * @returns {Object}
291
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
292
- * When you iterate the returned iterable, each element will be an object representing
293
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
294
- * so you can stop the iteration when you don't need more results.
295
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
296
- * for more details and examples.
297
- * @example
298
- * ```
299
- * const iterable = client.listLocationsAsync(request);
300
- * for await (const response of iterable) {
301
- * // process response
302
- * }
303
- * ```
304
- */
275
+ * Lists information about the supported locations for this service. Returns an iterable object.
276
+ *
277
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
278
+ * @param {Object} request
279
+ * The request object that will be sent.
280
+ * @param {string} request.name
281
+ * The resource that owns the locations collection, if applicable.
282
+ * @param {string} request.filter
283
+ * The standard list filter.
284
+ * @param {number} request.pageSize
285
+ * The standard list page size.
286
+ * @param {string} request.pageToken
287
+ * The standard list page token.
288
+ * @param {object} [options]
289
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
290
+ * @returns {Object}
291
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
292
+ * When you iterate the returned iterable, each element will be an object representing
293
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
294
+ * so you can stop the iteration when you don't need more results.
295
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
296
+ * for more details and examples.
297
+ * @example
298
+ * ```
299
+ * const iterable = client.listLocationsAsync(request);
300
+ * for await (const response of iterable) {
301
+ * // process response
302
+ * }
303
+ * ```
304
+ */
305
305
  listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;
306
306
  /**
307
307
  * Return a fully-qualified engine resource name string.
@@ -96,28 +96,18 @@ class RecommendationServiceClient {
96
96
  */
97
97
  constructor(opts, gaxInstance) {
98
98
  // Ensure that options include all the required fields.
99
- const staticMembers = this
100
- .constructor;
101
- if (opts?.universe_domain &&
102
- opts?.universeDomain &&
103
- opts?.universe_domain !== opts?.universeDomain) {
99
+ const staticMembers = this.constructor;
100
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
104
101
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
105
102
  }
106
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
107
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
108
- : undefined;
109
- this._universeDomain =
110
- opts?.universeDomain ??
111
- opts?.universe_domain ??
112
- universeDomainEnvVar ??
113
- 'googleapis.com';
103
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
104
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
114
105
  this._servicePath = 'discoveryengine.' + this._universeDomain;
115
106
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
116
107
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
117
108
  const port = opts?.port || staticMembers.port;
118
109
  const clientConfig = opts?.clientConfig ?? {};
119
- const fallback = opts?.fallback ??
120
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
110
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
121
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
122
112
  // Request numeric enum values if REST transport is used.
123
113
  opts.numericEnums = true;
@@ -147,7 +137,10 @@ class RecommendationServiceClient {
147
137
  }
148
138
  this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
149
139
  // Determine the client header string.
150
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
140
+ const clientHeader = [
141
+ `gax/${this._gaxModule.version}`,
142
+ `gapic/${version}`,
143
+ ];
151
144
  if (typeof process === 'object' && 'versions' in process) {
152
145
  clientHeader.push(`gl-node/${process.versions.node}`);
153
146
  }
@@ -232,11 +225,10 @@ class RecommendationServiceClient {
232
225
  }
233
226
  // Put together the "service stub" for
234
227
  // google.cloud.discoveryengine.v1.RecommendationService.
235
- this.recommendationServiceStub = this._gaxGrpc.createStub(this._opts.fallback
236
- ? this._protos.lookupService('google.cloud.discoveryengine.v1.RecommendationService')
237
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
238
- this._protos.google.cloud.discoveryengine.v1
239
- .RecommendationService, this._opts, this._providedCustomServicePath);
228
+ this.recommendationServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
229
+ this._protos.lookupService('google.cloud.discoveryengine.v1.RecommendationService') :
230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
+ this._protos.google.cloud.discoveryengine.v1.RecommendationService, this._opts, this._providedCustomServicePath);
240
232
  // Iterate over each of the methods that the service provides
241
233
  // and create an API call method for each.
242
234
  const recommendationServiceStubMethods = ['recommend'];
@@ -262,8 +254,7 @@ class RecommendationServiceClient {
262
254
  * @returns {string} The DNS address for this service.
263
255
  */
264
256
  static get servicePath() {
265
- if (typeof process === 'object' &&
266
- typeof process.emitWarning === 'function') {
257
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
267
258
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
268
259
  }
269
260
  return 'discoveryengine.googleapis.com';
@@ -274,8 +265,7 @@ class RecommendationServiceClient {
274
265
  * @returns {string} The DNS address for this service.
275
266
  */
276
267
  static get apiEndpoint() {
277
- if (typeof process === 'object' &&
278
- typeof process.emitWarning === 'function') {
268
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
279
269
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
280
270
  }
281
271
  return 'discoveryengine.googleapis.com';
@@ -303,7 +293,9 @@ class RecommendationServiceClient {
303
293
  * @returns {string[]} List of default scopes.
304
294
  */
305
295
  static get scopes() {
306
- return ['https://www.googleapis.com/auth/cloud-platform'];
296
+ return [
297
+ 'https://www.googleapis.com/auth/cloud-platform'
298
+ ];
307
299
  }
308
300
  /**
309
301
  * Return the project ID used by this class.
@@ -329,13 +321,10 @@ class RecommendationServiceClient {
329
321
  options = options || {};
330
322
  options.otherArgs = options.otherArgs || {};
331
323
  options.otherArgs.headers = options.otherArgs.headers || {};
332
- options.otherArgs.headers['x-goog-request-params'] =
333
- this._gaxModule.routingHeader.fromParams({
334
- serving_config: request.servingConfig ?? '',
335
- });
336
- this.initialize().catch(err => {
337
- throw err;
324
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
325
+ 'serving_config': request.servingConfig ?? '',
338
326
  });
327
+ this.initialize().catch(err => { throw err; });
339
328
  this._log.info('recommend request %j', request);
340
329
  const wrappedCallback = callback
341
330
  ? (error, response, options, rawResponse) => {
@@ -343,65 +332,64 @@ class RecommendationServiceClient {
343
332
  callback(error, response, options, rawResponse); // We verified callback above.
344
333
  }
345
334
  : undefined;
346
- return this.innerApiCalls
347
- .recommend(request, options, wrappedCallback)
335
+ return this.innerApiCalls.recommend(request, options, wrappedCallback)
348
336
  ?.then(([response, options, rawResponse]) => {
349
337
  this._log.info('recommend response %j', response);
350
338
  return [response, options, rawResponse];
351
339
  });
352
340
  }
353
341
  /**
354
- * Gets information about a location.
355
- *
356
- * @param {Object} request
357
- * The request object that will be sent.
358
- * @param {string} request.name
359
- * Resource name for the location.
360
- * @param {object} [options]
361
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
362
- * @returns {Promise} - The promise which resolves to an array.
363
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
364
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
365
- * for more details and examples.
366
- * @example
367
- * ```
368
- * const [response] = await client.getLocation(request);
369
- * ```
370
- */
342
+ * Gets information about a location.
343
+ *
344
+ * @param {Object} request
345
+ * The request object that will be sent.
346
+ * @param {string} request.name
347
+ * Resource name for the location.
348
+ * @param {object} [options]
349
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
350
+ * @returns {Promise} - The promise which resolves to an array.
351
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
352
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
353
+ * for more details and examples.
354
+ * @example
355
+ * ```
356
+ * const [response] = await client.getLocation(request);
357
+ * ```
358
+ */
371
359
  getLocation(request, options, callback) {
372
360
  return this.locationsClient.getLocation(request, options, callback);
373
361
  }
374
362
  /**
375
- * Lists information about the supported locations for this service. Returns an iterable object.
376
- *
377
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
378
- * @param {Object} request
379
- * The request object that will be sent.
380
- * @param {string} request.name
381
- * The resource that owns the locations collection, if applicable.
382
- * @param {string} request.filter
383
- * The standard list filter.
384
- * @param {number} request.pageSize
385
- * The standard list page size.
386
- * @param {string} request.pageToken
387
- * The standard list page token.
388
- * @param {object} [options]
389
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
390
- * @returns {Object}
391
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
392
- * When you iterate the returned iterable, each element will be an object representing
393
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
394
- * so you can stop the iteration when you don't need more results.
395
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
396
- * for more details and examples.
397
- * @example
398
- * ```
399
- * const iterable = client.listLocationsAsync(request);
400
- * for await (const response of iterable) {
401
- * // process response
402
- * }
403
- * ```
404
- */
363
+ * Lists information about the supported locations for this service. Returns an iterable object.
364
+ *
365
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
366
+ * @param {Object} request
367
+ * The request object that will be sent.
368
+ * @param {string} request.name
369
+ * The resource that owns the locations collection, if applicable.
370
+ * @param {string} request.filter
371
+ * The standard list filter.
372
+ * @param {number} request.pageSize
373
+ * The standard list page size.
374
+ * @param {string} request.pageToken
375
+ * The standard list page token.
376
+ * @param {object} [options]
377
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
378
+ * @returns {Object}
379
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
380
+ * When you iterate the returned iterable, each element will be an object representing
381
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
382
+ * so you can stop the iteration when you don't need more results.
383
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
384
+ * for more details and examples.
385
+ * @example
386
+ * ```
387
+ * const iterable = client.listLocationsAsync(request);
388
+ * for await (const response of iterable) {
389
+ * // process response
390
+ * }
391
+ * ```
392
+ */
405
393
  listLocationsAsync(request, options) {
406
394
  return this.locationsClient.listLocationsAsync(request, options);
407
395
  }
@@ -2643,7 +2631,7 @@ class RecommendationServiceClient {
2643
2631
  this._log.info('ending gRPC channel');
2644
2632
  this._terminated = true;
2645
2633
  stub.close();
2646
- this.locationsClient.close();
2634
+ this.locationsClient.close().catch(err => { throw err; });
2647
2635
  });
2648
2636
  }
2649
2637
  return Promise.resolve();