@google-apps/chat 0.13.0 → 0.15.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 (35) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +4 -2
  3. package/build/protos/google/apps/card/v1/card.proto +1 -1
  4. package/build/protos/google/chat/v1/action_status.proto +1 -1
  5. package/build/protos/google/chat/v1/annotation.proto +1 -1
  6. package/build/protos/google/chat/v1/attachment.proto +1 -1
  7. package/build/protos/google/chat/v1/chat_service.proto +34 -2
  8. package/build/protos/google/chat/v1/contextual_addon.proto +1 -1
  9. package/build/protos/google/chat/v1/deletion_metadata.proto +1 -1
  10. package/build/protos/google/chat/v1/event_payload.proto +1 -1
  11. package/build/protos/google/chat/v1/group.proto +1 -1
  12. package/build/protos/google/chat/v1/history_state.proto +1 -1
  13. package/build/protos/google/chat/v1/matched_url.proto +1 -1
  14. package/build/protos/google/chat/v1/membership.proto +1 -1
  15. package/build/protos/google/chat/v1/message.proto +1 -1
  16. package/build/protos/google/chat/v1/reaction.proto +1 -1
  17. package/build/protos/google/chat/v1/slash_command.proto +1 -1
  18. package/build/protos/google/chat/v1/space.proto +1 -1
  19. package/build/protos/google/chat/v1/space_event.proto +1 -1
  20. package/build/protos/google/chat/v1/space_notification_setting.proto +122 -0
  21. package/build/protos/google/chat/v1/space_read_state.proto +1 -1
  22. package/build/protos/google/chat/v1/space_setup.proto +1 -1
  23. package/build/protos/google/chat/v1/thread_read_state.proto +1 -1
  24. package/build/protos/google/chat/v1/user.proto +1 -1
  25. package/build/protos/google/chat/v1/widgets.proto +1 -1
  26. package/build/protos/protos.d.ts +376 -0
  27. package/build/protos/protos.js +883 -0
  28. package/build/protos/protos.json +129 -4
  29. package/build/src/v1/chat_service_client.d.ts +96 -1
  30. package/build/src/v1/chat_service_client.js +686 -152
  31. package/build/src/v1/chat_service_client.js.map +1 -1
  32. package/build/src/v1/chat_service_client_config.json +10 -0
  33. package/build/src/v1/chat_service_proto_list.json +25 -0
  34. package/build/src/v1/gapic_metadata.json +357 -0
  35. package/package.json +16 -16
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.ChatServiceClient = void 0;
21
21
  const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
22
23
  /**
23
24
  * Client JSON configuration object, loaded from
24
25
  * `src/v1/chat_service_client_config.json`.
@@ -33,6 +34,27 @@ const version = require('../../../package.json').version;
33
34
  * @memberof v1
34
35
  */
