@google-cloud/apikeys 2.1.0 → 2.2.1

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.
@@ -97,26 +97,17 @@ class ApiKeysClient {
97
97
  constructor(opts, gaxInstance) {
98
98
  // Ensure that options include all the required fields.
99
99
  const staticMembers = this.constructor;
100
- if (opts?.universe_domain &&
101
- opts?.universeDomain &&
102
- opts?.universe_domain !== opts?.universeDomain) {
100
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
103
101
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
104
102
  }
105
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
- : undefined;
108
- this._universeDomain =
109
- opts?.universeDomain ??
110
- opts?.universe_domain ??
111
- universeDomainEnvVar ??
112
- 'googleapis.com';
103
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
104
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
113
105
  this._servicePath = 'apikeys.' + this._universeDomain;
114
106
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
107
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
108
  const port = opts?.port || staticMembers.port;
117
109
  const clientConfig = opts?.clientConfig ?? {};
118
- const fallback = opts?.fallback ??
119
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
110
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
120
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
121
112
  // Request numeric enum values if REST transport is used.
122
113
  opts.numericEnums = true;
@@ -145,7 +136,10 @@ class ApiKeysClient {
145
136
  this.auth.defaultScopes = staticMembers.scopes;
146
137
  }
147
138
  // Determine the client header string.
148
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
139
+ const clientHeader = [
140
+ `gax/${this._gaxModule.version}`,
141
+ `gapic/${version}`,
142
+ ];
149
143
  if (typeof process === 'object' && 'versions' in process) {
150
144
  clientHeader.push(`gl-node/${process.versions.node}`);
151
145
  }
@@ -175,28 +169,21 @@ class ApiKeysClient {
175
169
  // (e.g. 50 results at a time, with tokens to get subsequent
176
170
  // pages). Denote the keys used for pagination and results.
177
171
  this.descriptors.page = {
178
- listKeys: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keys'),
172
+ listKeys: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keys')
179
173
  };
180
- const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
174
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
181
175
  // This API contains "long-running operations", which return a
182
176
  // an Operation object that allows for tracking of the operation,
183
177
  // rather than holding a request open.
184
178
  const lroOptions = {
185
179
  auth: this.auth,
186
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
180
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
187
181
  };
188
182
  if (opts.fallback) {
189
183
  lroOptions.protoJson = protoFilesRoot;
190
- lroOptions.httpRules = [
191
- {
192
- selector: 'google.longrunning.Operations.GetOperation',
193
- get: '/v2/{name=operations/*}',
194
- },
195
- ];
184
+ lroOptions.httpRules = [{ selector: 'google.longrunning.Operations.GetOperation', get: '/v2/{name=operations/*}', }];
196
185
  }
197
- this.operationsClient = this._gaxModule
198
- .lro(lroOptions)
199
- .operationsClient(opts);
186
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
200
187
  const createKeyResponse = protoFilesRoot.lookup('.google.api.apikeys.v2.Key');
201
188
  const createKeyMetadata = protoFilesRoot.lookup('.google.protobuf.Empty');
202
189
  const updateKeyResponse = protoFilesRoot.lookup('.google.api.apikeys.v2.Key');
@@ -209,7 +196,7 @@ class ApiKeysClient {
209
196
  createKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createKeyResponse.decode.bind(createKeyResponse), createKeyMetadata.decode.bind(createKeyMetadata)),
210
197
  updateKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateKeyResponse.decode.bind(updateKeyResponse), updateKeyMetadata.decode.bind(updateKeyMetadata)),
211
198
  deleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteKeyResponse.decode.bind(deleteKeyResponse), deleteKeyMetadata.decode.bind(deleteKeyMetadata)),
212
- undeleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, undeleteKeyResponse.decode.bind(undeleteKeyResponse), undeleteKeyMetadata.decode.bind(undeleteKeyMetadata)),
199
+ undeleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, undeleteKeyResponse.decode.bind(undeleteKeyResponse), undeleteKeyMetadata.decode.bind(undeleteKeyMetadata))
213
200
  };
