@google-cloud/firestore-api 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 (58) hide show
  1. package/README.md +111 -0
  2. package/build/protos/google/firestore/admin/v1/backup.proto +112 -0
  3. package/build/protos/google/firestore/admin/v1/database.proto +403 -0
  4. package/build/protos/google/firestore/admin/v1/field.proto +154 -0
  5. package/build/protos/google/firestore/admin/v1/firestore_admin.proto +1229 -0
  6. package/build/protos/google/firestore/admin/v1/index.proto +378 -0
  7. package/build/protos/google/firestore/admin/v1/location.proto +30 -0
  8. package/build/protos/google/firestore/admin/v1/operation.proto +330 -0
  9. package/build/protos/google/firestore/admin/v1/realtime_updates.proto +40 -0
  10. package/build/protos/google/firestore/admin/v1/schedule.proto +95 -0
  11. package/build/protos/google/firestore/admin/v1/snapshot.proto +53 -0
  12. package/build/protos/google/firestore/admin/v1/user_creds.proto +86 -0
  13. package/build/protos/google/firestore/v1/aggregation_result.proto +43 -0
  14. package/build/protos/google/firestore/v1/bloom_filter.proto +73 -0
  15. package/build/protos/google/firestore/v1/common.proto +111 -0
  16. package/build/protos/google/firestore/v1/document.proto +247 -0
  17. package/build/protos/google/firestore/v1/explain_stats.proto +41 -0
  18. package/build/protos/google/firestore/v1/firestore.proto +1237 -0
  19. package/build/protos/google/firestore/v1/pipeline.proto +43 -0
  20. package/build/protos/google/firestore/v1/query.proto +600 -0
  21. package/build/protos/google/firestore/v1/query_profile.proto +92 -0
  22. package/build/protos/google/firestore/v1/write.proto +286 -0
  23. package/build/protos/google/firestore/v1beta1/common.proto +82 -0
  24. package/build/protos/google/firestore/v1beta1/document.proto +149 -0
  25. package/build/protos/google/firestore/v1beta1/firestore.proto +900 -0
  26. package/build/protos/google/firestore/v1beta1/query.proto +300 -0
  27. package/build/protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto +75 -0
  28. package/build/protos/google/firestore/v1beta1/write.proto +258 -0
  29. package/build/protos/protos.d.ts +35648 -0
  30. package/build/protos/protos.js +1 -0
  31. package/build/protos/protos.json +1 -0
  32. package/build/src/index.d.ts +13 -0
  33. package/build/src/index.js +30 -0
  34. package/build/src/index.js.map +1 -0
  35. package/build/src/v1/firestore_admin_client.d.ts +1925 -0
  36. package/build/src/v1/firestore_admin_client.js +2734 -0
  37. package/build/src/v1/firestore_admin_client.js.map +1 -0
  38. package/build/src/v1/firestore_admin_client_config.json +172 -0
  39. package/build/src/v1/firestore_admin_proto_list.json +13 -0
  40. package/build/src/v1/firestore_client.d.ts +1204 -0
  41. package/build/src/v1/firestore_client.js +1605 -0
  42. package/build/src/v1/firestore_client.js.map +1 -0
  43. package/build/src/v1/firestore_client_config.json +135 -0
  44. package/build/src/v1/firestore_proto_list.json +12 -0
  45. package/build/src/v1/gapic_metadata.json +351 -0
  46. package/build/src/v1/index.d.ts +2 -0
  47. package/build/src/v1/index.js +25 -0
  48. package/build/src/v1/index.js.map +1 -0
  49. package/build/src/v1beta1/firestore_client.d.ts +930 -0
  50. package/build/src/v1beta1/firestore_client.js +1310 -0
  51. package/build/src/v1beta1/firestore_client.js.map +1 -0
  52. package/build/src/v1beta1/firestore_client_config.json +99 -0
  53. package/build/src/v1beta1/firestore_proto_list.json +8 -0
  54. package/build/src/v1beta1/gapic_metadata.json +165 -0
  55. package/build/src/v1beta1/index.d.ts +1 -0
  56. package/build/src/v1beta1/index.js +23 -0
  57. package/build/src/v1beta1/index.js.map +1 -0
  58. package/package.json +65 -0
