@google-cloud/vectorsearch 0.1.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 (34) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +134 -0
  3. package/build/protos/google/cloud/vectorsearch/v1beta/common.proto +34 -0
  4. package/build/protos/google/cloud/vectorsearch/v1beta/data_object.proto +92 -0
  5. package/build/protos/google/cloud/vectorsearch/v1beta/data_object_search_service.proto +428 -0
  6. package/build/protos/google/cloud/vectorsearch/v1beta/data_object_service.proto +233 -0
  7. package/build/protos/google/cloud/vectorsearch/v1beta/embedding_config.proto +71 -0
  8. package/build/protos/google/cloud/vectorsearch/v1beta/vectorsearch_service.proto +631 -0
  9. package/build/protos/protos.d.ts +15049 -0
  10. package/build/protos/protos.js +39060 -0
  11. package/build/protos/protos.json +4174 -0
  12. package/build/src/index.d.ts +17 -0
  13. package/build/src/index.js +32 -0
  14. package/build/src/index.js.map +1 -0
  15. package/build/src/v1beta/data_object_search_service_client.d.ts +574 -0
  16. package/build/src/v1beta/data_object_search_service_client.js +849 -0
  17. package/build/src/v1beta/data_object_search_service_client.js.map +1 -0
  18. package/build/src/v1beta/data_object_search_service_client_config.json +58 -0
  19. package/build/src/v1beta/data_object_search_service_proto_list.json +8 -0
  20. package/build/src/v1beta/data_object_service_client.d.ts +486 -0
  21. package/build/src/v1beta/data_object_service_client.js +767 -0
  22. package/build/src/v1beta/data_object_service_client.js.map +1 -0
  23. package/build/src/v1beta/data_object_service_client_config.json +73 -0
  24. package/build/src/v1beta/data_object_service_proto_list.json +8 -0
  25. package/build/src/v1beta/gapic_metadata.json +277 -0
  26. package/build/src/v1beta/index.d.ts +3 -0
  27. package/build/src/v1beta/index.js +27 -0
  28. package/build/src/v1beta/index.js.map +1 -0
  29. package/build/src/v1beta/vector_search_service_client.d.ts +1020 -0
  30. package/build/src/v1beta/vector_search_service_client.js +1387 -0
  31. package/build/src/v1beta/vector_search_service_client.js.map +1 -0
  32. package/build/src/v1beta/vector_search_service_client_config.json +88 -0
  33. package/build/src/v1beta/vector_search_service_proto_list.json +8 -0
  34. package/package.json +70 -0
