@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
@@ -98,26 +98,17 @@ class CompletionServiceClient {
98
98
  constructor(opts, gaxInstance) {
99
99
  // Ensure that options include all the required fields.
100
100
  const staticMembers = this.constructor;
101
- if (opts?.universe_domain &&
102
- opts?.universeDomain &&
103
- opts?.universe_domain !== opts?.universeDomain) {
101
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
104
102
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
105
103
  }
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';
104
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
105
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
114
106
  this._servicePath = 'discoveryengine.' + this._universeDomain;
115
107
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
116
108
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
117
109
  const port = opts?.port || staticMembers.port;
118
110
  const clientConfig = opts?.clientConfig ?? {};
119
- const fallback = opts?.fallback ??
120
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
111
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
121
112
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
122
113
  // Request numeric enum values if REST transport is used.
123
114
  opts.numericEnums = true;
@@ -147,7 +138,10 @@ class CompletionServiceClient {
147
138
  }
148
139
  this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
149
140
  // Determine the client header string.
150
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
141
+ const clientHeader = [
142
+ `gax/${this._gaxModule.version}`,
143
+ `gapic/${version}`,
144
+ ];
151
145
  if (typeof process === 'object' && 'versions' in process) {
152
146
  clientHeader.push(`gl-node/${process.versions.node}`);
153
147
  }
@@ -211,121 +205,16 @@ class CompletionServiceClient {
211
205
  // rather than holding a request open.
212
206
  const lroOptions = {
213
207
  auth: this.auth,
214
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
208
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
215
209
  };
216
210
  if (opts.fallback) {
217
211
  lroOptions.protoJson = protoFilesRoot;
218
- lroOptions.httpRules = [
219
- {
220
- selector: 'google.longrunning.Operations.CancelOperation',
221
- post: '/v1/{name=projects/*/operations/*}:cancel',
222
- body: '*',
223
- additional_bindings: [
224
- {
225
- post: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel',
226
- body: '*',
227
- },
228
- {
229
- post: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel',
230
- body: '*',
231
- },
232
- ],
233
- },
234
- {
235
- selector: 'google.longrunning.Operations.GetOperation',
236
- get: '/v1/{name=projects/*/operations/*}',
237
- additional_bindings: [
238
- {
239
- get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}',
240
- },
241
- {
242
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}',
243
- },
244
- {
245
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}',
246
- },
247
- {
248
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}',
249
- },
250
- {
251
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}',
252
- },
253
- {
254
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}',
255
- },
256
- {
257
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}',
258
- },
259
- {
260
- get: '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}',
261
- },
262
- {
263
- get: '/v1/{name=projects/*/locations/*/collections/*/operations/*}',
264
- },
265
- {
266
- get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}',
267
- },
268
- {
269
- get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}',
270
- },
271
- {
272
- get: '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}',
273
- },
274
- {
275
- get: '/v1/{name=projects/*/locations/*/identityMappingStores/*/operations/*}',
276
- },
277
- { get: '/v1/{name=projects/*/locations/*/operations/*}' },
278
- { get: '/v1/{name=projects/*/operations/*}' },
279
- ],
280
- },
281
- {
282
- selector: 'google.longrunning.Operations.ListOperations',
283
- get: '/v1/{name=projects/*}/operations',
284
- additional_bindings: [
285
- {
286
- get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations',
287
- },
288
- {
289
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations',
290
- },
291
- {
292
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations',
293
- },
294
- {
295
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations',
296
- },
297
- {
298
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations',
299
- },
300
- {
301
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations',
302
- },
303
- {
304
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations',
305
- },
306
- {
307
- get: '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations',
308
- },
309
- { get: '/v1/{name=projects/*/locations/*/collections/*}/operations' },
310
- {
311
- get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations',
312
- },
313
- {
314
- get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations',
315
- },
316
- { get: '/v1/{name=projects/*/locations/*/dataStores/*}/operations' },
317
- {
318
- get: '/v1/{name=projects/*/locations/*/identityMappingStores/*}/operations',
319
- },
320
- { get: '/v1/{name=projects/*/locations/*}/operations' },
321
- { get: '/v1/{name=projects/*}/operations' },
322
- ],
323
- },
324
- ];
212
+ lroOptions.httpRules = [{ selector: 'google.longrunning.Operations.CancelOperation', post: '/v1/{name=projects/*/operations/*}:cancel', body: '*', additional_bindings: [{ post: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', body: '*', }, { post: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', body: '*', }],
213
+ }, { selector: 'google.longrunning.Operations.GetOperation', get: '/v1/{name=projects/*/operations/*}', additional_bindings: [{ get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/collections/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/identityMappingStores/*/operations/*}', }, { get: '/v1/{name=projects/*/locations/*/operations/*}', }, { get: '/v1/{name=projects/*/operations/*}', }],
214
+ }, { selector: 'google.longrunning.Operations.ListOperations', get: '/v1/{name=projects/*}/operations', additional_bindings: [{ get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/collections/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/dataStores/*}/operations', }, { get: '/v1/{name=projects/*/locations/*/identityMappingStores/*}/operations', }, { get: '/v1/{name=projects/*/locations/*}/operations', }, { get: '/v1/{name=projects/*}/operations', }],
215
+ }];
325
216
  }
326
- this.operationsClient = this._gaxModule
327
- .lro(lroOptions)
328
- .operationsClient(opts);
217
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
329
218
  const importSuggestionDenyListEntriesResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.ImportSuggestionDenyListEntriesResponse');
330
219
  const importSuggestionDenyListEntriesMetadata = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.ImportSuggestionDenyListEntriesMetadata');
331
220
  const purgeSuggestionDenyListEntriesResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.PurgeSuggestionDenyListEntriesResponse');
@@ -338,7 +227,7 @@ class CompletionServiceClient {
338
227
  importSuggestionDenyListEntries: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importSuggestionDenyListEntriesResponse.decode.bind(importSuggestionDenyListEntriesResponse), importSuggestionDenyListEntriesMetadata.decode.bind(importSuggestionDenyListEntriesMetadata)),
339
228
  purgeSuggestionDenyListEntries: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeSuggestionDenyListEntriesResponse.decode.bind(purgeSuggestionDenyListEntriesResponse), purgeSuggestionDenyListEntriesMetadata.decode.bind(purgeSuggestionDenyListEntriesMetadata)),
340
229
  importCompletionSuggestions: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importCompletionSuggestionsResponse.decode.bind(importCompletionSuggestionsResponse), importCompletionSuggestionsMetadata.decode.bind(importCompletionSuggestionsMetadata)),
341
- purgeCompletionSuggestions: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeCompletionSuggestionsResponse.decode.bind(purgeCompletionSuggestionsResponse), purgeCompletionSuggestionsMetadata.decode.bind(purgeCompletionSuggestionsMetadata)),
230
+ purgeCompletionSuggestions: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeCompletionSuggestionsResponse.decode.bind(purgeCompletionSuggestionsResponse), purgeCompletionSuggestionsMetadata.decode.bind(purgeCompletionSuggestionsMetadata))
342
231
  };
343
232
  // Put together the default options sent with requests.
344
233
  this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1.CompletionService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -367,20 +256,13 @@ class CompletionServiceClient {
367
256
  }
368
257
  // Put together the "service stub" for
369
258
  // google.cloud.discoveryengine.v1.CompletionService.
370
- this.completionServiceStub = this._gaxGrpc.createStub(this._opts.fallback
371
- ? this._protos.lookupService('google.cloud.discoveryengine.v1.CompletionService')
372
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
373
- this._protos.google.cloud.discoveryengine.v1
374
- .CompletionService, this._opts, this._providedCustomServicePath);
259
+ this.completionServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
260
+ this._protos.lookupService('google.cloud.discoveryengine.v1.CompletionService') :
261
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
+ this._protos.google.cloud.discoveryengine.v1.CompletionService, this._opts, this._providedCustomServicePath);
375
263
  // Iterate over each of the methods that the service provides
376
264
  // and create an API call method for each.
377
- const completionServiceStubMethods = [
378
- 'completeQuery',
379
- 'importSuggestionDenyListEntries',
380
- 'purgeSuggestionDenyListEntries',
381
- 'importCompletionSuggestions',
382
- 'purgeCompletionSuggestions',
383
- ];
265
+ const completionServiceStubMethods = ['completeQuery', 'importSuggestionDenyListEntries', 'purgeSuggestionDenyListEntries', 'importCompletionSuggestions', 'purgeCompletionSuggestions'];
384
266
  for (const methodName of completionServiceStubMethods) {
385
267
  const callPromise = this.completionServiceStub.then(stub => (...args) => {
386
268
  if (this._terminated) {
@@ -391,7 +273,8 @@ class CompletionServiceClient {
391
273
  }, (err) => () => {
392
274
  throw err;
393
275
  });
394
- const descriptor = this.descriptors.longrunning[methodName] || undefined;
276
+ const descriptor = this.descriptors.longrunning[methodName] ||
277
+ undefined;
395
278
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
396
279
  this.innerApiCalls[methodName] = apiCall;
397
280
  }
@@ -403,8 +286,7 @@ class CompletionServiceClient {
403
286
  * @returns {string} The DNS address for this service.
404
287
  */
405
288
  static get servicePath() {
406
- if (typeof process === 'object' &&
407
- typeof process.emitWarning === 'function') {
289
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
408
290
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
409
291
  }
410
292
  return 'discoveryengine.googleapis.com';
@@ -415,8 +297,7 @@ class CompletionServiceClient {
415
297
  * @returns {string} The DNS address for this service.
416
298
  */
417
299
  static get apiEndpoint() {
418
- if (typeof process === 'object' &&
419
- typeof process.emitWarning === 'function') {
300
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
420
301
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
421
302
  }
422
303
  return 'discoveryengine.googleapis.com';
@@ -444,7 +325,9 @@ class CompletionServiceClient {
444
325
  * @returns {string[]} List of default scopes.
445
326
  */
446
327
  static get scopes() {
447
- return ['https://www.googleapis.com/auth/cloud-platform'];
328
+ return [
329
+ 'https://www.googleapis.com/auth/cloud-platform'
330
+ ];
448
331
  }
449
332
  /**
450
333
  * Return the project ID used by this class.
@@ -470,13 +353,10 @@ class CompletionServiceClient {
470
353
  options = options || {};
471
354
  options.otherArgs = options.otherArgs || {};
472
355
  options.otherArgs.headers = options.otherArgs.headers || {};
473
- options.otherArgs.headers['x-goog-request-params'] =
474
- this._gaxModule.routingHeader.fromParams({
475
- data_store: request.dataStore ?? '',
476
- });
477
- this.initialize().catch(err => {
478
- throw err;
356
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
357
+ 'data_store': request.dataStore ?? '',
479
358
  });
359
+ this.initialize().catch(err => { throw err; });
480
360
  this._log.info('completeQuery request %j', request);
481
361
  const wrappedCallback = callback
482
362
  ? (error, response, options, rawResponse) => {
@@ -484,8 +364,7 @@ class CompletionServiceClient {
484
364
  callback(error, response, options, rawResponse); // We verified callback above.
485
365
  }
486
366
  : undefined;
487
- return this.innerApiCalls
488
- .completeQuery(request, options, wrappedCallback)
367
+ return this.innerApiCalls.completeQuery(request, options, wrappedCallback)
489
368
  ?.then(([response, options, rawResponse]) => {
490
369
  this._log.info('completeQuery response %j', response);
491
370
  return [response, options, rawResponse];
@@ -504,13 +383,10 @@ class CompletionServiceClient {
504
383
  options = options || {};
505
384
  options.otherArgs = options.otherArgs || {};
506
385
  options.otherArgs.headers = options.otherArgs.headers || {};
507
- options.otherArgs.headers['x-goog-request-params'] =
508
- this._gaxModule.routingHeader.fromParams({
509
- parent: request.parent ?? '',
510
- });
511
- this.initialize().catch(err => {
512
- throw err;
386
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
387
+ 'parent': request.parent ?? '',
513
388
  });
389
+ this.initialize().catch(err => { throw err; });
514
390
  const wrappedCallback = callback
515
391
  ? (error, response, rawResponse, _) => {
516
392
  this._log.info('importSuggestionDenyListEntries response %j', rawResponse);
@@ -518,8 +394,7 @@ class CompletionServiceClient {
518
394
  }
519
395
  : undefined;
520
396
  this._log.info('importSuggestionDenyListEntries request %j', request);
521
- return this.innerApiCalls
522
- .importSuggestionDenyListEntries(request, options, wrappedCallback)
397
+ return this.innerApiCalls.importSuggestionDenyListEntries(request, options, wrappedCallback)
523
398
  ?.then(([response, rawResponse, _]) => {
524
399
  this._log.info('importSuggestionDenyListEntries response %j', rawResponse);
525
400
  return [response, rawResponse, _];
@@ -556,13 +431,10 @@ class CompletionServiceClient {
556
431
  options = options || {};
557
432
  options.otherArgs = options.otherArgs || {};
558
433
  options.otherArgs.headers = options.otherArgs.headers || {};
559
- options.otherArgs.headers['x-goog-request-params'] =
560
- this._gaxModule.routingHeader.fromParams({
561
- parent: request.parent ?? '',
562
- });
563
- this.initialize().catch(err => {
564
- throw err;
434
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
435
+ 'parent': request.parent ?? '',
565
436
  });
437
+ this.initialize().catch(err => { throw err; });
566
438
  const wrappedCallback = callback
567
439
  ? (error, response, rawResponse, _) => {
568
440
  this._log.info('purgeSuggestionDenyListEntries response %j', rawResponse);
@@ -570,8 +442,7 @@ class CompletionServiceClient {
570
442
  }
571
443
  : undefined;
572
444
  this._log.info('purgeSuggestionDenyListEntries request %j', request);
573
- return this.innerApiCalls
574
- .purgeSuggestionDenyListEntries(request, options, wrappedCallback)
445
+ return this.innerApiCalls.purgeSuggestionDenyListEntries(request, options, wrappedCallback)
575
446
  ?.then(([response, rawResponse, _]) => {
576
447
  this._log.info('purgeSuggestionDenyListEntries response %j', rawResponse);
577
448
  return [response, rawResponse, _];
@@ -608,13 +479,10 @@ class CompletionServiceClient {
608
479
  options = options || {};
609
480
  options.otherArgs = options.otherArgs || {};
610
481
  options.otherArgs.headers = options.otherArgs.headers || {};
611
- options.otherArgs.headers['x-goog-request-params'] =
612
- this._gaxModule.routingHeader.fromParams({
613
- parent: request.parent ?? '',
614
- });
615
- this.initialize().catch(err => {
616
- throw err;
482
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
483
+ 'parent': request.parent ?? '',
617
484
  });
485
+ this.initialize().catch(err => { throw err; });
618
486
  const wrappedCallback = callback
619
487
  ? (error, response, rawResponse, _) => {
620
488
  this._log.info('importCompletionSuggestions response %j', rawResponse);
@@ -622,8 +490,7 @@ class CompletionServiceClient {
622
490
  }
623
491
  : undefined;
624
492
  this._log.info('importCompletionSuggestions request %j', request);
625
- return this.innerApiCalls
626
- .importCompletionSuggestions(request, options, wrappedCallback)
493
+ return this.innerApiCalls.importCompletionSuggestions(request, options, wrappedCallback)
627
494
  ?.then(([response, rawResponse, _]) => {
628
495
  this._log.info('importCompletionSuggestions response %j', rawResponse);
629
496
  return [response, rawResponse, _];
@@ -660,13 +527,10 @@ class CompletionServiceClient {
660
527
  options = options || {};
661
528
  options.otherArgs = options.otherArgs || {};
662
529
  options.otherArgs.headers = options.otherArgs.headers || {};
663
- options.otherArgs.headers['x-goog-request-params'] =
664
- this._gaxModule.routingHeader.fromParams({
665
- parent: request.parent ?? '',
666
- });
667
- this.initialize().catch(err => {
668
- throw err;
530
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
531
+ 'parent': request.parent ?? '',
669
532
  });
533
+ this.initialize().catch(err => { throw err; });
670
534
  const wrappedCallback = callback
671
535
  ? (error, response, rawResponse, _) => {
672
536
  this._log.info('purgeCompletionSuggestions response %j', rawResponse);
@@ -674,8 +538,7 @@ class CompletionServiceClient {
674
538
  }
675
539
  : undefined;
676
540
  this._log.info('purgeCompletionSuggestions request %j', request);
677
- return this.innerApiCalls
678
- .purgeCompletionSuggestions(request, options, wrappedCallback)
541
+ return this.innerApiCalls.purgeCompletionSuggestions(request, options, wrappedCallback)
679
542
  ?.then(([response, rawResponse, _]) => {
680
543
  this._log.info('purgeCompletionSuggestions response %j', rawResponse);
681
544
  return [response, rawResponse, _];
@@ -700,90 +563,90 @@ class CompletionServiceClient {
700
563
  return decodeOperation;
701
564
  }
702
565
  /**
703
- * Gets information about a location.
704
- *
705
- * @param {Object} request
706
- * The request object that will be sent.
707
- * @param {string} request.name
708
- * Resource name for the location.
709
- * @param {object} [options]
710
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
711
- * @returns {Promise} - The promise which resolves to an array.
712
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
713
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
714
- * for more details and examples.
715
- * @example
716
- * ```
717
- * const [response] = await client.getLocation(request);
718
- * ```
719
- */
566
+ * Gets information about a location.
567
+ *
568
+ * @param {Object} request
569
+ * The request object that will be sent.
570
+ * @param {string} request.name
571
+ * Resource name for the location.
572
+ * @param {object} [options]
573
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
574
+ * @returns {Promise} - The promise which resolves to an array.
575
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
576
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
577
+ * for more details and examples.
578
+ * @example
579
+ * ```
580
+ * const [response] = await client.getLocation(request);
581
+ * ```
582
+ */
720
583
  getLocation(request, options, callback) {
721
584
  return this.locationsClient.getLocation(request, options, callback);
722
585
  }
723
586
  /**
724
- * Lists information about the supported locations for this service. Returns an iterable object.
725
- *
726
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
727
- * @param {Object} request
728
- * The request object that will be sent.
729
- * @param {string} request.name
730
- * The resource that owns the locations collection, if applicable.
731
- * @param {string} request.filter
732
- * The standard list filter.
733
- * @param {number} request.pageSize
734
- * The standard list page size.
735
- * @param {string} request.pageToken
736
- * The standard list page token.
737
- * @param {object} [options]
738
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
739
- * @returns {Object}
740
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
741
- * When you iterate the returned iterable, each element will be an object representing
742
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
743
- * so you can stop the iteration when you don't need more results.
744
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
745
- * for more details and examples.
746
- * @example
747
- * ```
748
- * const iterable = client.listLocationsAsync(request);
749
- * for await (const response of iterable) {
750
- * // process response
751
- * }
752
- * ```
753
- */
587
+ * Lists information about the supported locations for this service. Returns an iterable object.
588
+ *
589
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
590
+ * @param {Object} request
591
+ * The request object that will be sent.
592
+ * @param {string} request.name
593
+ * The resource that owns the locations collection, if applicable.
594
+ * @param {string} request.filter
595
+ * The standard list filter.
596
+ * @param {number} request.pageSize
597
+ * The standard list page size.
598
+ * @param {string} request.pageToken
599
+ * The standard list page token.
600
+ * @param {object} [options]
601
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
602
+ * @returns {Object}
603
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
604
+ * When you iterate the returned iterable, each element will be an object representing
605
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
606
+ * so you can stop the iteration when you don't need more results.
607
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
608
+ * for more details and examples.
609
+ * @example
610
+ * ```
611
+ * const iterable = client.listLocationsAsync(request);
612
+ * for await (const response of iterable) {
613
+ * // process response
614
+ * }
615
+ * ```
616
+ */
754
617
  listLocationsAsync(request, options) {
755
618
  return this.locationsClient.listLocationsAsync(request, options);
756
619
  }
757
620
  /**
758
- * Gets the latest state of a long-running operation. Clients can use this
759
- * method to poll the operation result at intervals as recommended by the API
760
- * service.
761
- *
762
- * @param {Object} request - The request object that will be sent.
763
- * @param {string} request.name - The name of the operation resource.
764
- * @param {Object=} options
765
- * Optional parameters. You can override the default settings for this call,
766
- * e.g, timeout, retries, paginations, etc. See {@link
767
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
768
- * for the details.
769
- * @param {function(?Error, ?Object)=} callback
770
- * The function which will be called with the result of the API call.
771
- *
772
- * The second parameter to the callback is an object representing
773
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
774
- * @return {Promise} - The promise which resolves to an array.
775
- * The first element of the array is an object representing
776
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
777
- * The promise has a method named "cancel" which cancels the ongoing API call.
778
- *
779
- * @example
780
- * ```
781
- * const client = longrunning.operationsClient();
782
- * const name = '';
783
- * const [response] = await client.getOperation({name});
784
- * // doThingsWith(response)
785
- * ```
786
- */
621
+ * Gets the latest state of a long-running operation. Clients can use this
622
+ * method to poll the operation result at intervals as recommended by the API
623
+ * service.
624
+ *
625
+ * @param {Object} request - The request object that will be sent.
626
+ * @param {string} request.name - The name of the operation resource.
627
+ * @param {Object=} options
628
+ * Optional parameters. You can override the default settings for this call,
629
+ * e.g, timeout, retries, paginations, etc. See {@link
630
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
631
+ * for the details.
632
+ * @param {function(?Error, ?Object)=} callback
633
+ * The function which will be called with the result of the API call.
634
+ *
635
+ * The second parameter to the callback is an object representing
636
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
637
+ * @return {Promise} - The promise which resolves to an array.
638
+ * The first element of the array is an object representing
639
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
640
+ * The promise has a method named "cancel" which cancels the ongoing API call.
641
+ *
642
+ * @example
643
+ * ```
644
+ * const client = longrunning.operationsClient();
645
+ * const name = '';
646
+ * const [response] = await client.getOperation({name});
647
+ * // doThingsWith(response)
648
+ * ```
649
+ */
787
650
  getOperation(request, optionsOrCallback, callback) {
788
651
  let options;
789
652
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -3172,8 +3035,8 @@ class CompletionServiceClient {
3172
3035
  this._log.info('ending gRPC channel');
3173
3036
  this._terminated = true;
3174
3037
  stub.close();
3175
- this.locationsClient.close();
3176
- this.operationsClient.close();
3038
+ this.locationsClient.close().catch(err => { throw err; });
3039
+ void this.operationsClient.close();
3177
3040
  });
3178
3041
  }
3179
3042
  return Promise.resolve();