@google-cloud/vectorsearch 0.2.0 → 0.4.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 (44) hide show
  1. package/README.md +22 -0
  2. package/build/protos/google/cloud/vectorsearch/v1/common.proto +37 -0
  3. package/build/protos/google/cloud/vectorsearch/v1/data_object.proto +95 -0
  4. package/build/protos/google/cloud/vectorsearch/v1/data_object_search_service.proto +409 -0
  5. package/build/protos/google/cloud/vectorsearch/v1/data_object_service.proto +242 -0
  6. package/build/protos/google/cloud/vectorsearch/v1/embedding_config.proto +74 -0
  7. package/build/protos/google/cloud/vectorsearch/v1/vectorsearch_service.proto +710 -0
  8. package/build/protos/google/cloud/vectorsearch/v1beta/common.proto +4 -1
  9. package/build/protos/google/cloud/vectorsearch/v1beta/data_object.proto +8 -3
  10. package/build/protos/google/cloud/vectorsearch/v1beta/data_object_search_service.proto +71 -40
  11. package/build/protos/google/cloud/vectorsearch/v1beta/data_object_service.proto +11 -2
  12. package/build/protos/google/cloud/vectorsearch/v1beta/embedding_config.proto +3 -0
  13. package/build/protos/google/cloud/vectorsearch/v1beta/vectorsearch_service.proto +85 -15
  14. package/build/protos/protos.d.ts +7493 -161
  15. package/build/protos/protos.js +24251 -6379
  16. package/build/protos/protos.json +2260 -56
  17. package/build/src/index.d.ts +12 -10
  18. package/build/src/index.js +7 -5
  19. package/build/src/index.js.map +1 -1
  20. package/build/src/v1/data_object_search_service_client.d.ts +583 -0
  21. package/build/src/v1/data_object_search_service_client.js +855 -0
  22. package/build/src/v1/data_object_search_service_client.js.map +1 -0
  23. package/build/src/v1/data_object_search_service_client_config.json +58 -0
  24. package/build/src/v1/data_object_search_service_proto_list.json +8 -0
  25. package/build/src/v1/data_object_service_client.d.ts +490 -0
  26. package/build/src/v1/data_object_service_client.js +767 -0
  27. package/build/src/v1/data_object_service_client.js.map +1 -0
  28. package/build/src/v1/data_object_service_client_config.json +73 -0
  29. package/build/src/v1/data_object_service_proto_list.json +8 -0
  30. package/build/src/v1/gapic_metadata.json +277 -0
  31. package/build/src/v1/index.d.ts +3 -0
  32. package/build/src/v1/index.js +27 -0
  33. package/build/src/v1/index.js.map +1 -0
  34. package/build/src/v1/vector_search_service_client.d.ts +1021 -0
  35. package/build/src/v1/vector_search_service_client.js +1387 -0
  36. package/build/src/v1/vector_search_service_client.js.map +1 -0
  37. package/build/src/v1/vector_search_service_client_config.json +88 -0
  38. package/build/src/v1/vector_search_service_proto_list.json +8 -0
  39. package/build/src/v1beta/data_object_search_service_client.d.ts +15 -6
  40. package/build/src/v1beta/data_object_search_service_client.js +10 -4
  41. package/build/src/v1beta/data_object_search_service_client.js.map +1 -1
  42. package/build/src/v1beta/data_object_service_client.d.ts +4 -0
  43. package/build/src/v1beta/data_object_service_client.js.map +1 -1
  44. package/package.json +1 -1