@@ -0,0 +1,767 @@
1
+ "use strict";
2
+ // Copyright 2025 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.DataObjectServiceClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
23
+ /**
24
+ * Client JSON configuration object, loaded from
25
+ * `src/v1beta/data_object_service_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./data_object_service_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * Service for creating and managing data objects.
32
+ * @class
33
+ * @memberof v1beta
34
+ */
35
+ class DataObjectServiceClient {
36
+ _terminated = false;
37
+ _opts;
38
+ _providedCustomServicePath;
39
+ _gaxModule;
40
+ _gaxGrpc;
41
+ _protos;
42
+ _defaults;
43
+ _universeDomain;
44
+ _servicePath;
45
+ _log = google_gax_1.loggingUtils.log('vectorsearch');
46
+ auth;
47
+ descriptors = {
48
+ page: {},
49
+ stream: {},
50
+ longrunning: {},
51
+ batching: {},
52
+ };
53
+ warn;
54
+ innerApiCalls;
55
+ locationsClient;
56
+ pathTemplates;
57
+ dataObjectServiceStub;
58
+ /**
59
+ * Construct an instance of DataObjectServiceClient.
60
+ *
61
+ * @param {object} [options] - The configuration object.
62
+ * The options accepted by the constructor are described in detail
63
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
64
+ * The common options are:
65
+ * @param {object} [options.credentials] - Credentials object.
66
+ * @param {string} [options.credentials.client_email]
67
+ * @param {string} [options.credentials.private_key]
68
+ * @param {string} [options.email] - Account email address. Required when
69
+ * using a .pem or .p12 keyFilename.
70
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
71
+ * .p12 key downloaded from the Google Developers Console. If you provide
72
+ * a path to a JSON file, the projectId option below is not necessary.
73
+ * NOTE: .pem and .p12 require you to specify options.email as well.
74
+ * @param {number} [options.port] - The port on which to connect to
75
+ * the remote host.
76
+ * @param {string} [options.projectId] - The project ID from the Google
77
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
78
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
79
+ * app is running in an environment which supports
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
81
+ * your project ID will be detected automatically.
82
+ * @param {string} [options.apiEndpoint] - The domain name of the
83
+ * API remote host.
84
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
85
+ * Follows the structure of {@link gapicConfig}.
86
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
87
+ * For more information, please check the
88
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
89
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
90
+ * need to avoid loading the default gRPC version and want to use the fallback
91
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
92
+ * ```
93
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
94
+ * const client = new DataObjectServiceClient({fallback: true}, gax);
95
+ * ```
96
+ */
97
+ constructor(opts, gaxInstance) {
98
+ // Ensure that options include all the required fields.
99
+ const staticMembers = this.constructor;
100
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
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';
105
+ this._servicePath = 'vectorsearch.' + this._universeDomain;
106
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
107
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
108
+ const port = opts?.port || staticMembers.port;
109
+ const clientConfig = opts?.clientConfig ?? {};
110
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
111
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
112
+ // Request numeric enum values if REST transport is used.
113
+ opts.numericEnums = true;
114
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
116
+ opts['scopes'] = staticMembers.scopes;
117
+ }
118
+ // Load google-gax module synchronously if needed
119
+ if (!gaxInstance) {
120
+ gaxInstance = require('google-gax');
121
+ }
122
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
123
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
124
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
125
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
126
+ // Save options to use in initialize() method.
127
+ this._opts = opts;
128
+ // Save the auth object to the client, for use by other methods.
129
+ this.auth = this._gaxGrpc.auth;
130
+ // Set useJWTAccessWithScope on the auth object.
131
+ this.auth.useJWTAccessWithScope = true;
132
+ // Set defaultServicePath on the auth object.
133
+ this.auth.defaultServicePath = this._servicePath;
134
+ // Set the default scopes in auth client if needed.
135
+ if (servicePath === this._servicePath) {
136
+ this.auth.defaultScopes = staticMembers.scopes;
137
+ }
138
+ this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
139
+ // Determine the client header string.
140
+ const clientHeader = [
141
+ `gax/${this._gaxModule.version}`,
142
+ `gapic/${version}`,
143
+ ];
144
+ if (typeof process === 'object' && 'versions' in process) {
145
+ clientHeader.push(`gl-node/${process.versions.node}`);
146
+ }
147
+ else {
148
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
149
+ }
150
+ if (!opts.fallback) {
151
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
152
+ }
153
+ else {
154
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
155
+ }
156
+ if (opts.libName && opts.libVersion) {
157
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
158
+ }
159
+ // Load the applicable protos.
160
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
161
+ // This API contains "path templates"; forward-slash-separated
162
+ // identifiers to uniquely identify resources within the API.
163
+ // Create useful helper objects for these.
164
+ this.pathTemplates = {
165
+ collectionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}'),
166
+ dataObjectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}'),
167
+ indexPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/indexes/{index}'),
168
+ };
169
+ // Put together the default options sent with requests.
170
+ this._defaults = this._gaxGrpc.constructSettings('google.cloud.vectorsearch.v1beta.DataObjectService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
171
+ // Set up a dictionary of "inner API calls"; the core implementation
172
+ // of calling the API is handled in `google-gax`, with this code
173
+ // merely providing the destination and request information.
174
+ this.innerApiCalls = {};
175
+ // Add a warn function to the client constructor so it can be easily tested.
176
+ this.warn = this._gaxModule.warn;
177
+ }
178
+ /**
179
+ * Initialize the client.
180
+ * Performs asynchronous operations (such as authentication) and prepares the client.
181
+ * This function will be called automatically when any class method is called for the
182
+ * first time, but if you need to initialize it before calling an actual method,
183
+ * feel free to call initialize() directly.
184
+ *
185
+ * You can await on this method if you want to make sure the client is initialized.
186
+ *
187
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
188
+ */
189
+ initialize() {
190
+ // If the client stub promise is already initialized, return immediately.
191
+ if (this.dataObjectServiceStub) {
192
+ return this.dataObjectServiceStub;
193
+ }
194
+ // Put together the "service stub" for
195
+ // google.cloud.vectorsearch.v1beta.DataObjectService.
196
+ this.dataObjectServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
197
+ this._protos.lookupService('google.cloud.vectorsearch.v1beta.DataObjectService') :
198
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
+ this._protos.google.cloud.vectorsearch.v1beta.DataObjectService, this._opts, this._providedCustomServicePath);
200
+ // Iterate over each of the methods that the service provides
201
+ // and create an API call method for each.
202
+ const dataObjectServiceStubMethods = ['createDataObject', 'batchCreateDataObjects', 'getDataObject', 'updateDataObject', 'batchUpdateDataObjects', 'deleteDataObject', 'batchDeleteDataObjects'];
203
+ for (const methodName of dataObjectServiceStubMethods) {
204
+ const callPromise = this.dataObjectServiceStub.then(stub => (...args) => {
205
+ if (this._terminated) {
206
+ return Promise.reject('The client has already been closed.');
207
+ }
208
+ const func = stub[methodName];
209
+ return func.apply(stub, args);
210
+ }, (err) => () => {
211
+ throw err;
212
+ });
213
+ const descriptor = undefined;
214
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
215
+ this.innerApiCalls[methodName] = apiCall;
216
+ }
217
+ return this.dataObjectServiceStub;
218
+ }
219
+ /**
220
+ * The DNS address for this API service.
221
+ * @deprecated Use the apiEndpoint method of the client instance.
222
+ * @returns {string} The DNS address for this service.
223
+ */
224
+ static get servicePath() {
225
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
226
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
227
+ }
228
+ return 'vectorsearch.googleapis.com';
229
+ }
230
+ /**
231
+ * The DNS address for this API service - same as servicePath.
232
+ * @deprecated Use the apiEndpoint method of the client instance.
233
+ * @returns {string} The DNS address for this service.
234
+ */
235
+ static get apiEndpoint() {
236
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
237
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
238
+ }
239
+ return 'vectorsearch.googleapis.com';
240
+ }
241
+ /**
242
+ * The DNS address for this API service.
243
+ * @returns {string} The DNS address for this service.
244
+ */
245
+ get apiEndpoint() {
246
+ return this._servicePath;
247
+ }
248
+ get universeDomain() {
249
+ return this._universeDomain;
250
+ }
251
+ /**
252
+ * The port for this API service.
253
+ * @returns {number} The default port for this service.
254
+ */
255
+ static get port() {
256
+ return 443;
257
+ }
258
+ /**
259
+ * The scopes needed to make gRPC calls for every method defined
260
+ * in this service.
261
+ * @returns {string[]} List of default scopes.
262
+ */
263
+ static get scopes() {
264
+ return [
265
+ 'https://www.googleapis.com/auth/cloud-platform'
266
+ ];
267
+ }
268
+ /**
269
+ * Return the project ID used by this class.
270
+ * @returns {Promise} A promise that resolves to string containing the project ID.
271
+ */
272
+ getProjectId(callback) {
273
+ if (callback) {
274
+ this.auth.getProjectId(callback);
275
+ return;
276
+ }
277
+ return this.auth.getProjectId();
278
+ }
279
+ createDataObject(request, optionsOrCallback, callback) {
280
+ request = request || {};
281
+ let options;
282
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
283
+ callback = optionsOrCallback;
284
+ options = {};
285
+ }
286
+ else {
287
+ options = optionsOrCallback;
288
+ }
289
+ options = options || {};
290
+ options.otherArgs = options.otherArgs || {};
291
+ options.otherArgs.headers = options.otherArgs.headers || {};
292
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
293
+ 'parent': request.parent ?? '',
294
+ });
295
+ this.initialize().catch(err => { throw err; });
296
+ this._log.info('createDataObject request %j', request);
297
+ const wrappedCallback = callback
298
+ ? (error, response, options, rawResponse) => {
299
+ this._log.info('createDataObject response %j', response);
300
+ callback(error, response, options, rawResponse); // We verified callback above.
301
+ }
302
+ : undefined;
303
+ return this.innerApiCalls.createDataObject(request, options, wrappedCallback)
304
+ ?.then(([response, options, rawResponse]) => {
305
+ this._log.info('createDataObject response %j', response);
306
+ return [response, options, rawResponse];
307
+ }).catch((error) => {
308
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
309
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
310
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
311
+ }
312
+ throw error;
313
+ });
314
+ }
315
+ batchCreateDataObjects(request, optionsOrCallback, callback) {
316
+ request = request || {};
317
+ let options;
318
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
319
+ callback = optionsOrCallback;
320
+ options = {};
321
+ }
322
+ else {
323
+ options = optionsOrCallback;
324
+ }
325
+ options = options || {};
326
+ options.otherArgs = options.otherArgs || {};
327
+ options.otherArgs.headers = options.otherArgs.headers || {};
328
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
329
+ 'parent': request.parent ?? '',
330
+ });
331
+ this.initialize().catch(err => { throw err; });
332
+ this._log.info('batchCreateDataObjects request %j', request);
333
+ const wrappedCallback = callback
334
+ ? (error, response, options, rawResponse) => {
335
+ this._log.info('batchCreateDataObjects response %j', response);
336
+ callback(error, response, options, rawResponse); // We verified callback above.
337
+ }
338
+ : undefined;
339
+ return this.innerApiCalls.batchCreateDataObjects(request, options, wrappedCallback)
340
+ ?.then(([response, options, rawResponse]) => {
341
+ this._log.info('batchCreateDataObjects response %j', response);
342
+ return [response, options, rawResponse];
343
+ }).catch((error) => {
344
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
345
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
346
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
347
+ }
348
+ throw error;
349
+ });
350
+ }
351
+ getDataObject(request, optionsOrCallback, callback) {
352
+ request = request || {};
353
+ let options;
354
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
355
+ callback = optionsOrCallback;
356
+ options = {};
357
+ }
358
+ else {
359
+ options = optionsOrCallback;
360
+ }
361
+ options = options || {};
362
+ options.otherArgs = options.otherArgs || {};
363
+ options.otherArgs.headers = options.otherArgs.headers || {};
364
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
365
+ 'name': request.name ?? '',
366
+ });
367
+ this.initialize().catch(err => { throw err; });
368
+ this._log.info('getDataObject request %j', request);
369
+ const wrappedCallback = callback
370
+ ? (error, response, options, rawResponse) => {
371
+ this._log.info('getDataObject response %j', response);
372
+ callback(error, response, options, rawResponse); // We verified callback above.
373
+ }
374
+ : undefined;
375
+ return this.innerApiCalls.getDataObject(request, options, wrappedCallback)
376
+ ?.then(([response, options, rawResponse]) => {
377
+ this._log.info('getDataObject response %j', response);
378
+ return [response, options, rawResponse];
379
+ }).catch((error) => {
380
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
381
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
382
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
383
+ }
384
+ throw error;
385
+ });
386
+ }
387
+ updateDataObject(request, optionsOrCallback, callback) {
388
+ request = request || {};
389
+ let options;
390
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
391
+ callback = optionsOrCallback;
392
+ options = {};
393
+ }
394
+ else {
395
+ options = optionsOrCallback;
396
+ }
397
+ options = options || {};
398
+ options.otherArgs = options.otherArgs || {};
399
+ options.otherArgs.headers = options.otherArgs.headers || {};
400
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
401
+ 'data_object.name': request.dataObject.name ?? '',
402
+ });
403
+ this.initialize().catch(err => { throw err; });
404
+ this._log.info('updateDataObject request %j', request);
405
+ const wrappedCallback = callback
406
+ ? (error, response, options, rawResponse) => {
407
+ this._log.info('updateDataObject response %j', response);
408
+ callback(error, response, options, rawResponse); // We verified callback above.
409
+ }
410
+ : undefined;
411
+ return this.innerApiCalls.updateDataObject(request, options, wrappedCallback)
412
+ ?.then(([response, options, rawResponse]) => {
413
+ this._log.info('updateDataObject response %j', response);
414
+ return [response, options, rawResponse];
415
+ }).catch((error) => {
416
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
417
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
418
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
419
+ }
420
+ throw error;
421
+ });
422
+ }
423
+ batchUpdateDataObjects(request, optionsOrCallback, callback) {
424
+ request = request || {};
425
+ let options;
426
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
427
+ callback = optionsOrCallback;
428
+ options = {};
429
+ }
430
+ else {
431
+ options = optionsOrCallback;
432
+ }
433
+ options = options || {};
434
+ options.otherArgs = options.otherArgs || {};
435
+ options.otherArgs.headers = options.otherArgs.headers || {};
436
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
437
+ 'parent': request.parent ?? '',
438
+ });
439
+ this.initialize().catch(err => { throw err; });
440
+ this._log.info('batchUpdateDataObjects request %j', request);
441
+ const wrappedCallback = callback
442
+ ? (error, response, options, rawResponse) => {
443
+ this._log.info('batchUpdateDataObjects response %j', response);
444
+ callback(error, response, options, rawResponse); // We verified callback above.
445
+ }
446
+ : undefined;
447
+ return this.innerApiCalls.batchUpdateDataObjects(request, options, wrappedCallback)
448
+ ?.then(([response, options, rawResponse]) => {
449
+ this._log.info('batchUpdateDataObjects response %j', response);
450
+ return [response, options, rawResponse];
451
+ }).catch((error) => {
452
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
453
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
454
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
455
+ }
456
+ throw error;
457
+ });
458
+ }
459
+ deleteDataObject(request, optionsOrCallback, callback) {
460
+ request = request || {};
461
+ let options;
462
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
463
+ callback = optionsOrCallback;
464
+ options = {};
465
+ }
466
+ else {
467
+ options = optionsOrCallback;
468
+ }
469
+ options = options || {};
470
+ options.otherArgs = options.otherArgs || {};
471
+ options.otherArgs.headers = options.otherArgs.headers || {};
472
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
473
+ 'name': request.name ?? '',
474
+ });
475
+ this.initialize().catch(err => { throw err; });
476
+ this._log.info('deleteDataObject request %j', request);
477
+ const wrappedCallback = callback
478
+ ? (error, response, options, rawResponse) => {
479
+ this._log.info('deleteDataObject response %j', response);
480
+ callback(error, response, options, rawResponse); // We verified callback above.
481
+ }
482
+ : undefined;
483
+ return this.innerApiCalls.deleteDataObject(request, options, wrappedCallback)
484
+ ?.then(([response, options, rawResponse]) => {
485
+ this._log.info('deleteDataObject response %j', response);
486
+ return [response, options, rawResponse];
487
+ }).catch((error) => {
488
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
489
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
490
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
491
+ }
492
+ throw error;
493
+ });
494
+ }
495
+ batchDeleteDataObjects(request, optionsOrCallback, callback) {
496
+ request = request || {};
497
+ let options;
498
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
499
+ callback = optionsOrCallback;
500
+ options = {};
501
+ }
502
+ else {
503
+ options = optionsOrCallback;
504
+ }
505
+ options = options || {};
506
+ options.otherArgs = options.otherArgs || {};
507
+ options.otherArgs.headers = options.otherArgs.headers || {};
508
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
509
+ 'parent': request.parent ?? '',
510
+ });
511
+ this.initialize().catch(err => { throw err; });
512
+ this._log.info('batchDeleteDataObjects request %j', request);
513
+ const wrappedCallback = callback
514
+ ? (error, response, options, rawResponse) => {
515
+ this._log.info('batchDeleteDataObjects response %j', response);
516
+ callback(error, response, options, rawResponse); // We verified callback above.
517
+ }
518
+ : undefined;
519
+ return this.innerApiCalls.batchDeleteDataObjects(request, options, wrappedCallback)
520
+ ?.then(([response, options, rawResponse]) => {
521
+ this._log.info('batchDeleteDataObjects response %j', response);
522
+ return [response, options, rawResponse];
523
+ }).catch((error) => {
524
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
525
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
526
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
527
+ }
528
+ throw error;
529
+ });
530
+ }
531
+ /**
532
+ * Gets information about a location.
533
+ *
534
+ * @param {Object} request
535
+ * The request object that will be sent.
536
+ * @param {string} request.name
537
+ * Resource name for the location.
538
+ * @param {object} [options]
539
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
540
+ * @returns {Promise} - The promise which resolves to an array.
541
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
542
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
543
+ * for more details and examples.
544
+ * @example
545
+ * ```
546
+ * const [response] = await client.getLocation(request);
547
+ * ```
548
+ */
549
+ getLocation(request, options, callback) {
550
+ return this.locationsClient.getLocation(request, options, callback);
551
+ }
552
+ /**
553
+ * Lists information about the supported locations for this service. Returns an iterable object.
554
+ *
555
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
556
+ * @param {Object} request
557
+ * The request object that will be sent.
558
+ * @param {string} request.name
559
+ * The resource that owns the locations collection, if applicable.
560
+ * @param {string} request.filter
561
+ * The standard list filter.
562
+ * @param {number} request.pageSize
563
+ * The standard list page size.
564
+ * @param {string} request.pageToken
565
+ * The standard list page token.
566
+ * @param {object} [options]
567
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
568
+ * @returns {Object}
569
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
570
+ * When you iterate the returned iterable, each element will be an object representing
571
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
572
+ * so you can stop the iteration when you don't need more results.
573
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
574
+ * for more details and examples.
575
+ * @example
576
+ * ```
577
+ * const iterable = client.listLocationsAsync(request);
578
+ * for await (const response of iterable) {
579
+ * // process response
580
+ * }
581
+ * ```
582
+ */
583
+ listLocationsAsync(request, options) {
584
+ return this.locationsClient.listLocationsAsync(request, options);
585
+ }
586
+ // --------------------
587
+ // -- Path templates --
588
+ // --------------------
589
+ /**
590
+ * Return a fully-qualified collection resource name string.
591
+ *
592
+ * @param {string} project
593
+ * @param {string} location
594
+ * @param {string} collection
595
+ * @returns {string} Resource name string.
596
+ */
597
+ collectionPath(project, location, collection) {
598
+ return this.pathTemplates.collectionPathTemplate.render({
599
+ project: project,
600
+ location: location,
601
+ collection: collection,
602
+ });
603
+ }
604
+ /**
605
+ * Parse the project from Collection resource.
606
+ *
607
+ * @param {string} collectionName
608
+ * A fully-qualified path representing Collection resource.
609
+ * @returns {string} A string representing the project.
610
+ */
611
+ matchProjectFromCollectionName(collectionName) {
612
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).project;
613
+ }
614
+ /**
615
+ * Parse the location from Collection resource.
616
+ *
617
+ * @param {string} collectionName
618
+ * A fully-qualified path representing Collection resource.
619
+ * @returns {string} A string representing the location.
620
+ */
621
+ matchLocationFromCollectionName(collectionName) {
622
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).location;
623
+ }
624
+ /**
625
+ * Parse the collection from Collection resource.
626
+ *
627
+ * @param {string} collectionName
628
+ * A fully-qualified path representing Collection resource.
629
+ * @returns {string} A string representing the collection.
630
+ */
631
+ matchCollectionFromCollectionName(collectionName) {
632
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).collection;
633
+ }
634
+ /**
635
+ * Return a fully-qualified dataObject resource name string.
636
+ *
637
+ * @param {string} project
638
+ * @param {string} location
639
+ * @param {string} collection
640
+ * @param {string} dataObject
641
+ * @returns {string} Resource name string.
642
+ */
643
+ dataObjectPath(project, location, collection, dataObject) {
644
+ return this.pathTemplates.dataObjectPathTemplate.render({
645
+ project: project,
646
+ location: location,
647
+ collection: collection,
648
+ dataObject: dataObject,
649
+ });
650
+ }
651
+ /**
652
+ * Parse the project from DataObject resource.
653
+ *
654
+ * @param {string} dataObjectName
655
+ * A fully-qualified path representing DataObject resource.
656
+ * @returns {string} A string representing the project.
657
+ */
658
+ matchProjectFromDataObjectName(dataObjectName) {
659
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).project;
660
+ }
661
+ /**
662
+ * Parse the location from DataObject resource.
663
+ *
664
+ * @param {string} dataObjectName
665
+ * A fully-qualified path representing DataObject resource.
666
+ * @returns {string} A string representing the location.
667
+ */
668
+ matchLocationFromDataObjectName(dataObjectName) {
669
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).location;
670
+ }
671
+ /**
672
+ * Parse the collection from DataObject resource.
673
+ *
674
+ * @param {string} dataObjectName
675
+ * A fully-qualified path representing DataObject resource.
676
+ * @returns {string} A string representing the collection.
677
+ */
678
+ matchCollectionFromDataObjectName(dataObjectName) {
679
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).collection;
680
+ }
681
+ /**
682
+ * Parse the dataObject from DataObject resource.
683
+ *
684
+ * @param {string} dataObjectName
685
+ * A fully-qualified path representing DataObject resource.
686
+ * @returns {string} A string representing the dataObject.
687
+ */
688
+ matchDataObjectFromDataObjectName(dataObjectName) {
689
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).dataObject;
690
+ }
691
+ /**
692
+ * Return a fully-qualified index resource name string.
693
+ *
694
+ * @param {string} project
695
+ * @param {string} location
696
+ * @param {string} collection
697
+ * @param {string} index
698
+ * @returns {string} Resource name string.
699
+ */
700
+ indexPath(project, location, collection, index) {
701
+ return this.pathTemplates.indexPathTemplate.render({
702
+ project: project,
703
+ location: location,
704
+ collection: collection,
705
+ index: index,
706
+ });
707
+ }
708
+ /**
709
+ * Parse the project from Index resource.
710
+ *
711
+ * @param {string} indexName
712
+ * A fully-qualified path representing Index resource.
713
+ * @returns {string} A string representing the project.
714
+ */
715
+ matchProjectFromIndexName(indexName) {
716
+ return this.pathTemplates.indexPathTemplate.match(indexName).project;
717
+ }
718
+ /**
719
+ * Parse the location from Index resource.
720
+ *
721
+ * @param {string} indexName
722
+ * A fully-qualified path representing Index resource.
723
+ * @returns {string} A string representing the location.
724
+ */
725
+ matchLocationFromIndexName(indexName) {
726
+ return this.pathTemplates.indexPathTemplate.match(indexName).location;
727
+ }
728
+ /**
729
+ * Parse the collection from Index resource.
730
+ *
731
+ * @param {string} indexName
732
+ * A fully-qualified path representing Index resource.
733
+ * @returns {string} A string representing the collection.
734
+ */
735
+ matchCollectionFromIndexName(indexName) {
736
+ return this.pathTemplates.indexPathTemplate.match(indexName).collection;
737
+ }
738
+ /**
739
+ * Parse the index from Index resource.
740
+ *
741
+ * @param {string} indexName
742
+ * A fully-qualified path representing Index resource.
743
+ * @returns {string} A string representing the index.
744
+ */
745
+ matchIndexFromIndexName(indexName) {
746
+ return this.pathTemplates.indexPathTemplate.match(indexName).index;
747
+ }
748
+ /**
749
+ * Terminate the gRPC channel and close the client.
750
+ *
751
+ * The client will no longer be usable and all future behavior is undefined.
752
+ * @returns {Promise} A promise that resolves when the client is closed.
753
+ */
754
+ close() {
755
+ if (this.dataObjectServiceStub && !this._terminated) {
756
+ return this.dataObjectServiceStub.then(stub => {
757
+ this._log.info('ending gRPC channel');
758
+ this._terminated = true;
759
+ stub.close();
760
+ this.locationsClient.close().catch(err => { throw err; });
761
+ });
762
+ }
763
+ return Promise.resolve();
764
+ }
765
+ }
766
+ exports.DataObjectServiceClient = DataObjectServiceClient;
767
+ //# sourceMappingURL=data_object_service_client.js.map