214
201
  // Put together the default options sent with requests.
215
202
  this._defaults = this._gaxGrpc.constructSettings('google.api.apikeys.v2.ApiKeys', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -238,22 +225,13 @@ class ApiKeysClient {
238
225
  }
239
226
  // Put together the "service stub" for
240
227
  // google.api.apikeys.v2.ApiKeys.
241
- this.apiKeysStub = this._gaxGrpc.createStub(this._opts.fallback
242
- ? this._protos.lookupService('google.api.apikeys.v2.ApiKeys')
243
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
- this._protos.google.api.apikeys.v2.ApiKeys, this._opts, this._providedCustomServicePath);
228
+ this.apiKeysStub = this._gaxGrpc.createStub(this._opts.fallback ?
229
+ this._protos.lookupService('google.api.apikeys.v2.ApiKeys') :
230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
+ this._protos.google.api.apikeys.v2.ApiKeys, this._opts, this._providedCustomServicePath);
245
232
  // Iterate over each of the methods that the service provides
246
233
  // and create an API call method for each.
247
- const apiKeysStubMethods = [
248
- 'createKey',
249
- 'listKeys',
250
- 'getKey',
251
- 'getKeyString',
252
- 'updateKey',
253
- 'deleteKey',
254
- 'undeleteKey',
255
- 'lookupKey',
256
- ];
234
+ const apiKeysStubMethods = ['createKey', 'listKeys', 'getKey', 'getKeyString', 'updateKey', 'deleteKey', 'undeleteKey', 'lookupKey'];
257
235
  for (const methodName of apiKeysStubMethods) {
258
236
  const callPromise = this.apiKeysStub.then(stub => (...args) => {
259
237
  if (this._terminated) {
@@ -278,8 +256,7 @@ class ApiKeysClient {
278
256
  * @returns {string} The DNS address for this service.
279
257
  */
280
258
  static get servicePath() {
281
- if (typeof process === 'object' &&
282
- typeof process.emitWarning === 'function') {
259
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
283
260
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
284
261
  }
285
262
  return 'apikeys.googleapis.com';
@@ -290,8 +267,7 @@ class ApiKeysClient {
290
267
  * @returns {string} The DNS address for this service.
291
268
  */
292
269
  static get apiEndpoint() {
293
- if (typeof process === 'object' &&
294
- typeof process.emitWarning === 'function') {
270
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
295
271
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
296
272
  }
297
273
  return 'apikeys.googleapis.com';
@@ -321,7 +297,7 @@ class ApiKeysClient {
321
297
  static get scopes() {
322
298
  return [
323
299
  'https://www.googleapis.com/auth/cloud-platform',
324
- 'https://www.googleapis.com/auth/cloud-platform.read-only',
300
+ 'https://www.googleapis.com/auth/cloud-platform.read-only'
325
301
  ];
326
302
  }
327
303
  /**
@@ -348,13 +324,10 @@ class ApiKeysClient {
348
324
  options = options || {};
349
325
  options.otherArgs = options.otherArgs || {};
350
326
  options.otherArgs.headers = options.otherArgs.headers || {};
351
- options.otherArgs.headers['x-goog-request-params'] =
352
- this._gaxModule.routingHeader.fromParams({
353
- name: request.name ?? '',
354
- });
355
- this.initialize().catch(err => {
356
- throw err;
327
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
328
+ 'name': request.name ?? '',
357
329
  });
330
+ this.initialize().catch(err => { throw err; });
358
331
  this._log.info('getKey request %j', request);
359
332
  const wrappedCallback = callback
360
333
  ? (error, response, options, rawResponse) => {
@@ -362,11 +335,16 @@ class ApiKeysClient {
362
335
  callback(error, response, options, rawResponse); // We verified callback above.
363
336
  }
364
337
  : undefined;
365
- return this.innerApiCalls
366
- .getKey(request, options, wrappedCallback)
338
+ return this.innerApiCalls.getKey(request, options, wrappedCallback)
367
339
  ?.then(([response, options, rawResponse]) => {
368
340
  this._log.info('getKey response %j', response);
369
341
  return [response, options, rawResponse];
342
+ }).catch((error) => {
343
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
344
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
345
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
346
+ }
347
+ throw error;
370
348
  });
371
349
  }
372
350
  getKeyString(request, optionsOrCallback, callback) {
@@ -382,13 +360,10 @@ class ApiKeysClient {
382
360
  options = options || {};
383
361
  options.otherArgs = options.otherArgs || {};
384
362
  options.otherArgs.headers = options.otherArgs.headers || {};
385
- options.otherArgs.headers['x-goog-request-params'] =
386
- this._gaxModule.routingHeader.fromParams({
387
- name: request.name ?? '',
388
- });
389
- this.initialize().catch(err => {
390
- throw err;
363
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
364
+ 'name': request.name ?? '',
391
365
  });
366
+ this.initialize().catch(err => { throw err; });
392
367
  this._log.info('getKeyString request %j', request);
393
368
  const wrappedCallback = callback
394
369
  ? (error, response, options, rawResponse) => {
@@ -396,11 +371,16 @@ class ApiKeysClient {
396
371
  callback(error, response, options, rawResponse); // We verified callback above.
397
372
  }
398
373
  : undefined;
399
- return this.innerApiCalls
400
- .getKeyString(request, options, wrappedCallback)
374
+ return this.innerApiCalls.getKeyString(request, options, wrappedCallback)
401
375
  ?.then(([response, options, rawResponse]) => {
402
376
  this._log.info('getKeyString response %j', response);
403
377
  return [response, options, rawResponse];
378
+ }).catch((error) => {
379
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
380
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
381
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
382
+ }
383
+ throw error;
404
384
  });
405
385
  }
406
386
  lookupKey(request, optionsOrCallback, callback) {
@@ -416,9 +396,7 @@ class ApiKeysClient {
416
396
  options = options || {};
417
397
  options.otherArgs = options.otherArgs || {};
418
398
  options.otherArgs.headers = options.otherArgs.headers || {};
419
- this.initialize().catch(err => {
420
- throw err;
421
- });
399
+ this.initialize().catch(err => { throw err; });
422
400
  this._log.info('lookupKey request %j', request);
423
401
  const wrappedCallback = callback
424
402
  ? (error, response, options, rawResponse) => {
@@ -426,11 +404,16 @@ class ApiKeysClient {
426
404
  callback(error, response, options, rawResponse); // We verified callback above.
427
405
  }
428
406
  : undefined;
429
- return this.innerApiCalls
430
- .lookupKey(request, options, wrappedCallback)
407
+ return this.innerApiCalls.lookupKey(request, options, wrappedCallback)
431
408
  ?.then(([response, options, rawResponse]) => {
432
409
  this._log.info('lookupKey response %j', response);
433
410
  return [response, options, rawResponse];
411
+ }).catch((error) => {
412
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
413
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
414
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
415
+ }
416
+ throw error;
434
417
  });
435
418
  }
436
419
  createKey(request, optionsOrCallback, callback) {
@@ -446,13 +429,10 @@ class ApiKeysClient {
446
429
  options = options || {};
447
430
  options.otherArgs = options.otherArgs || {};
448
431
  options.otherArgs.headers = options.otherArgs.headers || {};
449
- options.otherArgs.headers['x-goog-request-params'] =
450
- this._gaxModule.routingHeader.fromParams({
451
- parent: request.parent ?? '',
452
- });
453
- this.initialize().catch(err => {
454
- throw err;
432
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
433
+ 'parent': request.parent ?? '',
455
434
  });
435
+ this.initialize().catch(err => { throw err; });
456
436
  const wrappedCallback = callback
457
437
  ? (error, response, rawResponse, _) => {
458
438
  this._log.info('createKey response %j', rawResponse);
@@ -460,8 +440,7 @@ class ApiKeysClient {
460
440
  }
461
441
  : undefined;
462
442
  this._log.info('createKey request %j', request);
463
- return this.innerApiCalls
464
- .createKey(request, options, wrappedCallback)
443
+ return this.innerApiCalls.createKey(request, options, wrappedCallback)
465
444
  ?.then(([response, rawResponse, _]) => {
466
445
  this._log.info('createKey response %j', rawResponse);
467
446
  return [response, rawResponse, _];
@@ -498,13 +477,10 @@ class ApiKeysClient {
498
477
  options = options || {};
499
478
  options.otherArgs = options.otherArgs || {};
500
479
  options.otherArgs.headers = options.otherArgs.headers || {};
501
- options.otherArgs.headers['x-goog-request-params'] =
502
- this._gaxModule.routingHeader.fromParams({
503
- 'key.name': request.key.name ?? '',
504
- });
505
- this.initialize().catch(err => {
506
- throw err;
480
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
481
+ 'key.name': request.key.name ?? '',
507
482
  });
483
+ this.initialize().catch(err => { throw err; });
508
484
  const wrappedCallback = callback
509
485
  ? (error, response, rawResponse, _) => {
510
486
  this._log.info('updateKey response %j', rawResponse);
@@ -512,8 +488,7 @@ class ApiKeysClient {
512
488
  }
513
489
  : undefined;
514
490
  this._log.info('updateKey request %j', request);
515
- return this.innerApiCalls
516
- .updateKey(request, options, wrappedCallback)
491
+ return this.innerApiCalls.updateKey(request, options, wrappedCallback)
517
492
  ?.then(([response, rawResponse, _]) => {
518
493
  this._log.info('updateKey response %j', rawResponse);
519
494
  return [response, rawResponse, _];
@@ -550,13 +525,10 @@ class ApiKeysClient {
550
525
  options = options || {};
551
526
  options.otherArgs = options.otherArgs || {};
552
527
  options.otherArgs.headers = options.otherArgs.headers || {};
553
- options.otherArgs.headers['x-goog-request-params'] =
554
- this._gaxModule.routingHeader.fromParams({
555
- name: request.name ?? '',
556
- });
557
- this.initialize().catch(err => {
558
- throw err;
528
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
529
+ 'name': request.name ?? '',
559
530
  });
531
+ this.initialize().catch(err => { throw err; });
560
532
  const wrappedCallback = callback
561
533
  ? (error, response, rawResponse, _) => {
562
534
  this._log.info('deleteKey response %j', rawResponse);
@@ -564,8 +536,7 @@ class ApiKeysClient {
564
536
  }
565
537
  : undefined;
566
538
  this._log.info('deleteKey request %j', request);
567
- return this.innerApiCalls
568
- .deleteKey(request, options, wrappedCallback)
539
+ return this.innerApiCalls.deleteKey(request, options, wrappedCallback)
569
540
  ?.then(([response, rawResponse, _]) => {
570
541
  this._log.info('deleteKey response %j', rawResponse);
571
542
  return [response, rawResponse, _];
@@ -602,13 +573,10 @@ class ApiKeysClient {
602
573
  options = options || {};
603
574
  options.otherArgs = options.otherArgs || {};
604
575
  options.otherArgs.headers = options.otherArgs.headers || {};
605
- options.otherArgs.headers['x-goog-request-params'] =
606
- this._gaxModule.routingHeader.fromParams({
607
- name: request.name ?? '',
608
- });
609
- this.initialize().catch(err => {
610
- throw err;
576
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
577
+ 'name': request.name ?? '',
611
578
  });
579
+ this.initialize().catch(err => { throw err; });
612
580
  const wrappedCallback = callback
613
581
  ? (error, response, rawResponse, _) => {
614
582
  this._log.info('undeleteKey response %j', rawResponse);
@@ -616,8 +584,7 @@ class ApiKeysClient {
616
584
  }
617
585
  : undefined;
618
586
  this._log.info('undeleteKey request %j', request);
619
- return this.innerApiCalls
620
- .undeleteKey(request, options, wrappedCallback)
587
+ return this.innerApiCalls.undeleteKey(request, options, wrappedCallback)
621
588
  ?.then(([response, rawResponse, _]) => {
622
589
  this._log.info('undeleteKey response %j', rawResponse);
623
590
  return [response, rawResponse, _];
@@ -654,13 +621,10 @@ class ApiKeysClient {
654
621
  options = options || {};
655
622
  options.otherArgs = options.otherArgs || {};
656
623
  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;
624
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
625
+ 'parent': request.parent ?? '',
663
626
  });
627
+ this.initialize().catch(err => { throw err; });
664
628
  const wrappedCallback = callback
665
629
  ? (error, values, nextPageRequest, rawResponse) => {
666
630
  this._log.info('listKeys values %j', values);
@@ -704,15 +668,12 @@ class ApiKeysClient {
704
668
  options = options || {};
705
669
  options.otherArgs = options.otherArgs || {};
706
670
  options.otherArgs.headers = options.otherArgs.headers || {};
707
- options.otherArgs.headers['x-goog-request-params'] =
708
- this._gaxModule.routingHeader.fromParams({
709
- parent: request.parent ?? '',
710
- });
671
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
672
+ 'parent': request.parent ?? '',
673
+ });
711
674
  const defaultCallSettings = this._defaults['listKeys'];
712
675
  const callSettings = defaultCallSettings.merge(options);
713
- this.initialize().catch(err => {
714
- throw err;
715
- });
676
+ this.initialize().catch(err => { throw err; });
716
677
  this._log.info('listKeys stream %j', request);
717
678
  return this.descriptors.page.listKeys.createStream(this.innerApiCalls.listKeys, request, callSettings);
718
679
  }
@@ -748,48 +709,45 @@ class ApiKeysClient {
748
709
  options = options || {};
749
710
  options.otherArgs = options.otherArgs || {};
750
711
  options.otherArgs.headers = options.otherArgs.headers || {};
751
- options.otherArgs.headers['x-goog-request-params'] =
752
- this._gaxModule.routingHeader.fromParams({
753
- parent: request.parent ?? '',
754
- });
712
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
713
+ 'parent': request.parent ?? '',
714
+ });
755
715
  const defaultCallSettings = this._defaults['listKeys'];
756
716
  const callSettings = defaultCallSettings.merge(options);
757
- this.initialize().catch(err => {
758
- throw err;
759
- });
717
+ this.initialize().catch(err => { throw err; });
760
718
  this._log.info('listKeys iterate %j', request);
761
719
  return this.descriptors.page.listKeys.asyncIterate(this.innerApiCalls['listKeys'], request, callSettings);
762
720
  }
763
721
  /**
764
- * Gets the latest state of a long-running operation. Clients can use this
765
- * method to poll the operation result at intervals as recommended by the API
766
- * service.
767
- *
768
- * @param {Object} request - The request object that will be sent.
769
- * @param {string} request.name - The name of the operation resource.
770
- * @param {Object=} options
771
- * Optional parameters. You can override the default settings for this call,
772
- * e.g, timeout, retries, paginations, etc. See {@link
773
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
774
- * for the details.
775
- * @param {function(?Error, ?Object)=} callback
776
- * The function which will be called with the result of the API call.
777
- *
778
- * The second parameter to the callback is an object representing
779
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
780
- * @return {Promise} - The promise which resolves to an array.
781
- * The first element of the array is an object representing
782
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
783
- * The promise has a method named "cancel" which cancels the ongoing API call.
784
- *
785
- * @example
786
- * ```
787
- * const client = longrunning.operationsClient();
788
- * const name = '';
789
- * const [response] = await client.getOperation({name});
790
- * // doThingsWith(response)
791
- * ```
792
- */
722
+ * Gets the latest state of a long-running operation. Clients can use this
723
+ * method to poll the operation result at intervals as recommended by the API
724
+ * service.
725
+ *
726
+ * @param {Object} request - The request object that will be sent.
727
+ * @param {string} request.name - The name of the operation resource.
728
+ * @param {Object=} options
729
+ * Optional parameters. You can override the default settings for this call,
730
+ * e.g, timeout, retries, paginations, etc. See {@link
731
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
732
+ * for the details.
733
+ * @param {function(?Error, ?Object)=} callback
734
+ * The function which will be called with the result of the API call.
735
+ *
736
+ * The second parameter to the callback is an object representing
737
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
738
+ * @return {Promise} - The promise which resolves to an array.
739
+ * The first element of the array is an object representing
740
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
741
+ * The promise has a method named "cancel" which cancels the ongoing API call.
742
+ *
743
+ * @example
744
+ * ```
745
+ * const client = longrunning.operationsClient();
746
+ * const name = '';
747
+ * const [response] = await client.getOperation({name});
748
+ * // doThingsWith(response)
749
+ * ```
750
+ */
793
751
  getOperation(request, optionsOrCallback, callback) {
794
752
  let options;
795
753
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1054,7 +1012,7 @@ class ApiKeysClient {
1054
1012
  this._log.info('ending gRPC channel');
1055
1013
  this._terminated = true;
1056
1014
  stub.close();
1057
- this.operationsClient.close();
1015
+ void this.operationsClient.close();
1058
1016
  });
1059
1017
  }
1060
1018
  return Promise.resolve();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/apikeys",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "API Keys API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "test": "c8 mocha build/test"
47
47
  },
48
48
  "dependencies": {
49
- "google-gax": "^5.0.1-rc.0"
49
+ "google-gax": "^5.0.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/mocha": "^10.0.10",
@@ -56,13 +56,13 @@
56
56
  "gapic-tools": "^1.0.0",
57
57
  "gts": "^6.0.2",
58
58
  "jsdoc": "^4.0.4",
59
- "jsdoc-fresh": "^3.0.0",
59
+ "jsdoc-fresh": "^4.0.0",
60
60
  "jsdoc-region-tag": "^3.0.0",
61
61
  "linkinator": "^6.1.2",
62
62
  "long": "^5.3.1",
63
63
  "mocha": "^11.1.0",
64
64
  "pack-n-play": "^3.0.0",
65
- "sinon": "^19.0.2",
65
+ "sinon": "^21.0.0",
66
66
  "typescript": "^5.8.2"
67
67
  },
68
68
  "engines": {
package/CHANGELOG.md DELETED
@@ -1,128 +0,0 @@
1
- # Changelog
2
-
3
- ## [2.1.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v2.0.0...apikeys-v2.1.0) (2025-03-19)
4
-
5
-
6
- ### Features
7
-
8
- * [Many APIs] await/catch promises, and update listOperationsAsync return type ([#6182](https://github.com/googleapis/google-cloud-node/issues/6182)) ([c41ff07](https://github.com/googleapis/google-cloud-node/commit/c41ff0729b65a1207978b4029d6369cc0552e0bf))
9
-
10
- ## [2.0.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.1...apikeys-v2.0.0) (2025-03-18)
11
-
12
-
13
- ### ⚠ BREAKING CHANGES
14
-
15
- * upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096))
16
-
17
- ### Features
18
-
19
- * [Many APIs] add request/response debug logging to gapics, update templates to gax 5 ([54a73fe](https://github.com/googleapis/google-cloud-node/commit/54a73fe74eab0675c006f24d5f1e4574c44d829b))
20
-
21
-
22
- ### Miscellaneous Chores
23
-
24
- * Upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) ([eadae64](https://github.com/googleapis/google-cloud-node/commit/eadae64d54e07aa2c65097ea52e65008d4e87436))
25
-
26
- ## [1.3.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.3.0...apikeys-v1.3.1) (2025-02-12)
27
-
28
-
29
- ### Bug Fixes
30
-
31
- * [Many APIs] finalize fixing typings for headers in generator ([#6011](https://github.com/googleapis/google-cloud-node/issues/6011)) ([ee865ff](https://github.com/googleapis/google-cloud-node/commit/ee865ff34a696fbd657e4cfb6cc4be2f6651f77a))
32
-
33
- ## [1.3.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.2.0...apikeys-v1.3.0) (2024-05-21)
34
-
35
-
36
- ### Features
37
-
38
- * [Many APIs] update Nodejs generator to send API versions in headers for GAPICs ([#5350](https://github.com/googleapis/google-cloud-node/issues/5350)) ([6c03873](https://github.com/googleapis/google-cloud-node/commit/6c038731de1f36456042e6b4ecf2a9686be662c7))
39
- * [Many APIs] update Nodejs generator to send API versions in headers for GAPICs ([#5351](https://github.com/googleapis/google-cloud-node/issues/5351)) ([01f48fc](https://github.com/googleapis/google-cloud-node/commit/01f48fce63ec4ddf801d59ee2b8c0db9f6fb8372))
40
- * [Many APIs] update Nodejs generator to send API versions in headers for GAPICs ([#5354](https://github.com/googleapis/google-cloud-node/issues/5354)) ([a9784ed](https://github.com/googleapis/google-cloud-node/commit/a9784ed3db6ee96d171762308bbbcd57390b6866))
41
-
42
- ## [1.2.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.1.0...apikeys-v1.2.0) (2024-04-16)
43
-
44
-
45
- ### Features
46
-
47
- * [Many APIs] support GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable ([#5185](https://github.com/googleapis/google-cloud-node/issues/5185)) ([cc54e98](https://github.com/googleapis/google-cloud-node/commit/cc54e98f7f51598e88277ac50310b07b778acbc7))
48
-
49
- ## [1.1.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.0.1...apikeys-v1.1.0) (2024-02-09)
50
-
51
-
52
- ### Features
53
-
54
- * Trusted Private Cloud support, use the universeDomain parameter ([#5022](https://github.com/googleapis/google-cloud-node/issues/5022)) ([b6498d8](https://github.com/googleapis/google-cloud-node/commit/b6498d8580d056817981dedbaa0ea5d82e9dccc2))
55
-
56
- ## [1.0.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v1.0.0...apikeys-v1.0.1) (2023-09-06)
57
-
58
-
59
- ### Bug Fixes
60
-
61
- * [Many APIs] simplify logic for HTTP/1.1 REST fallback option ([#4583](https://github.com/googleapis/google-cloud-node/issues/4583)) ([c3ddba8](https://github.com/googleapis/google-cloud-node/commit/c3ddba8df9fee6185e36a4e99f7c67b0319f1242))
62
-
63
- ## [1.0.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.2.2...apikeys-v1.0.0) (2023-08-06)
64
-
65
-
66
- ### ⚠ BREAKING CHANGES
67
-
68
- * migrate to Node 14 ([#4443](https://github.com/googleapis/google-cloud-node/issues/4443))
69
-
70
- ### Bug Fixes
71
-
72
- * [Many APIs] fix typings for IAM methods ([#4459](https://github.com/googleapis/google-cloud-node/issues/4459)) ([1d510be](https://github.com/googleapis/google-cloud-node/commit/1d510bef5bd7b0ac3552b4729ef3d9ebe1ac3dc4))
73
-
74
-
75
- ### Miscellaneous Chores
76
-
77
- * Migrate to Node 14 ([#4443](https://github.com/googleapis/google-cloud-node/issues/4443)) ([2260f12](https://github.com/googleapis/google-cloud-node/commit/2260f12543d171bda95345e53475f5f0fdc45770))
78
-
79
- ## [0.2.2](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.2.1...apikeys-v0.2.2) (2023-04-13)
80
-
81
-
82
- ### Bug Fixes
83
-
84
- * **deps:** Bump `google-gax` to ^3.5.8 ([#4117](https://github.com/googleapis/google-cloud-node/issues/4117)) ([0b67d88](https://github.com/googleapis/google-cloud-node/commit/0b67d883963643ce1b4f6d2ccd3e8d37adf6e029))
85
- * Minify JSON and JS files, and remove .map files ([#4143](https://github.com/googleapis/google-cloud-node/issues/4143)) ([170f7d5](https://github.com/googleapis/google-cloud-node/commit/170f7d57b8fd344d182a8e758867b8124722eebc))
86
-
87
- ## [0.2.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.2.0...apikeys-v0.2.1) (2023-02-15)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * [Many APIs] changing format of the jsdoc links ([#3985](https://github.com/googleapis/google-cloud-node/issues/3985)) ([fb2a6fd](https://github.com/googleapis/google-cloud-node/commit/fb2a6fdbd9dcf2ae91b3767629d71f0970d0712c))
93
-
94
- ## [0.2.0](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.1.3...apikeys-v0.2.0) (2023-01-28)
95
-
96
-
97
- ### Features
98
-
99
- * Added SuggestConversationSummary RPC ([#3851](https://github.com/googleapis/google-cloud-node/issues/3851)) ([79fbaa8](https://github.com/googleapis/google-cloud-node/commit/79fbaa833d08738fa37aa37158ddb5b1c91710e1))
100
-
101
- ## [0.1.3](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.1.2...apikeys-v0.1.3) (2022-11-10)
102
-
103
-
104
- ### Bug Fixes
105
-
106
- * Regenerated proto JS and TS definitions (generator update) ([#3472](https://github.com/googleapis/google-cloud-node/issues/3472)) ([5e2230d](https://github.com/googleapis/google-cloud-node/commit/5e2230dfc4302bb2ac9628ff4200eb46509e103d))
107
-
108
- ## [0.1.2](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.1.1...apikeys-v0.1.2) (2022-11-03)
109
-
110
-
111
- ### Bug Fixes
112
-
113
- * **deps:** Use google-gax v3.5.2 ([#3478](https://github.com/googleapis/google-cloud-node/issues/3478)) ([09305e0](https://github.com/googleapis/google-cloud-node/commit/09305e06548b89dc17bb3d3167e2d1e69588caa4))
114
-
115
- ## [0.1.1](https://github.com/googleapis/google-cloud-node/compare/apikeys-v0.1.0...apikeys-v0.1.1) (2022-09-28)
116
-
117
-
118
- ### Bug Fixes
119
-
120
- * preserve default values in x-goog-request-params header ([#3353](https://github.com/googleapis/google-cloud-node/issues/3353)) ([da99ad5](https://github.com/googleapis/google-cloud-node/commit/da99ad57f592a504750d57fdb1c7423734fec069))
121
-
122
- ## 0.1.0 (2022-08-29)
123
-
124
-
125
- ### Features
126
-
127
- * accept google-gax instance as a parameter ([#3307](https://github.com/googleapis/google-cloud-node/issues/3307)) ([502e3f7](https://github.com/googleapis/google-cloud-node/commit/502e3f7247193962c7546112d695ac8e5e220b22))
128
- * add initial files for google.api.apikeys.v2 ([6fad7f0](https://github.com/googleapis/google-cloud-node/commit/6fad7f0e625c0382c24e60eec2267d56766617ce))