@@ -0,0 +1,1387 @@
1
+ "use strict";
2
+ // Copyright 2026 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.VectorSearchServiceClient = 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/v1/vector_search_service_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./vector_search_service_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * VectorSearchService provides methods for managing Collection resources, and
32
+ * Collection Index resources. The primary resources offered by this service are
33
+ * Collections which are a container for a set of related JSON data objects, and
34
+ * Collection Indexes which enable efficient ANN search across data objects
35
+ * within a Collection.
36
+ * @class
37
+ * @memberof v1
38
+ */
39
+ class VectorSearchServiceClient {
40
+ _terminated = false;
41
+ _opts;
42
+ _providedCustomServicePath;
43
+ _gaxModule;
44
+ _gaxGrpc;
45
+ _protos;
46
+ _defaults;
47
+ _universeDomain;
48
+ _servicePath;
49
+ _log = google_gax_1.loggingUtils.log('vectorsearch');
50
+ auth;
51
+ descriptors = {
52
+ page: {},
53
+ stream: {},
54
+ longrunning: {},
55
+ batching: {},
56
+ };
57
+ warn;
58
+ innerApiCalls;
59
+ locationsClient;
60
+ pathTemplates;
61
+ operationsClient;
62
+ vectorSearchServiceStub;
63
+ /**
64
+ * Construct an instance of VectorSearchServiceClient.
65
+ *
66
+ * @param {object} [options] - The configuration object.
67
+ * The options accepted by the constructor are described in detail
68
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
69
+ * The common options are:
70
+ * @param {object} [options.credentials] - Credentials object.
71
+ * @param {string} [options.credentials.client_email]
72
+ * @param {string} [options.credentials.private_key]
73
+ * @param {string} [options.email] - Account email address. Required when
74
+ * using a .pem or .p12 keyFilename.
75
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
76
+ * .p12 key downloaded from the Google Developers Console. If you provide
77
+ * a path to a JSON file, the projectId option below is not necessary.
78
+ * NOTE: .pem and .p12 require you to specify options.email as well.
79
+ * @param {number} [options.port] - The port on which to connect to
80
+ * the remote host.
81
+ * @param {string} [options.projectId] - The project ID from the Google
82
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
83
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
84
+ * app is running in an environment which supports
85
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
86
+ * your project ID will be detected automatically.
87
+ * @param {string} [options.apiEndpoint] - The domain name of the
88
+ * API remote host.
89
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
90
+ * Follows the structure of {@link gapicConfig}.
91
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
92
+ * For more information, please check the
93
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
94
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
95
+ * need to avoid loading the default gRPC version and want to use the fallback
96
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
97
+ * ```
98
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
99
+ * const client = new VectorSearchServiceClient({fallback: true}, gax);
100
+ * ```
101
+ */
102
+ constructor(opts, gaxInstance) {
103
+ // Ensure that options include all the required fields.
104
+ const staticMembers = this.constructor;
105
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
106
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
107
+ }
108
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
109
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
110
+ this._servicePath = 'vectorsearch.' + this._universeDomain;
111
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
112
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
113
+ const port = opts?.port || staticMembers.port;
114
+ const clientConfig = opts?.clientConfig ?? {};
115
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
116
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
117
+ // Request numeric enum values if REST transport is used.
118
+ opts.numericEnums = true;
119
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
120
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
121
+ opts['scopes'] = staticMembers.scopes;
122
+ }
123
+ // Load google-gax module synchronously if needed
124
+ if (!gaxInstance) {
125
+ gaxInstance = require('google-gax');
126
+ }
127
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
128
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
129
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
130
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
131
+ // Save options to use in initialize() method.
132
+ this._opts = opts;
133
+ // Save the auth object to the client, for use by other methods.
134
+ this.auth = this._gaxGrpc.auth;
135
+ // Set useJWTAccessWithScope on the auth object.
136
+ this.auth.useJWTAccessWithScope = true;
137
+ // Set defaultServicePath on the auth object.
138
+ this.auth.defaultServicePath = this._servicePath;
139
+ // Set the default scopes in auth client if needed.
140
+ if (servicePath === this._servicePath) {
141
+ this.auth.defaultScopes = staticMembers.scopes;
142
+ }
143
+ this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
144
+ // Determine the client header string.
145
+ const clientHeader = [
146
+ `gax/${this._gaxModule.version}`,
147
+ `gapic/${version}`,
148
+ ];
149
+ if (typeof process === 'object' && 'versions' in process) {
150
+ clientHeader.push(`gl-node/${process.versions.node}`);
151
+ }
152
+ else {
153
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
154
+ }
155
+ if (!opts.fallback) {
156
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
157
+ }
158
+ else {
159
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
160
+ }
161
+ if (opts.libName && opts.libVersion) {
162
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
163
+ }
164
+ // Load the applicable protos.
165
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
166
+ // This API contains "path templates"; forward-slash-separated
167
+ // identifiers to uniquely identify resources within the API.
168
+ // Create useful helper objects for these.
169
+ this.pathTemplates = {
170
+ collectionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}'),
171
+ dataObjectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}'),
172
+ indexPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/indexes/{index}'),
173
+ locationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}'),
174
+ projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
175
+ };
176
+ // Some of the methods on this service return "paged" results,
177
+ // (e.g. 50 results at a time, with tokens to get subsequent
178
+ // pages). Denote the keys used for pagination and results.
179
+ this.descriptors.page = {
180
+ listCollections: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'collections'),
181
+ listIndexes: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'indexes')
182
+ };
183
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
184
+ // This API contains "long-running operations", which return a
185
+ // an Operation object that allows for tracking of the operation,
186
+ // rather than holding a request open.
187
+ const lroOptions = {
188
+ auth: this.auth,
189
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
190
+ };
191
+ if (opts.fallback) {
192
+ lroOptions.protoJson = protoFilesRoot;
193
+ lroOptions.httpRules = [{ selector: 'google.cloud.location.Locations.GetLocation', get: '/v1/{name=projects/*/locations/*}', }, { selector: 'google.cloud.location.Locations.ListLocations', get: '/v1/{name=projects/*}/locations', }, { selector: 'google.longrunning.Operations.CancelOperation', post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', body: '*', }, { selector: 'google.longrunning.Operations.DeleteOperation', delete: '/v1/{name=projects/*/locations/*/operations/*}', }, { selector: 'google.longrunning.Operations.GetOperation', get: '/v1/{name=projects/*/locations/*/operations/*}', }, { selector: 'google.longrunning.Operations.ListOperations', get: '/v1/{name=projects/*/locations/*}/operations', }];
194
+ }
195
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
196
+ const createCollectionResponse = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.Collection');
197
+ const createCollectionMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.OperationMetadata');
198
+ const updateCollectionResponse = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.Collection');
199
+ const updateCollectionMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.OperationMetadata');
200
+ const deleteCollectionResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
201
+ const deleteCollectionMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.OperationMetadata');
202
+ const createIndexResponse = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.Index');
203
+ const createIndexMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.OperationMetadata');
204
+ const deleteIndexResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
205
+ const deleteIndexMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.OperationMetadata');
206
+ const importDataObjectsResponse = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.ImportDataObjectsResponse');
207
+ const importDataObjectsMetadata = protoFilesRoot.lookup('.google.cloud.vectorsearch.v1.ImportDataObjectsMetadata');
208
+ this.descriptors.longrunning = {
209
+ createCollection: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createCollectionResponse.decode.bind(createCollectionResponse), createCollectionMetadata.decode.bind(createCollectionMetadata)),
210
+ updateCollection: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateCollectionResponse.decode.bind(updateCollectionResponse), updateCollectionMetadata.decode.bind(updateCollectionMetadata)),
211
+ deleteCollection: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteCollectionResponse.decode.bind(deleteCollectionResponse), deleteCollectionMetadata.decode.bind(deleteCollectionMetadata)),
212
+ createIndex: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createIndexResponse.decode.bind(createIndexResponse), createIndexMetadata.decode.bind(createIndexMetadata)),
213
+ deleteIndex: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteIndexResponse.decode.bind(deleteIndexResponse), deleteIndexMetadata.decode.bind(deleteIndexMetadata)),
214
+ importDataObjects: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importDataObjectsResponse.decode.bind(importDataObjectsResponse), importDataObjectsMetadata.decode.bind(importDataObjectsMetadata))
215
+ };
216
+ // Put together the default options sent with requests.
217
+ this._defaults = this._gaxGrpc.constructSettings('google.cloud.vectorsearch.v1.VectorSearchService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
218
+ // Set up a dictionary of "inner API calls"; the core implementation
219
+ // of calling the API is handled in `google-gax`, with this code
220
+ // merely providing the destination and request information.
221
+ this.innerApiCalls = {};
222
+ // Add a warn function to the client constructor so it can be easily tested.
223
+ this.warn = this._gaxModule.warn;
224
+ }
225
+ /**
226
+ * Initialize the client.
227
+ * Performs asynchronous operations (such as authentication) and prepares the client.
228
+ * This function will be called automatically when any class method is called for the
229
+ * first time, but if you need to initialize it before calling an actual method,
230
+ * feel free to call initialize() directly.
231
+ *
232
+ * You can await on this method if you want to make sure the client is initialized.
233
+ *
234
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
235
+ */
236
+ initialize() {
237
+ // If the client stub promise is already initialized, return immediately.
238
+ if (this.vectorSearchServiceStub) {
239
+ return this.vectorSearchServiceStub;
240
+ }
241
+ // Put together the "service stub" for
242
+ // google.cloud.vectorsearch.v1.VectorSearchService.
243
+ this.vectorSearchServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
244
+ this._protos.lookupService('google.cloud.vectorsearch.v1.VectorSearchService') :
245
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
+ this._protos.google.cloud.vectorsearch.v1.VectorSearchService, this._opts, this._providedCustomServicePath);
247
+ // Iterate over each of the methods that the service provides
248
+ // and create an API call method for each.
249
+ const vectorSearchServiceStubMethods = ['listCollections', 'getCollection', 'createCollection', 'updateCollection', 'deleteCollection', 'listIndexes', 'getIndex', 'createIndex', 'deleteIndex', 'importDataObjects'];
250
+ for (const methodName of vectorSearchServiceStubMethods) {
251
+ const callPromise = this.vectorSearchServiceStub.then(stub => (...args) => {
252
+ if (this._terminated) {
253
+ return Promise.reject('The client has already been closed.');
254
+ }
255
+ const func = stub[methodName];
256
+ return func.apply(stub, args);
257
+ }, (err) => () => {
258
+ throw err;
259
+ });
260
+ const descriptor = this.descriptors.page[methodName] ||
261
+ this.descriptors.longrunning[methodName] ||
262
+ undefined;
263
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
264
+ this.innerApiCalls[methodName] = apiCall;
265
+ }
266
+ return this.vectorSearchServiceStub;
267
+ }
268
+ /**
269
+ * The DNS address for this API service.
270
+ * @deprecated Use the apiEndpoint method of the client instance.
271
+ * @returns {string} The DNS address for this service.
272
+ */
273
+ static get servicePath() {
274
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
275
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
276
+ }
277
+ return 'vectorsearch.googleapis.com';
278
+ }
279
+ /**
280
+ * The DNS address for this API service - same as servicePath.
281
+ * @deprecated Use the apiEndpoint method of the client instance.
282
+ * @returns {string} The DNS address for this service.
283
+ */
284
+ static get apiEndpoint() {
285
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
286
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
287
+ }
288
+ return 'vectorsearch.googleapis.com';
289
+ }
290
+ /**
291
+ * The DNS address for this API service.
292
+ * @returns {string} The DNS address for this service.
293
+ */
294
+ get apiEndpoint() {
295
+ return this._servicePath;
296
+ }
297
+ get universeDomain() {
298
+ return this._universeDomain;
299
+ }
300
+ /**
301
+ * The port for this API service.
302
+ * @returns {number} The default port for this service.
303
+ */
304
+ static get port() {
305
+ return 443;
306
+ }
307
+ /**
308
+ * The scopes needed to make gRPC calls for every method defined
309
+ * in this service.
310
+ * @returns {string[]} List of default scopes.
311
+ */
312
+ static get scopes() {
313
+ return [
314
+ 'https://www.googleapis.com/auth/cloud-platform'
315
+ ];
316
+ }
317
+ /**
318
+ * Return the project ID used by this class.
319
+ * @returns {Promise} A promise that resolves to string containing the project ID.
320
+ */
321
+ getProjectId(callback) {
322
+ if (callback) {
323
+ this.auth.getProjectId(callback);
324
+ return;
325
+ }
326
+ return this.auth.getProjectId();
327
+ }
328
+ getCollection(request, optionsOrCallback, callback) {
329
+ request = request || {};
330
+ let options;
331
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
332
+ callback = optionsOrCallback;
333
+ options = {};
334
+ }
335
+ else {
336
+ options = optionsOrCallback;
337
+ }
338
+ options = options || {};
339
+ options.otherArgs = options.otherArgs || {};
340
+ options.otherArgs.headers = options.otherArgs.headers || {};
341
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
342
+ 'name': request.name ?? '',
343
+ });
344
+ this.initialize().catch(err => { throw err; });
345
+ this._log.info('getCollection request %j', request);
346
+ const wrappedCallback = callback
347
+ ? (error, response, options, rawResponse) => {
348
+ this._log.info('getCollection response %j', response);
349
+ callback(error, response, options, rawResponse); // We verified callback above.
350
+ }
351
+ : undefined;
352
+ return this.innerApiCalls.getCollection(request, options, wrappedCallback)
353
+ ?.then(([response, options, rawResponse]) => {
354
+ this._log.info('getCollection response %j', response);
355
+ return [response, options, rawResponse];
356
+ }).catch((error) => {
357
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
358
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
359
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
360
+ }
361
+ throw error;
362
+ });
363
+ }
364
+ getIndex(request, optionsOrCallback, callback) {
365
+ request = request || {};
366
+ let options;
367
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
368
+ callback = optionsOrCallback;
369
+ options = {};
370
+ }
371
+ else {
372
+ options = optionsOrCallback;
373
+ }
374
+ options = options || {};
375
+ options.otherArgs = options.otherArgs || {};
376
+ options.otherArgs.headers = options.otherArgs.headers || {};
377
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
378
+ 'name': request.name ?? '',
379
+ });
380
+ this.initialize().catch(err => { throw err; });
381
+ this._log.info('getIndex request %j', request);
382
+ const wrappedCallback = callback
383
+ ? (error, response, options, rawResponse) => {
384
+ this._log.info('getIndex response %j', response);
385
+ callback(error, response, options, rawResponse); // We verified callback above.
386
+ }
387
+ : undefined;
388
+ return this.innerApiCalls.getIndex(request, options, wrappedCallback)
389
+ ?.then(([response, options, rawResponse]) => {
390
+ this._log.info('getIndex response %j', response);
391
+ return [response, options, rawResponse];
392
+ }).catch((error) => {
393
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
394
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
395
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
396
+ }
397
+ throw error;
398
+ });
399
+ }
400
+ createCollection(request, optionsOrCallback, callback) {
401
+ request = request || {};
402
+ let options;
403
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
404
+ callback = optionsOrCallback;
405
+ options = {};
406
+ }
407
+ else {
408
+ options = optionsOrCallback;
409
+ }
410
+ options = options || {};
411
+ options.otherArgs = options.otherArgs || {};
412
+ options.otherArgs.headers = options.otherArgs.headers || {};
413
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
414
+ 'parent': request.parent ?? '',
415
+ });
416
+ this.initialize().catch(err => { throw err; });
417
+ const wrappedCallback = callback
418
+ ? (error, response, rawResponse, _) => {
419
+ this._log.info('createCollection response %j', rawResponse);
420
+ callback(error, response, rawResponse, _); // We verified callback above.
421
+ }
422
+ : undefined;
423
+ this._log.info('createCollection request %j', request);
424
+ return this.innerApiCalls.createCollection(request, options, wrappedCallback)
425
+ ?.then(([response, rawResponse, _]) => {
426
+ this._log.info('createCollection response %j', rawResponse);
427
+ return [response, rawResponse, _];
428
+ });
429
+ }
430
+ /**
431
+ * Check the status of the long running operation returned by `createCollection()`.
432
+ * @param {String} name
433
+ * The operation name that will be passed.
434
+ * @returns {Promise} - The promise which resolves to an object.
435
+ * The decoded operation object has result and metadata field to get information from.
436
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
437
+ * for more details and examples.
438
+ * @example <caption>include:samples/generated/v1/vector_search_service.create_collection.js</caption>
439
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_CreateCollection_async
440
+ */
441
+ async checkCreateCollectionProgress(name) {
442
+ this._log.info('createCollection long-running');
443
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
444
+ const [operation] = await this.operationsClient.getOperation(request);
445
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCollection, this._gaxModule.createDefaultBackoffSettings());
446
+ return decodeOperation;
447
+ }
448
+ updateCollection(request, optionsOrCallback, callback) {
449
+ request = request || {};
450
+ let options;
451
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
452
+ callback = optionsOrCallback;
453
+ options = {};
454
+ }
455
+ else {
456
+ options = optionsOrCallback;
457
+ }
458
+ options = options || {};
459
+ options.otherArgs = options.otherArgs || {};
460
+ options.otherArgs.headers = options.otherArgs.headers || {};
461
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
462
+ 'collection.name': request.collection.name ?? '',
463
+ });
464
+ this.initialize().catch(err => { throw err; });
465
+ const wrappedCallback = callback
466
+ ? (error, response, rawResponse, _) => {
467
+ this._log.info('updateCollection response %j', rawResponse);
468
+ callback(error, response, rawResponse, _); // We verified callback above.
469
+ }
470
+ : undefined;
471
+ this._log.info('updateCollection request %j', request);
472
+ return this.innerApiCalls.updateCollection(request, options, wrappedCallback)
473
+ ?.then(([response, rawResponse, _]) => {
474
+ this._log.info('updateCollection response %j', rawResponse);
475
+ return [response, rawResponse, _];
476
+ });
477
+ }
478
+ /**
479
+ * Check the status of the long running operation returned by `updateCollection()`.
480
+ * @param {String} name
481
+ * The operation name that will be passed.
482
+ * @returns {Promise} - The promise which resolves to an object.
483
+ * The decoded operation object has result and metadata field to get information from.
484
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
485
+ * for more details and examples.
486
+ * @example <caption>include:samples/generated/v1/vector_search_service.update_collection.js</caption>
487
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_UpdateCollection_async
488
+ */
489
+ async checkUpdateCollectionProgress(name) {
490
+ this._log.info('updateCollection long-running');
491
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
492
+ const [operation] = await this.operationsClient.getOperation(request);
493
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateCollection, this._gaxModule.createDefaultBackoffSettings());
494
+ return decodeOperation;
495
+ }
496
+ deleteCollection(request, optionsOrCallback, callback) {
497
+ request = request || {};
498
+ let options;
499
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
500
+ callback = optionsOrCallback;
501
+ options = {};
502
+ }
503
+ else {
504
+ options = optionsOrCallback;
505
+ }
506
+ options = options || {};
507
+ options.otherArgs = options.otherArgs || {};
508
+ options.otherArgs.headers = options.otherArgs.headers || {};
509
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
510
+ 'name': request.name ?? '',
511
+ });
512
+ this.initialize().catch(err => { throw err; });
513
+ const wrappedCallback = callback
514
+ ? (error, response, rawResponse, _) => {
515
+ this._log.info('deleteCollection response %j', rawResponse);
516
+ callback(error, response, rawResponse, _); // We verified callback above.
517
+ }
518
+ : undefined;
519
+ this._log.info('deleteCollection request %j', request);
520
+ return this.innerApiCalls.deleteCollection(request, options, wrappedCallback)
521
+ ?.then(([response, rawResponse, _]) => {
522
+ this._log.info('deleteCollection response %j', rawResponse);
523
+ return [response, rawResponse, _];
524
+ });
525
+ }
526
+ /**
527
+ * Check the status of the long running operation returned by `deleteCollection()`.
528
+ * @param {String} name
529
+ * The operation name that will be passed.
530
+ * @returns {Promise} - The promise which resolves to an object.
531
+ * The decoded operation object has result and metadata field to get information from.
532
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
533
+ * for more details and examples.
534
+ * @example <caption>include:samples/generated/v1/vector_search_service.delete_collection.js</caption>
535
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_DeleteCollection_async
536
+ */
537
+ async checkDeleteCollectionProgress(name) {
538
+ this._log.info('deleteCollection long-running');
539
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
540
+ const [operation] = await this.operationsClient.getOperation(request);
541
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCollection, this._gaxModule.createDefaultBackoffSettings());
542
+ return decodeOperation;
543
+ }
544
+ createIndex(request, optionsOrCallback, callback) {
545
+ request = request || {};
546
+ let options;
547
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
548
+ callback = optionsOrCallback;
549
+ options = {};
550
+ }
551
+ else {
552
+ options = optionsOrCallback;
553
+ }
554
+ options = options || {};
555
+ options.otherArgs = options.otherArgs || {};
556
+ options.otherArgs.headers = options.otherArgs.headers || {};
557
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
558
+ 'parent': request.parent ?? '',
559
+ });
560
+ this.initialize().catch(err => { throw err; });
561
+ const wrappedCallback = callback
562
+ ? (error, response, rawResponse, _) => {
563
+ this._log.info('createIndex response %j', rawResponse);
564
+ callback(error, response, rawResponse, _); // We verified callback above.
565
+ }
566
+ : undefined;
567
+ this._log.info('createIndex request %j', request);
568
+ return this.innerApiCalls.createIndex(request, options, wrappedCallback)
569
+ ?.then(([response, rawResponse, _]) => {
570
+ this._log.info('createIndex response %j', rawResponse);
571
+ return [response, rawResponse, _];
572
+ });
573
+ }
574
+ /**
575
+ * Check the status of the long running operation returned by `createIndex()`.
576
+ * @param {String} name
577
+ * The operation name that will be passed.
578
+ * @returns {Promise} - The promise which resolves to an object.
579
+ * The decoded operation object has result and metadata field to get information from.
580
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
581
+ * for more details and examples.
582
+ * @example <caption>include:samples/generated/v1/vector_search_service.create_index.js</caption>
583
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_CreateIndex_async
584
+ */
585
+ async checkCreateIndexProgress(name) {
586
+ this._log.info('createIndex long-running');
587
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
588
+ const [operation] = await this.operationsClient.getOperation(request);
589
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createIndex, this._gaxModule.createDefaultBackoffSettings());
590
+ return decodeOperation;
591
+ }
592
+ deleteIndex(request, optionsOrCallback, callback) {
593
+ request = request || {};
594
+ let options;
595
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
596
+ callback = optionsOrCallback;
597
+ options = {};
598
+ }
599
+ else {
600
+ options = optionsOrCallback;
601
+ }
602
+ options = options || {};
603
+ options.otherArgs = options.otherArgs || {};
604
+ options.otherArgs.headers = options.otherArgs.headers || {};
605
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
606
+ 'name': request.name ?? '',
607
+ });
608
+ this.initialize().catch(err => { throw err; });
609
+ const wrappedCallback = callback
610
+ ? (error, response, rawResponse, _) => {
611
+ this._log.info('deleteIndex response %j', rawResponse);
612
+ callback(error, response, rawResponse, _); // We verified callback above.
613
+ }
614
+ : undefined;
615
+ this._log.info('deleteIndex request %j', request);
616
+ return this.innerApiCalls.deleteIndex(request, options, wrappedCallback)
617
+ ?.then(([response, rawResponse, _]) => {
618
+ this._log.info('deleteIndex response %j', rawResponse);
619
+ return [response, rawResponse, _];
620
+ });
621
+ }
622
+ /**
623
+ * Check the status of the long running operation returned by `deleteIndex()`.
624
+ * @param {String} name
625
+ * The operation name that will be passed.
626
+ * @returns {Promise} - The promise which resolves to an object.
627
+ * The decoded operation object has result and metadata field to get information from.
628
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
629
+ * for more details and examples.
630
+ * @example <caption>include:samples/generated/v1/vector_search_service.delete_index.js</caption>
631
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_DeleteIndex_async
632
+ */
633
+ async checkDeleteIndexProgress(name) {
634
+ this._log.info('deleteIndex long-running');
635
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
636
+ const [operation] = await this.operationsClient.getOperation(request);
637
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteIndex, this._gaxModule.createDefaultBackoffSettings());
638
+ return decodeOperation;
639
+ }
640
+ importDataObjects(request, optionsOrCallback, callback) {
641
+ request = request || {};
642
+ let options;
643
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
644
+ callback = optionsOrCallback;
645
+ options = {};
646
+ }
647
+ else {
648
+ options = optionsOrCallback;
649
+ }
650
+ options = options || {};
651
+ options.otherArgs = options.otherArgs || {};
652
+ options.otherArgs.headers = options.otherArgs.headers || {};
653
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
654
+ 'name': request.name ?? '',
655
+ });
656
+ this.initialize().catch(err => { throw err; });
657
+ const wrappedCallback = callback
658
+ ? (error, response, rawResponse, _) => {
659
+ this._log.info('importDataObjects response %j', rawResponse);
660
+ callback(error, response, rawResponse, _); // We verified callback above.
661
+ }
662
+ : undefined;
663
+ this._log.info('importDataObjects request %j', request);
664
+ return this.innerApiCalls.importDataObjects(request, options, wrappedCallback)
665
+ ?.then(([response, rawResponse, _]) => {
666
+ this._log.info('importDataObjects response %j', rawResponse);
667
+ return [response, rawResponse, _];
668
+ });
669
+ }
670
+ /**
671
+ * Check the status of the long running operation returned by `importDataObjects()`.
672
+ * @param {String} name
673
+ * The operation name that will be passed.
674
+ * @returns {Promise} - The promise which resolves to an object.
675
+ * The decoded operation object has result and metadata field to get information from.
676
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
677
+ * for more details and examples.
678
+ * @example <caption>include:samples/generated/v1/vector_search_service.import_data_objects.js</caption>
679
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_ImportDataObjects_async
680
+ */
681
+ async checkImportDataObjectsProgress(name) {
682
+ this._log.info('importDataObjects long-running');
683
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
684
+ const [operation] = await this.operationsClient.getOperation(request);
685
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDataObjects, this._gaxModule.createDefaultBackoffSettings());
686
+ return decodeOperation;
687
+ }
688
+ listCollections(request, optionsOrCallback, callback) {
689
+ request = request || {};
690
+ let options;
691
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
692
+ callback = optionsOrCallback;
693
+ options = {};
694
+ }
695
+ else {
696
+ options = optionsOrCallback;
697
+ }
698
+ options = options || {};
699
+ options.otherArgs = options.otherArgs || {};
700
+ options.otherArgs.headers = options.otherArgs.headers || {};
701
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
702
+ 'parent': request.parent ?? '',
703
+ });
704
+ this.initialize().catch(err => { throw err; });
705
+ const wrappedCallback = callback
706
+ ? (error, values, nextPageRequest, rawResponse) => {
707
+ this._log.info('listCollections values %j', values);
708
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
709
+ }
710
+ : undefined;
711
+ this._log.info('listCollections request %j', request);
712
+ return this.innerApiCalls
713
+ .listCollections(request, options, wrappedCallback)
714
+ ?.then(([response, input, output]) => {
715
+ this._log.info('listCollections values %j', response);
716
+ return [response, input, output];
717
+ });
718
+ }
719
+ /**
720
+ * Equivalent to `listCollections`, but returns a NodeJS Stream object.
721
+ * @param {Object} request
722
+ * The request object that will be sent.
723
+ * @param {string} request.parent
724
+ * Required. Parent value for ListCollectionsRequest
725
+ * @param {number} [request.pageSize]
726
+ * Optional. Requested page size. Server may return fewer items than
727
+ * requested. If unspecified, server will pick an appropriate default.
728
+ * @param {string} [request.pageToken]
729
+ * Optional. A token identifying a page of results the server should return.
730
+ * @param {string} [request.filter]
731
+ * Optional. Filtering results
732
+ * @param {string} [request.orderBy]
733
+ * Optional. Hint for how to order the results
734
+ * @param {object} [options]
735
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
736
+ * @returns {Stream}
737
+ * An object stream which emits an object representing {@link protos.google.cloud.vectorsearch.v1.Collection|Collection} on 'data' event.
738
+ * The client library will perform auto-pagination by default: it will call the API as many
739
+ * times as needed. Note that it can affect your quota.
740
+ * We recommend using `listCollectionsAsync()`
741
+ * method described below for async iteration which you can stop as needed.
742
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
743
+ * for more details and examples.
744
+ */
745
+ listCollectionsStream(request, options) {
746
+ request = request || {};
747
+ options = options || {};
748
+ options.otherArgs = options.otherArgs || {};
749
+ options.otherArgs.headers = options.otherArgs.headers || {};
750
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
751
+ 'parent': request.parent ?? '',
752
+ });
753
+ const defaultCallSettings = this._defaults['listCollections'];
754
+ const callSettings = defaultCallSettings.merge(options);
755
+ this.initialize().catch(err => { throw err; });
756
+ this._log.info('listCollections stream %j', request);
757
+ return this.descriptors.page.listCollections.createStream(this.innerApiCalls.listCollections, request, callSettings);
758
+ }
759
+ /**
760
+ * Equivalent to `listCollections`, but returns an iterable object.
761
+ *
762
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
763
+ * @param {Object} request
764
+ * The request object that will be sent.
765
+ * @param {string} request.parent
766
+ * Required. Parent value for ListCollectionsRequest
767
+ * @param {number} [request.pageSize]
768
+ * Optional. Requested page size. Server may return fewer items than
769
+ * requested. If unspecified, server will pick an appropriate default.
770
+ * @param {string} [request.pageToken]
771
+ * Optional. A token identifying a page of results the server should return.
772
+ * @param {string} [request.filter]
773
+ * Optional. Filtering results
774
+ * @param {string} [request.orderBy]
775
+ * Optional. Hint for how to order the results
776
+ * @param {object} [options]
777
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
778
+ * @returns {Object}
779
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
780
+ * When you iterate the returned iterable, each element will be an object representing
781
+ * {@link protos.google.cloud.vectorsearch.v1.Collection|Collection}. The API will be called under the hood as needed, once per the page,
782
+ * so you can stop the iteration when you don't need more results.
783
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
784
+ * for more details and examples.
785
+ * @example <caption>include:samples/generated/v1/vector_search_service.list_collections.js</caption>
786
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_ListCollections_async
787
+ */
788
+ listCollectionsAsync(request, options) {
789
+ request = request || {};
790
+ options = options || {};
791
+ options.otherArgs = options.otherArgs || {};
792
+ options.otherArgs.headers = options.otherArgs.headers || {};
793
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
794
+ 'parent': request.parent ?? '',
795
+ });
796
+ const defaultCallSettings = this._defaults['listCollections'];
797
+ const callSettings = defaultCallSettings.merge(options);
798
+ this.initialize().catch(err => { throw err; });
799
+ this._log.info('listCollections iterate %j', request);
800
+ return this.descriptors.page.listCollections.asyncIterate(this.innerApiCalls['listCollections'], request, callSettings);
801
+ }
802
+ listIndexes(request, optionsOrCallback, callback) {
803
+ request = request || {};
804
+ let options;
805
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
806
+ callback = optionsOrCallback;
807
+ options = {};
808
+ }
809
+ else {
810
+ options = optionsOrCallback;
811
+ }
812
+ options = options || {};
813
+ options.otherArgs = options.otherArgs || {};
814
+ options.otherArgs.headers = options.otherArgs.headers || {};
815
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
816
+ 'parent': request.parent ?? '',
817
+ });
818
+ this.initialize().catch(err => { throw err; });
819
+ const wrappedCallback = callback
820
+ ? (error, values, nextPageRequest, rawResponse) => {
821
+ this._log.info('listIndexes values %j', values);
822
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
823
+ }
824
+ : undefined;
825
+ this._log.info('listIndexes request %j', request);
826
+ return this.innerApiCalls
827
+ .listIndexes(request, options, wrappedCallback)
828
+ ?.then(([response, input, output]) => {
829
+ this._log.info('listIndexes values %j', response);
830
+ return [response, input, output];
831
+ });
832
+ }
833
+ /**
834
+ * Equivalent to `listIndexes`, but returns a NodeJS Stream object.
835
+ * @param {Object} request
836
+ * The request object that will be sent.
837
+ * @param {string} request.parent
838
+ * Required. Parent value for ListIndexesRequest
839
+ * @param {number} [request.pageSize]
840
+ * Optional. Requested page size. Server may return fewer items than
841
+ * requested. If unspecified, server will pick an appropriate default.
842
+ * @param {string} [request.pageToken]
843
+ * Optional. A token identifying a page of results the server should return.
844
+ * @param {string} [request.filter]
845
+ * Optional. Filtering results
846
+ * @param {string} [request.orderBy]
847
+ * Optional. Hint for how to order the results
848
+ * @param {object} [options]
849
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
850
+ * @returns {Stream}
851
+ * An object stream which emits an object representing {@link protos.google.cloud.vectorsearch.v1.Index|Index} on 'data' event.
852
+ * The client library will perform auto-pagination by default: it will call the API as many
853
+ * times as needed. Note that it can affect your quota.
854
+ * We recommend using `listIndexesAsync()`
855
+ * method described below for async iteration which you can stop as needed.
856
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
857
+ * for more details and examples.
858
+ */
859
+ listIndexesStream(request, options) {
860
+ request = request || {};
861
+ options = options || {};
862
+ options.otherArgs = options.otherArgs || {};
863
+ options.otherArgs.headers = options.otherArgs.headers || {};
864
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
865
+ 'parent': request.parent ?? '',
866
+ });
867
+ const defaultCallSettings = this._defaults['listIndexes'];
868
+ const callSettings = defaultCallSettings.merge(options);
869
+ this.initialize().catch(err => { throw err; });
870
+ this._log.info('listIndexes stream %j', request);
871
+ return this.descriptors.page.listIndexes.createStream(this.innerApiCalls.listIndexes, request, callSettings);
872
+ }
873
+ /**
874
+ * Equivalent to `listIndexes`, but returns an iterable object.
875
+ *
876
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
877
+ * @param {Object} request
878
+ * The request object that will be sent.
879
+ * @param {string} request.parent
880
+ * Required. Parent value for ListIndexesRequest
881
+ * @param {number} [request.pageSize]
882
+ * Optional. Requested page size. Server may return fewer items than
883
+ * requested. If unspecified, server will pick an appropriate default.
884
+ * @param {string} [request.pageToken]
885
+ * Optional. A token identifying a page of results the server should return.
886
+ * @param {string} [request.filter]
887
+ * Optional. Filtering results
888
+ * @param {string} [request.orderBy]
889
+ * Optional. Hint for how to order the results
890
+ * @param {object} [options]
891
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
892
+ * @returns {Object}
893
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
894
+ * When you iterate the returned iterable, each element will be an object representing
895
+ * {@link protos.google.cloud.vectorsearch.v1.Index|Index}. The API will be called under the hood as needed, once per the page,
896
+ * so you can stop the iteration when you don't need more results.
897
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
898
+ * for more details and examples.
899
+ * @example <caption>include:samples/generated/v1/vector_search_service.list_indexes.js</caption>
900
+ * region_tag:vectorsearch_v1_generated_VectorSearchService_ListIndexes_async
901
+ */
902
+ listIndexesAsync(request, options) {
903
+ request = request || {};
904
+ options = options || {};
905
+ options.otherArgs = options.otherArgs || {};
906
+ options.otherArgs.headers = options.otherArgs.headers || {};
907
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
908
+ 'parent': request.parent ?? '',
909
+ });
910
+ const defaultCallSettings = this._defaults['listIndexes'];
911
+ const callSettings = defaultCallSettings.merge(options);
912
+ this.initialize().catch(err => { throw err; });
913
+ this._log.info('listIndexes iterate %j', request);
914
+ return this.descriptors.page.listIndexes.asyncIterate(this.innerApiCalls['listIndexes'], request, callSettings);
915
+ }
916
+ /**
917
+ * Gets information about a location.
918
+ *
919
+ * @param {Object} request
920
+ * The request object that will be sent.
921
+ * @param {string} request.name
922
+ * Resource name for the location.
923
+ * @param {object} [options]
924
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
925
+ * @returns {Promise} - The promise which resolves to an array.
926
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
927
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
928
+ * for more details and examples.
929
+ * @example
930
+ * ```
931
+ * const [response] = await client.getLocation(request);
932
+ * ```
933
+ */
934
+ getLocation(request, options, callback) {
935
+ return this.locationsClient.getLocation(request, options, callback);
936
+ }
937
+ /**
938
+ * Lists information about the supported locations for this service. Returns an iterable object.
939
+ *
940
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
941
+ * @param {Object} request
942
+ * The request object that will be sent.
943
+ * @param {string} request.name
944
+ * The resource that owns the locations collection, if applicable.
945
+ * @param {string} request.filter
946
+ * The standard list filter.
947
+ * @param {number} request.pageSize
948
+ * The standard list page size.
949
+ * @param {string} request.pageToken
950
+ * The standard list page token.
951
+ * @param {object} [options]
952
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
953
+ * @returns {Object}
954
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
955
+ * When you iterate the returned iterable, each element will be an object representing
956
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
957
+ * so you can stop the iteration when you don't need more results.
958
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
959
+ * for more details and examples.
960
+ * @example
961
+ * ```
962
+ * const iterable = client.listLocationsAsync(request);
963
+ * for await (const response of iterable) {
964
+ * // process response
965
+ * }
966
+ * ```
967
+ */
968
+ listLocationsAsync(request, options) {
969
+ return this.locationsClient.listLocationsAsync(request, options);
970
+ }
971
+ /**
972
+ * Gets the latest state of a long-running operation. Clients can use this
973
+ * method to poll the operation result at intervals as recommended by the API
974
+ * service.
975
+ *
976
+ * @param {Object} request - The request object that will be sent.
977
+ * @param {string} request.name - The name of the operation resource.
978
+ * @param {Object=} options
979
+ * Optional parameters. You can override the default settings for this call,
980
+ * e.g, timeout, retries, paginations, etc. See {@link
981
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
982
+ * for the details.
983
+ * @param {function(?Error, ?Object)=} callback
984
+ * The function which will be called with the result of the API call.
985
+ *
986
+ * The second parameter to the callback is an object representing
987
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
988
+ * @return {Promise} - The promise which resolves to an array.
989
+ * The first element of the array is an object representing
990
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
991
+ * The promise has a method named "cancel" which cancels the ongoing API call.
992
+ *
993
+ * @example
994
+ * ```
995
+ * const client = longrunning.operationsClient();
996
+ * const name = '';
997
+ * const [response] = await client.getOperation({name});
998
+ * // doThingsWith(response)
999
+ * ```
1000
+ */
1001
+ getOperation(request, optionsOrCallback, callback) {
1002
+ let options;
1003
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1004
+ callback = optionsOrCallback;
1005
+ options = {};
1006
+ }
1007
+ else {
1008
+ options = optionsOrCallback;
1009
+ }
1010
+ options = options || {};
1011
+ options.otherArgs = options.otherArgs || {};
1012
+ options.otherArgs.headers = options.otherArgs.headers || {};
1013
+ options.otherArgs.headers['x-goog-request-params'] =
1014
+ this._gaxModule.routingHeader.fromParams({
1015
+ name: request.name ?? '',
1016
+ });
1017
+ return this.operationsClient.getOperation(request, options, callback);
1018
+ }
1019
+ /**
1020
+ * Lists operations that match the specified filter in the request. If the
1021
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
1022
+ *
1023
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
1024
+ *
1025
+ * @param {Object} request - The request object that will be sent.
1026
+ * @param {string} request.name - The name of the operation collection.
1027
+ * @param {string} request.filter - The standard list filter.
1028
+ * @param {number=} request.pageSize -
1029
+ * The maximum number of resources contained in the underlying API
1030
+ * response. If page streaming is performed per-resource, this
1031
+ * parameter does not affect the return value. If page streaming is
1032
+ * performed per-page, this determines the maximum number of
1033
+ * resources in a page.
1034
+ * @param {Object=} options
1035
+ * Optional parameters. You can override the default settings for this call,
1036
+ * e.g, timeout, retries, paginations, etc. See {@link
1037
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
1038
+ * details.
1039
+ * @returns {Object}
1040
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
1041
+ *
1042
+ * @example
1043
+ * ```
1044
+ * const client = longrunning.operationsClient();
1045
+ * for await (const response of client.listOperationsAsync(request));
1046
+ * // doThingsWith(response)
1047
+ * ```
1048
+ */
1049
+ listOperationsAsync(request, options) {
1050
+ options = options || {};
1051
+ options.otherArgs = options.otherArgs || {};
1052
+ options.otherArgs.headers = options.otherArgs.headers || {};
1053
+ options.otherArgs.headers['x-goog-request-params'] =
1054
+ this._gaxModule.routingHeader.fromParams({
1055
+ name: request.name ?? '',
1056
+ });
1057
+ return this.operationsClient.listOperationsAsync(request, options);
1058
+ }
1059
+ /**
1060
+ * Starts asynchronous cancellation on a long-running operation. The server
1061
+ * makes a best effort to cancel the operation, but success is not
1062
+ * guaranteed. If the server doesn't support this method, it returns
1063
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
1064
+ * {@link Operations.GetOperation} or
1065
+ * other methods to check whether the cancellation succeeded or whether the
1066
+ * operation completed despite cancellation. On successful cancellation,
1067
+ * the operation is not deleted; instead, it becomes an operation with
1068
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
1069
+ * 1, corresponding to `Code.CANCELLED`.
1070
+ *
1071
+ * @param {Object} request - The request object that will be sent.
1072
+ * @param {string} request.name - The name of the operation resource to be cancelled.
1073
+ * @param {Object=} options
1074
+ * Optional parameters. You can override the default settings for this call,
1075
+ * e.g, timeout, retries, paginations, etc. See {@link
1076
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
1077
+ * details.
1078
+ * @param {function(?Error)=} callback
1079
+ * The function which will be called with the result of the API call.
1080
+ * @return {Promise} - The promise which resolves when API call finishes.
1081
+ * The promise has a method named "cancel" which cancels the ongoing API
1082
+ * call.
1083
+ *
1084
+ * @example
1085
+ * ```
1086
+ * const client = longrunning.operationsClient();
1087
+ * await client.cancelOperation({name: ''});
1088
+ * ```
1089
+ */
1090
+ cancelOperation(request, optionsOrCallback, callback) {
1091
+ let options;
1092
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1093
+ callback = optionsOrCallback;
1094
+ options = {};
1095
+ }
1096
+ else {
1097
+ options = optionsOrCallback;
1098
+ }
1099
+ options = options || {};
1100
+ options.otherArgs = options.otherArgs || {};
1101
+ options.otherArgs.headers = options.otherArgs.headers || {};
1102
+ options.otherArgs.headers['x-goog-request-params'] =
1103
+ this._gaxModule.routingHeader.fromParams({
1104
+ name: request.name ?? '',
1105
+ });
1106
+ return this.operationsClient.cancelOperation(request, options, callback);
1107
+ }
1108
+ /**
1109
+ * Deletes a long-running operation. This method indicates that the client is
1110
+ * no longer interested in the operation result. It does not cancel the
1111
+ * operation. If the server doesn't support this method, it returns
1112
+ * `google.rpc.Code.UNIMPLEMENTED`.
1113
+ *
1114
+ * @param {Object} request - The request object that will be sent.
1115
+ * @param {string} request.name - The name of the operation resource to be deleted.
1116
+ * @param {Object=} options
1117
+ * Optional parameters. You can override the default settings for this call,
1118
+ * e.g, timeout, retries, paginations, etc. See {@link
1119
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1120
+ * for the details.
1121
+ * @param {function(?Error)=} callback
1122
+ * The function which will be called with the result of the API call.
1123
+ * @return {Promise} - The promise which resolves when API call finishes.
1124
+ * The promise has a method named "cancel" which cancels the ongoing API
1125
+ * call.
1126
+ *
1127
+ * @example
1128
+ * ```
1129
+ * const client = longrunning.operationsClient();
1130
+ * await client.deleteOperation({name: ''});
1131
+ * ```
1132
+ */
1133
+ deleteOperation(request, optionsOrCallback, callback) {
1134
+ let options;
1135
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1136
+ callback = optionsOrCallback;
1137
+ options = {};
1138
+ }
1139
+ else {
1140
+ options = optionsOrCallback;
1141
+ }
1142
+ options = options || {};
1143
+ options.otherArgs = options.otherArgs || {};
1144
+ options.otherArgs.headers = options.otherArgs.headers || {};
1145
+ options.otherArgs.headers['x-goog-request-params'] =
1146
+ this._gaxModule.routingHeader.fromParams({
1147
+ name: request.name ?? '',
1148
+ });
1149
+ return this.operationsClient.deleteOperation(request, options, callback);
1150
+ }
1151
+ // --------------------
1152
+ // -- Path templates --
1153
+ // --------------------
1154
+ /**
1155
+ * Return a fully-qualified collection resource name string.
1156
+ *
1157
+ * @param {string} project
1158
+ * @param {string} location
1159
+ * @param {string} collection
1160
+ * @returns {string} Resource name string.
1161
+ */
1162
+ collectionPath(project, location, collection) {
1163
+ return this.pathTemplates.collectionPathTemplate.render({
1164
+ project: project,
1165
+ location: location,
1166
+ collection: collection,
1167
+ });
1168
+ }
1169
+ /**
1170
+ * Parse the project from Collection resource.
1171
+ *
1172
+ * @param {string} collectionName
1173
+ * A fully-qualified path representing Collection resource.
1174
+ * @returns {string} A string representing the project.
1175
+ */
1176
+ matchProjectFromCollectionName(collectionName) {
1177
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).project;
1178
+ }
1179
+ /**
1180
+ * Parse the location from Collection resource.
1181
+ *
1182
+ * @param {string} collectionName
1183
+ * A fully-qualified path representing Collection resource.
1184
+ * @returns {string} A string representing the location.
1185
+ */
1186
+ matchLocationFromCollectionName(collectionName) {
1187
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).location;
1188
+ }
1189
+ /**
1190
+ * Parse the collection from Collection resource.
1191
+ *
1192
+ * @param {string} collectionName
1193
+ * A fully-qualified path representing Collection resource.
1194
+ * @returns {string} A string representing the collection.
1195
+ */
1196
+ matchCollectionFromCollectionName(collectionName) {
1197
+ return this.pathTemplates.collectionPathTemplate.match(collectionName).collection;
1198
+ }
1199
+ /**
1200
+ * Return a fully-qualified dataObject resource name string.
1201
+ *
1202
+ * @param {string} project
1203
+ * @param {string} location
1204
+ * @param {string} collection
1205
+ * @param {string} dataObject
1206
+ * @returns {string} Resource name string.
1207
+ */
1208
+ dataObjectPath(project, location, collection, dataObject) {
1209
+ return this.pathTemplates.dataObjectPathTemplate.render({
1210
+ project: project,
1211
+ location: location,
1212
+ collection: collection,
1213
+ dataObject: dataObject,
1214
+ });
1215
+ }
1216
+ /**
1217
+ * Parse the project from DataObject resource.
1218
+ *
1219
+ * @param {string} dataObjectName
1220
+ * A fully-qualified path representing DataObject resource.
1221
+ * @returns {string} A string representing the project.
1222
+ */
1223
+ matchProjectFromDataObjectName(dataObjectName) {
1224
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).project;
1225
+ }
1226
+ /**
1227
+ * Parse the location from DataObject resource.
1228
+ *
1229
+ * @param {string} dataObjectName
1230
+ * A fully-qualified path representing DataObject resource.
1231
+ * @returns {string} A string representing the location.
1232
+ */
1233
+ matchLocationFromDataObjectName(dataObjectName) {
1234
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).location;
1235
+ }
1236
+ /**
1237
+ * Parse the collection from DataObject resource.
1238
+ *
1239
+ * @param {string} dataObjectName
1240
+ * A fully-qualified path representing DataObject resource.
1241
+ * @returns {string} A string representing the collection.
1242
+ */
1243
+ matchCollectionFromDataObjectName(dataObjectName) {
1244
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).collection;
1245
+ }
1246
+ /**
1247
+ * Parse the dataObject from DataObject resource.
1248
+ *
1249
+ * @param {string} dataObjectName
1250
+ * A fully-qualified path representing DataObject resource.
1251
+ * @returns {string} A string representing the dataObject.
1252
+ */
1253
+ matchDataObjectFromDataObjectName(dataObjectName) {
1254
+ return this.pathTemplates.dataObjectPathTemplate.match(dataObjectName).dataObject;
1255
+ }
1256
+ /**
1257
+ * Return a fully-qualified index resource name string.
1258
+ *
1259
+ * @param {string} project
1260
+ * @param {string} location
1261
+ * @param {string} collection
1262
+ * @param {string} index
1263
+ * @returns {string} Resource name string.
1264
+ */
1265
+ indexPath(project, location, collection, index) {
1266
+ return this.pathTemplates.indexPathTemplate.render({
1267
+ project: project,
1268
+ location: location,
1269
+ collection: collection,
1270
+ index: index,
1271
+ });
1272
+ }
1273
+ /**
1274
+ * Parse the project from Index resource.
1275
+ *
1276
+ * @param {string} indexName
1277
+ * A fully-qualified path representing Index resource.
1278
+ * @returns {string} A string representing the project.
1279
+ */
1280
+ matchProjectFromIndexName(indexName) {
1281
+ return this.pathTemplates.indexPathTemplate.match(indexName).project;
1282
+ }
1283
+ /**
1284
+ * Parse the location from Index resource.
1285
+ *
1286
+ * @param {string} indexName
1287
+ * A fully-qualified path representing Index resource.
1288
+ * @returns {string} A string representing the location.
1289
+ */
1290
+ matchLocationFromIndexName(indexName) {
1291
+ return this.pathTemplates.indexPathTemplate.match(indexName).location;
1292
+ }
1293
+ /**
1294
+ * Parse the collection from Index resource.
1295
+ *
1296
+ * @param {string} indexName
1297
+ * A fully-qualified path representing Index resource.
1298
+ * @returns {string} A string representing the collection.
1299
+ */
1300
+ matchCollectionFromIndexName(indexName) {
1301
+ return this.pathTemplates.indexPathTemplate.match(indexName).collection;
1302
+ }
1303
+ /**
1304
+ * Parse the index from Index resource.
1305
+ *
1306
+ * @param {string} indexName
1307
+ * A fully-qualified path representing Index resource.
1308
+ * @returns {string} A string representing the index.
1309
+ */
1310
+ matchIndexFromIndexName(indexName) {
1311
+ return this.pathTemplates.indexPathTemplate.match(indexName).index;
1312
+ }
1313
+ /**
1314
+ * Return a fully-qualified location resource name string.
1315
+ *
1316
+ * @param {string} project
1317
+ * @param {string} location
1318
+ * @returns {string} Resource name string.
1319
+ */
1320
+ locationPath(project, location) {
1321
+ return this.pathTemplates.locationPathTemplate.render({
1322
+ project: project,
1323
+ location: location,
1324
+ });
1325
+ }
1326
+ /**
1327
+ * Parse the project from Location resource.
1328
+ *
1329
+ * @param {string} locationName
1330
+ * A fully-qualified path representing Location resource.
1331
+ * @returns {string} A string representing the project.
1332
+ */
1333
+ matchProjectFromLocationName(locationName) {
1334
+ return this.pathTemplates.locationPathTemplate.match(locationName).project;
1335
+ }
1336
+ /**
1337
+ * Parse the location from Location resource.
1338
+ *
1339
+ * @param {string} locationName
1340
+ * A fully-qualified path representing Location resource.
1341
+ * @returns {string} A string representing the location.
1342
+ */
1343
+ matchLocationFromLocationName(locationName) {
1344
+ return this.pathTemplates.locationPathTemplate.match(locationName).location;
1345
+ }
1346
+ /**
1347
+ * Return a fully-qualified project resource name string.
1348
+ *
1349
+ * @param {string} project
1350
+ * @returns {string} Resource name string.
1351
+ */
1352
+ projectPath(project) {
1353
+ return this.pathTemplates.projectPathTemplate.render({
1354
+ project: project,
1355
+ });
1356
+ }
1357
+ /**
1358
+ * Parse the project from Project resource.
1359
+ *
1360
+ * @param {string} projectName
1361
+ * A fully-qualified path representing Project resource.
1362
+ * @returns {string} A string representing the project.
1363
+ */
1364
+ matchProjectFromProjectName(projectName) {
1365
+ return this.pathTemplates.projectPathTemplate.match(projectName).project;
1366
+ }
1367
+ /**
1368
+ * Terminate the gRPC channel and close the client.
1369
+ *
1370
+ * The client will no longer be usable and all future behavior is undefined.
1371
+ * @returns {Promise} A promise that resolves when the client is closed.
1372
+ */
1373
+ close() {
1374
+ if (this.vectorSearchServiceStub && !this._terminated) {
1375
+ return this.vectorSearchServiceStub.then(stub => {
1376
+ this._log.info('ending gRPC channel');
1377
+ this._terminated = true;
1378
+ stub.close();
1379
+ this.locationsClient.close().catch(err => { throw err; });
1380
+ void this.operationsClient.close();
1381
+ });
1382
+ }
1383
+ return Promise.resolve();
1384
+ }
1385
+ }
1386
+ exports.VectorSearchServiceClient = VectorSearchServiceClient;
1387
+ //# sourceMappingURL=vector_search_service_client.js.map