@@ -0,0 +1,2734 @@
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.FirestoreAdminClient = 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/firestore_admin_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./firestore_admin_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * The Cloud Firestore Admin API.
32
+ *
33
+ * This API provides several administrative services for Cloud Firestore.
34
+ *
35
+ * Project, Database, Namespace, Collection, Collection Group, and Document are
36
+ * used as defined in the Google Cloud Firestore API.
37
+ *
38
+ * Operation: An Operation represents work being performed in the background.
39
+ *
40
+ * The index service manages Cloud Firestore indexes.
41
+ *
42
+ * Index creation is performed asynchronously.
43
+ * An Operation resource is created for each such asynchronous operation.
44
+ * The state of the operation (including any errors encountered)
45
+ * may be queried via the Operation resource.
46
+ *
47
+ * The Operations collection provides a record of actions performed for the
48
+ * specified Project (including any Operations in progress). Operations are not
49
+ * created directly but through calls on other collections or resources.
50
+ *
51
+ * An Operation that is done may be deleted so that it is no longer listed as
52
+ * part of the Operation collection. Operations are garbage collected after
53
+ * 30 days. By default, ListOperations will only return in progress and failed
54
+ * operations. To list completed operation, issue a ListOperations request with
55
+ * the filter `done: true`.
56
+ *
57
+ * Operations are created by service `FirestoreAdmin`, but are accessed via
58
+ * service `google.longrunning.Operations`.
59
+ * @class
60
+ * @memberof v1
61
+ */
62
+ class FirestoreAdminClient {
63
+ _terminated = false;
64
+ _opts;
65
+ _providedCustomServicePath;
66
+ _gaxModule;
67
+ _gaxGrpc;
68
+ _protos;
69
+ _defaults;
70
+ _universeDomain;
71
+ _servicePath;
72
+ _log = google_gax_1.loggingUtils.log('firestore-api');
73
+ auth;
74
+ descriptors = {
75
+ page: {},
76
+ stream: {},
77
+ longrunning: {},
78
+ batching: {},
79
+ };
80
+ warn;
81
+ innerApiCalls;
82
+ locationsClient;
83
+ pathTemplates;
84
+ operationsClient;
85
+ firestoreAdminStub;
86
+ /**
87
+ * Construct an instance of FirestoreAdminClient.
88
+ *
89
+ * @param {object} [options] - The configuration object.
90
+ * The options accepted by the constructor are described in detail
91
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
92
+ * The common options are:
93
+ * @param {object} [options.credentials] - Credentials object.
94
+ * @param {string} [options.credentials.client_email]
95
+ * @param {string} [options.credentials.private_key]
96
+ * @param {string} [options.email] - Account email address. Required when
97
+ * using a .pem or .p12 keyFilename.
98
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
99
+ * .p12 key downloaded from the Google Developers Console. If you provide
100
+ * a path to a JSON file, the projectId option below is not necessary.
101
+ * NOTE: .pem and .p12 require you to specify options.email as well.
102
+ * @param {number} [options.port] - The port on which to connect to
103
+ * the remote host.
104
+ * @param {string} [options.projectId] - The project ID from the Google
105
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
106
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
107
+ * app is running in an environment which supports
108
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
109
+ * your project ID will be detected automatically.
110
+ * @param {string} [options.apiEndpoint] - The domain name of the
111
+ * API remote host.
112
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
113
+ * Follows the structure of {@link gapicConfig}.
114
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
115
+ * For more information, please check the
116
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
117
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
118
+ * need to avoid loading the default gRPC version and want to use the fallback
119
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
120
+ * ```
121
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
122
+ * const client = new FirestoreAdminClient({fallback: true}, gax);
123
+ * ```
124
+ */
125
+ constructor(opts, gaxInstance) {
126
+ // Ensure that options include all the required fields.
127
+ const staticMembers = this.constructor;
128
+ if (opts?.universe_domain &&
129
+ opts?.universeDomain &&
130
+ opts?.universe_domain !== opts?.universeDomain) {
131
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
132
+ }
133
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
134
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
135
+ : undefined;
136
+ this._universeDomain =
137
+ opts?.universeDomain ??
138
+ opts?.universe_domain ??
139
+ universeDomainEnvVar ??
140
+ 'googleapis.com';
141
+ this._servicePath = 'firestore.' + this._universeDomain;
142
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
143
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
144
+ const port = opts?.port || staticMembers.port;
145
+ const clientConfig = opts?.clientConfig ?? {};
146
+ const fallback = opts?.fallback ??
147
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
148
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
149
+ // Request numeric enum values if REST transport is used.
150
+ opts.numericEnums = true;
151
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
152
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
153
+ opts['scopes'] = staticMembers.scopes;
154
+ }
155
+ // Load google-gax module synchronously if needed
156
+ if (!gaxInstance) {
157
+ gaxInstance = require('google-gax');
158
+ }
159
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
160
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
161
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
162
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
163
+ // Save options to use in initialize() method.
164
+ this._opts = opts;
165
+ // Save the auth object to the client, for use by other methods.
166
+ this.auth = this._gaxGrpc.auth;
167
+ // Set useJWTAccessWithScope on the auth object.
168
+ this.auth.useJWTAccessWithScope = true;
169
+ // Set defaultServicePath on the auth object.
170
+ this.auth.defaultServicePath = this._servicePath;
171
+ // Set the default scopes in auth client if needed.
172
+ if (servicePath === this._servicePath) {
173
+ this.auth.defaultScopes = staticMembers.scopes;
174
+ }
175
+ this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
176
+ // Determine the client header string.
177
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
178
+ if (typeof process === 'object' && 'versions' in process) {
179
+ clientHeader.push(`gl-node/${process.versions.node}`);
180
+ }
181
+ else {
182
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
183
+ }
184
+ if (!opts.fallback) {
185
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
186
+ }
187
+ else {
188
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
189
+ }
190
+ if (opts.libName && opts.libVersion) {
191
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
192
+ }
193
+ // Load the applicable protos.
194
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
195
+ // This API contains "path templates"; forward-slash-separated
196
+ // identifiers to uniquely identify resources within the API.
197
+ // Create useful helper objects for these.
198
+ this.pathTemplates = {
199
+ backupPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/backups/{backup}'),
200
+ backupSchedulePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/backupSchedules/{backup_schedule}'),
201
+ collectionGroupPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/collectionGroups/{collection}'),
202
+ databasePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}'),
203
+ fieldPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}'),
204
+ indexPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}'),
205
+ locationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}'),
206
+ projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
207
+ userCredsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/userCreds/{user_creds}'),
208
+ };
209
+ // Some of the methods on this service return "paged" results,
210
+ // (e.g. 50 results at a time, with tokens to get subsequent
211
+ // pages). Denote the keys used for pagination and results.
212
+ this.descriptors.page = {
213
+ listIndexes: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'indexes'),
214
+ listFields: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'fields'),
215
+ };
216
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
217
+ // This API contains "long-running operations", which return a
218
+ // an Operation object that allows for tracking of the operation,
219
+ // rather than holding a request open.
220
+ const lroOptions = {
221
+ auth: this.auth,
222
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
223
+ };
224
+ if (opts.fallback) {
225
+ lroOptions.protoJson = protoFilesRoot;
226
+ lroOptions.httpRules = [
227
+ {
228
+ selector: 'google.longrunning.Operations.CancelOperation',
229
+ post: '/v1/{name=projects/*/databases/*/operations/*}:cancel',
230
+ body: '*',
231
+ },
232
+ {
233
+ selector: 'google.longrunning.Operations.DeleteOperation',
234
+ delete: '/v1/{name=projects/*/databases/*/operations/*}',
235
+ },
236
+ {
237
+ selector: 'google.longrunning.Operations.GetOperation',
238
+ get: '/v1/{name=projects/*/databases/*/operations/*}',
239
+ },
240
+ {
241
+ selector: 'google.longrunning.Operations.ListOperations',
242
+ get: '/v1/{name=projects/*/databases/*}/operations',
243
+ },
244
+ ];
245
+ }
246
+ this.operationsClient = this._gaxModule
247
+ .lro(lroOptions)
248
+ .operationsClient(opts);
249
+ const createIndexResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Index');
250
+ const createIndexMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.IndexOperationMetadata');
251
+ const updateFieldResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Field');
252
+ const updateFieldMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.FieldOperationMetadata');
253
+ const exportDocumentsResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.ExportDocumentsResponse');
254
+ const exportDocumentsMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.ExportDocumentsMetadata');
255
+ const importDocumentsResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
256
+ const importDocumentsMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.ImportDocumentsMetadata');
257
+ const bulkDeleteDocumentsResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.BulkDeleteDocumentsResponse');
258
+ const bulkDeleteDocumentsMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.BulkDeleteDocumentsMetadata');
259
+ const createDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
260
+ const createDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.CreateDatabaseMetadata');
261
+ const updateDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
262
+ const updateDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.UpdateDatabaseMetadata');
263
+ const deleteDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
264
+ const deleteDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.DeleteDatabaseMetadata');
265
+ const restoreDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
266
+ const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.RestoreDatabaseMetadata');
267
+ const cloneDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
268
+ const cloneDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.CloneDatabaseMetadata');
269
+ this.descriptors.longrunning = {
270
+ createIndex: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createIndexResponse.decode.bind(createIndexResponse), createIndexMetadata.decode.bind(createIndexMetadata)),
271
+ updateField: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateFieldResponse.decode.bind(updateFieldResponse), updateFieldMetadata.decode.bind(updateFieldMetadata)),
272
+ exportDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, exportDocumentsResponse.decode.bind(exportDocumentsResponse), exportDocumentsMetadata.decode.bind(exportDocumentsMetadata)),
273
+ importDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importDocumentsResponse.decode.bind(importDocumentsResponse), importDocumentsMetadata.decode.bind(importDocumentsMetadata)),
274
+ bulkDeleteDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, bulkDeleteDocumentsResponse.decode.bind(bulkDeleteDocumentsResponse), bulkDeleteDocumentsMetadata.decode.bind(bulkDeleteDocumentsMetadata)),
275
+ createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
276
+ updateDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseResponse.decode.bind(updateDatabaseResponse), updateDatabaseMetadata.decode.bind(updateDatabaseMetadata)),
277
+ deleteDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteDatabaseResponse.decode.bind(deleteDatabaseResponse), deleteDatabaseMetadata.decode.bind(deleteDatabaseMetadata)),
278
+ restoreDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, restoreDatabaseResponse.decode.bind(restoreDatabaseResponse), restoreDatabaseMetadata.decode.bind(restoreDatabaseMetadata)),
279
+ cloneDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, cloneDatabaseResponse.decode.bind(cloneDatabaseResponse), cloneDatabaseMetadata.decode.bind(cloneDatabaseMetadata)),
280
+ };
281
+ // Put together the default options sent with requests.
282
+ this._defaults = this._gaxGrpc.constructSettings('google.firestore.admin.v1.FirestoreAdmin', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
283
+ // Set up a dictionary of "inner API calls"; the core implementation
284
+ // of calling the API is handled in `google-gax`, with this code
285
+ // merely providing the destination and request information.
286
+ this.innerApiCalls = {};
287
+ // Add a warn function to the client constructor so it can be easily tested.
288
+ this.warn = this._gaxModule.warn;
289
+ }
290
+ /**
291
+ * Initialize the client.
292
+ * Performs asynchronous operations (such as authentication) and prepares the client.
293
+ * This function will be called automatically when any class method is called for the
294
+ * first time, but if you need to initialize it before calling an actual method,
295
+ * feel free to call initialize() directly.
296
+ *
297
+ * You can await on this method if you want to make sure the client is initialized.
298
+ *
299
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
300
+ */
301
+ initialize() {
302
+ // If the client stub promise is already initialized, return immediately.
303
+ if (this.firestoreAdminStub) {
304
+ return this.firestoreAdminStub;
305
+ }
306
+ // Put together the "service stub" for
307
+ // google.firestore.admin.v1.FirestoreAdmin.
308
+ this.firestoreAdminStub = this._gaxGrpc.createStub(this._opts.fallback
309
+ ? this._protos.lookupService('google.firestore.admin.v1.FirestoreAdmin')
310
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
311
+ this._protos.google.firestore.admin.v1.FirestoreAdmin, this._opts, this._providedCustomServicePath);
312
+ // Iterate over each of the methods that the service provides
313
+ // and create an API call method for each.
314
+ const firestoreAdminStubMethods = [
315
+ 'createIndex',
316
+ 'listIndexes',
317
+ 'getIndex',
318
+ 'deleteIndex',
319
+ 'getField',
320
+ 'updateField',
321
+ 'listFields',
322
+ 'exportDocuments',
323
+ 'importDocuments',
324
+ 'bulkDeleteDocuments',
325
+ 'createDatabase',
326
+ 'getDatabase',
327
+ 'listDatabases',
328
+ 'updateDatabase',
329
+ 'deleteDatabase',
330
+ 'createUserCreds',
331
+ 'getUserCreds',
332
+ 'listUserCreds',
333
+ 'enableUserCreds',
334
+ 'disableUserCreds',
335
+ 'resetUserPassword',
336
+ 'deleteUserCreds',
337
+ 'getBackup',
338
+ 'listBackups',
339
+ 'deleteBackup',
340
+ 'restoreDatabase',
341
+ 'createBackupSchedule',
342
+ 'getBackupSchedule',
343
+ 'listBackupSchedules',
344
+ 'updateBackupSchedule',
345
+ 'deleteBackupSchedule',
346
+ 'cloneDatabase',
347
+ ];
348
+ for (const methodName of firestoreAdminStubMethods) {
349
+ const callPromise = this.firestoreAdminStub.then((stub) => (...args) => {
350
+ if (this._terminated) {
351
+ return Promise.reject('The client has already been closed.');
352
+ }
353
+ const func = stub[methodName];
354
+ return func.apply(stub, args);
355
+ }, (err) => () => {
356
+ throw err;
357
+ });
358
+ const descriptor = this.descriptors.page[methodName] ||
359
+ this.descriptors.longrunning[methodName] ||
360
+ undefined;
361
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
362
+ this.innerApiCalls[methodName] = apiCall;
363
+ }
364
+ return this.firestoreAdminStub;
365
+ }
366
+ /**
367
+ * The DNS address for this API service.
368
+ * @deprecated Use the apiEndpoint method of the client instance.
369
+ * @returns {string} The DNS address for this service.
370
+ */
371
+ static get servicePath() {
372
+ if (typeof process === 'object' &&
373
+ typeof process.emitWarning === 'function') {
374
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
375
+ }
376
+ return 'firestore.googleapis.com';
377
+ }
378
+ /**
379
+ * The DNS address for this API service - same as servicePath.
380
+ * @deprecated Use the apiEndpoint method of the client instance.
381
+ * @returns {string} The DNS address for this service.
382
+ */
383
+ static get apiEndpoint() {
384
+ if (typeof process === 'object' &&
385
+ typeof process.emitWarning === 'function') {
386
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
387
+ }
388
+ return 'firestore.googleapis.com';
389
+ }
390
+ /**
391
+ * The DNS address for this API service.
392
+ * @returns {string} The DNS address for this service.
393
+ */
394
+ get apiEndpoint() {
395
+ return this._servicePath;
396
+ }
397
+ get universeDomain() {
398
+ return this._universeDomain;
399
+ }
400
+ /**
401
+ * The port for this API service.
402
+ * @returns {number} The default port for this service.
403
+ */
404
+ static get port() {
405
+ return 443;
406
+ }
407
+ /**
408
+ * The scopes needed to make gRPC calls for every method defined
409
+ * in this service.
410
+ * @returns {string[]} List of default scopes.
411
+ */
412
+ static get scopes() {
413
+ return [
414
+ 'https://www.googleapis.com/auth/cloud-platform',
415
+ 'https://www.googleapis.com/auth/datastore',
416
+ ];
417
+ }
418
+ /**
419
+ * Return the project ID used by this class.
420
+ * @returns {Promise} A promise that resolves to string containing the project ID.
421
+ */
422
+ getProjectId(callback) {
423
+ if (callback) {
424
+ this.auth.getProjectId(callback);
425
+ return;
426
+ }
427
+ return this.auth.getProjectId();
428
+ }
429
+ getIndex(request, optionsOrCallback, callback) {
430
+ request = request || {};
431
+ let options;
432
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
433
+ callback = optionsOrCallback;
434
+ options = {};
435
+ }
436
+ else {
437
+ options = optionsOrCallback;
438
+ }
439
+ options = options || {};
440
+ options.otherArgs = options.otherArgs || {};
441
+ options.otherArgs.headers = options.otherArgs.headers || {};
442
+ options.otherArgs.headers['x-goog-request-params'] =
443
+ this._gaxModule.routingHeader.fromParams({
444
+ name: request.name ?? '',
445
+ });
446
+ this.initialize().catch((err) => {
447
+ throw err;
448
+ });
449
+ this._log.info('getIndex request %j', request);
450
+ const wrappedCallback = callback
451
+ ? (error, response, options, rawResponse) => {
452
+ this._log.info('getIndex response %j', response);
453
+ callback(error, response, options, rawResponse); // We verified callback above.
454
+ }
455
+ : undefined;
456
+ return this.innerApiCalls
457
+ .getIndex(request, options, wrappedCallback)
458
+ ?.then(([response, options, rawResponse]) => {
459
+ this._log.info('getIndex response %j', response);
460
+ return [response, options, rawResponse];
461
+ })
462
+ .catch((error) => {
463
+ if (error &&
464
+ 'statusDetails' in error &&
465
+ error.statusDetails instanceof Array) {
466
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
467
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
468
+ }
469
+ throw error;
470
+ });
471
+ }
472
+ deleteIndex(request, optionsOrCallback, callback) {
473
+ request = request || {};
474
+ let options;
475
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
476
+ callback = optionsOrCallback;
477
+ options = {};
478
+ }
479
+ else {
480
+ options = optionsOrCallback;
481
+ }
482
+ options = options || {};
483
+ options.otherArgs = options.otherArgs || {};
484
+ options.otherArgs.headers = options.otherArgs.headers || {};
485
+ options.otherArgs.headers['x-goog-request-params'] =
486
+ this._gaxModule.routingHeader.fromParams({
487
+ name: request.name ?? '',
488
+ });
489
+ this.initialize().catch((err) => {
490
+ throw err;
491
+ });
492
+ this._log.info('deleteIndex request %j', request);
493
+ const wrappedCallback = callback
494
+ ? (error, response, options, rawResponse) => {
495
+ this._log.info('deleteIndex response %j', response);
496
+ callback(error, response, options, rawResponse); // We verified callback above.
497
+ }
498
+ : undefined;
499
+ return this.innerApiCalls
500
+ .deleteIndex(request, options, wrappedCallback)
501
+ ?.then(([response, options, rawResponse]) => {
502
+ this._log.info('deleteIndex response %j', response);
503
+ return [response, options, rawResponse];
504
+ })
505
+ .catch((error) => {
506
+ if (error &&
507
+ 'statusDetails' in error &&
508
+ error.statusDetails instanceof Array) {
509
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
510
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
511
+ }
512
+ throw error;
513
+ });
514
+ }
515
+ getField(request, optionsOrCallback, callback) {
516
+ request = request || {};
517
+ let options;
518
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
519
+ callback = optionsOrCallback;
520
+ options = {};
521
+ }
522
+ else {
523
+ options = optionsOrCallback;
524
+ }
525
+ options = options || {};
526
+ options.otherArgs = options.otherArgs || {};
527
+ options.otherArgs.headers = options.otherArgs.headers || {};
528
+ options.otherArgs.headers['x-goog-request-params'] =
529
+ this._gaxModule.routingHeader.fromParams({
530
+ name: request.name ?? '',
531
+ });
532
+ this.initialize().catch((err) => {
533
+ throw err;
534
+ });
535
+ this._log.info('getField request %j', request);
536
+ const wrappedCallback = callback
537
+ ? (error, response, options, rawResponse) => {
538
+ this._log.info('getField response %j', response);
539
+ callback(error, response, options, rawResponse); // We verified callback above.
540
+ }
541
+ : undefined;
542
+ return this.innerApiCalls
543
+ .getField(request, options, wrappedCallback)
544
+ ?.then(([response, options, rawResponse]) => {
545
+ this._log.info('getField response %j', response);
546
+ return [response, options, rawResponse];
547
+ })
548
+ .catch((error) => {
549
+ if (error &&
550
+ 'statusDetails' in error &&
551
+ error.statusDetails instanceof Array) {
552
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
553
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
554
+ }
555
+ throw error;
556
+ });
557
+ }
558
+ getDatabase(request, optionsOrCallback, callback) {
559
+ request = request || {};
560
+ let options;
561
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
562
+ callback = optionsOrCallback;
563
+ options = {};
564
+ }
565
+ else {
566
+ options = optionsOrCallback;
567
+ }
568
+ options = options || {};
569
+ options.otherArgs = options.otherArgs || {};
570
+ options.otherArgs.headers = options.otherArgs.headers || {};
571
+ options.otherArgs.headers['x-goog-request-params'] =
572
+ this._gaxModule.routingHeader.fromParams({
573
+ name: request.name ?? '',
574
+ });
575
+ this.initialize().catch((err) => {
576
+ throw err;
577
+ });
578
+ this._log.info('getDatabase request %j', request);
579
+ const wrappedCallback = callback
580
+ ? (error, response, options, rawResponse) => {
581
+ this._log.info('getDatabase response %j', response);
582
+ callback(error, response, options, rawResponse); // We verified callback above.
583
+ }
584
+ : undefined;
585
+ return this.innerApiCalls
586
+ .getDatabase(request, options, wrappedCallback)
587
+ ?.then(([response, options, rawResponse]) => {
588
+ this._log.info('getDatabase response %j', response);
589
+ return [response, options, rawResponse];
590
+ })
591
+ .catch((error) => {
592
+ if (error &&
593
+ 'statusDetails' in error &&
594
+ error.statusDetails instanceof Array) {
595
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
596
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
597
+ }
598
+ throw error;
599
+ });
600
+ }
601
+ listDatabases(request, optionsOrCallback, callback) {
602
+ request = request || {};
603
+ let options;
604
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
605
+ callback = optionsOrCallback;
606
+ options = {};
607
+ }
608
+ else {
609
+ options = optionsOrCallback;
610
+ }
611
+ options = options || {};
612
+ options.otherArgs = options.otherArgs || {};
613
+ options.otherArgs.headers = options.otherArgs.headers || {};
614
+ options.otherArgs.headers['x-goog-request-params'] =
615
+ this._gaxModule.routingHeader.fromParams({
616
+ parent: request.parent ?? '',
617
+ });
618
+ this.initialize().catch((err) => {
619
+ throw err;
620
+ });
621
+ this._log.info('listDatabases request %j', request);
622
+ const wrappedCallback = callback
623
+ ? (error, response, options, rawResponse) => {
624
+ this._log.info('listDatabases response %j', response);
625
+ callback(error, response, options, rawResponse); // We verified callback above.
626
+ }
627
+ : undefined;
628
+ return this.innerApiCalls
629
+ .listDatabases(request, options, wrappedCallback)
630
+ ?.then(([response, options, rawResponse]) => {
631
+ this._log.info('listDatabases response %j', response);
632
+ return [response, options, rawResponse];
633
+ })
634
+ .catch((error) => {
635
+ if (error &&
636
+ 'statusDetails' in error &&
637
+ error.statusDetails instanceof Array) {
638
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
639
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
640
+ }
641
+ throw error;
642
+ });
643
+ }
644
+ createUserCreds(request, optionsOrCallback, callback) {
645
+ request = request || {};
646
+ let options;
647
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
648
+ callback = optionsOrCallback;
649
+ options = {};
650
+ }
651
+ else {
652
+ options = optionsOrCallback;
653
+ }
654
+ options = options || {};
655
+ options.otherArgs = options.otherArgs || {};
656
+ options.otherArgs.headers = options.otherArgs.headers || {};
657
+ options.otherArgs.headers['x-goog-request-params'] =
658
+ this._gaxModule.routingHeader.fromParams({
659
+ parent: request.parent ?? '',
660
+ });
661
+ this.initialize().catch((err) => {
662
+ throw err;
663
+ });
664
+ this._log.info('createUserCreds request %j', request);
665
+ const wrappedCallback = callback
666
+ ? (error, response, options, rawResponse) => {
667
+ this._log.info('createUserCreds response %j', response);
668
+ callback(error, response, options, rawResponse); // We verified callback above.
669
+ }
670
+ : undefined;
671
+ return this.innerApiCalls
672
+ .createUserCreds(request, options, wrappedCallback)
673
+ ?.then(([response, options, rawResponse]) => {
674
+ this._log.info('createUserCreds response %j', response);
675
+ return [response, options, rawResponse];
676
+ })
677
+ .catch((error) => {
678
+ if (error &&
679
+ 'statusDetails' in error &&
680
+ error.statusDetails instanceof Array) {
681
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
682
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
683
+ }
684
+ throw error;
685
+ });
686
+ }
687
+ getUserCreds(request, optionsOrCallback, callback) {
688
+ request = request || {};
689
+ let options;
690
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
691
+ callback = optionsOrCallback;
692
+ options = {};
693
+ }
694
+ else {
695
+ options = optionsOrCallback;
696
+ }
697
+ options = options || {};
698
+ options.otherArgs = options.otherArgs || {};
699
+ options.otherArgs.headers = options.otherArgs.headers || {};
700
+ options.otherArgs.headers['x-goog-request-params'] =
701
+ this._gaxModule.routingHeader.fromParams({
702
+ name: request.name ?? '',
703
+ });
704
+ this.initialize().catch((err) => {
705
+ throw err;
706
+ });
707
+ this._log.info('getUserCreds request %j', request);
708
+ const wrappedCallback = callback
709
+ ? (error, response, options, rawResponse) => {
710
+ this._log.info('getUserCreds response %j', response);
711
+ callback(error, response, options, rawResponse); // We verified callback above.
712
+ }
713
+ : undefined;
714
+ return this.innerApiCalls
715
+ .getUserCreds(request, options, wrappedCallback)
716
+ ?.then(([response, options, rawResponse]) => {
717
+ this._log.info('getUserCreds response %j', response);
718
+ return [response, options, rawResponse];
719
+ })
720
+ .catch((error) => {
721
+ if (error &&
722
+ 'statusDetails' in error &&
723
+ error.statusDetails instanceof Array) {
724
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
725
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
726
+ }
727
+ throw error;
728
+ });
729
+ }
730
+ listUserCreds(request, optionsOrCallback, callback) {
731
+ request = request || {};
732
+ let options;
733
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
734
+ callback = optionsOrCallback;
735
+ options = {};
736
+ }
737
+ else {
738
+ options = optionsOrCallback;
739
+ }
740
+ options = options || {};
741
+ options.otherArgs = options.otherArgs || {};
742
+ options.otherArgs.headers = options.otherArgs.headers || {};
743
+ options.otherArgs.headers['x-goog-request-params'] =
744
+ this._gaxModule.routingHeader.fromParams({
745
+ parent: request.parent ?? '',
746
+ });
747
+ this.initialize().catch((err) => {
748
+ throw err;
749
+ });
750
+ this._log.info('listUserCreds request %j', request);
751
+ const wrappedCallback = callback
752
+ ? (error, response, options, rawResponse) => {
753
+ this._log.info('listUserCreds response %j', response);
754
+ callback(error, response, options, rawResponse); // We verified callback above.
755
+ }
756
+ : undefined;
757
+ return this.innerApiCalls
758
+ .listUserCreds(request, options, wrappedCallback)
759
+ ?.then(([response, options, rawResponse]) => {
760
+ this._log.info('listUserCreds response %j', response);
761
+ return [response, options, rawResponse];
762
+ })
763
+ .catch((error) => {
764
+ if (error &&
765
+ 'statusDetails' in error &&
766
+ error.statusDetails instanceof Array) {
767
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
768
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
769
+ }
770
+ throw error;
771
+ });
772
+ }
773
+ enableUserCreds(request, optionsOrCallback, callback) {
774
+ request = request || {};
775
+ let options;
776
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
777
+ callback = optionsOrCallback;
778
+ options = {};
779
+ }
780
+ else {
781
+ options = optionsOrCallback;
782
+ }
783
+ options = options || {};
784
+ options.otherArgs = options.otherArgs || {};
785
+ options.otherArgs.headers = options.otherArgs.headers || {};
786
+ options.otherArgs.headers['x-goog-request-params'] =
787
+ this._gaxModule.routingHeader.fromParams({
788
+ name: request.name ?? '',
789
+ });
790
+ this.initialize().catch((err) => {
791
+ throw err;
792
+ });
793
+ this._log.info('enableUserCreds request %j', request);
794
+ const wrappedCallback = callback
795
+ ? (error, response, options, rawResponse) => {
796
+ this._log.info('enableUserCreds response %j', response);
797
+ callback(error, response, options, rawResponse); // We verified callback above.
798
+ }
799
+ : undefined;
800
+ return this.innerApiCalls
801
+ .enableUserCreds(request, options, wrappedCallback)
802
+ ?.then(([response, options, rawResponse]) => {
803
+ this._log.info('enableUserCreds response %j', response);
804
+ return [response, options, rawResponse];
805
+ })
806
+ .catch((error) => {
807
+ if (error &&
808
+ 'statusDetails' in error &&
809
+ error.statusDetails instanceof Array) {
810
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
811
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
812
+ }
813
+ throw error;
814
+ });
815
+ }
816
+ disableUserCreds(request, optionsOrCallback, callback) {
817
+ request = request || {};
818
+ let options;
819
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
820
+ callback = optionsOrCallback;
821
+ options = {};
822
+ }
823
+ else {
824
+ options = optionsOrCallback;
825
+ }
826
+ options = options || {};
827
+ options.otherArgs = options.otherArgs || {};
828
+ options.otherArgs.headers = options.otherArgs.headers || {};
829
+ options.otherArgs.headers['x-goog-request-params'] =
830
+ this._gaxModule.routingHeader.fromParams({
831
+ name: request.name ?? '',
832
+ });
833
+ this.initialize().catch((err) => {
834
+ throw err;
835
+ });
836
+ this._log.info('disableUserCreds request %j', request);
837
+ const wrappedCallback = callback
838
+ ? (error, response, options, rawResponse) => {
839
+ this._log.info('disableUserCreds response %j', response);
840
+ callback(error, response, options, rawResponse); // We verified callback above.
841
+ }
842
+ : undefined;
843
+ return this.innerApiCalls
844
+ .disableUserCreds(request, options, wrappedCallback)
845
+ ?.then(([response, options, rawResponse]) => {
846
+ this._log.info('disableUserCreds response %j', response);
847
+ return [response, options, rawResponse];
848
+ })
849
+ .catch((error) => {
850
+ if (error &&
851
+ 'statusDetails' in error &&
852
+ error.statusDetails instanceof Array) {
853
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
854
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
855
+ }
856
+ throw error;
857
+ });
858
+ }
859
+ resetUserPassword(request, optionsOrCallback, callback) {
860
+ request = request || {};
861
+ let options;
862
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
863
+ callback = optionsOrCallback;
864
+ options = {};
865
+ }
866
+ else {
867
+ options = optionsOrCallback;
868
+ }
869
+ options = options || {};
870
+ options.otherArgs = options.otherArgs || {};
871
+ options.otherArgs.headers = options.otherArgs.headers || {};
872
+ options.otherArgs.headers['x-goog-request-params'] =
873
+ this._gaxModule.routingHeader.fromParams({
874
+ name: request.name ?? '',
875
+ });
876
+ this.initialize().catch((err) => {
877
+ throw err;
878
+ });
879
+ this._log.info('resetUserPassword request %j', request);
880
+ const wrappedCallback = callback
881
+ ? (error, response, options, rawResponse) => {
882
+ this._log.info('resetUserPassword response %j', response);
883
+ callback(error, response, options, rawResponse); // We verified callback above.
884
+ }
885
+ : undefined;
886
+ return this.innerApiCalls
887
+ .resetUserPassword(request, options, wrappedCallback)
888
+ ?.then(([response, options, rawResponse]) => {
889
+ this._log.info('resetUserPassword response %j', response);
890
+ return [response, options, rawResponse];
891
+ })
892
+ .catch((error) => {
893
+ if (error &&
894
+ 'statusDetails' in error &&
895
+ error.statusDetails instanceof Array) {
896
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
897
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
898
+ }
899
+ throw error;
900
+ });
901
+ }
902
+ deleteUserCreds(request, optionsOrCallback, callback) {
903
+ request = request || {};
904
+ let options;
905
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
906
+ callback = optionsOrCallback;
907
+ options = {};
908
+ }
909
+ else {
910
+ options = optionsOrCallback;
911
+ }
912
+ options = options || {};
913
+ options.otherArgs = options.otherArgs || {};
914
+ options.otherArgs.headers = options.otherArgs.headers || {};
915
+ options.otherArgs.headers['x-goog-request-params'] =
916
+ this._gaxModule.routingHeader.fromParams({
917
+ name: request.name ?? '',
918
+ });
919
+ this.initialize().catch((err) => {
920
+ throw err;
921
+ });
922
+ this._log.info('deleteUserCreds request %j', request);
923
+ const wrappedCallback = callback
924
+ ? (error, response, options, rawResponse) => {
925
+ this._log.info('deleteUserCreds response %j', response);
926
+ callback(error, response, options, rawResponse); // We verified callback above.
927
+ }
928
+ : undefined;
929
+ return this.innerApiCalls
930
+ .deleteUserCreds(request, options, wrappedCallback)
931
+ ?.then(([response, options, rawResponse]) => {
932
+ this._log.info('deleteUserCreds response %j', response);
933
+ return [response, options, rawResponse];
934
+ })
935
+ .catch((error) => {
936
+ if (error &&
937
+ 'statusDetails' in error &&
938
+ error.statusDetails instanceof Array) {
939
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
940
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
941
+ }
942
+ throw error;
943
+ });
944
+ }
945
+ getBackup(request, optionsOrCallback, callback) {
946
+ request = request || {};
947
+ let options;
948
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
949
+ callback = optionsOrCallback;
950
+ options = {};
951
+ }
952
+ else {
953
+ options = optionsOrCallback;
954
+ }
955
+ options = options || {};
956
+ options.otherArgs = options.otherArgs || {};
957
+ options.otherArgs.headers = options.otherArgs.headers || {};
958
+ options.otherArgs.headers['x-goog-request-params'] =
959
+ this._gaxModule.routingHeader.fromParams({
960
+ name: request.name ?? '',
961
+ });
962
+ this.initialize().catch((err) => {
963
+ throw err;
964
+ });
965
+ this._log.info('getBackup request %j', request);
966
+ const wrappedCallback = callback
967
+ ? (error, response, options, rawResponse) => {
968
+ this._log.info('getBackup response %j', response);
969
+ callback(error, response, options, rawResponse); // We verified callback above.
970
+ }
971
+ : undefined;
972
+ return this.innerApiCalls
973
+ .getBackup(request, options, wrappedCallback)
974
+ ?.then(([response, options, rawResponse]) => {
975
+ this._log.info('getBackup response %j', response);
976
+ return [response, options, rawResponse];
977
+ })
978
+ .catch((error) => {
979
+ if (error &&
980
+ 'statusDetails' in error &&
981
+ error.statusDetails instanceof Array) {
982
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
983
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
984
+ }
985
+ throw error;
986
+ });
987
+ }
988
+ listBackups(request, optionsOrCallback, callback) {
989
+ request = request || {};
990
+ let options;
991
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
992
+ callback = optionsOrCallback;
993
+ options = {};
994
+ }
995
+ else {
996
+ options = optionsOrCallback;
997
+ }
998
+ options = options || {};
999
+ options.otherArgs = options.otherArgs || {};
1000
+ options.otherArgs.headers = options.otherArgs.headers || {};
1001
+ options.otherArgs.headers['x-goog-request-params'] =
1002
+ this._gaxModule.routingHeader.fromParams({
1003
+ parent: request.parent ?? '',
1004
+ });
1005
+ this.initialize().catch((err) => {
1006
+ throw err;
1007
+ });
1008
+ this._log.info('listBackups request %j', request);
1009
+ const wrappedCallback = callback
1010
+ ? (error, response, options, rawResponse) => {
1011
+ this._log.info('listBackups response %j', response);
1012
+ callback(error, response, options, rawResponse); // We verified callback above.
1013
+ }
1014
+ : undefined;
1015
+ return this.innerApiCalls
1016
+ .listBackups(request, options, wrappedCallback)
1017
+ ?.then(([response, options, rawResponse]) => {
1018
+ this._log.info('listBackups response %j', response);
1019
+ return [response, options, rawResponse];
1020
+ })
1021
+ .catch((error) => {
1022
+ if (error &&
1023
+ 'statusDetails' in error &&
1024
+ error.statusDetails instanceof Array) {
1025
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1026
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1027
+ }
1028
+ throw error;
1029
+ });
1030
+ }
1031
+ deleteBackup(request, optionsOrCallback, callback) {
1032
+ request = request || {};
1033
+ let options;
1034
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1035
+ callback = optionsOrCallback;
1036
+ options = {};
1037
+ }
1038
+ else {
1039
+ options = optionsOrCallback;
1040
+ }
1041
+ options = options || {};
1042
+ options.otherArgs = options.otherArgs || {};
1043
+ options.otherArgs.headers = options.otherArgs.headers || {};
1044
+ options.otherArgs.headers['x-goog-request-params'] =
1045
+ this._gaxModule.routingHeader.fromParams({
1046
+ name: request.name ?? '',
1047
+ });
1048
+ this.initialize().catch((err) => {
1049
+ throw err;
1050
+ });
1051
+ this._log.info('deleteBackup request %j', request);
1052
+ const wrappedCallback = callback
1053
+ ? (error, response, options, rawResponse) => {
1054
+ this._log.info('deleteBackup response %j', response);
1055
+ callback(error, response, options, rawResponse); // We verified callback above.
1056
+ }
1057
+ : undefined;
1058
+ return this.innerApiCalls
1059
+ .deleteBackup(request, options, wrappedCallback)
1060
+ ?.then(([response, options, rawResponse]) => {
1061
+ this._log.info('deleteBackup response %j', response);
1062
+ return [response, options, rawResponse];
1063
+ })
1064
+ .catch((error) => {
1065
+ if (error &&
1066
+ 'statusDetails' in error &&
1067
+ error.statusDetails instanceof Array) {
1068
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1069
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1070
+ }
1071
+ throw error;
1072
+ });
1073
+ }
1074
+ createBackupSchedule(request, optionsOrCallback, callback) {
1075
+ request = request || {};
1076
+ let options;
1077
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1078
+ callback = optionsOrCallback;
1079
+ options = {};
1080
+ }
1081
+ else {
1082
+ options = optionsOrCallback;
1083
+ }
1084
+ options = options || {};
1085
+ options.otherArgs = options.otherArgs || {};
1086
+ options.otherArgs.headers = options.otherArgs.headers || {};
1087
+ options.otherArgs.headers['x-goog-request-params'] =
1088
+ this._gaxModule.routingHeader.fromParams({
1089
+ parent: request.parent ?? '',
1090
+ });
1091
+ this.initialize().catch((err) => {
1092
+ throw err;
1093
+ });
1094
+ this._log.info('createBackupSchedule request %j', request);
1095
+ const wrappedCallback = callback
1096
+ ? (error, response, options, rawResponse) => {
1097
+ this._log.info('createBackupSchedule response %j', response);
1098
+ callback(error, response, options, rawResponse); // We verified callback above.
1099
+ }
1100
+ : undefined;
1101
+ return this.innerApiCalls
1102
+ .createBackupSchedule(request, options, wrappedCallback)
1103
+ ?.then(([response, options, rawResponse]) => {
1104
+ this._log.info('createBackupSchedule response %j', response);
1105
+ return [response, options, rawResponse];
1106
+ })
1107
+ .catch((error) => {
1108
+ if (error &&
1109
+ 'statusDetails' in error &&
1110
+ error.statusDetails instanceof Array) {
1111
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1112
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1113
+ }
1114
+ throw error;
1115
+ });
1116
+ }
1117
+ getBackupSchedule(request, optionsOrCallback, callback) {
1118
+ request = request || {};
1119
+ let options;
1120
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1121
+ callback = optionsOrCallback;
1122
+ options = {};
1123
+ }
1124
+ else {
1125
+ options = optionsOrCallback;
1126
+ }
1127
+ options = options || {};
1128
+ options.otherArgs = options.otherArgs || {};
1129
+ options.otherArgs.headers = options.otherArgs.headers || {};
1130
+ options.otherArgs.headers['x-goog-request-params'] =
1131
+ this._gaxModule.routingHeader.fromParams({
1132
+ name: request.name ?? '',
1133
+ });
1134
+ this.initialize().catch((err) => {
1135
+ throw err;
1136
+ });
1137
+ this._log.info('getBackupSchedule request %j', request);
1138
+ const wrappedCallback = callback
1139
+ ? (error, response, options, rawResponse) => {
1140
+ this._log.info('getBackupSchedule response %j', response);
1141
+ callback(error, response, options, rawResponse); // We verified callback above.
1142
+ }
1143
+ : undefined;
1144
+ return this.innerApiCalls
1145
+ .getBackupSchedule(request, options, wrappedCallback)
1146
+ ?.then(([response, options, rawResponse]) => {
1147
+ this._log.info('getBackupSchedule response %j', response);
1148
+ return [response, options, rawResponse];
1149
+ })
1150
+ .catch((error) => {
1151
+ if (error &&
1152
+ 'statusDetails' in error &&
1153
+ error.statusDetails instanceof Array) {
1154
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1155
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1156
+ }
1157
+ throw error;
1158
+ });
1159
+ }
1160
+ listBackupSchedules(request, optionsOrCallback, callback) {
1161
+ request = request || {};
1162
+ let options;
1163
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1164
+ callback = optionsOrCallback;
1165
+ options = {};
1166
+ }
1167
+ else {
1168
+ options = optionsOrCallback;
1169
+ }
1170
+ options = options || {};
1171
+ options.otherArgs = options.otherArgs || {};
1172
+ options.otherArgs.headers = options.otherArgs.headers || {};
1173
+ options.otherArgs.headers['x-goog-request-params'] =
1174
+ this._gaxModule.routingHeader.fromParams({
1175
+ parent: request.parent ?? '',
1176
+ });
1177
+ this.initialize().catch((err) => {
1178
+ throw err;
1179
+ });
1180
+ this._log.info('listBackupSchedules request %j', request);
1181
+ const wrappedCallback = callback
1182
+ ? (error, response, options, rawResponse) => {
1183
+ this._log.info('listBackupSchedules response %j', response);
1184
+ callback(error, response, options, rawResponse); // We verified callback above.
1185
+ }
1186
+ : undefined;
1187
+ return this.innerApiCalls
1188
+ .listBackupSchedules(request, options, wrappedCallback)
1189
+ ?.then(([response, options, rawResponse]) => {
1190
+ this._log.info('listBackupSchedules response %j', response);
1191
+ return [response, options, rawResponse];
1192
+ })
1193
+ .catch((error) => {
1194
+ if (error &&
1195
+ 'statusDetails' in error &&
1196
+ error.statusDetails instanceof Array) {
1197
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1198
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1199
+ }
1200
+ throw error;
1201
+ });
1202
+ }
1203
+ updateBackupSchedule(request, optionsOrCallback, callback) {
1204
+ request = request || {};
1205
+ let options;
1206
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1207
+ callback = optionsOrCallback;
1208
+ options = {};
1209
+ }
1210
+ else {
1211
+ options = optionsOrCallback;
1212
+ }
1213
+ options = options || {};
1214
+ options.otherArgs = options.otherArgs || {};
1215
+ options.otherArgs.headers = options.otherArgs.headers || {};
1216
+ options.otherArgs.headers['x-goog-request-params'] =
1217
+ this._gaxModule.routingHeader.fromParams({
1218
+ 'backup_schedule.name': request.backupSchedule.name ?? '',
1219
+ });
1220
+ this.initialize().catch((err) => {
1221
+ throw err;
1222
+ });
1223
+ this._log.info('updateBackupSchedule request %j', request);
1224
+ const wrappedCallback = callback
1225
+ ? (error, response, options, rawResponse) => {
1226
+ this._log.info('updateBackupSchedule response %j', response);
1227
+ callback(error, response, options, rawResponse); // We verified callback above.
1228
+ }
1229
+ : undefined;
1230
+ return this.innerApiCalls
1231
+ .updateBackupSchedule(request, options, wrappedCallback)
1232
+ ?.then(([response, options, rawResponse]) => {
1233
+ this._log.info('updateBackupSchedule response %j', response);
1234
+ return [response, options, rawResponse];
1235
+ })
1236
+ .catch((error) => {
1237
+ if (error &&
1238
+ 'statusDetails' in error &&
1239
+ error.statusDetails instanceof Array) {
1240
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1241
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1242
+ }
1243
+ throw error;
1244
+ });
1245
+ }
1246
+ deleteBackupSchedule(request, optionsOrCallback, callback) {
1247
+ request = request || {};
1248
+ let options;
1249
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1250
+ callback = optionsOrCallback;
1251
+ options = {};
1252
+ }
1253
+ else {
1254
+ options = optionsOrCallback;
1255
+ }
1256
+ options = options || {};
1257
+ options.otherArgs = options.otherArgs || {};
1258
+ options.otherArgs.headers = options.otherArgs.headers || {};
1259
+ options.otherArgs.headers['x-goog-request-params'] =
1260
+ this._gaxModule.routingHeader.fromParams({
1261
+ name: request.name ?? '',
1262
+ });
1263
+ this.initialize().catch((err) => {
1264
+ throw err;
1265
+ });
1266
+ this._log.info('deleteBackupSchedule request %j', request);
1267
+ const wrappedCallback = callback
1268
+ ? (error, response, options, rawResponse) => {
1269
+ this._log.info('deleteBackupSchedule response %j', response);
1270
+ callback(error, response, options, rawResponse); // We verified callback above.
1271
+ }
1272
+ : undefined;
1273
+ return this.innerApiCalls
1274
+ .deleteBackupSchedule(request, options, wrappedCallback)
1275
+ ?.then(([response, options, rawResponse]) => {
1276
+ this._log.info('deleteBackupSchedule response %j', response);
1277
+ return [response, options, rawResponse];
1278
+ })
1279
+ .catch((error) => {
1280
+ if (error &&
1281
+ 'statusDetails' in error &&
1282
+ error.statusDetails instanceof Array) {
1283
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1284
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1285
+ }
1286
+ throw error;
1287
+ });
1288
+ }
1289
+ createIndex(request, optionsOrCallback, callback) {
1290
+ request = request || {};
1291
+ let options;
1292
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1293
+ callback = optionsOrCallback;
1294
+ options = {};
1295
+ }
1296
+ else {
1297
+ options = optionsOrCallback;
1298
+ }
1299
+ options = options || {};
1300
+ options.otherArgs = options.otherArgs || {};
1301
+ options.otherArgs.headers = options.otherArgs.headers || {};
1302
+ options.otherArgs.headers['x-goog-request-params'] =
1303
+ this._gaxModule.routingHeader.fromParams({
1304
+ parent: request.parent ?? '',
1305
+ });
1306
+ this.initialize().catch((err) => {
1307
+ throw err;
1308
+ });
1309
+ const wrappedCallback = callback
1310
+ ? (error, response, rawResponse, _) => {
1311
+ this._log.info('createIndex response %j', rawResponse);
1312
+ callback(error, response, rawResponse, _); // We verified callback above.
1313
+ }
1314
+ : undefined;
1315
+ this._log.info('createIndex request %j', request);
1316
+ return this.innerApiCalls
1317
+ .createIndex(request, options, wrappedCallback)
1318
+ ?.then(([response, rawResponse, _]) => {
1319
+ this._log.info('createIndex response %j', rawResponse);
1320
+ return [response, rawResponse, _];
1321
+ });
1322
+ }
1323
+ /**
1324
+ * Check the status of the long running operation returned by `createIndex()`.
1325
+ * @param {String} name
1326
+ * The operation name that will be passed.
1327
+ * @returns {Promise} - The promise which resolves to an object.
1328
+ * The decoded operation object has result and metadata field to get information from.
1329
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1330
+ * for more details and examples.
1331
+ * @example <caption>include:samples/generated/v1/firestore_admin.create_index.js</caption>
1332
+ * region_tag:firestore_v1_generated_FirestoreAdmin_CreateIndex_async
1333
+ */
1334
+ async checkCreateIndexProgress(name) {
1335
+ this._log.info('createIndex long-running');
1336
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1337
+ const [operation] = await this.operationsClient.getOperation(request);
1338
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createIndex, this._gaxModule.createDefaultBackoffSettings());
1339
+ return decodeOperation;
1340
+ }
1341
+ updateField(request, optionsOrCallback, callback) {
1342
+ request = request || {};
1343
+ let options;
1344
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1345
+ callback = optionsOrCallback;
1346
+ options = {};
1347
+ }
1348
+ else {
1349
+ options = optionsOrCallback;
1350
+ }
1351
+ options = options || {};
1352
+ options.otherArgs = options.otherArgs || {};
1353
+ options.otherArgs.headers = options.otherArgs.headers || {};
1354
+ options.otherArgs.headers['x-goog-request-params'] =
1355
+ this._gaxModule.routingHeader.fromParams({
1356
+ 'field.name': request.field.name ?? '',
1357
+ });
1358
+ this.initialize().catch((err) => {
1359
+ throw err;
1360
+ });
1361
+ const wrappedCallback = callback
1362
+ ? (error, response, rawResponse, _) => {
1363
+ this._log.info('updateField response %j', rawResponse);
1364
+ callback(error, response, rawResponse, _); // We verified callback above.
1365
+ }
1366
+ : undefined;
1367
+ this._log.info('updateField request %j', request);
1368
+ return this.innerApiCalls
1369
+ .updateField(request, options, wrappedCallback)
1370
+ ?.then(([response, rawResponse, _]) => {
1371
+ this._log.info('updateField response %j', rawResponse);
1372
+ return [response, rawResponse, _];
1373
+ });
1374
+ }
1375
+ /**
1376
+ * Check the status of the long running operation returned by `updateField()`.
1377
+ * @param {String} name
1378
+ * The operation name that will be passed.
1379
+ * @returns {Promise} - The promise which resolves to an object.
1380
+ * The decoded operation object has result and metadata field to get information from.
1381
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1382
+ * for more details and examples.
1383
+ * @example <caption>include:samples/generated/v1/firestore_admin.update_field.js</caption>
1384
+ * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateField_async
1385
+ */
1386
+ async checkUpdateFieldProgress(name) {
1387
+ this._log.info('updateField long-running');
1388
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1389
+ const [operation] = await this.operationsClient.getOperation(request);
1390
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateField, this._gaxModule.createDefaultBackoffSettings());
1391
+ return decodeOperation;
1392
+ }
1393
+ exportDocuments(request, optionsOrCallback, callback) {
1394
+ request = request || {};
1395
+ let options;
1396
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1397
+ callback = optionsOrCallback;
1398
+ options = {};
1399
+ }
1400
+ else {
1401
+ options = optionsOrCallback;
1402
+ }
1403
+ options = options || {};
1404
+ options.otherArgs = options.otherArgs || {};
1405
+ options.otherArgs.headers = options.otherArgs.headers || {};
1406
+ options.otherArgs.headers['x-goog-request-params'] =
1407
+ this._gaxModule.routingHeader.fromParams({
1408
+ name: request.name ?? '',
1409
+ });
1410
+ this.initialize().catch((err) => {
1411
+ throw err;
1412
+ });
1413
+ const wrappedCallback = callback
1414
+ ? (error, response, rawResponse, _) => {
1415
+ this._log.info('exportDocuments response %j', rawResponse);
1416
+ callback(error, response, rawResponse, _); // We verified callback above.
1417
+ }
1418
+ : undefined;
1419
+ this._log.info('exportDocuments request %j', request);
1420
+ return this.innerApiCalls
1421
+ .exportDocuments(request, options, wrappedCallback)
1422
+ ?.then(([response, rawResponse, _]) => {
1423
+ this._log.info('exportDocuments response %j', rawResponse);
1424
+ return [response, rawResponse, _];
1425
+ });
1426
+ }
1427
+ /**
1428
+ * Check the status of the long running operation returned by `exportDocuments()`.
1429
+ * @param {String} name
1430
+ * The operation name that will be passed.
1431
+ * @returns {Promise} - The promise which resolves to an object.
1432
+ * The decoded operation object has result and metadata field to get information from.
1433
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1434
+ * for more details and examples.
1435
+ * @example <caption>include:samples/generated/v1/firestore_admin.export_documents.js</caption>
1436
+ * region_tag:firestore_v1_generated_FirestoreAdmin_ExportDocuments_async
1437
+ */
1438
+ async checkExportDocumentsProgress(name) {
1439
+ this._log.info('exportDocuments long-running');
1440
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1441
+ const [operation] = await this.operationsClient.getOperation(request);
1442
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportDocuments, this._gaxModule.createDefaultBackoffSettings());
1443
+ return decodeOperation;
1444
+ }
1445
+ importDocuments(request, optionsOrCallback, callback) {
1446
+ request = request || {};
1447
+ let options;
1448
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1449
+ callback = optionsOrCallback;
1450
+ options = {};
1451
+ }
1452
+ else {
1453
+ options = optionsOrCallback;
1454
+ }
1455
+ options = options || {};
1456
+ options.otherArgs = options.otherArgs || {};
1457
+ options.otherArgs.headers = options.otherArgs.headers || {};
1458
+ options.otherArgs.headers['x-goog-request-params'] =
1459
+ this._gaxModule.routingHeader.fromParams({
1460
+ name: request.name ?? '',
1461
+ });
1462
+ this.initialize().catch((err) => {
1463
+ throw err;
1464
+ });
1465
+ const wrappedCallback = callback
1466
+ ? (error, response, rawResponse, _) => {
1467
+ this._log.info('importDocuments response %j', rawResponse);
1468
+ callback(error, response, rawResponse, _); // We verified callback above.
1469
+ }
1470
+ : undefined;
1471
+ this._log.info('importDocuments request %j', request);
1472
+ return this.innerApiCalls
1473
+ .importDocuments(request, options, wrappedCallback)
1474
+ ?.then(([response, rawResponse, _]) => {
1475
+ this._log.info('importDocuments response %j', rawResponse);
1476
+ return [response, rawResponse, _];
1477
+ });
1478
+ }
1479
+ /**
1480
+ * Check the status of the long running operation returned by `importDocuments()`.
1481
+ * @param {String} name
1482
+ * The operation name that will be passed.
1483
+ * @returns {Promise} - The promise which resolves to an object.
1484
+ * The decoded operation object has result and metadata field to get information from.
1485
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1486
+ * for more details and examples.
1487
+ * @example <caption>include:samples/generated/v1/firestore_admin.import_documents.js</caption>
1488
+ * region_tag:firestore_v1_generated_FirestoreAdmin_ImportDocuments_async
1489
+ */
1490
+ async checkImportDocumentsProgress(name) {
1491
+ this._log.info('importDocuments long-running');
1492
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1493
+ const [operation] = await this.operationsClient.getOperation(request);
1494
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings());
1495
+ return decodeOperation;
1496
+ }
1497
+ bulkDeleteDocuments(request, optionsOrCallback, callback) {
1498
+ request = request || {};
1499
+ let options;
1500
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1501
+ callback = optionsOrCallback;
1502
+ options = {};
1503
+ }
1504
+ else {
1505
+ options = optionsOrCallback;
1506
+ }
1507
+ options = options || {};
1508
+ options.otherArgs = options.otherArgs || {};
1509
+ options.otherArgs.headers = options.otherArgs.headers || {};
1510
+ options.otherArgs.headers['x-goog-request-params'] =
1511
+ this._gaxModule.routingHeader.fromParams({
1512
+ name: request.name ?? '',
1513
+ });
1514
+ this.initialize().catch((err) => {
1515
+ throw err;
1516
+ });
1517
+ const wrappedCallback = callback
1518
+ ? (error, response, rawResponse, _) => {
1519
+ this._log.info('bulkDeleteDocuments response %j', rawResponse);
1520
+ callback(error, response, rawResponse, _); // We verified callback above.
1521
+ }
1522
+ : undefined;
1523
+ this._log.info('bulkDeleteDocuments request %j', request);
1524
+ return this.innerApiCalls
1525
+ .bulkDeleteDocuments(request, options, wrappedCallback)
1526
+ ?.then(([response, rawResponse, _]) => {
1527
+ this._log.info('bulkDeleteDocuments response %j', rawResponse);
1528
+ return [response, rawResponse, _];
1529
+ });
1530
+ }
1531
+ /**
1532
+ * Check the status of the long running operation returned by `bulkDeleteDocuments()`.
1533
+ * @param {String} name
1534
+ * The operation name that will be passed.
1535
+ * @returns {Promise} - The promise which resolves to an object.
1536
+ * The decoded operation object has result and metadata field to get information from.
1537
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1538
+ * for more details and examples.
1539
+ * @example <caption>include:samples/generated/v1/firestore_admin.bulk_delete_documents.js</caption>
1540
+ * region_tag:firestore_v1_generated_FirestoreAdmin_BulkDeleteDocuments_async
1541
+ */
1542
+ async checkBulkDeleteDocumentsProgress(name) {
1543
+ this._log.info('bulkDeleteDocuments long-running');
1544
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1545
+ const [operation] = await this.operationsClient.getOperation(request);
1546
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.bulkDeleteDocuments, this._gaxModule.createDefaultBackoffSettings());
1547
+ return decodeOperation;
1548
+ }
1549
+ createDatabase(request, optionsOrCallback, callback) {
1550
+ request = request || {};
1551
+ let options;
1552
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1553
+ callback = optionsOrCallback;
1554
+ options = {};
1555
+ }
1556
+ else {
1557
+ options = optionsOrCallback;
1558
+ }
1559
+ options = options || {};
1560
+ options.otherArgs = options.otherArgs || {};
1561
+ options.otherArgs.headers = options.otherArgs.headers || {};
1562
+ options.otherArgs.headers['x-goog-request-params'] =
1563
+ this._gaxModule.routingHeader.fromParams({
1564
+ parent: request.parent ?? '',
1565
+ });
1566
+ this.initialize().catch((err) => {
1567
+ throw err;
1568
+ });
1569
+ const wrappedCallback = callback
1570
+ ? (error, response, rawResponse, _) => {
1571
+ this._log.info('createDatabase response %j', rawResponse);
1572
+ callback(error, response, rawResponse, _); // We verified callback above.
1573
+ }
1574
+ : undefined;
1575
+ this._log.info('createDatabase request %j', request);
1576
+ return this.innerApiCalls
1577
+ .createDatabase(request, options, wrappedCallback)
1578
+ ?.then(([response, rawResponse, _]) => {
1579
+ this._log.info('createDatabase response %j', rawResponse);
1580
+ return [response, rawResponse, _];
1581
+ });
1582
+ }
1583
+ /**
1584
+ * Check the status of the long running operation returned by `createDatabase()`.
1585
+ * @param {String} name
1586
+ * The operation name that will be passed.
1587
+ * @returns {Promise} - The promise which resolves to an object.
1588
+ * The decoded operation object has result and metadata field to get information from.
1589
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1590
+ * for more details and examples.
1591
+ * @example <caption>include:samples/generated/v1/firestore_admin.create_database.js</caption>
1592
+ * region_tag:firestore_v1_generated_FirestoreAdmin_CreateDatabase_async
1593
+ */
1594
+ async checkCreateDatabaseProgress(name) {
1595
+ this._log.info('createDatabase long-running');
1596
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1597
+ const [operation] = await this.operationsClient.getOperation(request);
1598
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
1599
+ return decodeOperation;
1600
+ }
1601
+ updateDatabase(request, optionsOrCallback, callback) {
1602
+ request = request || {};
1603
+ let options;
1604
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1605
+ callback = optionsOrCallback;
1606
+ options = {};
1607
+ }
1608
+ else {
1609
+ options = optionsOrCallback;
1610
+ }
1611
+ options = options || {};
1612
+ options.otherArgs = options.otherArgs || {};
1613
+ options.otherArgs.headers = options.otherArgs.headers || {};
1614
+ options.otherArgs.headers['x-goog-request-params'] =
1615
+ this._gaxModule.routingHeader.fromParams({
1616
+ 'database.name': request.database.name ?? '',
1617
+ });
1618
+ this.initialize().catch((err) => {
1619
+ throw err;
1620
+ });
1621
+ const wrappedCallback = callback
1622
+ ? (error, response, rawResponse, _) => {
1623
+ this._log.info('updateDatabase response %j', rawResponse);
1624
+ callback(error, response, rawResponse, _); // We verified callback above.
1625
+ }
1626
+ : undefined;
1627
+ this._log.info('updateDatabase request %j', request);
1628
+ return this.innerApiCalls
1629
+ .updateDatabase(request, options, wrappedCallback)
1630
+ ?.then(([response, rawResponse, _]) => {
1631
+ this._log.info('updateDatabase response %j', rawResponse);
1632
+ return [response, rawResponse, _];
1633
+ });
1634
+ }
1635
+ /**
1636
+ * Check the status of the long running operation returned by `updateDatabase()`.
1637
+ * @param {String} name
1638
+ * The operation name that will be passed.
1639
+ * @returns {Promise} - The promise which resolves to an object.
1640
+ * The decoded operation object has result and metadata field to get information from.
1641
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1642
+ * for more details and examples.
1643
+ * @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
1644
+ * region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
1645
+ */
1646
+ async checkUpdateDatabaseProgress(name) {
1647
+ this._log.info('updateDatabase long-running');
1648
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1649
+ const [operation] = await this.operationsClient.getOperation(request);
1650
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
1651
+ return decodeOperation;
1652
+ }
1653
+ deleteDatabase(request, optionsOrCallback, callback) {
1654
+ request = request || {};
1655
+ let options;
1656
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1657
+ callback = optionsOrCallback;
1658
+ options = {};
1659
+ }
1660
+ else {
1661
+ options = optionsOrCallback;
1662
+ }
1663
+ options = options || {};
1664
+ options.otherArgs = options.otherArgs || {};
1665
+ options.otherArgs.headers = options.otherArgs.headers || {};
1666
+ options.otherArgs.headers['x-goog-request-params'] =
1667
+ this._gaxModule.routingHeader.fromParams({
1668
+ name: request.name ?? '',
1669
+ });
1670
+ this.initialize().catch((err) => {
1671
+ throw err;
1672
+ });
1673
+ const wrappedCallback = callback
1674
+ ? (error, response, rawResponse, _) => {
1675
+ this._log.info('deleteDatabase response %j', rawResponse);
1676
+ callback(error, response, rawResponse, _); // We verified callback above.
1677
+ }
1678
+ : undefined;
1679
+ this._log.info('deleteDatabase request %j', request);
1680
+ return this.innerApiCalls
1681
+ .deleteDatabase(request, options, wrappedCallback)
1682
+ ?.then(([response, rawResponse, _]) => {
1683
+ this._log.info('deleteDatabase response %j', rawResponse);
1684
+ return [response, rawResponse, _];
1685
+ });
1686
+ }
1687
+ /**
1688
+ * Check the status of the long running operation returned by `deleteDatabase()`.
1689
+ * @param {String} name
1690
+ * The operation name that will be passed.
1691
+ * @returns {Promise} - The promise which resolves to an object.
1692
+ * The decoded operation object has result and metadata field to get information from.
1693
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1694
+ * for more details and examples.
1695
+ * @example <caption>include:samples/generated/v1/firestore_admin.delete_database.js</caption>
1696
+ * region_tag:firestore_v1_generated_FirestoreAdmin_DeleteDatabase_async
1697
+ */
1698
+ async checkDeleteDatabaseProgress(name) {
1699
+ this._log.info('deleteDatabase long-running');
1700
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1701
+ const [operation] = await this.operationsClient.getOperation(request);
1702
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDatabase, this._gaxModule.createDefaultBackoffSettings());
1703
+ return decodeOperation;
1704
+ }
1705
+ restoreDatabase(request, optionsOrCallback, callback) {
1706
+ request = request || {};
1707
+ let options;
1708
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1709
+ callback = optionsOrCallback;
1710
+ options = {};
1711
+ }
1712
+ else {
1713
+ options = optionsOrCallback;
1714
+ }
1715
+ options = options || {};
1716
+ options.otherArgs = options.otherArgs || {};
1717
+ options.otherArgs.headers = options.otherArgs.headers || {};
1718
+ options.otherArgs.headers['x-goog-request-params'] =
1719
+ this._gaxModule.routingHeader.fromParams({
1720
+ parent: request.parent ?? '',
1721
+ });
1722
+ this.initialize().catch((err) => {
1723
+ throw err;
1724
+ });
1725
+ const wrappedCallback = callback
1726
+ ? (error, response, rawResponse, _) => {
1727
+ this._log.info('restoreDatabase response %j', rawResponse);
1728
+ callback(error, response, rawResponse, _); // We verified callback above.
1729
+ }
1730
+ : undefined;
1731
+ this._log.info('restoreDatabase request %j', request);
1732
+ return this.innerApiCalls
1733
+ .restoreDatabase(request, options, wrappedCallback)
1734
+ ?.then(([response, rawResponse, _]) => {
1735
+ this._log.info('restoreDatabase response %j', rawResponse);
1736
+ return [response, rawResponse, _];
1737
+ });
1738
+ }
1739
+ /**
1740
+ * Check the status of the long running operation returned by `restoreDatabase()`.
1741
+ * @param {String} name
1742
+ * The operation name that will be passed.
1743
+ * @returns {Promise} - The promise which resolves to an object.
1744
+ * The decoded operation object has result and metadata field to get information from.
1745
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1746
+ * for more details and examples.
1747
+ * @example <caption>include:samples/generated/v1/firestore_admin.restore_database.js</caption>
1748
+ * region_tag:firestore_v1_generated_FirestoreAdmin_RestoreDatabase_async
1749
+ */
1750
+ async checkRestoreDatabaseProgress(name) {
1751
+ this._log.info('restoreDatabase long-running');
1752
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1753
+ const [operation] = await this.operationsClient.getOperation(request);
1754
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreDatabase, this._gaxModule.createDefaultBackoffSettings());
1755
+ return decodeOperation;
1756
+ }
1757
+ cloneDatabase(request, optionsOrCallback, callback) {
1758
+ request = request || {};
1759
+ let options;
1760
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1761
+ callback = optionsOrCallback;
1762
+ options = {};
1763
+ }
1764
+ else {
1765
+ options = optionsOrCallback;
1766
+ }
1767
+ options = options || {};
1768
+ options.otherArgs = options.otherArgs || {};
1769
+ options.otherArgs.headers = options.otherArgs.headers || {};
1770
+ let routingParameter = {};
1771
+ {
1772
+ const fieldValue = request.pitrSnapshot?.database;
1773
+ if (fieldValue !== undefined && fieldValue !== null) {
1774
+ const match = fieldValue
1775
+ .toString()
1776
+ .match(RegExp('projects/(?<project_id>[^/]+)(?:/.*)?'));
1777
+ if (match) {
1778
+ const parameterValue = match.groups?.['project_id'] ?? fieldValue;
1779
+ Object.assign(routingParameter, { project_id: parameterValue });
1780
+ }
1781
+ }
1782
+ }
1783
+ {
1784
+ const fieldValue = request.pitrSnapshot?.database;
1785
+ if (fieldValue !== undefined && fieldValue !== null) {
1786
+ const match = fieldValue
1787
+ .toString()
1788
+ .match(RegExp('projects/[^/]+/databases/(?<database_id>[^/]+)(?:/.*)?'));
1789
+ if (match) {
1790
+ const parameterValue = match.groups?.['database_id'] ?? fieldValue;
1791
+ Object.assign(routingParameter, { database_id: parameterValue });
1792
+ }
1793
+ }
1794
+ }
1795
+ options.otherArgs.headers['x-goog-request-params'] =
1796
+ this._gaxModule.routingHeader.fromParams(routingParameter);
1797
+ this.initialize().catch((err) => {
1798
+ throw err;
1799
+ });
1800
+ const wrappedCallback = callback
1801
+ ? (error, response, rawResponse, _) => {
1802
+ this._log.info('cloneDatabase response %j', rawResponse);
1803
+ callback(error, response, rawResponse, _); // We verified callback above.
1804
+ }
1805
+ : undefined;
1806
+ this._log.info('cloneDatabase request %j', request);
1807
+ return this.innerApiCalls
1808
+ .cloneDatabase(request, options, wrappedCallback)
1809
+ ?.then(([response, rawResponse, _]) => {
1810
+ this._log.info('cloneDatabase response %j', rawResponse);
1811
+ return [response, rawResponse, _];
1812
+ });
1813
+ }
1814
+ /**
1815
+ * Check the status of the long running operation returned by `cloneDatabase()`.
1816
+ * @param {String} name
1817
+ * The operation name that will be passed.
1818
+ * @returns {Promise} - The promise which resolves to an object.
1819
+ * The decoded operation object has result and metadata field to get information from.
1820
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1821
+ * for more details and examples.
1822
+ * @example <caption>include:samples/generated/v1/firestore_admin.clone_database.js</caption>
1823
+ * region_tag:firestore_v1_generated_FirestoreAdmin_CloneDatabase_async
1824
+ */
1825
+ async checkCloneDatabaseProgress(name) {
1826
+ this._log.info('cloneDatabase long-running');
1827
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1828
+ const [operation] = await this.operationsClient.getOperation(request);
1829
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.cloneDatabase, this._gaxModule.createDefaultBackoffSettings());
1830
+ return decodeOperation;
1831
+ }
1832
+ listIndexes(request, optionsOrCallback, callback) {
1833
+ request = request || {};
1834
+ let options;
1835
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1836
+ callback = optionsOrCallback;
1837
+ options = {};
1838
+ }
1839
+ else {
1840
+ options = optionsOrCallback;
1841
+ }
1842
+ options = options || {};
1843
+ options.otherArgs = options.otherArgs || {};
1844
+ options.otherArgs.headers = options.otherArgs.headers || {};
1845
+ options.otherArgs.headers['x-goog-request-params'] =
1846
+ this._gaxModule.routingHeader.fromParams({
1847
+ parent: request.parent ?? '',
1848
+ });
1849
+ this.initialize().catch((err) => {
1850
+ throw err;
1851
+ });
1852
+ const wrappedCallback = callback
1853
+ ? (error, values, nextPageRequest, rawResponse) => {
1854
+ this._log.info('listIndexes values %j', values);
1855
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1856
+ }
1857
+ : undefined;
1858
+ this._log.info('listIndexes request %j', request);
1859
+ return this.innerApiCalls
1860
+ .listIndexes(request, options, wrappedCallback)
1861
+ ?.then(([response, input, output]) => {
1862
+ this._log.info('listIndexes values %j', response);
1863
+ return [response, input, output];
1864
+ });
1865
+ }
1866
+ /**
1867
+ * Equivalent to `listIndexes`, but returns a NodeJS Stream object.
1868
+ * @param {Object} request
1869
+ * The request object that will be sent.
1870
+ * @param {string} request.parent
1871
+ * Required. A parent name of the form
1872
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
1873
+ * @param {string} request.filter
1874
+ * The filter to apply to list results.
1875
+ * @param {number} request.pageSize
1876
+ * The number of results to return.
1877
+ * @param {string} request.pageToken
1878
+ * A page token, returned from a previous call to
1879
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes},
1880
+ * that may be used to get the next page of results.
1881
+ * @param {object} [options]
1882
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1883
+ * @returns {Stream}
1884
+ * An object stream which emits an object representing {@link protos.google.firestore.admin.v1.Index|Index} on 'data' event.
1885
+ * The client library will perform auto-pagination by default: it will call the API as many
1886
+ * times as needed. Note that it can affect your quota.
1887
+ * We recommend using `listIndexesAsync()`
1888
+ * method described below for async iteration which you can stop as needed.
1889
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1890
+ * for more details and examples.
1891
+ */
1892
+ listIndexesStream(request, options) {
1893
+ request = request || {};
1894
+ options = options || {};
1895
+ options.otherArgs = options.otherArgs || {};
1896
+ options.otherArgs.headers = options.otherArgs.headers || {};
1897
+ options.otherArgs.headers['x-goog-request-params'] =
1898
+ this._gaxModule.routingHeader.fromParams({
1899
+ parent: request.parent ?? '',
1900
+ });
1901
+ const defaultCallSettings = this._defaults['listIndexes'];
1902
+ const callSettings = defaultCallSettings.merge(options);
1903
+ this.initialize().catch((err) => {
1904
+ throw err;
1905
+ });
1906
+ this._log.info('listIndexes stream %j', request);
1907
+ return this.descriptors.page.listIndexes.createStream(this.innerApiCalls.listIndexes, request, callSettings);
1908
+ }
1909
+ /**
1910
+ * Equivalent to `listIndexes`, but returns an iterable object.
1911
+ *
1912
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1913
+ * @param {Object} request
1914
+ * The request object that will be sent.
1915
+ * @param {string} request.parent
1916
+ * Required. A parent name of the form
1917
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
1918
+ * @param {string} request.filter
1919
+ * The filter to apply to list results.
1920
+ * @param {number} request.pageSize
1921
+ * The number of results to return.
1922
+ * @param {string} request.pageToken
1923
+ * A page token, returned from a previous call to
1924
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes},
1925
+ * that may be used to get the next page of results.
1926
+ * @param {object} [options]
1927
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1928
+ * @returns {Object}
1929
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1930
+ * When you iterate the returned iterable, each element will be an object representing
1931
+ * {@link protos.google.firestore.admin.v1.Index|Index}. The API will be called under the hood as needed, once per the page,
1932
+ * so you can stop the iteration when you don't need more results.
1933
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1934
+ * for more details and examples.
1935
+ * @example <caption>include:samples/generated/v1/firestore_admin.list_indexes.js</caption>
1936
+ * region_tag:firestore_v1_generated_FirestoreAdmin_ListIndexes_async
1937
+ */
1938
+ listIndexesAsync(request, options) {
1939
+ request = request || {};
1940
+ options = options || {};
1941
+ options.otherArgs = options.otherArgs || {};
1942
+ options.otherArgs.headers = options.otherArgs.headers || {};
1943
+ options.otherArgs.headers['x-goog-request-params'] =
1944
+ this._gaxModule.routingHeader.fromParams({
1945
+ parent: request.parent ?? '',
1946
+ });
1947
+ const defaultCallSettings = this._defaults['listIndexes'];
1948
+ const callSettings = defaultCallSettings.merge(options);
1949
+ this.initialize().catch((err) => {
1950
+ throw err;
1951
+ });
1952
+ this._log.info('listIndexes iterate %j', request);
1953
+ return this.descriptors.page.listIndexes.asyncIterate(this.innerApiCalls['listIndexes'], request, callSettings);
1954
+ }
1955
+ listFields(request, optionsOrCallback, callback) {
1956
+ request = request || {};
1957
+ let options;
1958
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1959
+ callback = optionsOrCallback;
1960
+ options = {};
1961
+ }
1962
+ else {
1963
+ options = optionsOrCallback;
1964
+ }
1965
+ options = options || {};
1966
+ options.otherArgs = options.otherArgs || {};
1967
+ options.otherArgs.headers = options.otherArgs.headers || {};
1968
+ options.otherArgs.headers['x-goog-request-params'] =
1969
+ this._gaxModule.routingHeader.fromParams({
1970
+ parent: request.parent ?? '',
1971
+ });
1972
+ this.initialize().catch((err) => {
1973
+ throw err;
1974
+ });
1975
+ const wrappedCallback = callback
1976
+ ? (error, values, nextPageRequest, rawResponse) => {
1977
+ this._log.info('listFields values %j', values);
1978
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1979
+ }
1980
+ : undefined;
1981
+ this._log.info('listFields request %j', request);
1982
+ return this.innerApiCalls
1983
+ .listFields(request, options, wrappedCallback)
1984
+ ?.then(([response, input, output]) => {
1985
+ this._log.info('listFields values %j', response);
1986
+ return [response, input, output];
1987
+ });
1988
+ }
1989
+ /**
1990
+ * Equivalent to `listFields`, but returns a NodeJS Stream object.
1991
+ * @param {Object} request
1992
+ * The request object that will be sent.
1993
+ * @param {string} request.parent
1994
+ * Required. A parent name of the form
1995
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
1996
+ * @param {string} request.filter
1997
+ * The filter to apply to list results. Currently,
1998
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}
1999
+ * only supports listing fields that have been explicitly overridden. To issue
2000
+ * this query, call
2001
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}
2002
+ * with a filter that includes `indexConfig.usesAncestorConfig:false` or
2003
+ * `ttlConfig:*`.
2004
+ * @param {number} request.pageSize
2005
+ * The number of results to return.
2006
+ * @param {string} request.pageToken
2007
+ * A page token, returned from a previous call to
2008
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields},
2009
+ * that may be used to get the next page of results.
2010
+ * @param {object} [options]
2011
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2012
+ * @returns {Stream}
2013
+ * An object stream which emits an object representing {@link protos.google.firestore.admin.v1.Field|Field} on 'data' event.
2014
+ * The client library will perform auto-pagination by default: it will call the API as many
2015
+ * times as needed. Note that it can affect your quota.
2016
+ * We recommend using `listFieldsAsync()`
2017
+ * method described below for async iteration which you can stop as needed.
2018
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2019
+ * for more details and examples.
2020
+ */
2021
+ listFieldsStream(request, options) {
2022
+ request = request || {};
2023
+ options = options || {};
2024
+ options.otherArgs = options.otherArgs || {};
2025
+ options.otherArgs.headers = options.otherArgs.headers || {};
2026
+ options.otherArgs.headers['x-goog-request-params'] =
2027
+ this._gaxModule.routingHeader.fromParams({
2028
+ parent: request.parent ?? '',
2029
+ });
2030
+ const defaultCallSettings = this._defaults['listFields'];
2031
+ const callSettings = defaultCallSettings.merge(options);
2032
+ this.initialize().catch((err) => {
2033
+ throw err;
2034
+ });
2035
+ this._log.info('listFields stream %j', request);
2036
+ return this.descriptors.page.listFields.createStream(this.innerApiCalls.listFields, request, callSettings);
2037
+ }
2038
+ /**
2039
+ * Equivalent to `listFields`, but returns an iterable object.
2040
+ *
2041
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
2042
+ * @param {Object} request
2043
+ * The request object that will be sent.
2044
+ * @param {string} request.parent
2045
+ * Required. A parent name of the form
2046
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
2047
+ * @param {string} request.filter
2048
+ * The filter to apply to list results. Currently,
2049
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}
2050
+ * only supports listing fields that have been explicitly overridden. To issue
2051
+ * this query, call
2052
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}
2053
+ * with a filter that includes `indexConfig.usesAncestorConfig:false` or
2054
+ * `ttlConfig:*`.
2055
+ * @param {number} request.pageSize
2056
+ * The number of results to return.
2057
+ * @param {string} request.pageToken
2058
+ * A page token, returned from a previous call to
2059
+ * {@link protos.google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields},
2060
+ * that may be used to get the next page of results.
2061
+ * @param {object} [options]
2062
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2063
+ * @returns {Object}
2064
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2065
+ * When you iterate the returned iterable, each element will be an object representing
2066
+ * {@link protos.google.firestore.admin.v1.Field|Field}. The API will be called under the hood as needed, once per the page,
2067
+ * so you can stop the iteration when you don't need more results.
2068
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2069
+ * for more details and examples.
2070
+ * @example <caption>include:samples/generated/v1/firestore_admin.list_fields.js</caption>
2071
+ * region_tag:firestore_v1_generated_FirestoreAdmin_ListFields_async
2072
+ */
2073
+ listFieldsAsync(request, options) {
2074
+ request = request || {};
2075
+ options = options || {};
2076
+ options.otherArgs = options.otherArgs || {};
2077
+ options.otherArgs.headers = options.otherArgs.headers || {};
2078
+ options.otherArgs.headers['x-goog-request-params'] =
2079
+ this._gaxModule.routingHeader.fromParams({
2080
+ parent: request.parent ?? '',
2081
+ });
2082
+ const defaultCallSettings = this._defaults['listFields'];
2083
+ const callSettings = defaultCallSettings.merge(options);
2084
+ this.initialize().catch((err) => {
2085
+ throw err;
2086
+ });
2087
+ this._log.info('listFields iterate %j', request);
2088
+ return this.descriptors.page.listFields.asyncIterate(this.innerApiCalls['listFields'], request, callSettings);
2089
+ }
2090
+ /**
2091
+ * Gets information about a location.
2092
+ *
2093
+ * @param {Object} request
2094
+ * The request object that will be sent.
2095
+ * @param {string} request.name
2096
+ * Resource name for the location.
2097
+ * @param {object} [options]
2098
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
2099
+ * @returns {Promise} - The promise which resolves to an array.
2100
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
2101
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
2102
+ * for more details and examples.
2103
+ * @example
2104
+ * ```
2105
+ * const [response] = await client.getLocation(request);
2106
+ * ```
2107
+ */
2108
+ getLocation(request, options, callback) {
2109
+ return this.locationsClient.getLocation(request, options, callback);
2110
+ }
2111
+ /**
2112
+ * Lists information about the supported locations for this service. Returns an iterable object.
2113
+ *
2114
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
2115
+ * @param {Object} request
2116
+ * The request object that will be sent.
2117
+ * @param {string} request.name
2118
+ * The resource that owns the locations collection, if applicable.
2119
+ * @param {string} request.filter
2120
+ * The standard list filter.
2121
+ * @param {number} request.pageSize
2122
+ * The standard list page size.
2123
+ * @param {string} request.pageToken
2124
+ * The standard list page token.
2125
+ * @param {object} [options]
2126
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2127
+ * @returns {Object}
2128
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2129
+ * When you iterate the returned iterable, each element will be an object representing
2130
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
2131
+ * so you can stop the iteration when you don't need more results.
2132
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2133
+ * for more details and examples.
2134
+ * @example
2135
+ * ```
2136
+ * const iterable = client.listLocationsAsync(request);
2137
+ * for await (const response of iterable) {
2138
+ * // process response
2139
+ * }
2140
+ * ```
2141
+ */
2142
+ listLocationsAsync(request, options) {
2143
+ return this.locationsClient.listLocationsAsync(request, options);
2144
+ }
2145
+ /**
2146
+ * Gets the latest state of a long-running operation. Clients can use this
2147
+ * method to poll the operation result at intervals as recommended by the API
2148
+ * service.
2149
+ *
2150
+ * @param {Object} request - The request object that will be sent.
2151
+ * @param {string} request.name - The name of the operation resource.
2152
+ * @param {Object=} options
2153
+ * Optional parameters. You can override the default settings for this call,
2154
+ * e.g, timeout, retries, paginations, etc. See {@link
2155
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
2156
+ * for the details.
2157
+ * @param {function(?Error, ?Object)=} callback
2158
+ * The function which will be called with the result of the API call.
2159
+ *
2160
+ * The second parameter to the callback is an object representing
2161
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
2162
+ * @return {Promise} - The promise which resolves to an array.
2163
+ * The first element of the array is an object representing
2164
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
2165
+ * The promise has a method named "cancel" which cancels the ongoing API call.
2166
+ *
2167
+ * @example
2168
+ * ```
2169
+ * const client = longrunning.operationsClient();
2170
+ * const name = '';
2171
+ * const [response] = await client.getOperation({name});
2172
+ * // doThingsWith(response)
2173
+ * ```
2174
+ */
2175
+ getOperation(request, optionsOrCallback, callback) {
2176
+ let options;
2177
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2178
+ callback = optionsOrCallback;
2179
+ options = {};
2180
+ }
2181
+ else {
2182
+ options = optionsOrCallback;
2183
+ }
2184
+ options = options || {};
2185
+ options.otherArgs = options.otherArgs || {};
2186
+ options.otherArgs.headers = options.otherArgs.headers || {};
2187
+ options.otherArgs.headers['x-goog-request-params'] =
2188
+ this._gaxModule.routingHeader.fromParams({
2189
+ name: request.name ?? '',
2190
+ });
2191
+ return this.operationsClient.getOperation(request, options, callback);
2192
+ }
2193
+ /**
2194
+ * Lists operations that match the specified filter in the request. If the
2195
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
2196
+ *
2197
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
2198
+ *
2199
+ * @param {Object} request - The request object that will be sent.
2200
+ * @param {string} request.name - The name of the operation collection.
2201
+ * @param {string} request.filter - The standard list filter.
2202
+ * @param {number=} request.pageSize -
2203
+ * The maximum number of resources contained in the underlying API
2204
+ * response. If page streaming is performed per-resource, this
2205
+ * parameter does not affect the return value. If page streaming is
2206
+ * performed per-page, this determines the maximum number of
2207
+ * resources in a page.
2208
+ * @param {Object=} options
2209
+ * Optional parameters. You can override the default settings for this call,
2210
+ * e.g, timeout, retries, paginations, etc. See {@link
2211
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
2212
+ * details.
2213
+ * @returns {Object}
2214
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
2215
+ *
2216
+ * @example
2217
+ * ```
2218
+ * const client = longrunning.operationsClient();
2219
+ * for await (const response of client.listOperationsAsync(request));
2220
+ * // doThingsWith(response)
2221
+ * ```
2222
+ */
2223
+ listOperationsAsync(request, options) {
2224
+ options = options || {};
2225
+ options.otherArgs = options.otherArgs || {};
2226
+ options.otherArgs.headers = options.otherArgs.headers || {};
2227
+ options.otherArgs.headers['x-goog-request-params'] =
2228
+ this._gaxModule.routingHeader.fromParams({
2229
+ name: request.name ?? '',
2230
+ });
2231
+ return this.operationsClient.listOperationsAsync(request, options);
2232
+ }
2233
+ /**
2234
+ * Starts asynchronous cancellation on a long-running operation. The server
2235
+ * makes a best effort to cancel the operation, but success is not
2236
+ * guaranteed. If the server doesn't support this method, it returns
2237
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
2238
+ * {@link Operations.GetOperation} or
2239
+ * other methods to check whether the cancellation succeeded or whether the
2240
+ * operation completed despite cancellation. On successful cancellation,
2241
+ * the operation is not deleted; instead, it becomes an operation with
2242
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
2243
+ * 1, corresponding to `Code.CANCELLED`.
2244
+ *
2245
+ * @param {Object} request - The request object that will be sent.
2246
+ * @param {string} request.name - The name of the operation resource to be cancelled.
2247
+ * @param {Object=} options
2248
+ * Optional parameters. You can override the default settings for this call,
2249
+ * e.g, timeout, retries, paginations, etc. See {@link
2250
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
2251
+ * details.
2252
+ * @param {function(?Error)=} callback
2253
+ * The function which will be called with the result of the API call.
2254
+ * @return {Promise} - The promise which resolves when API call finishes.
2255
+ * The promise has a method named "cancel" which cancels the ongoing API
2256
+ * call.
2257
+ *
2258
+ * @example
2259
+ * ```
2260
+ * const client = longrunning.operationsClient();
2261
+ * await client.cancelOperation({name: ''});
2262
+ * ```
2263
+ */
2264
+ cancelOperation(request, optionsOrCallback, callback) {
2265
+ let options;
2266
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2267
+ callback = optionsOrCallback;
2268
+ options = {};
2269
+ }
2270
+ else {
2271
+ options = optionsOrCallback;
2272
+ }
2273
+ options = options || {};
2274
+ options.otherArgs = options.otherArgs || {};
2275
+ options.otherArgs.headers = options.otherArgs.headers || {};
2276
+ options.otherArgs.headers['x-goog-request-params'] =
2277
+ this._gaxModule.routingHeader.fromParams({
2278
+ name: request.name ?? '',
2279
+ });
2280
+ return this.operationsClient.cancelOperation(request, options, callback);
2281
+ }
2282
+ /**
2283
+ * Deletes a long-running operation. This method indicates that the client is
2284
+ * no longer interested in the operation result. It does not cancel the
2285
+ * operation. If the server doesn't support this method, it returns
2286
+ * `google.rpc.Code.UNIMPLEMENTED`.
2287
+ *
2288
+ * @param {Object} request - The request object that will be sent.
2289
+ * @param {string} request.name - The name of the operation resource to be deleted.
2290
+ * @param {Object=} options
2291
+ * Optional parameters. You can override the default settings for this call,
2292
+ * e.g, timeout, retries, paginations, etc. See {@link
2293
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
2294
+ * for the details.
2295
+ * @param {function(?Error)=} callback
2296
+ * The function which will be called with the result of the API call.
2297
+ * @return {Promise} - The promise which resolves when API call finishes.
2298
+ * The promise has a method named "cancel" which cancels the ongoing API
2299
+ * call.
2300
+ *
2301
+ * @example
2302
+ * ```
2303
+ * const client = longrunning.operationsClient();
2304
+ * await client.deleteOperation({name: ''});
2305
+ * ```
2306
+ */
2307
+ deleteOperation(request, optionsOrCallback, callback) {
2308
+ let options;
2309
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2310
+ callback = optionsOrCallback;
2311
+ options = {};
2312
+ }
2313
+ else {
2314
+ options = optionsOrCallback;
2315
+ }
2316
+ options = options || {};
2317
+ options.otherArgs = options.otherArgs || {};
2318
+ options.otherArgs.headers = options.otherArgs.headers || {};
2319
+ options.otherArgs.headers['x-goog-request-params'] =
2320
+ this._gaxModule.routingHeader.fromParams({
2321
+ name: request.name ?? '',
2322
+ });
2323
+ return this.operationsClient.deleteOperation(request, options, callback);
2324
+ }
2325
+ // --------------------
2326
+ // -- Path templates --
2327
+ // --------------------
2328
+ /**
2329
+ * Return a fully-qualified backup resource name string.
2330
+ *
2331
+ * @param {string} project
2332
+ * @param {string} location
2333
+ * @param {string} backup
2334
+ * @returns {string} Resource name string.
2335
+ */
2336
+ backupPath(project, location, backup) {
2337
+ return this.pathTemplates.backupPathTemplate.render({
2338
+ project: project,
2339
+ location: location,
2340
+ backup: backup,
2341
+ });
2342
+ }
2343
+ /**
2344
+ * Parse the project from Backup resource.
2345
+ *
2346
+ * @param {string} backupName
2347
+ * A fully-qualified path representing Backup resource.
2348
+ * @returns {string} A string representing the project.
2349
+ */
2350
+ matchProjectFromBackupName(backupName) {
2351
+ return this.pathTemplates.backupPathTemplate.match(backupName).project;
2352
+ }
2353
+ /**
2354
+ * Parse the location from Backup resource.
2355
+ *
2356
+ * @param {string} backupName
2357
+ * A fully-qualified path representing Backup resource.
2358
+ * @returns {string} A string representing the location.
2359
+ */
2360
+ matchLocationFromBackupName(backupName) {
2361
+ return this.pathTemplates.backupPathTemplate.match(backupName).location;
2362
+ }
2363
+ /**
2364
+ * Parse the backup from Backup resource.
2365
+ *
2366
+ * @param {string} backupName
2367
+ * A fully-qualified path representing Backup resource.
2368
+ * @returns {string} A string representing the backup.
2369
+ */
2370
+ matchBackupFromBackupName(backupName) {
2371
+ return this.pathTemplates.backupPathTemplate.match(backupName).backup;
2372
+ }
2373
+ /**
2374
+ * Return a fully-qualified backupSchedule resource name string.
2375
+ *
2376
+ * @param {string} project
2377
+ * @param {string} database
2378
+ * @param {string} backup_schedule
2379
+ * @returns {string} Resource name string.
2380
+ */
2381
+ backupSchedulePath(project, database, backupSchedule) {
2382
+ return this.pathTemplates.backupSchedulePathTemplate.render({
2383
+ project: project,
2384
+ database: database,
2385
+ backup_schedule: backupSchedule,
2386
+ });
2387
+ }
2388
+ /**
2389
+ * Parse the project from BackupSchedule resource.
2390
+ *
2391
+ * @param {string} backupScheduleName
2392
+ * A fully-qualified path representing BackupSchedule resource.
2393
+ * @returns {string} A string representing the project.
2394
+ */
2395
+ matchProjectFromBackupScheduleName(backupScheduleName) {
2396
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).project;
2397
+ }
2398
+ /**
2399
+ * Parse the database from BackupSchedule resource.
2400
+ *
2401
+ * @param {string} backupScheduleName
2402
+ * A fully-qualified path representing BackupSchedule resource.
2403
+ * @returns {string} A string representing the database.
2404
+ */
2405
+ matchDatabaseFromBackupScheduleName(backupScheduleName) {
2406
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).database;
2407
+ }
2408
+ /**
2409
+ * Parse the backup_schedule from BackupSchedule resource.
2410
+ *
2411
+ * @param {string} backupScheduleName
2412
+ * A fully-qualified path representing BackupSchedule resource.
2413
+ * @returns {string} A string representing the backup_schedule.
2414
+ */
2415
+ matchBackupScheduleFromBackupScheduleName(backupScheduleName) {
2416
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).backup_schedule;
2417
+ }
2418
+ /**
2419
+ * Return a fully-qualified collectionGroup resource name string.
2420
+ *
2421
+ * @param {string} project
2422
+ * @param {string} database
2423
+ * @param {string} collection
2424
+ * @returns {string} Resource name string.
2425
+ */
2426
+ collectionGroupPath(project, database, collection) {
2427
+ return this.pathTemplates.collectionGroupPathTemplate.render({
2428
+ project: project,
2429
+ database: database,
2430
+ collection: collection,
2431
+ });
2432
+ }
2433
+ /**
2434
+ * Parse the project from CollectionGroup resource.
2435
+ *
2436
+ * @param {string} collectionGroupName
2437
+ * A fully-qualified path representing CollectionGroup resource.
2438
+ * @returns {string} A string representing the project.
2439
+ */
2440
+ matchProjectFromCollectionGroupName(collectionGroupName) {
2441
+ return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).project;
2442
+ }
2443
+ /**
2444
+ * Parse the database from CollectionGroup resource.
2445
+ *
2446
+ * @param {string} collectionGroupName
2447
+ * A fully-qualified path representing CollectionGroup resource.
2448
+ * @returns {string} A string representing the database.
2449
+ */
2450
+ matchDatabaseFromCollectionGroupName(collectionGroupName) {
2451
+ return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).database;
2452
+ }
2453
+ /**
2454
+ * Parse the collection from CollectionGroup resource.
2455
+ *
2456
+ * @param {string} collectionGroupName
2457
+ * A fully-qualified path representing CollectionGroup resource.
2458
+ * @returns {string} A string representing the collection.
2459
+ */
2460
+ matchCollectionFromCollectionGroupName(collectionGroupName) {
2461
+ return this.pathTemplates.collectionGroupPathTemplate.match(collectionGroupName).collection;
2462
+ }
2463
+ /**
2464
+ * Return a fully-qualified database resource name string.
2465
+ *
2466
+ * @param {string} project
2467
+ * @param {string} database
2468
+ * @returns {string} Resource name string.
2469
+ */
2470
+ databasePath(project, database) {
2471
+ return this.pathTemplates.databasePathTemplate.render({
2472
+ project: project,
2473
+ database: database,
2474
+ });
2475
+ }
2476
+ /**
2477
+ * Parse the project from Database resource.
2478
+ *
2479
+ * @param {string} databaseName
2480
+ * A fully-qualified path representing Database resource.
2481
+ * @returns {string} A string representing the project.
2482
+ */
2483
+ matchProjectFromDatabaseName(databaseName) {
2484
+ return this.pathTemplates.databasePathTemplate.match(databaseName).project;
2485
+ }
2486
+ /**
2487
+ * Parse the database from Database resource.
2488
+ *
2489
+ * @param {string} databaseName
2490
+ * A fully-qualified path representing Database resource.
2491
+ * @returns {string} A string representing the database.
2492
+ */
2493
+ matchDatabaseFromDatabaseName(databaseName) {
2494
+ return this.pathTemplates.databasePathTemplate.match(databaseName).database;
2495
+ }
2496
+ /**
2497
+ * Return a fully-qualified field resource name string.
2498
+ *
2499
+ * @param {string} project
2500
+ * @param {string} database
2501
+ * @param {string} collection
2502
+ * @param {string} field
2503
+ * @returns {string} Resource name string.
2504
+ */
2505
+ fieldPath(project, database, collection, field) {
2506
+ return this.pathTemplates.fieldPathTemplate.render({
2507
+ project: project,
2508
+ database: database,
2509
+ collection: collection,
2510
+ field: field,
2511
+ });
2512
+ }
2513
+ /**
2514
+ * Parse the project from Field resource.
2515
+ *
2516
+ * @param {string} fieldName
2517
+ * A fully-qualified path representing Field resource.
2518
+ * @returns {string} A string representing the project.
2519
+ */
2520
+ matchProjectFromFieldName(fieldName) {
2521
+ return this.pathTemplates.fieldPathTemplate.match(fieldName).project;
2522
+ }
2523
+ /**
2524
+ * Parse the database from Field resource.
2525
+ *
2526
+ * @param {string} fieldName
2527
+ * A fully-qualified path representing Field resource.
2528
+ * @returns {string} A string representing the database.
2529
+ */
2530
+ matchDatabaseFromFieldName(fieldName) {
2531
+ return this.pathTemplates.fieldPathTemplate.match(fieldName).database;
2532
+ }
2533
+ /**
2534
+ * Parse the collection from Field resource.
2535
+ *
2536
+ * @param {string} fieldName
2537
+ * A fully-qualified path representing Field resource.
2538
+ * @returns {string} A string representing the collection.
2539
+ */
2540
+ matchCollectionFromFieldName(fieldName) {
2541
+ return this.pathTemplates.fieldPathTemplate.match(fieldName).collection;
2542
+ }
2543
+ /**
2544
+ * Parse the field from Field resource.
2545
+ *
2546
+ * @param {string} fieldName
2547
+ * A fully-qualified path representing Field resource.
2548
+ * @returns {string} A string representing the field.
2549
+ */
2550
+ matchFieldFromFieldName(fieldName) {
2551
+ return this.pathTemplates.fieldPathTemplate.match(fieldName).field;
2552
+ }
2553
+ /**
2554
+ * Return a fully-qualified index resource name string.
2555
+ *
2556
+ * @param {string} project
2557
+ * @param {string} database
2558
+ * @param {string} collection
2559
+ * @param {string} index
2560
+ * @returns {string} Resource name string.
2561
+ */
2562
+ indexPath(project, database, collection, index) {
2563
+ return this.pathTemplates.indexPathTemplate.render({
2564
+ project: project,
2565
+ database: database,
2566
+ collection: collection,
2567
+ index: index,
2568
+ });
2569
+ }
2570
+ /**
2571
+ * Parse the project from Index resource.
2572
+ *
2573
+ * @param {string} indexName
2574
+ * A fully-qualified path representing Index resource.
2575
+ * @returns {string} A string representing the project.
2576
+ */
2577
+ matchProjectFromIndexName(indexName) {
2578
+ return this.pathTemplates.indexPathTemplate.match(indexName).project;
2579
+ }
2580
+ /**
2581
+ * Parse the database from Index resource.
2582
+ *
2583
+ * @param {string} indexName
2584
+ * A fully-qualified path representing Index resource.
2585
+ * @returns {string} A string representing the database.
2586
+ */
2587
+ matchDatabaseFromIndexName(indexName) {
2588
+ return this.pathTemplates.indexPathTemplate.match(indexName).database;
2589
+ }
2590
+ /**
2591
+ * Parse the collection from Index resource.
2592
+ *
2593
+ * @param {string} indexName
2594
+ * A fully-qualified path representing Index resource.
2595
+ * @returns {string} A string representing the collection.
2596
+ */
2597
+ matchCollectionFromIndexName(indexName) {
2598
+ return this.pathTemplates.indexPathTemplate.match(indexName).collection;
2599
+ }
2600
+ /**
2601
+ * Parse the index from Index resource.
2602
+ *
2603
+ * @param {string} indexName
2604
+ * A fully-qualified path representing Index resource.
2605
+ * @returns {string} A string representing the index.
2606
+ */
2607
+ matchIndexFromIndexName(indexName) {
2608
+ return this.pathTemplates.indexPathTemplate.match(indexName).index;
2609
+ }
2610
+ /**
2611
+ * Return a fully-qualified location resource name string.
2612
+ *
2613
+ * @param {string} project
2614
+ * @param {string} location
2615
+ * @returns {string} Resource name string.
2616
+ */
2617
+ locationPath(project, location) {
2618
+ return this.pathTemplates.locationPathTemplate.render({
2619
+ project: project,
2620
+ location: location,
2621
+ });
2622
+ }
2623
+ /**
2624
+ * Parse the project from Location resource.
2625
+ *
2626
+ * @param {string} locationName
2627
+ * A fully-qualified path representing Location resource.
2628
+ * @returns {string} A string representing the project.
2629
+ */
2630
+ matchProjectFromLocationName(locationName) {
2631
+ return this.pathTemplates.locationPathTemplate.match(locationName).project;
2632
+ }
2633
+ /**
2634
+ * Parse the location from Location resource.
2635
+ *
2636
+ * @param {string} locationName
2637
+ * A fully-qualified path representing Location resource.
2638
+ * @returns {string} A string representing the location.
2639
+ */
2640
+ matchLocationFromLocationName(locationName) {
2641
+ return this.pathTemplates.locationPathTemplate.match(locationName).location;
2642
+ }
2643
+ /**
2644
+ * Return a fully-qualified project resource name string.
2645
+ *
2646
+ * @param {string} project
2647
+ * @returns {string} Resource name string.
2648
+ */
2649
+ projectPath(project) {
2650
+ return this.pathTemplates.projectPathTemplate.render({
2651
+ project: project,
2652
+ });
2653
+ }
2654
+ /**
2655
+ * Parse the project from Project resource.
2656
+ *
2657
+ * @param {string} projectName
2658
+ * A fully-qualified path representing Project resource.
2659
+ * @returns {string} A string representing the project.
2660
+ */
2661
+ matchProjectFromProjectName(projectName) {
2662
+ return this.pathTemplates.projectPathTemplate.match(projectName).project;
2663
+ }
2664
+ /**
2665
+ * Return a fully-qualified userCreds resource name string.
2666
+ *
2667
+ * @param {string} project
2668
+ * @param {string} database
2669
+ * @param {string} user_creds
2670
+ * @returns {string} Resource name string.
2671
+ */
2672
+ userCredsPath(project, database, userCreds) {
2673
+ return this.pathTemplates.userCredsPathTemplate.render({
2674
+ project: project,
2675
+ database: database,
2676
+ user_creds: userCreds,
2677
+ });
2678
+ }
2679
+ /**
2680
+ * Parse the project from UserCreds resource.
2681
+ *
2682
+ * @param {string} userCredsName
2683
+ * A fully-qualified path representing UserCreds resource.
2684
+ * @returns {string} A string representing the project.
2685
+ */
2686
+ matchProjectFromUserCredsName(userCredsName) {
2687
+ return this.pathTemplates.userCredsPathTemplate.match(userCredsName)
2688
+ .project;
2689
+ }
2690
+ /**
2691
+ * Parse the database from UserCreds resource.
2692
+ *
2693
+ * @param {string} userCredsName
2694
+ * A fully-qualified path representing UserCreds resource.
2695
+ * @returns {string} A string representing the database.
2696
+ */
2697
+ matchDatabaseFromUserCredsName(userCredsName) {
2698
+ return this.pathTemplates.userCredsPathTemplate.match(userCredsName)
2699
+ .database;
2700
+ }
2701
+ /**
2702
+ * Parse the user_creds from UserCreds resource.
2703
+ *
2704
+ * @param {string} userCredsName
2705
+ * A fully-qualified path representing UserCreds resource.
2706
+ * @returns {string} A string representing the user_creds.
2707
+ */
2708
+ matchUserCredsFromUserCredsName(userCredsName) {
2709
+ return this.pathTemplates.userCredsPathTemplate.match(userCredsName)
2710
+ .user_creds;
2711
+ }
2712
+ /**
2713
+ * Terminate the gRPC channel and close the client.
2714
+ *
2715
+ * The client will no longer be usable and all future behavior is undefined.
2716
+ * @returns {Promise} A promise that resolves when the client is closed.
2717
+ */
2718
+ close() {
2719
+ if (this.firestoreAdminStub && !this._terminated) {
2720
+ return this.firestoreAdminStub.then((stub) => {
2721
+ this._log.info('ending gRPC channel');
2722
+ this._terminated = true;
2723
+ stub.close();
2724
+ this.locationsClient.close().catch((err) => {
2725
+ throw err;
2726
+ });
2727
+ void this.operationsClient.close();
2728
+ });
2729
+ }
2730
+ return Promise.resolve();
2731
+ }
2732
+ }
2733
+ exports.FirestoreAdminClient = FirestoreAdminClient;
2734
+ //# sourceMappingURL=firestore_admin_client.js.map