35
36
  class ChatServiceClient {
37
+ _terminated = false;
38
+ _opts;
39
+ _providedCustomServicePath;
40
+ _gaxModule;
41
+ _gaxGrpc;
42
+ _protos;
43
+ _defaults;
44
+ _universeDomain;
45
+ _servicePath;
46
+ _log = google_gax_1.loggingUtils.log('chat');
47
+ auth;
48
+ descriptors = {
49
+ page: {},
50
+ stream: {},
51
+ longrunning: {},
52
+ batching: {},
53
+ };
54
+ warn;
55
+ innerApiCalls;
56
+ pathTemplates;
57
+ chatServiceStub;
36
58
  /**
37
59
  * Construct an instance of ChatServiceClient.
38
60
  *
@@ -55,7 +77,7 @@ class ChatServiceClient {
55
77
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
56
78
  * the environment variable GCLOUD_PROJECT for your project ID. If your
57
79
  * app is running in an environment which supports
58
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
59
81
  * your project ID will be detected automatically.
60
82
  * @param {string} [options.apiEndpoint] - The domain name of the
61
83
  * API remote host.
@@ -73,32 +95,28 @@ class ChatServiceClient {
73
95
  * ```
74
96
  */
75
97
  constructor(opts, gaxInstance) {
76
- var _a, _b, _c, _d, _e;
77
- this._terminated = false;
78
- this.descriptors = {
79
- page: {},
80
- stream: {},
81
- longrunning: {},
82
- batching: {},
83
- };
84
98
  // Ensure that options include all the required fields.
85
99
  const staticMembers = this.constructor;
86
- if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
87
- (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
88
- (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
89
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
90
104
  }
91
105
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
92
106
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
93
107
  : undefined;
94
108
  this._universeDomain =
95
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
96
113
  this._servicePath = 'chat.' + this._universeDomain;
97
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
98
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
99
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
100
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
101
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
114
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
+ const port = opts?.port || staticMembers.port;
117
+ const clientConfig = opts?.clientConfig ?? {};
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
102
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
103
121
  // Request numeric enum values if REST transport is used.
104
122
  opts.numericEnums = true;
@@ -156,6 +174,7 @@ class ChatServiceClient {
156
174
  reactionPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/reactions/{reaction}'),
157
175
  spacePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}'),
158
176
  spaceEventPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/spaceEvents/{space_event}'),
177
+ spaceNotificationSettingPathTemplate: new this._gaxModule.PathTemplate('users/{user}/spaces/{space}/spaceNotificationSetting'),
159
178
  spaceReadStatePathTemplate: new this._gaxModule.PathTemplate('users/{user}/spaces/{space}/spaceReadState'),
160
179
  threadPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/threads/{thread}'),
161
180
  threadReadStatePathTemplate: new this._gaxModule.PathTemplate('users/{user}/spaces/{space}/threads/{thread}/threadReadState'),
@@ -234,6 +253,8 @@ class ChatServiceClient {
234
253
  'getThreadReadState',
235
254
  'getSpaceEvent',
236
255
  'listSpaceEvents',
256
+ 'getSpaceNotificationSetting',
257
+ 'updateSpaceNotificationSetting',
237
258
  ];
238
259
  for (const methodName of chatServiceStubMethods) {
239
260
  const callPromise = this.chatServiceStub.then(stub => (...args) => {
@@ -321,6 +342,7 @@ class ChatServiceClient {
321
342
  'https://www.googleapis.com/auth/chat.spaces.readonly',
322
343
  'https://www.googleapis.com/auth/chat.users.readstate',
323
344
  'https://www.googleapis.com/auth/chat.users.readstate.readonly',
345
+ 'https://www.googleapis.com/auth/chat.users.spacesettings',
324
346
  ];
325
347
  }
326
348
  /**
@@ -335,7 +357,6 @@ class ChatServiceClient {
335
357
  return this.auth.getProjectId();
336
358
  }
337
359
  createMessage(request, optionsOrCallback, callback) {
338
- var _a;
339
360
  request = request || {};
340
361
  let options;
341
362
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -350,13 +371,26 @@ class ChatServiceClient {
350
371
  options.otherArgs.headers = options.otherArgs.headers || {};
351
372
  options.otherArgs.headers['x-goog-request-params'] =
352
373
  this._gaxModule.routingHeader.fromParams({
353
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
374
+ parent: request.parent ?? '',
354
375
  });
355
- this.initialize();
356
- return this.innerApiCalls.createMessage(request, options, callback);
376
+ this.initialize().catch(err => {
377
+ throw err;
378
+ });
379
+ this._log.info('createMessage request %j', request);
380
+ const wrappedCallback = callback
381
+ ? (error, response, options, rawResponse) => {
382
+ this._log.info('createMessage response %j', response);
383
+ callback(error, response, options, rawResponse); // We verified callback above.
384
+ }
385
+ : undefined;
386
+ return this.innerApiCalls
387
+ .createMessage(request, options, wrappedCallback)
388
+ ?.then(([response, options, rawResponse]) => {
389
+ this._log.info('createMessage response %j', response);
390
+ return [response, options, rawResponse];
391
+ });
357
392
  }
358
393
  getMembership(request, optionsOrCallback, callback) {
359
- var _a;
360
394
  request = request || {};
361
395
  let options;
362
396
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -371,13 +405,26 @@ class ChatServiceClient {
371
405
  options.otherArgs.headers = options.otherArgs.headers || {};
372
406
  options.otherArgs.headers['x-goog-request-params'] =
373
407
  this._gaxModule.routingHeader.fromParams({
374
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
408
+ name: request.name ?? '',
375
409
  });
376
- this.initialize();
377
- return this.innerApiCalls.getMembership(request, options, callback);
410
+ this.initialize().catch(err => {
411
+ throw err;
412
+ });
413
+ this._log.info('getMembership request %j', request);
414
+ const wrappedCallback = callback
415
+ ? (error, response, options, rawResponse) => {
416
+ this._log.info('getMembership response %j', response);
417
+ callback(error, response, options, rawResponse); // We verified callback above.
418
+ }
419
+ : undefined;
420
+ return this.innerApiCalls
421
+ .getMembership(request, options, wrappedCallback)
422
+ ?.then(([response, options, rawResponse]) => {
423
+ this._log.info('getMembership response %j', response);
424
+ return [response, options, rawResponse];
425
+ });
378
426
  }
379
427
  getMessage(request, optionsOrCallback, callback) {
380
- var _a;
381
428
  request = request || {};
382
429
  let options;
383
430
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -392,13 +439,26 @@ class ChatServiceClient {
392
439
  options.otherArgs.headers = options.otherArgs.headers || {};
393
440
  options.otherArgs.headers['x-goog-request-params'] =
394
441
  this._gaxModule.routingHeader.fromParams({
395
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
442
+ name: request.name ?? '',
396
443
  });
397
- this.initialize();
398
- return this.innerApiCalls.getMessage(request, options, callback);
444
+ this.initialize().catch(err => {
445
+ throw err;
446
+ });
447
+ this._log.info('getMessage request %j', request);
448
+ const wrappedCallback = callback
449
+ ? (error, response, options, rawResponse) => {
450
+ this._log.info('getMessage response %j', response);
451
+ callback(error, response, options, rawResponse); // We verified callback above.
452
+ }
453
+ : undefined;
454
+ return this.innerApiCalls
455
+ .getMessage(request, options, wrappedCallback)
456
+ ?.then(([response, options, rawResponse]) => {
457
+ this._log.info('getMessage response %j', response);
458
+ return [response, options, rawResponse];
459
+ });
399
460
  }
400
461
  updateMessage(request, optionsOrCallback, callback) {
401
- var _a;
402
462
  request = request || {};
403
463
  let options;
404
464
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -413,13 +473,26 @@ class ChatServiceClient {
413
473
  options.otherArgs.headers = options.otherArgs.headers || {};
414
474
  options.otherArgs.headers['x-goog-request-params'] =
415
475
  this._gaxModule.routingHeader.fromParams({
416
- 'message.name': (_a = request.message.name) !== null && _a !== void 0 ? _a : '',
476
+ 'message.name': request.message.name ?? '',
417
477
  });
418
- this.initialize();
419
- return this.innerApiCalls.updateMessage(request, options, callback);
478
+ this.initialize().catch(err => {
479
+ throw err;
480
+ });
481
+ this._log.info('updateMessage request %j', request);
482
+ const wrappedCallback = callback
483
+ ? (error, response, options, rawResponse) => {
484
+ this._log.info('updateMessage response %j', response);
485
+ callback(error, response, options, rawResponse); // We verified callback above.
486
+ }
487
+ : undefined;
488
+ return this.innerApiCalls
489
+ .updateMessage(request, options, wrappedCallback)
490
+ ?.then(([response, options, rawResponse]) => {
491
+ this._log.info('updateMessage response %j', response);
492
+ return [response, options, rawResponse];
493
+ });
420
494
  }
421
495
  deleteMessage(request, optionsOrCallback, callback) {
422
- var _a;
423
496
  request = request || {};
424
497
  let options;
425
498
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -434,13 +507,26 @@ class ChatServiceClient {
434
507
  options.otherArgs.headers = options.otherArgs.headers || {};
435
508
  options.otherArgs.headers['x-goog-request-params'] =
436
509
  this._gaxModule.routingHeader.fromParams({
437
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
510
+ name: request.name ?? '',
438
511
  });
439
- this.initialize();
440
- return this.innerApiCalls.deleteMessage(request, options, callback);
512
+ this.initialize().catch(err => {
513
+ throw err;
514
+ });
515
+ this._log.info('deleteMessage request %j', request);
516
+ const wrappedCallback = callback
517
+ ? (error, response, options, rawResponse) => {
518
+ this._log.info('deleteMessage response %j', response);
519
+ callback(error, response, options, rawResponse); // We verified callback above.
520
+ }
521
+ : undefined;
522
+ return this.innerApiCalls
523
+ .deleteMessage(request, options, wrappedCallback)
524
+ ?.then(([response, options, rawResponse]) => {
525
+ this._log.info('deleteMessage response %j', response);
526
+ return [response, options, rawResponse];
527
+ });
441
528
  }
442
529
  getAttachment(request, optionsOrCallback, callback) {
443
- var _a;
444
530
  request = request || {};
445
531
  let options;
446
532
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -455,13 +541,26 @@ class ChatServiceClient {
455
541
  options.otherArgs.headers = options.otherArgs.headers || {};
456
542
  options.otherArgs.headers['x-goog-request-params'] =
457
543
  this._gaxModule.routingHeader.fromParams({
458
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
544
+ name: request.name ?? '',
459
545
  });
460
- this.initialize();
461
- return this.innerApiCalls.getAttachment(request, options, callback);
546
+ this.initialize().catch(err => {
547
+ throw err;
548
+ });
549
+ this._log.info('getAttachment request %j', request);
550
+ const wrappedCallback = callback
551
+ ? (error, response, options, rawResponse) => {
552
+ this._log.info('getAttachment response %j', response);
553
+ callback(error, response, options, rawResponse); // We verified callback above.
554
+ }
555
+ : undefined;
556
+ return this.innerApiCalls
557
+ .getAttachment(request, options, wrappedCallback)
558
+ ?.then(([response, options, rawResponse]) => {
559
+ this._log.info('getAttachment response %j', response);
560
+ return [response, options, rawResponse];
561
+ });
462
562
  }
463
563
  uploadAttachment(request, optionsOrCallback, callback) {
464
- var _a;
465
564
  request = request || {};
466
565
  let options;
467
566
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -476,13 +575,26 @@ class ChatServiceClient {
476
575
  options.otherArgs.headers = options.otherArgs.headers || {};
477
576
  options.otherArgs.headers['x-goog-request-params'] =
478
577
  this._gaxModule.routingHeader.fromParams({
479
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
578
+ parent: request.parent ?? '',
480
579
  });
481
- this.initialize();
482
- return this.innerApiCalls.uploadAttachment(request, options, callback);
580
+ this.initialize().catch(err => {
581
+ throw err;
582
+ });
583
+ this._log.info('uploadAttachment request %j', request);
584
+ const wrappedCallback = callback
585
+ ? (error, response, options, rawResponse) => {
586
+ this._log.info('uploadAttachment response %j', response);
587
+ callback(error, response, options, rawResponse); // We verified callback above.
588
+ }
589
+ : undefined;
590
+ return this.innerApiCalls
591
+ .uploadAttachment(request, options, wrappedCallback)
592
+ ?.then(([response, options, rawResponse]) => {
593
+ this._log.info('uploadAttachment response %j', response);
594
+ return [response, options, rawResponse];
595
+ });
483
596
  }
484
597
  getSpace(request, optionsOrCallback, callback) {
485
- var _a;
486
598
  request = request || {};
487
599
  let options;
488
600
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -497,10 +609,24 @@ class ChatServiceClient {
497
609
  options.otherArgs.headers = options.otherArgs.headers || {};
498
610
  options.otherArgs.headers['x-goog-request-params'] =
499
611
  this._gaxModule.routingHeader.fromParams({
500
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
612
+ name: request.name ?? '',
501
613
  });
502
- this.initialize();
503
- return this.innerApiCalls.getSpace(request, options, callback);
614
+ this.initialize().catch(err => {
615
+ throw err;
616
+ });
617
+ this._log.info('getSpace request %j', request);
618
+ const wrappedCallback = callback
619
+ ? (error, response, options, rawResponse) => {
620
+ this._log.info('getSpace response %j', response);
621
+ callback(error, response, options, rawResponse); // We verified callback above.
622
+ }
623
+ : undefined;
624
+ return this.innerApiCalls
625
+ .getSpace(request, options, wrappedCallback)
626
+ ?.then(([response, options, rawResponse]) => {
627
+ this._log.info('getSpace response %j', response);
628
+ return [response, options, rawResponse];
629
+ });
504
630
  }
505
631
  createSpace(request, optionsOrCallback, callback) {
506
632
  request = request || {};
@@ -515,8 +641,22 @@ class ChatServiceClient {
515
641
  options = options || {};
516
642
  options.otherArgs = options.otherArgs || {};
517
643
  options.otherArgs.headers = options.otherArgs.headers || {};
518
- this.initialize();
519
- return this.innerApiCalls.createSpace(request, options, callback);
644
+ this.initialize().catch(err => {
645
+ throw err;
646
+ });
647
+ this._log.info('createSpace request %j', request);
648
+ const wrappedCallback = callback
649
+ ? (error, response, options, rawResponse) => {
650
+ this._log.info('createSpace response %j', response);
651
+ callback(error, response, options, rawResponse); // We verified callback above.
652
+ }
653
+ : undefined;
654
+ return this.innerApiCalls
655
+ .createSpace(request, options, wrappedCallback)
656
+ ?.then(([response, options, rawResponse]) => {
657
+ this._log.info('createSpace response %j', response);
658
+ return [response, options, rawResponse];
659
+ });
520
660
  }
521
661
  setUpSpace(request, optionsOrCallback, callback) {
522
662
  request = request || {};
@@ -531,11 +671,24 @@ class ChatServiceClient {
531
671
  options = options || {};
532
672
  options.otherArgs = options.otherArgs || {};
533
673
  options.otherArgs.headers = options.otherArgs.headers || {};
534
- this.initialize();
535
- return this.innerApiCalls.setUpSpace(request, options, callback);
674
+ this.initialize().catch(err => {
675
+ throw err;
676
+ });
677
+ this._log.info('setUpSpace request %j', request);
678
+ const wrappedCallback = callback
679
+ ? (error, response, options, rawResponse) => {
680
+ this._log.info('setUpSpace response %j', response);
681
+ callback(error, response, options, rawResponse); // We verified callback above.
682
+ }
683
+ : undefined;
684
+ return this.innerApiCalls
685
+ .setUpSpace(request, options, wrappedCallback)
686
+ ?.then(([response, options, rawResponse]) => {
687
+ this._log.info('setUpSpace response %j', response);
688
+ return [response, options, rawResponse];
689
+ });
536
690
  }
537
691
  updateSpace(request, optionsOrCallback, callback) {
538
- var _a;
539
692
  request = request || {};
540
693
  let options;
541
694
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -550,13 +703,26 @@ class ChatServiceClient {
550
703
  options.otherArgs.headers = options.otherArgs.headers || {};
551
704
  options.otherArgs.headers['x-goog-request-params'] =
552
705
  this._gaxModule.routingHeader.fromParams({
553
- 'space.name': (_a = request.space.name) !== null && _a !== void 0 ? _a : '',
706
+ 'space.name': request.space.name ?? '',
554
707
  });
555
- this.initialize();
556
- return this.innerApiCalls.updateSpace(request, options, callback);
708
+ this.initialize().catch(err => {
709
+ throw err;
710
+ });
711
+ this._log.info('updateSpace request %j', request);
712
+ const wrappedCallback = callback
713
+ ? (error, response, options, rawResponse) => {
714
+ this._log.info('updateSpace response %j', response);
715
+ callback(error, response, options, rawResponse); // We verified callback above.
716
+ }
717
+ : undefined;
718
+ return this.innerApiCalls
719
+ .updateSpace(request, options, wrappedCallback)
720
+ ?.then(([response, options, rawResponse]) => {
721
+ this._log.info('updateSpace response %j', response);
722
+ return [response, options, rawResponse];
723
+ });
557
724
  }
558
725
  deleteSpace(request, optionsOrCallback, callback) {
559
- var _a;
560
726
  request = request || {};
561
727
  let options;
562
728
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -571,13 +737,26 @@ class ChatServiceClient {
571
737
  options.otherArgs.headers = options.otherArgs.headers || {};
572
738
  options.otherArgs.headers['x-goog-request-params'] =
573
739
  this._gaxModule.routingHeader.fromParams({
574
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
740
+ name: request.name ?? '',
575
741
  });
576
- this.initialize();
577
- return this.innerApiCalls.deleteSpace(request, options, callback);
742
+ this.initialize().catch(err => {
743
+ throw err;
744
+ });
745
+ this._log.info('deleteSpace request %j', request);
746
+ const wrappedCallback = callback
747
+ ? (error, response, options, rawResponse) => {
748
+ this._log.info('deleteSpace response %j', response);
749
+ callback(error, response, options, rawResponse); // We verified callback above.
750
+ }
751
+ : undefined;
752
+ return this.innerApiCalls
753
+ .deleteSpace(request, options, wrappedCallback)
754
+ ?.then(([response, options, rawResponse]) => {
755
+ this._log.info('deleteSpace response %j', response);
756
+ return [response, options, rawResponse];
757
+ });
578
758
  }
579
759
  completeImportSpace(request, optionsOrCallback, callback) {
580
- var _a;
581
760
  request = request || {};
582
761
  let options;
583
762
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -592,10 +771,24 @@ class ChatServiceClient {
592
771
  options.otherArgs.headers = options.otherArgs.headers || {};
593
772
  options.otherArgs.headers['x-goog-request-params'] =
594
773
  this._gaxModule.routingHeader.fromParams({
595
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
774
+ name: request.name ?? '',
596
775
  });
597
- this.initialize();
598
- return this.innerApiCalls.completeImportSpace(request, options, callback);
776
+ this.initialize().catch(err => {
777
+ throw err;
778
+ });
779
+ this._log.info('completeImportSpace request %j', request);
780
+ const wrappedCallback = callback
781
+ ? (error, response, options, rawResponse) => {
782
+ this._log.info('completeImportSpace response %j', response);
783
+ callback(error, response, options, rawResponse); // We verified callback above.
784
+ }
785
+ : undefined;
786
+ return this.innerApiCalls
787
+ .completeImportSpace(request, options, wrappedCallback)
788
+ ?.then(([response, options, rawResponse]) => {
789
+ this._log.info('completeImportSpace response %j', response);
790
+ return [response, options, rawResponse];
791
+ });
599
792
  }
600
793
  findDirectMessage(request, optionsOrCallback, callback) {
601
794
  request = request || {};
@@ -610,11 +803,24 @@ class ChatServiceClient {
610
803
  options = options || {};
611
804
  options.otherArgs = options.otherArgs || {};
612
805
  options.otherArgs.headers = options.otherArgs.headers || {};
613
- this.initialize();
614
- return this.innerApiCalls.findDirectMessage(request, options, callback);
806
+ this.initialize().catch(err => {
807
+ throw err;
808
+ });
809
+ this._log.info('findDirectMessage request %j', request);
810
+ const wrappedCallback = callback
811
+ ? (error, response, options, rawResponse) => {
812
+ this._log.info('findDirectMessage response %j', response);
813
+ callback(error, response, options, rawResponse); // We verified callback above.
814
+ }
815
+ : undefined;
816
+ return this.innerApiCalls
817
+ .findDirectMessage(request, options, wrappedCallback)
818
+ ?.then(([response, options, rawResponse]) => {
819
+ this._log.info('findDirectMessage response %j', response);
820
+ return [response, options, rawResponse];
821
+ });
615
822
  }
616
823
  createMembership(request, optionsOrCallback, callback) {
617
- var _a;
618
824
  request = request || {};
619
825
  let options;
620
826
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -629,13 +835,26 @@ class ChatServiceClient {
629
835
  options.otherArgs.headers = options.otherArgs.headers || {};
630
836
  options.otherArgs.headers['x-goog-request-params'] =
631
837
  this._gaxModule.routingHeader.fromParams({
632
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
838
+ parent: request.parent ?? '',
633
839
  });
634
- this.initialize();
635
- return this.innerApiCalls.createMembership(request, options, callback);
840
+ this.initialize().catch(err => {
841
+ throw err;
842
+ });
843
+ this._log.info('createMembership request %j', request);
844
+ const wrappedCallback = callback
845
+ ? (error, response, options, rawResponse) => {
846
+ this._log.info('createMembership response %j', response);
847
+ callback(error, response, options, rawResponse); // We verified callback above.
848
+ }
849
+ : undefined;
850
+ return this.innerApiCalls
851
+ .createMembership(request, options, wrappedCallback)
852
+ ?.then(([response, options, rawResponse]) => {
853
+ this._log.info('createMembership response %j', response);
854
+ return [response, options, rawResponse];
855
+ });
636
856
  }
637
857
  updateMembership(request, optionsOrCallback, callback) {
638
- var _a;
639
858
  request = request || {};
640
859
  let options;
641
860
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -650,13 +869,26 @@ class ChatServiceClient {
650
869
  options.otherArgs.headers = options.otherArgs.headers || {};
651
870
  options.otherArgs.headers['x-goog-request-params'] =
652
871
  this._gaxModule.routingHeader.fromParams({
653
- 'membership.name': (_a = request.membership.name) !== null && _a !== void 0 ? _a : '',
872
+ 'membership.name': request.membership.name ?? '',
654
873
  });
655
- this.initialize();
656
- return this.innerApiCalls.updateMembership(request, options, callback);
874
+ this.initialize().catch(err => {
875
+ throw err;
876
+ });
877
+ this._log.info('updateMembership request %j', request);
878
+ const wrappedCallback = callback
879
+ ? (error, response, options, rawResponse) => {
880
+ this._log.info('updateMembership response %j', response);
881
+ callback(error, response, options, rawResponse); // We verified callback above.
882
+ }
883
+ : undefined;
884
+ return this.innerApiCalls
885
+ .updateMembership(request, options, wrappedCallback)
886
+ ?.then(([response, options, rawResponse]) => {
887
+ this._log.info('updateMembership response %j', response);
888
+ return [response, options, rawResponse];
889
+ });
657
890
  }
658
891
  deleteMembership(request, optionsOrCallback, callback) {
659
- var _a;
660
892
  request = request || {};
661
893
  let options;
662
894
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -671,13 +903,26 @@ class ChatServiceClient {
671
903
  options.otherArgs.headers = options.otherArgs.headers || {};
672
904
  options.otherArgs.headers['x-goog-request-params'] =
673
905
  this._gaxModule.routingHeader.fromParams({
674
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
906
+ name: request.name ?? '',
675
907
  });
676
- this.initialize();
677
- return this.innerApiCalls.deleteMembership(request, options, callback);
908
+ this.initialize().catch(err => {
909
+ throw err;
910
+ });
911
+ this._log.info('deleteMembership request %j', request);
912
+ const wrappedCallback = callback
913
+ ? (error, response, options, rawResponse) => {
914
+ this._log.info('deleteMembership response %j', response);
915
+ callback(error, response, options, rawResponse); // We verified callback above.
916
+ }
917
+ : undefined;
918
+ return this.innerApiCalls
919
+ .deleteMembership(request, options, wrappedCallback)
920
+ ?.then(([response, options, rawResponse]) => {
921
+ this._log.info('deleteMembership response %j', response);
922
+ return [response, options, rawResponse];
923
+ });
678
924
  }
679
925
  createReaction(request, optionsOrCallback, callback) {
680
- var _a;
681
926
  request = request || {};
682
927
  let options;
683
928
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -692,13 +937,26 @@ class ChatServiceClient {
692
937
  options.otherArgs.headers = options.otherArgs.headers || {};
693
938
  options.otherArgs.headers['x-goog-request-params'] =
694
939
  this._gaxModule.routingHeader.fromParams({
695
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
940
+ parent: request.parent ?? '',
696
941
  });
697
- this.initialize();
698
- return this.innerApiCalls.createReaction(request, options, callback);
942
+ this.initialize().catch(err => {
943
+ throw err;
944
+ });
945
+ this._log.info('createReaction request %j', request);
946
+ const wrappedCallback = callback
947
+ ? (error, response, options, rawResponse) => {
948
+ this._log.info('createReaction response %j', response);
949
+ callback(error, response, options, rawResponse); // We verified callback above.
950
+ }
951
+ : undefined;
952
+ return this.innerApiCalls
953
+ .createReaction(request, options, wrappedCallback)
954
+ ?.then(([response, options, rawResponse]) => {
955
+ this._log.info('createReaction response %j', response);
956
+ return [response, options, rawResponse];
957
+ });
699
958
  }
700
959
  deleteReaction(request, optionsOrCallback, callback) {
701
- var _a;
702
960
  request = request || {};
703
961
  let options;
704
962
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -713,13 +971,26 @@ class ChatServiceClient {
713
971
  options.otherArgs.headers = options.otherArgs.headers || {};
714
972
  options.otherArgs.headers['x-goog-request-params'] =
715
973
  this._gaxModule.routingHeader.fromParams({
716
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
974
+ name: request.name ?? '',
717
975
  });
718
- this.initialize();
719
- return this.innerApiCalls.deleteReaction(request, options, callback);
976
+ this.initialize().catch(err => {
977
+ throw err;
978
+ });
979
+ this._log.info('deleteReaction request %j', request);
980
+ const wrappedCallback = callback
981
+ ? (error, response, options, rawResponse) => {
982
+ this._log.info('deleteReaction response %j', response);
983
+ callback(error, response, options, rawResponse); // We verified callback above.
984
+ }
985
+ : undefined;
986
+ return this.innerApiCalls
987
+ .deleteReaction(request, options, wrappedCallback)
988
+ ?.then(([response, options, rawResponse]) => {
989
+ this._log.info('deleteReaction response %j', response);
990
+ return [response, options, rawResponse];
991
+ });
720
992
  }
721
993
  getSpaceReadState(request, optionsOrCallback, callback) {
722
- var _a;
723
994
  request = request || {};
724
995
  let options;
725
996
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -734,13 +1005,26 @@ class ChatServiceClient {
734
1005
  options.otherArgs.headers = options.otherArgs.headers || {};
735
1006
  options.otherArgs.headers['x-goog-request-params'] =
736
1007
  this._gaxModule.routingHeader.fromParams({
737
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1008
+ name: request.name ?? '',
738
1009
  });
739
- this.initialize();
740
- return this.innerApiCalls.getSpaceReadState(request, options, callback);
1010
+ this.initialize().catch(err => {
1011
+ throw err;
1012
+ });
1013
+ this._log.info('getSpaceReadState request %j', request);
1014
+ const wrappedCallback = callback
1015
+ ? (error, response, options, rawResponse) => {
1016
+ this._log.info('getSpaceReadState response %j', response);
1017
+ callback(error, response, options, rawResponse); // We verified callback above.
1018
+ }
1019
+ : undefined;
1020
+ return this.innerApiCalls
1021
+ .getSpaceReadState(request, options, wrappedCallback)
1022
+ ?.then(([response, options, rawResponse]) => {
1023
+ this._log.info('getSpaceReadState response %j', response);
1024
+ return [response, options, rawResponse];
1025
+ });
741
1026
  }
742
1027
  updateSpaceReadState(request, optionsOrCallback, callback) {
743
- var _a;
744
1028
  request = request || {};
745
1029
  let options;
746
1030
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -755,13 +1039,26 @@ class ChatServiceClient {
755
1039
  options.otherArgs.headers = options.otherArgs.headers || {};
756
1040
  options.otherArgs.headers['x-goog-request-params'] =
757
1041
  this._gaxModule.routingHeader.fromParams({
758
- 'space_read_state.name': (_a = request.spaceReadState.name) !== null && _a !== void 0 ? _a : '',
1042
+ 'space_read_state.name': request.spaceReadState.name ?? '',
759
1043
  });
760
- this.initialize();
761
- return this.innerApiCalls.updateSpaceReadState(request, options, callback);
1044
+ this.initialize().catch(err => {
1045
+ throw err;
1046
+ });
1047
+ this._log.info('updateSpaceReadState request %j', request);
1048
+ const wrappedCallback = callback
1049
+ ? (error, response, options, rawResponse) => {
1050
+ this._log.info('updateSpaceReadState response %j', response);
1051
+ callback(error, response, options, rawResponse); // We verified callback above.
1052
+ }
1053
+ : undefined;
1054
+ return this.innerApiCalls
1055
+ .updateSpaceReadState(request, options, wrappedCallback)
1056
+ ?.then(([response, options, rawResponse]) => {
1057
+ this._log.info('updateSpaceReadState response %j', response);
1058
+ return [response, options, rawResponse];
1059
+ });
762
1060
  }
763
1061
  getThreadReadState(request, optionsOrCallback, callback) {
764
- var _a;
765
1062
  request = request || {};
766
1063
  let options;
767
1064
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -776,13 +1073,26 @@ class ChatServiceClient {
776
1073
  options.otherArgs.headers = options.otherArgs.headers || {};
777
1074
  options.otherArgs.headers['x-goog-request-params'] =
778
1075
  this._gaxModule.routingHeader.fromParams({
779
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1076
+ name: request.name ?? '',
780
1077
  });
781
- this.initialize();
782
- return this.innerApiCalls.getThreadReadState(request, options, callback);
1078
+ this.initialize().catch(err => {
1079
+ throw err;
1080
+ });
1081
+ this._log.info('getThreadReadState request %j', request);
1082
+ const wrappedCallback = callback
1083
+ ? (error, response, options, rawResponse) => {
1084
+ this._log.info('getThreadReadState response %j', response);
1085
+ callback(error, response, options, rawResponse); // We verified callback above.
1086
+ }
1087
+ : undefined;
1088
+ return this.innerApiCalls
1089
+ .getThreadReadState(request, options, wrappedCallback)
1090
+ ?.then(([response, options, rawResponse]) => {
1091
+ this._log.info('getThreadReadState response %j', response);
1092
+ return [response, options, rawResponse];
1093
+ });
783
1094
  }
784
1095
  getSpaceEvent(request, optionsOrCallback, callback) {
785
- var _a;
786
1096
  request = request || {};
787
1097
  let options;
788
1098
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -797,13 +1107,94 @@ class ChatServiceClient {
797
1107
  options.otherArgs.headers = options.otherArgs.headers || {};
798
1108
  options.otherArgs.headers['x-goog-request-params'] =
799
1109
  this._gaxModule.routingHeader.fromParams({
800
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1110
+ name: request.name ?? '',
1111
+ });
1112
+ this.initialize().catch(err => {
1113
+ throw err;
1114
+ });
1115
+ this._log.info('getSpaceEvent request %j', request);
1116
+ const wrappedCallback = callback
1117
+ ? (error, response, options, rawResponse) => {
1118
+ this._log.info('getSpaceEvent response %j', response);
1119
+ callback(error, response, options, rawResponse); // We verified callback above.
1120
+ }
1121
+ : undefined;
1122
+ return this.innerApiCalls
1123
+ .getSpaceEvent(request, options, wrappedCallback)
1124
+ ?.then(([response, options, rawResponse]) => {
1125
+ this._log.info('getSpaceEvent response %j', response);
1126
+ return [response, options, rawResponse];
1127
+ });
1128
+ }
1129
+ getSpaceNotificationSetting(request, optionsOrCallback, callback) {
1130
+ request = request || {};
1131
+ let options;
1132
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1133
+ callback = optionsOrCallback;
1134
+ options = {};
1135
+ }
1136
+ else {
1137
+ options = optionsOrCallback;
1138
+ }
1139
+ options = options || {};
1140
+ options.otherArgs = options.otherArgs || {};
1141
+ options.otherArgs.headers = options.otherArgs.headers || {};
1142
+ options.otherArgs.headers['x-goog-request-params'] =
1143
+ this._gaxModule.routingHeader.fromParams({
1144
+ name: request.name ?? '',
1145
+ });
1146
+ this.initialize().catch(err => {
1147
+ throw err;
1148
+ });
1149
+ this._log.info('getSpaceNotificationSetting request %j', request);
1150
+ const wrappedCallback = callback
1151
+ ? (error, response, options, rawResponse) => {
1152
+ this._log.info('getSpaceNotificationSetting response %j', response);
1153
+ callback(error, response, options, rawResponse); // We verified callback above.
1154
+ }
1155
+ : undefined;
1156
+ return this.innerApiCalls
1157
+ .getSpaceNotificationSetting(request, options, wrappedCallback)
1158
+ ?.then(([response, options, rawResponse]) => {
1159
+ this._log.info('getSpaceNotificationSetting response %j', response);
1160
+ return [response, options, rawResponse];
1161
+ });
1162
+ }
1163
+ updateSpaceNotificationSetting(request, optionsOrCallback, callback) {
1164
+ request = request || {};
1165
+ let options;
1166
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1167
+ callback = optionsOrCallback;
1168
+ options = {};
1169
+ }
1170
+ else {
1171
+ options = optionsOrCallback;
1172
+ }
1173
+ options = options || {};
1174
+ options.otherArgs = options.otherArgs || {};
1175
+ options.otherArgs.headers = options.otherArgs.headers || {};
1176
+ options.otherArgs.headers['x-goog-request-params'] =
1177
+ this._gaxModule.routingHeader.fromParams({
1178
+ 'space_notification_setting.name': request.spaceNotificationSetting.name ?? '',
801
1179
  });
802
- this.initialize();
803
- return this.innerApiCalls.getSpaceEvent(request, options, callback);
1180
+ this.initialize().catch(err => {
1181
+ throw err;
1182
+ });
1183
+ this._log.info('updateSpaceNotificationSetting request %j', request);
1184
+ const wrappedCallback = callback
1185
+ ? (error, response, options, rawResponse) => {
1186
+ this._log.info('updateSpaceNotificationSetting response %j', response);
1187
+ callback(error, response, options, rawResponse); // We verified callback above.
1188
+ }
1189
+ : undefined;
1190
+ return this.innerApiCalls
1191
+ .updateSpaceNotificationSetting(request, options, wrappedCallback)
1192
+ ?.then(([response, options, rawResponse]) => {
1193
+ this._log.info('updateSpaceNotificationSetting response %j', response);
1194
+ return [response, options, rawResponse];
1195
+ });
804
1196
  }
805
1197
  listMessages(request, optionsOrCallback, callback) {
806
- var _a;
807
1198
  request = request || {};
808
1199
  let options;
809
1200
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -818,10 +1209,24 @@ class ChatServiceClient {
818
1209
  options.otherArgs.headers = options.otherArgs.headers || {};
819
1210
  options.otherArgs.headers['x-goog-request-params'] =
820
1211
  this._gaxModule.routingHeader.fromParams({
821
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1212
+ parent: request.parent ?? '',
822
1213
  });
823
- this.initialize();
824
- return this.innerApiCalls.listMessages(request, options, callback);
1214
+ this.initialize().catch(err => {
1215
+ throw err;
1216
+ });
1217
+ const wrappedCallback = callback
1218
+ ? (error, values, nextPageRequest, rawResponse) => {
1219
+ this._log.info('listMessages values %j', values);
1220
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1221
+ }
1222
+ : undefined;
1223
+ this._log.info('listMessages request %j', request);
1224
+ return this.innerApiCalls
1225
+ .listMessages(request, options, wrappedCallback)
1226
+ ?.then(([response, input, output]) => {
1227
+ this._log.info('listMessages values %j', response);
1228
+ return [response, input, output];
1229
+ });
825
1230
  }
826
1231
  /**
827
1232
  * Equivalent to `listMessages`, but returns a NodeJS Stream object.
@@ -911,18 +1316,20 @@ class ChatServiceClient {
911
1316
  * for more details and examples.
912
1317
  */
913
1318
  listMessagesStream(request, options) {
914
- var _a;
915
1319
  request = request || {};
916
1320
  options = options || {};
917
1321
  options.otherArgs = options.otherArgs || {};
918
1322
  options.otherArgs.headers = options.otherArgs.headers || {};
919
1323
  options.otherArgs.headers['x-goog-request-params'] =
920
1324
  this._gaxModule.routingHeader.fromParams({
921
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1325
+ parent: request.parent ?? '',
922
1326
  });
923
1327
  const defaultCallSettings = this._defaults['listMessages'];
924
1328
  const callSettings = defaultCallSettings.merge(options);
925
- this.initialize();
1329
+ this.initialize().catch(err => {
1330
+ throw err;
1331
+ });
1332
+ this._log.info('listMessages stream %j', request);
926
1333
  return this.descriptors.page.listMessages.createStream(this.innerApiCalls.listMessages, request, callSettings);
927
1334
  }
928
1335
  /**
@@ -1016,22 +1423,23 @@ class ChatServiceClient {
1016
1423
  * region_tag:chat_v1_generated_ChatService_ListMessages_async
1017
1424
  */
1018
1425
  listMessagesAsync(request, options) {
1019
- var _a;
1020
1426
  request = request || {};
1021
1427
  options = options || {};
1022
1428
  options.otherArgs = options.otherArgs || {};
1023
1429
  options.otherArgs.headers = options.otherArgs.headers || {};
1024
1430
  options.otherArgs.headers['x-goog-request-params'] =
1025
1431
  this._gaxModule.routingHeader.fromParams({
1026
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1432
+ parent: request.parent ?? '',
1027
1433
  });
1028
1434
  const defaultCallSettings = this._defaults['listMessages'];
1029
1435
  const callSettings = defaultCallSettings.merge(options);
1030
- this.initialize();
1436
+ this.initialize().catch(err => {
1437
+ throw err;
1438
+ });
1439
+ this._log.info('listMessages iterate %j', request);
1031
1440
  return this.descriptors.page.listMessages.asyncIterate(this.innerApiCalls['listMessages'], request, callSettings);
1032
1441
  }
1033
1442
  listMemberships(request, optionsOrCallback, callback) {
1034
- var _a;
1035
1443
  request = request || {};
1036
1444
  let options;
1037
1445
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1046,10 +1454,24 @@ class ChatServiceClient {
1046
1454
  options.otherArgs.headers = options.otherArgs.headers || {};
1047
1455
  options.otherArgs.headers['x-goog-request-params'] =
1048
1456
  this._gaxModule.routingHeader.fromParams({
1049
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1457
+ parent: request.parent ?? '',
1050
1458
  });
1051
- this.initialize();
1052
- return this.innerApiCalls.listMemberships(request, options, callback);
1459
+ this.initialize().catch(err => {
1460
+ throw err;
1461
+ });
1462
+ const wrappedCallback = callback
1463
+ ? (error, values, nextPageRequest, rawResponse) => {
1464
+ this._log.info('listMemberships values %j', values);
1465
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1466
+ }
1467
+ : undefined;
1468
+ this._log.info('listMemberships request %j', request);
1469
+ return this.innerApiCalls
1470
+ .listMemberships(request, options, wrappedCallback)
1471
+ ?.then(([response, input, output]) => {
1472
+ this._log.info('listMemberships values %j', response);
1473
+ return [response, input, output];
1474
+ });
1053
1475
  }
1054
1476
  /**
1055
1477
  * Equivalent to `listMemberships`, but returns a NodeJS Stream object.
@@ -1157,18 +1579,20 @@ class ChatServiceClient {
1157
1579
  * for more details and examples.
1158
1580
  */
1159
1581
  listMembershipsStream(request, options) {
1160
- var _a;
1161
1582
  request = request || {};
1162
1583
  options = options || {};
1163
1584
  options.otherArgs = options.otherArgs || {};
1164
1585
  options.otherArgs.headers = options.otherArgs.headers || {};
1165
1586
  options.otherArgs.headers['x-goog-request-params'] =
1166
1587
  this._gaxModule.routingHeader.fromParams({
1167
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1588
+ parent: request.parent ?? '',
1168
1589
  });
1169
1590
  const defaultCallSettings = this._defaults['listMemberships'];
1170
1591
  const callSettings = defaultCallSettings.merge(options);
1171
- this.initialize();
1592
+ this.initialize().catch(err => {
1593
+ throw err;
1594
+ });
1595
+ this._log.info('listMemberships stream %j', request);
1172
1596
  return this.descriptors.page.listMemberships.createStream(this.innerApiCalls.listMemberships, request, callSettings);
1173
1597
  }
1174
1598
  /**
@@ -1280,18 +1704,20 @@ class ChatServiceClient {
1280
1704
  * region_tag:chat_v1_generated_ChatService_ListMemberships_async
1281
1705
  */
1282
1706
  listMembershipsAsync(request, options) {
1283
- var _a;
1284
1707
  request = request || {};
1285
1708
  options = options || {};
1286
1709
  options.otherArgs = options.otherArgs || {};
1287
1710
  options.otherArgs.headers = options.otherArgs.headers || {};
1288
1711
  options.otherArgs.headers['x-goog-request-params'] =
1289
1712
  this._gaxModule.routingHeader.fromParams({
1290
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1713
+ parent: request.parent ?? '',
1291
1714
  });
1292
1715
  const defaultCallSettings = this._defaults['listMemberships'];
1293
1716
  const callSettings = defaultCallSettings.merge(options);
1294
- this.initialize();
1717
+ this.initialize().catch(err => {
1718
+ throw err;
1719
+ });
1720
+ this._log.info('listMemberships iterate %j', request);
1295
1721
  return this.descriptors.page.listMemberships.asyncIterate(this.innerApiCalls['listMemberships'], request, callSettings);
1296
1722
  }
1297
1723
  listSpaces(request, optionsOrCallback, callback) {
@@ -1307,8 +1733,22 @@ class ChatServiceClient {
1307
1733
  options = options || {};
1308
1734
  options.otherArgs = options.otherArgs || {};
1309
1735
  options.otherArgs.headers = options.otherArgs.headers || {};
1310
- this.initialize();
1311
- return this.innerApiCalls.listSpaces(request, options, callback);
1736
+ this.initialize().catch(err => {
1737
+ throw err;
1738
+ });
1739
+ const wrappedCallback = callback
1740
+ ? (error, values, nextPageRequest, rawResponse) => {
1741
+ this._log.info('listSpaces values %j', values);
1742
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1743
+ }
1744
+ : undefined;
1745
+ this._log.info('listSpaces request %j', request);
1746
+ return this.innerApiCalls
1747
+ .listSpaces(request, options, wrappedCallback)
1748
+ ?.then(([response, input, output]) => {
1749
+ this._log.info('listSpaces values %j', response);
1750
+ return [response, input, output];
1751
+ });
1312
1752
  }
1313
1753
  /**
1314
1754
  * Equivalent to `listSpaces`, but returns a NodeJS Stream object.
@@ -1368,7 +1808,10 @@ class ChatServiceClient {
1368
1808
  options.otherArgs.headers = options.otherArgs.headers || {};
1369
1809
  const defaultCallSettings = this._defaults['listSpaces'];
1370
1810
  const callSettings = defaultCallSettings.merge(options);
1371
- this.initialize();
1811
+ this.initialize().catch(err => {
1812
+ throw err;
1813
+ });
1814
+ this._log.info('listSpaces stream %j', request);
1372
1815
  return this.descriptors.page.listSpaces.createStream(this.innerApiCalls.listSpaces, request, callSettings);
1373
1816
  }
1374
1817
  /**
@@ -1432,7 +1875,10 @@ class ChatServiceClient {
1432
1875
  options.otherArgs.headers = options.otherArgs.headers || {};
1433
1876
  const defaultCallSettings = this._defaults['listSpaces'];
1434
1877
  const callSettings = defaultCallSettings.merge(options);
1435
- this.initialize();
1878
+ this.initialize().catch(err => {
1879
+ throw err;
1880
+ });
1881
+ this._log.info('listSpaces iterate %j', request);
1436
1882
  return this.descriptors.page.listSpaces.asyncIterate(this.innerApiCalls['listSpaces'], request, callSettings);
1437
1883
  }
1438
1884
  searchSpaces(request, optionsOrCallback, callback) {
@@ -1448,8 +1894,22 @@ class ChatServiceClient {
1448
1894
  options = options || {};
1449
1895
  options.otherArgs = options.otherArgs || {};
1450
1896
  options.otherArgs.headers = options.otherArgs.headers || {};
1451
- this.initialize();
1452
- return this.innerApiCalls.searchSpaces(request, options, callback);
1897
+ this.initialize().catch(err => {
1898
+ throw err;
1899
+ });
1900
+ const wrappedCallback = callback
1901
+ ? (error, values, nextPageRequest, rawResponse) => {
1902
+ this._log.info('searchSpaces values %j', values);
1903
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1904
+ }
1905
+ : undefined;
1906
+ this._log.info('searchSpaces request %j', request);
1907
+ return this.innerApiCalls
1908
+ .searchSpaces(request, options, wrappedCallback)
1909
+ ?.then(([response, input, output]) => {
1910
+ this._log.info('searchSpaces values %j', response);
1911
+ return [response, input, output];
1912
+ });
1453
1913
  }
1454
1914
  /**
1455
1915
  * Equivalent to `searchSpaces`, but returns a NodeJS Stream object.
@@ -1596,7 +2056,10 @@ class ChatServiceClient {
1596
2056
  options.otherArgs.headers = options.otherArgs.headers || {};
1597
2057
  const defaultCallSettings = this._defaults['searchSpaces'];
1598
2058
  const callSettings = defaultCallSettings.merge(options);
1599
- this.initialize();
2059
+ this.initialize().catch(err => {
2060
+ throw err;
2061
+ });
2062
+ this._log.info('searchSpaces stream %j', request);
1600
2063
  return this.descriptors.page.searchSpaces.createStream(this.innerApiCalls.searchSpaces, request, callSettings);
1601
2064
  }
1602
2065
  /**
@@ -1747,11 +2210,13 @@ class ChatServiceClient {
1747
2210
  options.otherArgs.headers = options.otherArgs.headers || {};
1748
2211
  const defaultCallSettings = this._defaults['searchSpaces'];
1749
2212
  const callSettings = defaultCallSettings.merge(options);
1750
- this.initialize();
2213
+ this.initialize().catch(err => {
2214
+ throw err;
2215
+ });
2216
+ this._log.info('searchSpaces iterate %j', request);
1751
2217
  return this.descriptors.page.searchSpaces.asyncIterate(this.innerApiCalls['searchSpaces'], request, callSettings);
1752
2218
  }
1753
2219
  listReactions(request, optionsOrCallback, callback) {
1754
- var _a;
1755
2220
  request = request || {};
1756
2221
  let options;
1757
2222
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1766,10 +2231,24 @@ class ChatServiceClient {
1766
2231
  options.otherArgs.headers = options.otherArgs.headers || {};
1767
2232
  options.otherArgs.headers['x-goog-request-params'] =
1768
2233
  this._gaxModule.routingHeader.fromParams({
1769
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2234
+ parent: request.parent ?? '',
1770
2235
  });
1771
- this.initialize();
1772
- return this.innerApiCalls.listReactions(request, options, callback);
2236
+ this.initialize().catch(err => {
2237
+ throw err;
2238
+ });
2239
+ const wrappedCallback = callback
2240
+ ? (error, values, nextPageRequest, rawResponse) => {
2241
+ this._log.info('listReactions values %j', values);
2242
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2243
+ }
2244
+ : undefined;
2245
+ this._log.info('listReactions request %j', request);
2246
+ return this.innerApiCalls
2247
+ .listReactions(request, options, wrappedCallback)
2248
+ ?.then(([response, input, output]) => {
2249
+ this._log.info('listReactions values %j', response);
2250
+ return [response, input, output];
2251
+ });
1773
2252
  }
1774
2253
  /**
1775
2254
  * Equivalent to `listReactions`, but returns a NodeJS Stream object.
@@ -1848,18 +2327,20 @@ class ChatServiceClient {
1848
2327
  * for more details and examples.
1849
2328
  */
1850
2329
  listReactionsStream(request, options) {
1851
- var _a;
1852
2330
  request = request || {};
1853
2331
  options = options || {};
1854
2332
  options.otherArgs = options.otherArgs || {};
1855
2333
  options.otherArgs.headers = options.otherArgs.headers || {};
1856
2334
  options.otherArgs.headers['x-goog-request-params'] =
1857
2335
  this._gaxModule.routingHeader.fromParams({
1858
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2336
+ parent: request.parent ?? '',
1859
2337
  });
1860
2338
  const defaultCallSettings = this._defaults['listReactions'];
1861
2339
  const callSettings = defaultCallSettings.merge(options);
1862
- this.initialize();
2340
+ this.initialize().catch(err => {
2341
+ throw err;
2342
+ });
2343
+ this._log.info('listReactions stream %j', request);
1863
2344
  return this.descriptors.page.listReactions.createStream(this.innerApiCalls.listReactions, request, callSettings);
1864
2345
  }
1865
2346
  /**
@@ -1942,22 +2423,23 @@ class ChatServiceClient {
1942
2423
  * region_tag:chat_v1_generated_ChatService_ListReactions_async
1943
2424
  */
1944
2425
  listReactionsAsync(request, options) {
1945
- var _a;
1946
2426
  request = request || {};
1947
2427
  options = options || {};
1948
2428
  options.otherArgs = options.otherArgs || {};
1949
2429
  options.otherArgs.headers = options.otherArgs.headers || {};
1950
2430
  options.otherArgs.headers['x-goog-request-params'] =
1951
2431
  this._gaxModule.routingHeader.fromParams({
1952
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2432
+ parent: request.parent ?? '',
1953
2433
  });
1954
2434
  const defaultCallSettings = this._defaults['listReactions'];
1955
2435
  const callSettings = defaultCallSettings.merge(options);
1956
- this.initialize();
2436
+ this.initialize().catch(err => {
2437
+ throw err;
2438
+ });
2439
+ this._log.info('listReactions iterate %j', request);
1957
2440
  return this.descriptors.page.listReactions.asyncIterate(this.innerApiCalls['listReactions'], request, callSettings);
1958
2441
  }
1959
2442
  listSpaceEvents(request, optionsOrCallback, callback) {
1960
- var _a;
1961
2443
  request = request || {};
1962
2444
  let options;
1963
2445
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1972,10 +2454,24 @@ class ChatServiceClient {
1972
2454
  options.otherArgs.headers = options.otherArgs.headers || {};
1973
2455
  options.otherArgs.headers['x-goog-request-params'] =
1974
2456
  this._gaxModule.routingHeader.fromParams({
1975
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2457
+ parent: request.parent ?? '',
1976
2458
  });
1977
- this.initialize();
1978
- return this.innerApiCalls.listSpaceEvents(request, options, callback);
2459
+ this.initialize().catch(err => {
2460
+ throw err;
2461
+ });
2462
+ const wrappedCallback = callback
2463
+ ? (error, values, nextPageRequest, rawResponse) => {
2464
+ this._log.info('listSpaceEvents values %j', values);
2465
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2466
+ }
2467
+ : undefined;
2468
+ this._log.info('listSpaceEvents request %j', request);
2469
+ return this.innerApiCalls
2470
+ .listSpaceEvents(request, options, wrappedCallback)
2471
+ ?.then(([response, input, output]) => {
2472
+ this._log.info('listSpaceEvents values %j', response);
2473
+ return [response, input, output];
2474
+ });
1979
2475
  }
1980
2476
  /**
1981
2477
  * Equivalent to `listSpaceEvents`, but returns a NodeJS Stream object.
@@ -2064,18 +2560,20 @@ class ChatServiceClient {
2064
2560
  * for more details and examples.
2065
2561
  */
2066
2562
  listSpaceEventsStream(request, options) {
2067
- var _a;
2068
2563
  request = request || {};
2069
2564
  options = options || {};
2070
2565
  options.otherArgs = options.otherArgs || {};
2071
2566
  options.otherArgs.headers = options.otherArgs.headers || {};
2072
2567
  options.otherArgs.headers['x-goog-request-params'] =
2073
2568
  this._gaxModule.routingHeader.fromParams({
2074
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2569
+ parent: request.parent ?? '',
2075
2570
  });
2076
2571
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2077
2572
  const callSettings = defaultCallSettings.merge(options);
2078
- this.initialize();
2573
+ this.initialize().catch(err => {
2574
+ throw err;
2575
+ });
2576
+ this._log.info('listSpaceEvents stream %j', request);
2079
2577
  return this.descriptors.page.listSpaceEvents.createStream(this.innerApiCalls.listSpaceEvents, request, callSettings);
2080
2578
  }
2081
2579
  /**
@@ -2168,18 +2666,20 @@ class ChatServiceClient {
2168
2666
  * region_tag:chat_v1_generated_ChatService_ListSpaceEvents_async
2169
2667
  */
2170
2668
  listSpaceEventsAsync(request, options) {
2171
- var _a;
2172
2669
  request = request || {};
2173
2670
  options = options || {};
2174
2671
  options.otherArgs = options.otherArgs || {};
2175
2672
  options.otherArgs.headers = options.otherArgs.headers || {};
2176
2673
  options.otherArgs.headers['x-goog-request-params'] =
2177
2674
  this._gaxModule.routingHeader.fromParams({
2178
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2675
+ parent: request.parent ?? '',
2179
2676
  });
2180
2677
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2181
2678
  const callSettings = defaultCallSettings.merge(options);
2182
- this.initialize();
2679
+ this.initialize().catch(err => {
2680
+ throw err;
2681
+ });
2682
+ this._log.info('listSpaceEvents iterate %j', request);
2183
2683
  return this.descriptors.page.listSpaceEvents.asyncIterate(this.innerApiCalls['listSpaceEvents'], request, callSettings);
2184
2684
  }
2185
2685
  // --------------------
@@ -2447,6 +2947,39 @@ class ChatServiceClient {
2447
2947
  return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName)
2448
2948
  .space_event;
2449
2949
  }
2950
+ /**
2951
+ * Return a fully-qualified spaceNotificationSetting resource name string.
2952
+ *
2953
+ * @param {string} user
2954
+ * @param {string} space
2955
+ * @returns {string} Resource name string.
2956
+ */
2957
+ spaceNotificationSettingPath(user, space) {
2958
+ return this.pathTemplates.spaceNotificationSettingPathTemplate.render({
2959
+ user: user,
2960
+ space: space,
2961
+ });
2962
+ }
2963
+ /**
2964
+ * Parse the user from SpaceNotificationSetting resource.
2965
+ *
2966
+ * @param {string} spaceNotificationSettingName
2967
+ * A fully-qualified path representing SpaceNotificationSetting resource.
2968
+ * @returns {string} A string representing the user.
2969
+ */
2970
+ matchUserFromSpaceNotificationSettingName(spaceNotificationSettingName) {
2971
+ return this.pathTemplates.spaceNotificationSettingPathTemplate.match(spaceNotificationSettingName).user;
2972
+ }
2973
+ /**
2974
+ * Parse the space from SpaceNotificationSetting resource.
2975
+ *
2976
+ * @param {string} spaceNotificationSettingName
2977
+ * A fully-qualified path representing SpaceNotificationSetting resource.
2978
+ * @returns {string} A string representing the space.
2979
+ */
2980
+ matchSpaceFromSpaceNotificationSettingName(spaceNotificationSettingName) {
2981
+ return this.pathTemplates.spaceNotificationSettingPathTemplate.match(spaceNotificationSettingName).space;
2982
+ }
2450
2983
  /**
2451
2984
  * Return a fully-qualified spaceReadState resource name string.
2452
2985
  *
@@ -2567,6 +3100,7 @@ class ChatServiceClient {
2567
3100
  close() {
2568
3101
  if (this.chatServiceStub && !this._terminated) {
2569
3102
  return this.chatServiceStub.then(stub => {
3103
+ this._log.info('ending gRPC channel');
2570
3104
  this._terminated = true;
2571
3105
  stub.close();
2572
3106
  });