@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
@@ -99,26 +99,17 @@ class DocumentServiceClient {
99
99
  constructor(opts, gaxInstance) {
100
100
  // Ensure that options include all the required fields.
101
101
  const staticMembers = this.constructor;
102
- if (opts?.universe_domain &&
103
- opts?.universeDomain &&
104
- opts?.universe_domain !== opts?.universeDomain) {
102
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
105
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
106
104
  }
107
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
108
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
109
- : undefined;
110
- this._universeDomain =
111
- opts?.universeDomain ??
112
- opts?.universe_domain ??
113
- universeDomainEnvVar ??
114
- 'googleapis.com';
105
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
106
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
115
107
  this._servicePath = 'discoveryengine.' + this._universeDomain;
116
108
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
117
109
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
118
110
  const port = opts?.port || staticMembers.port;
119
111
  const clientConfig = opts?.clientConfig ?? {};
120
- const fallback = opts?.fallback ??
121
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
112
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
122
113
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
123
114
  // Request numeric enum values if REST transport is used.
124
115
  opts.numericEnums = true;
@@ -148,7 +139,10 @@ class DocumentServiceClient {
148
139
  }
149
140
  this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
150
141
  // Determine the client header string.
151
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
142
+ const clientHeader = [
143
+ `gax/${this._gaxModule.version}`,
144
+ `gapic/${version}`,
145
+ ];
152
146
  if (typeof process === 'object' && 'versions' in process) {
153
147
  clientHeader.push(`gl-node/${process.versions.node}`);
154
148
  }
@@ -212,7 +206,7 @@ class DocumentServiceClient {
212
206
  // (e.g. 50 results at a time, with tokens to get subsequent
213
207
  // pages). Denote the keys used for pagination and results.
214
208
  this.descriptors.page = {
215
- listDocuments: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents'),
209
+ listDocuments: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'documents')
216
210
  };
217
211
  const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
218
212
  // This API contains "long-running operations", which return a
@@ -220,128 +214,23 @@ class DocumentServiceClient {
220
214
  // rather than holding a request open.
221
215
  const lroOptions = {
222
216
  auth: this.auth,
223
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
217
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
224
218
  };
225
219
  if (opts.fallback) {
226
220
  lroOptions.protoJson = protoFilesRoot;
227
- lroOptions.httpRules = [
228
- {
229
- selector: 'google.longrunning.Operations.CancelOperation',
230
- post: '/v1/{name=projects/*/operations/*}:cancel',
231
- body: '*',
232
- additional_bindings: [
233
- {
234
- post: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel',
235
- body: '*',
236
- },
237
- {
238
- post: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel',
239
- body: '*',
240
- },
241
- ],
242
- },
243
- {
244
- selector: 'google.longrunning.Operations.GetOperation',
245
- get: '/v1/{name=projects/*/operations/*}',
246
- additional_bindings: [
247
- {
248
- get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}',
249
- },
250
- {
251
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}',
252
- },
253
- {
254
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}',
255
- },
256
- {
257
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}',
258
- },
259
- {
260
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}',
261
- },
262
- {
263
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}',
264
- },
265
- {
266
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}',
267
- },
268
- {
269
- get: '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}',
270
- },
271
- {
272
- get: '/v1/{name=projects/*/locations/*/collections/*/operations/*}',
273
- },
274
- {
275
- get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}',
276
- },
277
- {
278
- get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}',
279
- },
280
- {
281
- get: '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}',
282
- },
283
- {
284
- get: '/v1/{name=projects/*/locations/*/identityMappingStores/*/operations/*}',
285
- },
286
- { get: '/v1/{name=projects/*/locations/*/operations/*}' },
287
- { get: '/v1/{name=projects/*/operations/*}' },
288
- ],
289
- },
290
- {
291
- selector: 'google.longrunning.Operations.ListOperations',
292
- get: '/v1/{name=projects/*}/operations',
293
- additional_bindings: [
294
- {
295
- get: '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations',
296
- },
297
- {
298
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations',
299
- },
300
- {
301
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations',
302
- },
303
- {
304
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations',
305
- },
306
- {
307
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations',
308
- },
309
- {
310
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations',
311
- },
312
- {
313
- get: '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations',
314
- },
315
- {
316
- get: '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations',
317
- },
318
- { get: '/v1/{name=projects/*/locations/*/collections/*}/operations' },
319
- {
320
- get: '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations',
321
- },
322
- {
323
- get: '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations',
324
- },
325
- { get: '/v1/{name=projects/*/locations/*/dataStores/*}/operations' },
326
- {
327
- get: '/v1/{name=projects/*/locations/*/identityMappingStores/*}/operations',
328
- },
329
- { get: '/v1/{name=projects/*/locations/*}/operations' },
330
- { get: '/v1/{name=projects/*}/operations' },
331
- ],
332
- },
333
- ];
221
+ 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: '*', }],
222
+ }, { 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/*}', }],
223
+ }, { 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', }],
224
+ }];
334
225
  }
335
- this.operationsClient = this._gaxModule
336
- .lro(lroOptions)
337
- .operationsClient(opts);
226
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
338
227
  const importDocumentsResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.ImportDocumentsResponse');
339
228
  const importDocumentsMetadata = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.ImportDocumentsMetadata');
340
229
  const purgeDocumentsResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.PurgeDocumentsResponse');
341
230
  const purgeDocumentsMetadata = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1.PurgeDocumentsMetadata');
342
231
  this.descriptors.longrunning = {
343
232
  importDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importDocumentsResponse.decode.bind(importDocumentsResponse), importDocumentsMetadata.decode.bind(importDocumentsMetadata)),
344
- purgeDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeDocumentsResponse.decode.bind(purgeDocumentsResponse), purgeDocumentsMetadata.decode.bind(purgeDocumentsMetadata)),
233
+ purgeDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeDocumentsResponse.decode.bind(purgeDocumentsResponse), purgeDocumentsMetadata.decode.bind(purgeDocumentsMetadata))
345
234
  };
346
235
  // Put together the default options sent with requests.
347
236
  this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1.DocumentService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -370,22 +259,13 @@ class DocumentServiceClient {
370
259
  }
371
260
  // Put together the "service stub" for
372
261
  // google.cloud.discoveryengine.v1.DocumentService.
373
- this.documentServiceStub = this._gaxGrpc.createStub(this._opts.fallback
374
- ? this._protos.lookupService('google.cloud.discoveryengine.v1.DocumentService')
375
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
376
- this._protos.google.cloud.discoveryengine.v1.DocumentService, this._opts, this._providedCustomServicePath);
262
+ this.documentServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
263
+ this._protos.lookupService('google.cloud.discoveryengine.v1.DocumentService') :
264
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
265
+ this._protos.google.cloud.discoveryengine.v1.DocumentService, this._opts, this._providedCustomServicePath);
377
266
  // Iterate over each of the methods that the service provides
378
267
  // and create an API call method for each.
379
- const documentServiceStubMethods = [
380
- 'getDocument',
381
- 'listDocuments',
382
- 'createDocument',
383
- 'updateDocument',
384
- 'deleteDocument',
385
- 'importDocuments',
386
- 'purgeDocuments',
387
- 'batchGetDocumentsMetadata',
388
- ];
268
+ const documentServiceStubMethods = ['getDocument', 'listDocuments', 'createDocument', 'updateDocument', 'deleteDocument', 'importDocuments', 'purgeDocuments', 'batchGetDocumentsMetadata'];
389
269
  for (const methodName of documentServiceStubMethods) {
390
270
  const callPromise = this.documentServiceStub.then(stub => (...args) => {
391
271
  if (this._terminated) {
@@ -410,8 +290,7 @@ class DocumentServiceClient {
410
290
  * @returns {string} The DNS address for this service.
411
291
  */
412
292
  static get servicePath() {
413
- if (typeof process === 'object' &&
414
- typeof process.emitWarning === 'function') {
293
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
415
294
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
416
295
  }
417
296
  return 'discoveryengine.googleapis.com';
@@ -422,8 +301,7 @@ class DocumentServiceClient {
422
301
  * @returns {string} The DNS address for this service.
423
302
  */
424
303
  static get apiEndpoint() {
425
- if (typeof process === 'object' &&
426
- typeof process.emitWarning === 'function') {
304
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
427
305
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
428
306
  }
429
307
  return 'discoveryengine.googleapis.com';
@@ -451,7 +329,9 @@ class DocumentServiceClient {
451
329
  * @returns {string[]} List of default scopes.
452
330
  */
453
331
  static get scopes() {
454
- return ['https://www.googleapis.com/auth/cloud-platform'];
332
+ return [
333
+ 'https://www.googleapis.com/auth/cloud-platform'
334
+ ];
455
335
  }
456
336
  /**
457
337
  * Return the project ID used by this class.
@@ -477,13 +357,10 @@ class DocumentServiceClient {
477
357
  options = options || {};
478
358
  options.otherArgs = options.otherArgs || {};
479
359
  options.otherArgs.headers = options.otherArgs.headers || {};
480
- options.otherArgs.headers['x-goog-request-params'] =
481
- this._gaxModule.routingHeader.fromParams({
482
- name: request.name ?? '',
483
- });
484
- this.initialize().catch(err => {
485
- throw err;
360
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
361
+ 'name': request.name ?? '',
486
362
  });
363
+ this.initialize().catch(err => { throw err; });
487
364
  this._log.info('getDocument request %j', request);
488
365
  const wrappedCallback = callback
489
366
  ? (error, response, options, rawResponse) => {
@@ -491,8 +368,7 @@ class DocumentServiceClient {
491
368
  callback(error, response, options, rawResponse); // We verified callback above.
492
369
  }
493
370
  : undefined;
494
- return this.innerApiCalls
495
- .getDocument(request, options, wrappedCallback)
371
+ return this.innerApiCalls.getDocument(request, options, wrappedCallback)
496
372
  ?.then(([response, options, rawResponse]) => {
497
373
  this._log.info('getDocument response %j', response);
498
374
  return [response, options, rawResponse];
@@ -511,13 +387,10 @@ class DocumentServiceClient {
511
387
  options = options || {};
512
388
  options.otherArgs = options.otherArgs || {};
513
389
  options.otherArgs.headers = options.otherArgs.headers || {};
514
- options.otherArgs.headers['x-goog-request-params'] =
515
- this._gaxModule.routingHeader.fromParams({
516
- parent: request.parent ?? '',
517
- });
518
- this.initialize().catch(err => {
519
- throw err;
390
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
391
+ 'parent': request.parent ?? '',
520
392
  });
393
+ this.initialize().catch(err => { throw err; });
521
394
  this._log.info('createDocument request %j', request);
522
395
  const wrappedCallback = callback
523
396
  ? (error, response, options, rawResponse) => {
@@ -525,8 +398,7 @@ class DocumentServiceClient {
525
398
  callback(error, response, options, rawResponse); // We verified callback above.
526
399
  }
527
400
  : undefined;
528
- return this.innerApiCalls
529
- .createDocument(request, options, wrappedCallback)
401
+ return this.innerApiCalls.createDocument(request, options, wrappedCallback)
530
402
  ?.then(([response, options, rawResponse]) => {
531
403
  this._log.info('createDocument response %j', response);
532
404
  return [response, options, rawResponse];
@@ -545,13 +417,10 @@ class DocumentServiceClient {
545
417
  options = options || {};
546
418
  options.otherArgs = options.otherArgs || {};
547
419
  options.otherArgs.headers = options.otherArgs.headers || {};
548
- options.otherArgs.headers['x-goog-request-params'] =
549
- this._gaxModule.routingHeader.fromParams({
550
- 'document.name': request.document.name ?? '',
551
- });
552
- this.initialize().catch(err => {
553
- throw err;
420
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
421
+ 'document.name': request.document.name ?? '',
554
422
  });
423
+ this.initialize().catch(err => { throw err; });
555
424
  this._log.info('updateDocument request %j', request);
556
425
  const wrappedCallback = callback
557
426
  ? (error, response, options, rawResponse) => {
@@ -559,8 +428,7 @@ class DocumentServiceClient {
559
428
  callback(error, response, options, rawResponse); // We verified callback above.
560
429
  }
561
430
  : undefined;
562
- return this.innerApiCalls
563
- .updateDocument(request, options, wrappedCallback)
431
+ return this.innerApiCalls.updateDocument(request, options, wrappedCallback)
564
432
  ?.then(([response, options, rawResponse]) => {
565
433
  this._log.info('updateDocument response %j', response);
566
434
  return [response, options, rawResponse];
@@ -579,13 +447,10 @@ class DocumentServiceClient {
579
447
  options = options || {};
580
448
  options.otherArgs = options.otherArgs || {};
581
449
  options.otherArgs.headers = options.otherArgs.headers || {};
582
- options.otherArgs.headers['x-goog-request-params'] =
583
- this._gaxModule.routingHeader.fromParams({
584
- name: request.name ?? '',
585
- });
586
- this.initialize().catch(err => {
587
- throw err;
450
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
451
+ 'name': request.name ?? '',
588
452
  });
453
+ this.initialize().catch(err => { throw err; });
589
454
  this._log.info('deleteDocument request %j', request);
590
455
  const wrappedCallback = callback
591
456
  ? (error, response, options, rawResponse) => {
@@ -593,8 +458,7 @@ class DocumentServiceClient {
593
458
  callback(error, response, options, rawResponse); // We verified callback above.
594
459
  }
595
460
  : undefined;
596
- return this.innerApiCalls
597
- .deleteDocument(request, options, wrappedCallback)
461
+ return this.innerApiCalls.deleteDocument(request, options, wrappedCallback)
598
462
  ?.then(([response, options, rawResponse]) => {
599
463
  this._log.info('deleteDocument response %j', response);
600
464
  return [response, options, rawResponse];
@@ -613,13 +477,10 @@ class DocumentServiceClient {
613
477
  options = options || {};
614
478
  options.otherArgs = options.otherArgs || {};
615
479
  options.otherArgs.headers = options.otherArgs.headers || {};
616
- options.otherArgs.headers['x-goog-request-params'] =
617
- this._gaxModule.routingHeader.fromParams({
618
- parent: request.parent ?? '',
619
- });
620
- this.initialize().catch(err => {
621
- throw err;
480
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
481
+ 'parent': request.parent ?? '',
622
482
  });
483
+ this.initialize().catch(err => { throw err; });
623
484
  this._log.info('batchGetDocumentsMetadata request %j', request);
624
485
  const wrappedCallback = callback
625
486
  ? (error, response, options, rawResponse) => {
@@ -627,8 +488,7 @@ class DocumentServiceClient {
627
488
  callback(error, response, options, rawResponse); // We verified callback above.
628
489
  }
629
490
  : undefined;
630
- return this.innerApiCalls
631
- .batchGetDocumentsMetadata(request, options, wrappedCallback)
491
+ return this.innerApiCalls.batchGetDocumentsMetadata(request, options, wrappedCallback)
632
492
  ?.then(([response, options, rawResponse]) => {
633
493
  this._log.info('batchGetDocumentsMetadata response %j', response);
634
494
  return [response, options, rawResponse];
@@ -647,13 +507,10 @@ class DocumentServiceClient {
647
507
  options = options || {};
648
508
  options.otherArgs = options.otherArgs || {};
649
509
  options.otherArgs.headers = options.otherArgs.headers || {};
650
- options.otherArgs.headers['x-goog-request-params'] =
651
- this._gaxModule.routingHeader.fromParams({
652
- parent: request.parent ?? '',
653
- });
654
- this.initialize().catch(err => {
655
- throw err;
510
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
511
+ 'parent': request.parent ?? '',
656
512
  });
513
+ this.initialize().catch(err => { throw err; });
657
514
  const wrappedCallback = callback
658
515
  ? (error, response, rawResponse, _) => {
659
516
  this._log.info('importDocuments response %j', rawResponse);
@@ -661,8 +518,7 @@ class DocumentServiceClient {
661
518
  }
662
519
  : undefined;
663
520
  this._log.info('importDocuments request %j', request);
664
- return this.innerApiCalls
665
- .importDocuments(request, options, wrappedCallback)
521
+ return this.innerApiCalls.importDocuments(request, options, wrappedCallback)
666
522
  ?.then(([response, rawResponse, _]) => {
667
523
  this._log.info('importDocuments response %j', rawResponse);
668
524
  return [response, rawResponse, _];
@@ -699,13 +555,10 @@ class DocumentServiceClient {
699
555
  options = options || {};
700
556
  options.otherArgs = options.otherArgs || {};
701
557
  options.otherArgs.headers = options.otherArgs.headers || {};
702
- options.otherArgs.headers['x-goog-request-params'] =
703
- this._gaxModule.routingHeader.fromParams({
704
- parent: request.parent ?? '',
705
- });
706
- this.initialize().catch(err => {
707
- throw err;
558
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
559
+ 'parent': request.parent ?? '',
708
560
  });
561
+ this.initialize().catch(err => { throw err; });
709
562
  const wrappedCallback = callback
710
563
  ? (error, response, rawResponse, _) => {
711
564
  this._log.info('purgeDocuments response %j', rawResponse);
@@ -713,8 +566,7 @@ class DocumentServiceClient {
713
566
  }
714
567
  : undefined;
715
568
  this._log.info('purgeDocuments request %j', request);
716
- return this.innerApiCalls
717
- .purgeDocuments(request, options, wrappedCallback)
569
+ return this.innerApiCalls.purgeDocuments(request, options, wrappedCallback)
718
570
  ?.then(([response, rawResponse, _]) => {
719
571
  this._log.info('purgeDocuments response %j', rawResponse);
720
572
  return [response, rawResponse, _];
@@ -751,13 +603,10 @@ class DocumentServiceClient {
751
603
  options = options || {};
752
604
  options.otherArgs = options.otherArgs || {};
753
605
  options.otherArgs.headers = options.otherArgs.headers || {};
754
- options.otherArgs.headers['x-goog-request-params'] =
755
- this._gaxModule.routingHeader.fromParams({
756
- parent: request.parent ?? '',
757
- });
758
- this.initialize().catch(err => {
759
- throw err;
606
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
607
+ 'parent': request.parent ?? '',
760
608
  });
609
+ this.initialize().catch(err => { throw err; });
761
610
  const wrappedCallback = callback
762
611
  ? (error, values, nextPageRequest, rawResponse) => {
763
612
  this._log.info('listDocuments values %j', values);
@@ -819,15 +668,12 @@ class DocumentServiceClient {
819
668
  options = options || {};
820
669
  options.otherArgs = options.otherArgs || {};
821
670
  options.otherArgs.headers = options.otherArgs.headers || {};
822
- options.otherArgs.headers['x-goog-request-params'] =
823
- this._gaxModule.routingHeader.fromParams({
824
- parent: request.parent ?? '',
825
- });
671
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
672
+ 'parent': request.parent ?? '',
673
+ });
826
674
  const defaultCallSettings = this._defaults['listDocuments'];
827
675
  const callSettings = defaultCallSettings.merge(options);
828
- this.initialize().catch(err => {
829
- throw err;
830
- });
676
+ this.initialize().catch(err => { throw err; });
831
677
  this._log.info('listDocuments stream %j', request);
832
678
  return this.descriptors.page.listDocuments.createStream(this.innerApiCalls.listDocuments, request, callSettings);
833
679
  }
@@ -881,103 +727,100 @@ class DocumentServiceClient {
881
727
  options = options || {};
882
728
  options.otherArgs = options.otherArgs || {};
883
729
  options.otherArgs.headers = options.otherArgs.headers || {};
884
- options.otherArgs.headers['x-goog-request-params'] =
885
- this._gaxModule.routingHeader.fromParams({
886
- parent: request.parent ?? '',
887
- });
730
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
731
+ 'parent': request.parent ?? '',
732
+ });
888
733
  const defaultCallSettings = this._defaults['listDocuments'];
889
734
  const callSettings = defaultCallSettings.merge(options);
890
- this.initialize().catch(err => {
891
- throw err;
892
- });
735
+ this.initialize().catch(err => { throw err; });
893
736
  this._log.info('listDocuments iterate %j', request);
894
737
  return this.descriptors.page.listDocuments.asyncIterate(this.innerApiCalls['listDocuments'], request, callSettings);
895
738
  }
896
739
  /**
897
- * Gets information about a location.
898
- *
899
- * @param {Object} request
900
- * The request object that will be sent.
901
- * @param {string} request.name
902
- * Resource name for the location.
903
- * @param {object} [options]
904
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
905
- * @returns {Promise} - The promise which resolves to an array.
906
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
907
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
908
- * for more details and examples.
909
- * @example
910
- * ```
911
- * const [response] = await client.getLocation(request);
912
- * ```
913
- */
740
+ * Gets information about a location.
741
+ *
742
+ * @param {Object} request
743
+ * The request object that will be sent.
744
+ * @param {string} request.name
745
+ * Resource name for the location.
746
+ * @param {object} [options]
747
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
748
+ * @returns {Promise} - The promise which resolves to an array.
749
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
750
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
751
+ * for more details and examples.
752
+ * @example
753
+ * ```
754
+ * const [response] = await client.getLocation(request);
755
+ * ```
756
+ */
914
757
  getLocation(request, options, callback) {
915
758
  return this.locationsClient.getLocation(request, options, callback);
916
759
  }
917
760
  /**
918
- * Lists information about the supported locations for this service. Returns an iterable object.
919
- *
920
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
921
- * @param {Object} request
922
- * The request object that will be sent.
923
- * @param {string} request.name
924
- * The resource that owns the locations collection, if applicable.
925
- * @param {string} request.filter
926
- * The standard list filter.
927
- * @param {number} request.pageSize
928
- * The standard list page size.
929
- * @param {string} request.pageToken
930
- * The standard list page token.
931
- * @param {object} [options]
932
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
933
- * @returns {Object}
934
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
935
- * When you iterate the returned iterable, each element will be an object representing
936
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
937
- * so you can stop the iteration when you don't need more results.
938
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
939
- * for more details and examples.
940
- * @example
941
- * ```
942
- * const iterable = client.listLocationsAsync(request);
943
- * for await (const response of iterable) {
944
- * // process response
945
- * }
946
- * ```
947
- */
761
+ * Lists information about the supported locations for this service. Returns an iterable object.
762
+ *
763
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
764
+ * @param {Object} request
765
+ * The request object that will be sent.
766
+ * @param {string} request.name
767
+ * The resource that owns the locations collection, if applicable.
768
+ * @param {string} request.filter
769
+ * The standard list filter.
770
+ * @param {number} request.pageSize
771
+ * The standard list page size.
772
+ * @param {string} request.pageToken
773
+ * The standard list page token.
774
+ * @param {object} [options]
775
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
776
+ * @returns {Object}
777
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
778
+ * When you iterate the returned iterable, each element will be an object representing
779
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
780
+ * so you can stop the iteration when you don't need more results.
781
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
782
+ * for more details and examples.
783
+ * @example
784
+ * ```
785
+ * const iterable = client.listLocationsAsync(request);
786
+ * for await (const response of iterable) {
787
+ * // process response
788
+ * }
789
+ * ```
790
+ */
948
791
  listLocationsAsync(request, options) {
949
792
  return this.locationsClient.listLocationsAsync(request, options);
950
793
  }
951
794
  /**
952
- * Gets the latest state of a long-running operation. Clients can use this
953
- * method to poll the operation result at intervals as recommended by the API
954
- * service.
955
- *
956
- * @param {Object} request - The request object that will be sent.
957
- * @param {string} request.name - The name of the operation resource.
958
- * @param {Object=} options
959
- * Optional parameters. You can override the default settings for this call,
960
- * e.g, timeout, retries, paginations, etc. See {@link
961
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
962
- * for the details.
963
- * @param {function(?Error, ?Object)=} callback
964
- * The function which will be called with the result of the API call.
965
- *
966
- * The second parameter to the callback is an object representing
967
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
968
- * @return {Promise} - The promise which resolves to an array.
969
- * The first element of the array is an object representing
970
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
971
- * The promise has a method named "cancel" which cancels the ongoing API call.
972
- *
973
- * @example
974
- * ```
975
- * const client = longrunning.operationsClient();
976
- * const name = '';
977
- * const [response] = await client.getOperation({name});
978
- * // doThingsWith(response)
979
- * ```
980
- */
795
+ * Gets the latest state of a long-running operation. Clients can use this
796
+ * method to poll the operation result at intervals as recommended by the API
797
+ * service.
798
+ *
799
+ * @param {Object} request - The request object that will be sent.
800
+ * @param {string} request.name - The name of the operation resource.
801
+ * @param {Object=} options
802
+ * Optional parameters. You can override the default settings for this call,
803
+ * e.g, timeout, retries, paginations, etc. See {@link
804
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
805
+ * for the details.
806
+ * @param {function(?Error, ?Object)=} callback
807
+ * The function which will be called with the result of the API call.
808
+ *
809
+ * The second parameter to the callback is an object representing
810
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
811
+ * @return {Promise} - The promise which resolves to an array.
812
+ * The first element of the array is an object representing
813
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
814
+ * The promise has a method named "cancel" which cancels the ongoing API call.
815
+ *
816
+ * @example
817
+ * ```
818
+ * const client = longrunning.operationsClient();
819
+ * const name = '';
820
+ * const [response] = await client.getOperation({name});
821
+ * // doThingsWith(response)
822
+ * ```
823
+ */
981
824
  getOperation(request, optionsOrCallback, callback) {
982
825
  let options;
983
826
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -3492,8 +3335,8 @@ class DocumentServiceClient {
3492
3335
  this._log.info('ending gRPC channel');
3493
3336
  this._terminated = true;
3494
3337
  stub.close();
3495
- this.locationsClient.close();
3496
- this.operationsClient.close();
3338
+ this.locationsClient.close().catch(err => { throw err; });
3339
+ void this.operationsClient.close();
3497
3340
  });
3498
3341
  }
3499
3342
  return Promise.resolve();