@google-apps/chat 0.15.0 → 0.17.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.
@@ -97,26 +97,17 @@ class ChatServiceClient {
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 = 'chat.' + 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 ChatServiceClient {
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
  }
@@ -168,6 +162,7 @@ class ChatServiceClient {
168
162
  // Create useful helper objects for these.
169
163
  this.pathTemplates = {
170
164
  attachmentPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/attachments/{attachment}'),
165
+ customEmojiPathTemplate: new this._gaxModule.PathTemplate('customEmojis/{custom_emoji}'),
171
166
  membershipPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/members/{member}'),
172
167
  messagePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}'),
173
168
  quotedMessageMetadataPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/quotedMessageMetadata/{quoted_message_metadata}'),
@@ -188,7 +183,8 @@ class ChatServiceClient {
188
183
  listSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
189
184
  searchSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
190
185
  listReactions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reactions'),
191
- listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents'),
186
+ listCustomEmojis: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'customEmojis'),
187
+ listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents')
192
188
  };
193
189
  // Put together the default options sent with requests.
194
190
  this._defaults = this._gaxGrpc.constructSettings('google.chat.v1.ChatService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -217,45 +213,13 @@ class ChatServiceClient {
217
213
  }
218
214
  // Put together the "service stub" for
219
215
  // google.chat.v1.ChatService.
220
- this.chatServiceStub = this._gaxGrpc.createStub(this._opts.fallback
221
- ? this._protos.lookupService('google.chat.v1.ChatService')
222
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
- this._protos.google.chat.v1.ChatService, this._opts, this._providedCustomServicePath);
216
+ this.chatServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
217
+ this._protos.lookupService('google.chat.v1.ChatService') :
218
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
219
+ this._protos.google.chat.v1.ChatService, this._opts, this._providedCustomServicePath);
224
220
  // Iterate over each of the methods that the service provides
225
221
  // and create an API call method for each.
226
- const chatServiceStubMethods = [
227
- 'createMessage',
228
- 'listMessages',
229
- 'listMemberships',
230
- 'getMembership',
231
- 'getMessage',
232
- 'updateMessage',
233
- 'deleteMessage',
234
- 'getAttachment',
235
- 'uploadAttachment',
236
- 'listSpaces',
237
- 'searchSpaces',
238
- 'getSpace',
239
- 'createSpace',
240
- 'setUpSpace',
241
- 'updateSpace',
242
- 'deleteSpace',
243
- 'completeImportSpace',
244
- 'findDirectMessage',
245
- 'createMembership',
246
- 'updateMembership',
247
- 'deleteMembership',
248
- 'createReaction',
249
- 'listReactions',
250
- 'deleteReaction',
251
- 'getSpaceReadState',
252
- 'updateSpaceReadState',
253
- 'getThreadReadState',
254
- 'getSpaceEvent',
255
- 'listSpaceEvents',
256
- 'getSpaceNotificationSetting',
257
- 'updateSpaceNotificationSetting',
258
- ];
222
+ const chatServiceStubMethods = ['createMessage', 'listMessages', 'listMemberships', 'getMembership', 'getMessage', 'updateMessage', 'deleteMessage', 'getAttachment', 'uploadAttachment', 'listSpaces', 'searchSpaces', 'getSpace', 'createSpace', 'setUpSpace', 'updateSpace', 'deleteSpace', 'completeImportSpace', 'findDirectMessage', 'createMembership', 'updateMembership', 'deleteMembership', 'createReaction', 'listReactions', 'deleteReaction', 'createCustomEmoji', 'getCustomEmoji', 'listCustomEmojis', 'deleteCustomEmoji', 'getSpaceReadState', 'updateSpaceReadState', 'getThreadReadState', 'getSpaceEvent', 'listSpaceEvents', 'getSpaceNotificationSetting', 'updateSpaceNotificationSetting'];
259
223
  for (const methodName of chatServiceStubMethods) {
260
224
  const callPromise = this.chatServiceStub.then(stub => (...args) => {
261
225
  if (this._terminated) {
@@ -266,7 +230,8 @@ class ChatServiceClient {
266
230
  }, (err) => () => {
267
231
  throw err;
268
232
  });
269
- const descriptor = this.descriptors.page[methodName] || undefined;
233
+ const descriptor = this.descriptors.page[methodName] ||
234
+ undefined;
270
235
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
271
236
  this.innerApiCalls[methodName] = apiCall;
272
237
  }
@@ -278,8 +243,7 @@ class ChatServiceClient {
278
243
  * @returns {string} The DNS address for this service.
279
244
  */
280
245
  static get servicePath() {
281
- if (typeof process === 'object' &&
282
- typeof process.emitWarning === 'function') {
246
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
283
247
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
284
248
  }
285
249
  return 'chat.googleapis.com';
@@ -290,8 +254,7 @@ class ChatServiceClient {
290
254
  * @returns {string} The DNS address for this service.
291
255
  */
292
256
  static get apiEndpoint() {
293
- if (typeof process === 'object' &&
294
- typeof process.emitWarning === 'function') {
257
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
295
258
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
296
259
  }
297
260
  return 'chat.googleapis.com';
@@ -326,6 +289,8 @@ class ChatServiceClient {
326
289
  'https://www.googleapis.com/auth/chat.admin.spaces',
327
290
  'https://www.googleapis.com/auth/chat.admin.spaces.readonly',
328
291
  'https://www.googleapis.com/auth/chat.bot',
292
+ 'https://www.googleapis.com/auth/chat.customemojis',
293
+ 'https://www.googleapis.com/auth/chat.customemojis.readonly',
329
294
  'https://www.googleapis.com/auth/chat.delete',
330
295
  'https://www.googleapis.com/auth/chat.import',
331
296
  'https://www.googleapis.com/auth/chat.memberships',
@@ -342,7 +307,7 @@ class ChatServiceClient {
342
307
  'https://www.googleapis.com/auth/chat.spaces.readonly',
343
308
  'https://www.googleapis.com/auth/chat.users.readstate',
344
309
  'https://www.googleapis.com/auth/chat.users.readstate.readonly',
345
- 'https://www.googleapis.com/auth/chat.users.spacesettings',
310
+ 'https://www.googleapis.com/auth/chat.users.spacesettings'
346
311
  ];
347
312
  }
348
313
  /**
@@ -369,13 +334,10 @@ class ChatServiceClient {
369
334
  options = options || {};
370
335
  options.otherArgs = options.otherArgs || {};
371
336
  options.otherArgs.headers = options.otherArgs.headers || {};
372
- options.otherArgs.headers['x-goog-request-params'] =
373
- this._gaxModule.routingHeader.fromParams({
374
- parent: request.parent ?? '',
375
- });
376
- this.initialize().catch(err => {
377
- throw err;
337
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
338
+ 'parent': request.parent ?? '',
378
339
  });
340
+ this.initialize().catch(err => { throw err; });
379
341
  this._log.info('createMessage request %j', request);
380
342
  const wrappedCallback = callback
381
343
  ? (error, response, options, rawResponse) => {
@@ -383,11 +345,16 @@ class ChatServiceClient {
383
345
  callback(error, response, options, rawResponse); // We verified callback above.
384
346
  }
385
347
  : undefined;
386
- return this.innerApiCalls
387
- .createMessage(request, options, wrappedCallback)
348
+ return this.innerApiCalls.createMessage(request, options, wrappedCallback)
388
349
  ?.then(([response, options, rawResponse]) => {
389
350
  this._log.info('createMessage response %j', response);
390
351
  return [response, options, rawResponse];
352
+ }).catch((error) => {
353
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
354
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
355
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
356
+ }
357
+ throw error;
391
358
  });
392
359
  }
393
360
  getMembership(request, optionsOrCallback, callback) {
@@ -403,13 +370,10 @@ class ChatServiceClient {
403
370
  options = options || {};
404
371
  options.otherArgs = options.otherArgs || {};
405
372
  options.otherArgs.headers = options.otherArgs.headers || {};
406
- options.otherArgs.headers['x-goog-request-params'] =
407
- this._gaxModule.routingHeader.fromParams({
408
- name: request.name ?? '',
409
- });
410
- this.initialize().catch(err => {
411
- throw err;
373
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
374
+ 'name': request.name ?? '',
412
375
  });
376
+ this.initialize().catch(err => { throw err; });
413
377
  this._log.info('getMembership request %j', request);
414
378
  const wrappedCallback = callback
415
379
  ? (error, response, options, rawResponse) => {
@@ -417,11 +381,16 @@ class ChatServiceClient {
417
381
  callback(error, response, options, rawResponse); // We verified callback above.
418
382
  }
419
383
  : undefined;
420
- return this.innerApiCalls
421
- .getMembership(request, options, wrappedCallback)
384
+ return this.innerApiCalls.getMembership(request, options, wrappedCallback)
422
385
  ?.then(([response, options, rawResponse]) => {
423
386
  this._log.info('getMembership response %j', response);
424
387
  return [response, options, rawResponse];
388
+ }).catch((error) => {
389
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
390
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
391
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
392
+ }
393
+ throw error;
425
394
  });
426
395
  }
427
396
  getMessage(request, optionsOrCallback, callback) {
@@ -437,13 +406,10 @@ class ChatServiceClient {
437
406
  options = options || {};
438
407
  options.otherArgs = options.otherArgs || {};
439
408
  options.otherArgs.headers = options.otherArgs.headers || {};
440
- options.otherArgs.headers['x-goog-request-params'] =
441
- this._gaxModule.routingHeader.fromParams({
442
- name: request.name ?? '',
443
- });
444
- this.initialize().catch(err => {
445
- throw err;
409
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
410
+ 'name': request.name ?? '',
446
411
  });
412
+ this.initialize().catch(err => { throw err; });
447
413
  this._log.info('getMessage request %j', request);
448
414
  const wrappedCallback = callback
449
415
  ? (error, response, options, rawResponse) => {
@@ -451,11 +417,16 @@ class ChatServiceClient {
451
417
  callback(error, response, options, rawResponse); // We verified callback above.
452
418
  }
453
419
  : undefined;
454
- return this.innerApiCalls
455
- .getMessage(request, options, wrappedCallback)
420
+ return this.innerApiCalls.getMessage(request, options, wrappedCallback)
456
421
  ?.then(([response, options, rawResponse]) => {
457
422
  this._log.info('getMessage response %j', response);
458
423
  return [response, options, rawResponse];
424
+ }).catch((error) => {
425
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
426
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
427
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
428
+ }
429
+ throw error;
459
430
  });
460
431
  }
461
432
  updateMessage(request, optionsOrCallback, callback) {
@@ -471,13 +442,10 @@ class ChatServiceClient {
471
442
  options = options || {};
472
443
  options.otherArgs = options.otherArgs || {};
473
444
  options.otherArgs.headers = options.otherArgs.headers || {};
474
- options.otherArgs.headers['x-goog-request-params'] =
475
- this._gaxModule.routingHeader.fromParams({
476
- 'message.name': request.message.name ?? '',
477
- });
478
- this.initialize().catch(err => {
479
- throw err;
445
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
446
+ 'message.name': request.message.name ?? '',
480
447
  });
448
+ this.initialize().catch(err => { throw err; });
481
449
  this._log.info('updateMessage request %j', request);
482
450
  const wrappedCallback = callback
483
451
  ? (error, response, options, rawResponse) => {
@@ -485,11 +453,16 @@ class ChatServiceClient {
485
453
  callback(error, response, options, rawResponse); // We verified callback above.
486
454
  }
487
455
  : undefined;
488
- return this.innerApiCalls
489
- .updateMessage(request, options, wrappedCallback)
456
+ return this.innerApiCalls.updateMessage(request, options, wrappedCallback)
490
457
  ?.then(([response, options, rawResponse]) => {
491
458
  this._log.info('updateMessage response %j', response);
492
459
  return [response, options, rawResponse];
460
+ }).catch((error) => {
461
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
462
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
463
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
464
+ }
465
+ throw error;
493
466
  });
494
467
  }
495
468
  deleteMessage(request, optionsOrCallback, callback) {
@@ -505,13 +478,10 @@ class ChatServiceClient {
505
478
  options = options || {};
506
479
  options.otherArgs = options.otherArgs || {};
507
480
  options.otherArgs.headers = options.otherArgs.headers || {};
508
- options.otherArgs.headers['x-goog-request-params'] =
509
- this._gaxModule.routingHeader.fromParams({
510
- name: request.name ?? '',
511
- });
512
- this.initialize().catch(err => {
513
- throw err;
481
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
482
+ 'name': request.name ?? '',
514
483
  });
484
+ this.initialize().catch(err => { throw err; });
515
485
  this._log.info('deleteMessage request %j', request);
516
486
  const wrappedCallback = callback
517
487
  ? (error, response, options, rawResponse) => {
@@ -519,11 +489,16 @@ class ChatServiceClient {
519
489
  callback(error, response, options, rawResponse); // We verified callback above.
520
490
  }
521
491
  : undefined;
522
- return this.innerApiCalls
523
- .deleteMessage(request, options, wrappedCallback)
492
+ return this.innerApiCalls.deleteMessage(request, options, wrappedCallback)
524
493
  ?.then(([response, options, rawResponse]) => {
525
494
  this._log.info('deleteMessage response %j', response);
526
495
  return [response, options, rawResponse];
496
+ }).catch((error) => {
497
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
498
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
499
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
500
+ }
501
+ throw error;
527
502
  });
528
503
  }
529
504
  getAttachment(request, optionsOrCallback, callback) {
@@ -539,13 +514,10 @@ class ChatServiceClient {
539
514
  options = options || {};
540
515
  options.otherArgs = options.otherArgs || {};
541
516
  options.otherArgs.headers = options.otherArgs.headers || {};
542
- options.otherArgs.headers['x-goog-request-params'] =
543
- this._gaxModule.routingHeader.fromParams({
544
- name: request.name ?? '',
545
- });
546
- this.initialize().catch(err => {
547
- throw err;
517
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
518
+ 'name': request.name ?? '',
548
519
  });
520
+ this.initialize().catch(err => { throw err; });
549
521
  this._log.info('getAttachment request %j', request);
550
522
  const wrappedCallback = callback
551
523
  ? (error, response, options, rawResponse) => {
@@ -553,11 +525,16 @@ class ChatServiceClient {
553
525
  callback(error, response, options, rawResponse); // We verified callback above.
554
526
  }
555
527
  : undefined;
556
- return this.innerApiCalls
557
- .getAttachment(request, options, wrappedCallback)
528
+ return this.innerApiCalls.getAttachment(request, options, wrappedCallback)
558
529
  ?.then(([response, options, rawResponse]) => {
559
530
  this._log.info('getAttachment response %j', response);
560
531
  return [response, options, rawResponse];
532
+ }).catch((error) => {
533
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
534
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
535
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
536
+ }
537
+ throw error;
561
538
  });
562
539
  }
563
540
  uploadAttachment(request, optionsOrCallback, callback) {
@@ -573,13 +550,10 @@ class ChatServiceClient {
573
550
  options = options || {};
574
551
  options.otherArgs = options.otherArgs || {};
575
552
  options.otherArgs.headers = options.otherArgs.headers || {};
576
- options.otherArgs.headers['x-goog-request-params'] =
577
- this._gaxModule.routingHeader.fromParams({
578
- parent: request.parent ?? '',
579
- });
580
- this.initialize().catch(err => {
581
- throw err;
553
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
554
+ 'parent': request.parent ?? '',
582
555
  });
556
+ this.initialize().catch(err => { throw err; });
583
557
  this._log.info('uploadAttachment request %j', request);
584
558
  const wrappedCallback = callback
585
559
  ? (error, response, options, rawResponse) => {
@@ -587,11 +561,16 @@ class ChatServiceClient {
587
561
  callback(error, response, options, rawResponse); // We verified callback above.
588
562
  }
589
563
  : undefined;
590
- return this.innerApiCalls
591
- .uploadAttachment(request, options, wrappedCallback)
564
+ return this.innerApiCalls.uploadAttachment(request, options, wrappedCallback)
592
565
  ?.then(([response, options, rawResponse]) => {
593
566
  this._log.info('uploadAttachment response %j', response);
594
567
  return [response, options, rawResponse];
568
+ }).catch((error) => {
569
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
570
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
571
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
572
+ }
573
+ throw error;
595
574
  });
596
575
  }
597
576
  getSpace(request, optionsOrCallback, callback) {
@@ -607,13 +586,10 @@ class ChatServiceClient {
607
586
  options = options || {};
608
587
  options.otherArgs = options.otherArgs || {};
609
588
  options.otherArgs.headers = options.otherArgs.headers || {};
610
- options.otherArgs.headers['x-goog-request-params'] =
611
- this._gaxModule.routingHeader.fromParams({
612
- name: request.name ?? '',
613
- });
614
- this.initialize().catch(err => {
615
- throw err;
589
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
590
+ 'name': request.name ?? '',
616
591
  });
592
+ this.initialize().catch(err => { throw err; });
617
593
  this._log.info('getSpace request %j', request);
618
594
  const wrappedCallback = callback
619
595
  ? (error, response, options, rawResponse) => {
@@ -621,11 +597,16 @@ class ChatServiceClient {
621
597
  callback(error, response, options, rawResponse); // We verified callback above.
622
598
  }
623
599
  : undefined;
624
- return this.innerApiCalls
625
- .getSpace(request, options, wrappedCallback)
600
+ return this.innerApiCalls.getSpace(request, options, wrappedCallback)
626
601
  ?.then(([response, options, rawResponse]) => {
627
602
  this._log.info('getSpace response %j', response);
628
603
  return [response, options, rawResponse];
604
+ }).catch((error) => {
605
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
606
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
607
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
608
+ }
609
+ throw error;
629
610
  });
630
611
  }
631
612
  createSpace(request, optionsOrCallback, callback) {
@@ -641,9 +622,7 @@ class ChatServiceClient {
641
622
  options = options || {};
642
623
  options.otherArgs = options.otherArgs || {};
643
624
  options.otherArgs.headers = options.otherArgs.headers || {};
644
- this.initialize().catch(err => {
645
- throw err;
646
- });
625
+ this.initialize().catch(err => { throw err; });
647
626
  this._log.info('createSpace request %j', request);
648
627
  const wrappedCallback = callback
649
628
  ? (error, response, options, rawResponse) => {
@@ -651,11 +630,16 @@ class ChatServiceClient {
651
630
  callback(error, response, options, rawResponse); // We verified callback above.
652
631
  }
653
632
  : undefined;
654
- return this.innerApiCalls
655
- .createSpace(request, options, wrappedCallback)
633
+ return this.innerApiCalls.createSpace(request, options, wrappedCallback)
656
634
  ?.then(([response, options, rawResponse]) => {
657
635
  this._log.info('createSpace response %j', response);
658
636
  return [response, options, rawResponse];
637
+ }).catch((error) => {
638
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
639
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
640
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
641
+ }
642
+ throw error;
659
643
  });
660
644
  }
661
645
  setUpSpace(request, optionsOrCallback, callback) {
@@ -671,9 +655,7 @@ class ChatServiceClient {
671
655
  options = options || {};
672
656
  options.otherArgs = options.otherArgs || {};
673
657
  options.otherArgs.headers = options.otherArgs.headers || {};
674
- this.initialize().catch(err => {
675
- throw err;
676
- });
658
+ this.initialize().catch(err => { throw err; });
677
659
  this._log.info('setUpSpace request %j', request);
678
660
  const wrappedCallback = callback
679
661
  ? (error, response, options, rawResponse) => {
@@ -681,11 +663,16 @@ class ChatServiceClient {
681
663
  callback(error, response, options, rawResponse); // We verified callback above.
682
664
  }
683
665
  : undefined;
684
- return this.innerApiCalls
685
- .setUpSpace(request, options, wrappedCallback)
666
+ return this.innerApiCalls.setUpSpace(request, options, wrappedCallback)
686
667
  ?.then(([response, options, rawResponse]) => {
687
668
  this._log.info('setUpSpace response %j', response);
688
669
  return [response, options, rawResponse];
670
+ }).catch((error) => {
671
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
672
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
673
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
674
+ }
675
+ throw error;
689
676
  });
690
677
  }
691
678
  updateSpace(request, optionsOrCallback, callback) {
@@ -701,13 +688,10 @@ class ChatServiceClient {
701
688
  options = options || {};
702
689
  options.otherArgs = options.otherArgs || {};
703
690
  options.otherArgs.headers = options.otherArgs.headers || {};
704
- options.otherArgs.headers['x-goog-request-params'] =
705
- this._gaxModule.routingHeader.fromParams({
706
- 'space.name': request.space.name ?? '',
707
- });
708
- this.initialize().catch(err => {
709
- throw err;
691
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
692
+ 'space.name': request.space.name ?? '',
710
693
  });
694
+ this.initialize().catch(err => { throw err; });
711
695
  this._log.info('updateSpace request %j', request);
712
696
  const wrappedCallback = callback
713
697
  ? (error, response, options, rawResponse) => {
@@ -715,11 +699,16 @@ class ChatServiceClient {
715
699
  callback(error, response, options, rawResponse); // We verified callback above.
716
700
  }
717
701
  : undefined;
718
- return this.innerApiCalls
719
- .updateSpace(request, options, wrappedCallback)
702
+ return this.innerApiCalls.updateSpace(request, options, wrappedCallback)
720
703
  ?.then(([response, options, rawResponse]) => {
721
704
  this._log.info('updateSpace response %j', response);
722
705
  return [response, options, rawResponse];
706
+ }).catch((error) => {
707
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
708
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
709
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
710
+ }
711
+ throw error;
723
712
  });
724
713
  }
725
714
  deleteSpace(request, optionsOrCallback, callback) {
@@ -735,13 +724,10 @@ class ChatServiceClient {
735
724
  options = options || {};
736
725
  options.otherArgs = options.otherArgs || {};
737
726
  options.otherArgs.headers = options.otherArgs.headers || {};
738
- options.otherArgs.headers['x-goog-request-params'] =
739
- this._gaxModule.routingHeader.fromParams({
740
- name: request.name ?? '',
741
- });
742
- this.initialize().catch(err => {
743
- throw err;
727
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
728
+ 'name': request.name ?? '',
744
729
  });
730
+ this.initialize().catch(err => { throw err; });
745
731
  this._log.info('deleteSpace request %j', request);
746
732
  const wrappedCallback = callback
747
733
  ? (error, response, options, rawResponse) => {
@@ -749,11 +735,16 @@ class ChatServiceClient {
749
735
  callback(error, response, options, rawResponse); // We verified callback above.
750
736
  }
751
737
  : undefined;
752
- return this.innerApiCalls
753
- .deleteSpace(request, options, wrappedCallback)
738
+ return this.innerApiCalls.deleteSpace(request, options, wrappedCallback)
754
739
  ?.then(([response, options, rawResponse]) => {
755
740
  this._log.info('deleteSpace response %j', response);
756
741
  return [response, options, rawResponse];
742
+ }).catch((error) => {
743
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
744
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
745
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
746
+ }
747
+ throw error;
757
748
  });
758
749
  }
759
750
  completeImportSpace(request, optionsOrCallback, callback) {
@@ -769,13 +760,10 @@ class ChatServiceClient {
769
760
  options = options || {};
770
761
  options.otherArgs = options.otherArgs || {};
771
762
  options.otherArgs.headers = options.otherArgs.headers || {};
772
- options.otherArgs.headers['x-goog-request-params'] =
773
- this._gaxModule.routingHeader.fromParams({
774
- name: request.name ?? '',
775
- });
776
- this.initialize().catch(err => {
777
- throw err;
763
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
764
+ 'name': request.name ?? '',
778
765
  });
766
+ this.initialize().catch(err => { throw err; });
779
767
  this._log.info('completeImportSpace request %j', request);
780
768
  const wrappedCallback = callback
781
769
  ? (error, response, options, rawResponse) => {
@@ -783,11 +771,16 @@ class ChatServiceClient {
783
771
  callback(error, response, options, rawResponse); // We verified callback above.
784
772
  }
785
773
  : undefined;
786
- return this.innerApiCalls
787
- .completeImportSpace(request, options, wrappedCallback)
774
+ return this.innerApiCalls.completeImportSpace(request, options, wrappedCallback)
788
775
  ?.then(([response, options, rawResponse]) => {
789
776
  this._log.info('completeImportSpace response %j', response);
790
777
  return [response, options, rawResponse];
778
+ }).catch((error) => {
779
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
780
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
781
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
782
+ }
783
+ throw error;
791
784
  });
792
785
  }
793
786
  findDirectMessage(request, optionsOrCallback, callback) {
@@ -803,9 +796,7 @@ class ChatServiceClient {
803
796
  options = options || {};
804
797
  options.otherArgs = options.otherArgs || {};
805
798
  options.otherArgs.headers = options.otherArgs.headers || {};
806
- this.initialize().catch(err => {
807
- throw err;
808
- });
799
+ this.initialize().catch(err => { throw err; });
809
800
  this._log.info('findDirectMessage request %j', request);
810
801
  const wrappedCallback = callback
811
802
  ? (error, response, options, rawResponse) => {
@@ -813,11 +804,16 @@ class ChatServiceClient {
813
804
  callback(error, response, options, rawResponse); // We verified callback above.
814
805
  }
815
806
  : undefined;
816
- return this.innerApiCalls
817
- .findDirectMessage(request, options, wrappedCallback)
807
+ return this.innerApiCalls.findDirectMessage(request, options, wrappedCallback)
818
808
  ?.then(([response, options, rawResponse]) => {
819
809
  this._log.info('findDirectMessage response %j', response);
820
810
  return [response, options, rawResponse];
811
+ }).catch((error) => {
812
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
813
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
814
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
815
+ }
816
+ throw error;
821
817
  });
822
818
  }
823
819
  createMembership(request, optionsOrCallback, callback) {
@@ -833,13 +829,10 @@ class ChatServiceClient {
833
829
  options = options || {};
834
830
  options.otherArgs = options.otherArgs || {};
835
831
  options.otherArgs.headers = options.otherArgs.headers || {};
836
- options.otherArgs.headers['x-goog-request-params'] =
837
- this._gaxModule.routingHeader.fromParams({
838
- parent: request.parent ?? '',
839
- });
840
- this.initialize().catch(err => {
841
- throw err;
832
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
833
+ 'parent': request.parent ?? '',
842
834
  });
835
+ this.initialize().catch(err => { throw err; });
843
836
  this._log.info('createMembership request %j', request);
844
837
  const wrappedCallback = callback
845
838
  ? (error, response, options, rawResponse) => {
@@ -847,11 +840,16 @@ class ChatServiceClient {
847
840
  callback(error, response, options, rawResponse); // We verified callback above.
848
841
  }
849
842
  : undefined;
850
- return this.innerApiCalls
851
- .createMembership(request, options, wrappedCallback)
843
+ return this.innerApiCalls.createMembership(request, options, wrappedCallback)
852
844
  ?.then(([response, options, rawResponse]) => {
853
845
  this._log.info('createMembership response %j', response);
854
846
  return [response, options, rawResponse];
847
+ }).catch((error) => {
848
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
849
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
850
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
851
+ }
852
+ throw error;
855
853
  });
856
854
  }
857
855
  updateMembership(request, optionsOrCallback, callback) {
@@ -867,13 +865,10 @@ class ChatServiceClient {
867
865
  options = options || {};
868
866
  options.otherArgs = options.otherArgs || {};
869
867
  options.otherArgs.headers = options.otherArgs.headers || {};
870
- options.otherArgs.headers['x-goog-request-params'] =
871
- this._gaxModule.routingHeader.fromParams({
872
- 'membership.name': request.membership.name ?? '',
873
- });
874
- this.initialize().catch(err => {
875
- throw err;
868
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
869
+ 'membership.name': request.membership.name ?? '',
876
870
  });
871
+ this.initialize().catch(err => { throw err; });
877
872
  this._log.info('updateMembership request %j', request);
878
873
  const wrappedCallback = callback
879
874
  ? (error, response, options, rawResponse) => {
@@ -881,11 +876,16 @@ class ChatServiceClient {
881
876
  callback(error, response, options, rawResponse); // We verified callback above.
882
877
  }
883
878
  : undefined;
884
- return this.innerApiCalls
885
- .updateMembership(request, options, wrappedCallback)
879
+ return this.innerApiCalls.updateMembership(request, options, wrappedCallback)
886
880
  ?.then(([response, options, rawResponse]) => {
887
881
  this._log.info('updateMembership response %j', response);
888
882
  return [response, options, rawResponse];
883
+ }).catch((error) => {
884
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
885
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
886
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
887
+ }
888
+ throw error;
889
889
  });
890
890
  }
891
891
  deleteMembership(request, optionsOrCallback, callback) {
@@ -901,13 +901,10 @@ class ChatServiceClient {
901
901
  options = options || {};
902
902
  options.otherArgs = options.otherArgs || {};
903
903
  options.otherArgs.headers = options.otherArgs.headers || {};
904
- options.otherArgs.headers['x-goog-request-params'] =
905
- this._gaxModule.routingHeader.fromParams({
906
- name: request.name ?? '',
907
- });
908
- this.initialize().catch(err => {
909
- throw err;
904
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
905
+ 'name': request.name ?? '',
910
906
  });
907
+ this.initialize().catch(err => { throw err; });
911
908
  this._log.info('deleteMembership request %j', request);
912
909
  const wrappedCallback = callback
913
910
  ? (error, response, options, rawResponse) => {
@@ -915,11 +912,16 @@ class ChatServiceClient {
915
912
  callback(error, response, options, rawResponse); // We verified callback above.
916
913
  }
917
914
  : undefined;
918
- return this.innerApiCalls
919
- .deleteMembership(request, options, wrappedCallback)
915
+ return this.innerApiCalls.deleteMembership(request, options, wrappedCallback)
920
916
  ?.then(([response, options, rawResponse]) => {
921
917
  this._log.info('deleteMembership response %j', response);
922
918
  return [response, options, rawResponse];
919
+ }).catch((error) => {
920
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
921
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
922
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
923
+ }
924
+ throw error;
923
925
  });
924
926
  }
925
927
  createReaction(request, optionsOrCallback, callback) {
@@ -935,13 +937,10 @@ class ChatServiceClient {
935
937
  options = options || {};
936
938
  options.otherArgs = options.otherArgs || {};
937
939
  options.otherArgs.headers = options.otherArgs.headers || {};
938
- options.otherArgs.headers['x-goog-request-params'] =
939
- this._gaxModule.routingHeader.fromParams({
940
- parent: request.parent ?? '',
941
- });
942
- this.initialize().catch(err => {
943
- throw err;
940
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
941
+ 'parent': request.parent ?? '',
944
942
  });
943
+ this.initialize().catch(err => { throw err; });
945
944
  this._log.info('createReaction request %j', request);
946
945
  const wrappedCallback = callback
947
946
  ? (error, response, options, rawResponse) => {
@@ -949,11 +948,16 @@ class ChatServiceClient {
949
948
  callback(error, response, options, rawResponse); // We verified callback above.
950
949
  }
951
950
  : undefined;
952
- return this.innerApiCalls
953
- .createReaction(request, options, wrappedCallback)
951
+ return this.innerApiCalls.createReaction(request, options, wrappedCallback)
954
952
  ?.then(([response, options, rawResponse]) => {
955
953
  this._log.info('createReaction response %j', response);
956
954
  return [response, options, rawResponse];
955
+ }).catch((error) => {
956
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
957
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
958
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
959
+ }
960
+ throw error;
957
961
  });
958
962
  }
959
963
  deleteReaction(request, optionsOrCallback, callback) {
@@ -969,13 +973,10 @@ class ChatServiceClient {
969
973
  options = options || {};
970
974
  options.otherArgs = options.otherArgs || {};
971
975
  options.otherArgs.headers = options.otherArgs.headers || {};
972
- options.otherArgs.headers['x-goog-request-params'] =
973
- this._gaxModule.routingHeader.fromParams({
974
- name: request.name ?? '',
975
- });
976
- this.initialize().catch(err => {
977
- throw err;
976
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
977
+ 'name': request.name ?? '',
978
978
  });
979
+ this.initialize().catch(err => { throw err; });
979
980
  this._log.info('deleteReaction request %j', request);
980
981
  const wrappedCallback = callback
981
982
  ? (error, response, options, rawResponse) => {
@@ -983,11 +984,121 @@ class ChatServiceClient {
983
984
  callback(error, response, options, rawResponse); // We verified callback above.
984
985
  }
985
986
  : undefined;
986
- return this.innerApiCalls
987
- .deleteReaction(request, options, wrappedCallback)
987
+ return this.innerApiCalls.deleteReaction(request, options, wrappedCallback)
988
988
  ?.then(([response, options, rawResponse]) => {
989
989
  this._log.info('deleteReaction response %j', response);
990
990
  return [response, options, rawResponse];
991
+ }).catch((error) => {
992
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
993
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
994
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
995
+ }
996
+ throw error;
997
+ });
998
+ }
999
+ createCustomEmoji(request, optionsOrCallback, callback) {
1000
+ request = request || {};
1001
+ let options;
1002
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1003
+ callback = optionsOrCallback;
1004
+ options = {};
1005
+ }
1006
+ else {
1007
+ options = optionsOrCallback;
1008
+ }
1009
+ options = options || {};
1010
+ options.otherArgs = options.otherArgs || {};
1011
+ options.otherArgs.headers = options.otherArgs.headers || {};
1012
+ this.initialize().catch(err => { throw err; });
1013
+ this._log.info('createCustomEmoji request %j', request);
1014
+ const wrappedCallback = callback
1015
+ ? (error, response, options, rawResponse) => {
1016
+ this._log.info('createCustomEmoji response %j', response);
1017
+ callback(error, response, options, rawResponse); // We verified callback above.
1018
+ }
1019
+ : undefined;
1020
+ return this.innerApiCalls.createCustomEmoji(request, options, wrappedCallback)
1021
+ ?.then(([response, options, rawResponse]) => {
1022
+ this._log.info('createCustomEmoji response %j', response);
1023
+ return [response, options, rawResponse];
1024
+ }).catch((error) => {
1025
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1026
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1027
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1028
+ }
1029
+ throw error;
1030
+ });
1031
+ }
1032
+ getCustomEmoji(request, optionsOrCallback, callback) {
1033
+ request = request || {};
1034
+ let options;
1035
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1036
+ callback = optionsOrCallback;
1037
+ options = {};
1038
+ }
1039
+ else {
1040
+ options = optionsOrCallback;
1041
+ }
1042
+ options = options || {};
1043
+ options.otherArgs = options.otherArgs || {};
1044
+ options.otherArgs.headers = options.otherArgs.headers || {};
1045
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1046
+ 'name': request.name ?? '',
1047
+ });
1048
+ this.initialize().catch(err => { throw err; });
1049
+ this._log.info('getCustomEmoji request %j', request);
1050
+ const wrappedCallback = callback
1051
+ ? (error, response, options, rawResponse) => {
1052
+ this._log.info('getCustomEmoji response %j', response);
1053
+ callback(error, response, options, rawResponse); // We verified callback above.
1054
+ }
1055
+ : undefined;
1056
+ return this.innerApiCalls.getCustomEmoji(request, options, wrappedCallback)
1057
+ ?.then(([response, options, rawResponse]) => {
1058
+ this._log.info('getCustomEmoji response %j', response);
1059
+ return [response, options, rawResponse];
1060
+ }).catch((error) => {
1061
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1062
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1063
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1064
+ }
1065
+ throw error;
1066
+ });
1067
+ }
1068
+ deleteCustomEmoji(request, optionsOrCallback, callback) {
1069
+ request = request || {};
1070
+ let options;
1071
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1072
+ callback = optionsOrCallback;
1073
+ options = {};
1074
+ }
1075
+ else {
1076
+ options = optionsOrCallback;
1077
+ }
1078
+ options = options || {};
1079
+ options.otherArgs = options.otherArgs || {};
1080
+ options.otherArgs.headers = options.otherArgs.headers || {};
1081
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1082
+ 'name': request.name ?? '',
1083
+ });
1084
+ this.initialize().catch(err => { throw err; });
1085
+ this._log.info('deleteCustomEmoji request %j', request);
1086
+ const wrappedCallback = callback
1087
+ ? (error, response, options, rawResponse) => {
1088
+ this._log.info('deleteCustomEmoji response %j', response);
1089
+ callback(error, response, options, rawResponse); // We verified callback above.
1090
+ }
1091
+ : undefined;
1092
+ return this.innerApiCalls.deleteCustomEmoji(request, options, wrappedCallback)
1093
+ ?.then(([response, options, rawResponse]) => {
1094
+ this._log.info('deleteCustomEmoji response %j', response);
1095
+ return [response, options, rawResponse];
1096
+ }).catch((error) => {
1097
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1098
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1099
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1100
+ }
1101
+ throw error;
991
1102
  });
992
1103
  }
993
1104
  getSpaceReadState(request, optionsOrCallback, callback) {
@@ -1003,13 +1114,10 @@ class ChatServiceClient {
1003
1114
  options = options || {};
1004
1115
  options.otherArgs = options.otherArgs || {};
1005
1116
  options.otherArgs.headers = options.otherArgs.headers || {};
1006
- options.otherArgs.headers['x-goog-request-params'] =
1007
- this._gaxModule.routingHeader.fromParams({
1008
- name: request.name ?? '',
1009
- });
1010
- this.initialize().catch(err => {
1011
- throw err;
1117
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1118
+ 'name': request.name ?? '',
1012
1119
  });
1120
+ this.initialize().catch(err => { throw err; });
1013
1121
  this._log.info('getSpaceReadState request %j', request);
1014
1122
  const wrappedCallback = callback
1015
1123
  ? (error, response, options, rawResponse) => {
@@ -1017,11 +1125,16 @@ class ChatServiceClient {
1017
1125
  callback(error, response, options, rawResponse); // We verified callback above.
1018
1126
  }
1019
1127
  : undefined;
1020
- return this.innerApiCalls
1021
- .getSpaceReadState(request, options, wrappedCallback)
1128
+ return this.innerApiCalls.getSpaceReadState(request, options, wrappedCallback)
1022
1129
  ?.then(([response, options, rawResponse]) => {
1023
1130
  this._log.info('getSpaceReadState response %j', response);
1024
1131
  return [response, options, rawResponse];
1132
+ }).catch((error) => {
1133
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1134
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1135
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1136
+ }
1137
+ throw error;
1025
1138
  });
1026
1139
  }
1027
1140
  updateSpaceReadState(request, optionsOrCallback, callback) {
@@ -1037,13 +1150,10 @@ class ChatServiceClient {
1037
1150
  options = options || {};
1038
1151
  options.otherArgs = options.otherArgs || {};
1039
1152
  options.otherArgs.headers = options.otherArgs.headers || {};
1040
- options.otherArgs.headers['x-goog-request-params'] =
1041
- this._gaxModule.routingHeader.fromParams({
1042
- 'space_read_state.name': request.spaceReadState.name ?? '',
1043
- });
1044
- this.initialize().catch(err => {
1045
- throw err;
1153
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1154
+ 'space_read_state.name': request.spaceReadState.name ?? '',
1046
1155
  });
1156
+ this.initialize().catch(err => { throw err; });
1047
1157
  this._log.info('updateSpaceReadState request %j', request);
1048
1158
  const wrappedCallback = callback
1049
1159
  ? (error, response, options, rawResponse) => {
@@ -1051,11 +1161,16 @@ class ChatServiceClient {
1051
1161
  callback(error, response, options, rawResponse); // We verified callback above.
1052
1162
  }
1053
1163
  : undefined;
1054
- return this.innerApiCalls
1055
- .updateSpaceReadState(request, options, wrappedCallback)
1164
+ return this.innerApiCalls.updateSpaceReadState(request, options, wrappedCallback)
1056
1165
  ?.then(([response, options, rawResponse]) => {
1057
1166
  this._log.info('updateSpaceReadState response %j', response);
1058
1167
  return [response, options, rawResponse];
1168
+ }).catch((error) => {
1169
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1170
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1171
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1172
+ }
1173
+ throw error;
1059
1174
  });
1060
1175
  }
1061
1176
  getThreadReadState(request, optionsOrCallback, callback) {
@@ -1071,13 +1186,10 @@ class ChatServiceClient {
1071
1186
  options = options || {};
1072
1187
  options.otherArgs = options.otherArgs || {};
1073
1188
  options.otherArgs.headers = options.otherArgs.headers || {};
1074
- options.otherArgs.headers['x-goog-request-params'] =
1075
- this._gaxModule.routingHeader.fromParams({
1076
- name: request.name ?? '',
1077
- });
1078
- this.initialize().catch(err => {
1079
- throw err;
1189
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1190
+ 'name': request.name ?? '',
1080
1191
  });
1192
+ this.initialize().catch(err => { throw err; });
1081
1193
  this._log.info('getThreadReadState request %j', request);
1082
1194
  const wrappedCallback = callback
1083
1195
  ? (error, response, options, rawResponse) => {
@@ -1085,11 +1197,16 @@ class ChatServiceClient {
1085
1197
  callback(error, response, options, rawResponse); // We verified callback above.
1086
1198
  }
1087
1199
  : undefined;
1088
- return this.innerApiCalls
1089
- .getThreadReadState(request, options, wrappedCallback)
1200
+ return this.innerApiCalls.getThreadReadState(request, options, wrappedCallback)
1090
1201
  ?.then(([response, options, rawResponse]) => {
1091
1202
  this._log.info('getThreadReadState response %j', response);
1092
1203
  return [response, options, rawResponse];
1204
+ }).catch((error) => {
1205
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1206
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1207
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1208
+ }
1209
+ throw error;
1093
1210
  });
1094
1211
  }
1095
1212
  getSpaceEvent(request, optionsOrCallback, callback) {
@@ -1105,13 +1222,10 @@ class ChatServiceClient {
1105
1222
  options = options || {};
1106
1223
  options.otherArgs = options.otherArgs || {};
1107
1224
  options.otherArgs.headers = options.otherArgs.headers || {};
1108
- options.otherArgs.headers['x-goog-request-params'] =
1109
- this._gaxModule.routingHeader.fromParams({
1110
- name: request.name ?? '',
1111
- });
1112
- this.initialize().catch(err => {
1113
- throw err;
1225
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1226
+ 'name': request.name ?? '',
1114
1227
  });
1228
+ this.initialize().catch(err => { throw err; });
1115
1229
  this._log.info('getSpaceEvent request %j', request);
1116
1230
  const wrappedCallback = callback
1117
1231
  ? (error, response, options, rawResponse) => {
@@ -1119,11 +1233,16 @@ class ChatServiceClient {
1119
1233
  callback(error, response, options, rawResponse); // We verified callback above.
1120
1234
  }
1121
1235
  : undefined;
1122
- return this.innerApiCalls
1123
- .getSpaceEvent(request, options, wrappedCallback)
1236
+ return this.innerApiCalls.getSpaceEvent(request, options, wrappedCallback)
1124
1237
  ?.then(([response, options, rawResponse]) => {
1125
1238
  this._log.info('getSpaceEvent response %j', response);
1126
1239
  return [response, options, rawResponse];
1240
+ }).catch((error) => {
1241
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1242
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1243
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1244
+ }
1245
+ throw error;
1127
1246
  });
1128
1247
  }
1129
1248
  getSpaceNotificationSetting(request, optionsOrCallback, callback) {
@@ -1139,13 +1258,10 @@ class ChatServiceClient {
1139
1258
  options = options || {};
1140
1259
  options.otherArgs = options.otherArgs || {};
1141
1260
  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;
1261
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1262
+ 'name': request.name ?? '',
1148
1263
  });
1264
+ this.initialize().catch(err => { throw err; });
1149
1265
  this._log.info('getSpaceNotificationSetting request %j', request);
1150
1266
  const wrappedCallback = callback
1151
1267
  ? (error, response, options, rawResponse) => {
@@ -1153,11 +1269,16 @@ class ChatServiceClient {
1153
1269
  callback(error, response, options, rawResponse); // We verified callback above.
1154
1270
  }
1155
1271
  : undefined;
1156
- return this.innerApiCalls
1157
- .getSpaceNotificationSetting(request, options, wrappedCallback)
1272
+ return this.innerApiCalls.getSpaceNotificationSetting(request, options, wrappedCallback)
1158
1273
  ?.then(([response, options, rawResponse]) => {
1159
1274
  this._log.info('getSpaceNotificationSetting response %j', response);
1160
1275
  return [response, options, rawResponse];
1276
+ }).catch((error) => {
1277
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1278
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1279
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1280
+ }
1281
+ throw error;
1161
1282
  });
1162
1283
  }
1163
1284
  updateSpaceNotificationSetting(request, optionsOrCallback, callback) {
@@ -1173,13 +1294,10 @@ class ChatServiceClient {
1173
1294
  options = options || {};
1174
1295
  options.otherArgs = options.otherArgs || {};
1175
1296
  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 ?? '',
1179
- });
1180
- this.initialize().catch(err => {
1181
- throw err;
1297
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1298
+ 'space_notification_setting.name': request.spaceNotificationSetting.name ?? '',
1182
1299
  });
1300
+ this.initialize().catch(err => { throw err; });
1183
1301
  this._log.info('updateSpaceNotificationSetting request %j', request);
1184
1302
  const wrappedCallback = callback
1185
1303
  ? (error, response, options, rawResponse) => {
@@ -1187,11 +1305,16 @@ class ChatServiceClient {
1187
1305
  callback(error, response, options, rawResponse); // We verified callback above.
1188
1306
  }
1189
1307
  : undefined;
1190
- return this.innerApiCalls
1191
- .updateSpaceNotificationSetting(request, options, wrappedCallback)
1308
+ return this.innerApiCalls.updateSpaceNotificationSetting(request, options, wrappedCallback)
1192
1309
  ?.then(([response, options, rawResponse]) => {
1193
1310
  this._log.info('updateSpaceNotificationSetting response %j', response);
1194
1311
  return [response, options, rawResponse];
1312
+ }).catch((error) => {
1313
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1314
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1315
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1316
+ }
1317
+ throw error;
1195
1318
  });
1196
1319
  }
1197
1320
  listMessages(request, optionsOrCallback, callback) {
@@ -1207,13 +1330,10 @@ class ChatServiceClient {
1207
1330
  options = options || {};
1208
1331
  options.otherArgs = options.otherArgs || {};
1209
1332
  options.otherArgs.headers = options.otherArgs.headers || {};
1210
- options.otherArgs.headers['x-goog-request-params'] =
1211
- this._gaxModule.routingHeader.fromParams({
1212
- parent: request.parent ?? '',
1213
- });
1214
- this.initialize().catch(err => {
1215
- throw err;
1333
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1334
+ 'parent': request.parent ?? '',
1216
1335
  });
1336
+ this.initialize().catch(err => { throw err; });
1217
1337
  const wrappedCallback = callback
1218
1338
  ? (error, values, nextPageRequest, rawResponse) => {
1219
1339
  this._log.info('listMessages values %j', values);
@@ -1320,15 +1440,12 @@ class ChatServiceClient {
1320
1440
  options = options || {};
1321
1441
  options.otherArgs = options.otherArgs || {};
1322
1442
  options.otherArgs.headers = options.otherArgs.headers || {};
1323
- options.otherArgs.headers['x-goog-request-params'] =
1324
- this._gaxModule.routingHeader.fromParams({
1325
- parent: request.parent ?? '',
1326
- });
1443
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1444
+ 'parent': request.parent ?? '',
1445
+ });
1327
1446
  const defaultCallSettings = this._defaults['listMessages'];
1328
1447
  const callSettings = defaultCallSettings.merge(options);
1329
- this.initialize().catch(err => {
1330
- throw err;
1331
- });
1448
+ this.initialize().catch(err => { throw err; });
1332
1449
  this._log.info('listMessages stream %j', request);
1333
1450
  return this.descriptors.page.listMessages.createStream(this.innerApiCalls.listMessages, request, callSettings);
1334
1451
  }
@@ -1427,15 +1544,12 @@ class ChatServiceClient {
1427
1544
  options = options || {};
1428
1545
  options.otherArgs = options.otherArgs || {};
1429
1546
  options.otherArgs.headers = options.otherArgs.headers || {};
1430
- options.otherArgs.headers['x-goog-request-params'] =
1431
- this._gaxModule.routingHeader.fromParams({
1432
- parent: request.parent ?? '',
1433
- });
1547
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1548
+ 'parent': request.parent ?? '',
1549
+ });
1434
1550
  const defaultCallSettings = this._defaults['listMessages'];
1435
1551
  const callSettings = defaultCallSettings.merge(options);
1436
- this.initialize().catch(err => {
1437
- throw err;
1438
- });
1552
+ this.initialize().catch(err => { throw err; });
1439
1553
  this._log.info('listMessages iterate %j', request);
1440
1554
  return this.descriptors.page.listMessages.asyncIterate(this.innerApiCalls['listMessages'], request, callSettings);
1441
1555
  }
@@ -1452,13 +1566,10 @@ class ChatServiceClient {
1452
1566
  options = options || {};
1453
1567
  options.otherArgs = options.otherArgs || {};
1454
1568
  options.otherArgs.headers = options.otherArgs.headers || {};
1455
- options.otherArgs.headers['x-goog-request-params'] =
1456
- this._gaxModule.routingHeader.fromParams({
1457
- parent: request.parent ?? '',
1458
- });
1459
- this.initialize().catch(err => {
1460
- throw err;
1569
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1570
+ 'parent': request.parent ?? '',
1461
1571
  });
1572
+ this.initialize().catch(err => { throw err; });
1462
1573
  const wrappedCallback = callback
1463
1574
  ? (error, values, nextPageRequest, rawResponse) => {
1464
1575
  this._log.info('listMemberships values %j', values);
@@ -1583,15 +1694,12 @@ class ChatServiceClient {
1583
1694
  options = options || {};
1584
1695
  options.otherArgs = options.otherArgs || {};
1585
1696
  options.otherArgs.headers = options.otherArgs.headers || {};
1586
- options.otherArgs.headers['x-goog-request-params'] =
1587
- this._gaxModule.routingHeader.fromParams({
1588
- parent: request.parent ?? '',
1589
- });
1697
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1698
+ 'parent': request.parent ?? '',
1699
+ });
1590
1700
  const defaultCallSettings = this._defaults['listMemberships'];
1591
1701
  const callSettings = defaultCallSettings.merge(options);
1592
- this.initialize().catch(err => {
1593
- throw err;
1594
- });
1702
+ this.initialize().catch(err => { throw err; });
1595
1703
  this._log.info('listMemberships stream %j', request);
1596
1704
  return this.descriptors.page.listMemberships.createStream(this.innerApiCalls.listMemberships, request, callSettings);
1597
1705
  }
@@ -1708,15 +1816,12 @@ class ChatServiceClient {
1708
1816
  options = options || {};
1709
1817
  options.otherArgs = options.otherArgs || {};
1710
1818
  options.otherArgs.headers = options.otherArgs.headers || {};
1711
- options.otherArgs.headers['x-goog-request-params'] =
1712
- this._gaxModule.routingHeader.fromParams({
1713
- parent: request.parent ?? '',
1714
- });
1819
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1820
+ 'parent': request.parent ?? '',
1821
+ });
1715
1822
  const defaultCallSettings = this._defaults['listMemberships'];
1716
1823
  const callSettings = defaultCallSettings.merge(options);
1717
- this.initialize().catch(err => {
1718
- throw err;
1719
- });
1824
+ this.initialize().catch(err => { throw err; });
1720
1825
  this._log.info('listMemberships iterate %j', request);
1721
1826
  return this.descriptors.page.listMemberships.asyncIterate(this.innerApiCalls['listMemberships'], request, callSettings);
1722
1827
  }
@@ -1733,9 +1838,7 @@ class ChatServiceClient {
1733
1838
  options = options || {};
1734
1839
  options.otherArgs = options.otherArgs || {};
1735
1840
  options.otherArgs.headers = options.otherArgs.headers || {};
1736
- this.initialize().catch(err => {
1737
- throw err;
1738
- });
1841
+ this.initialize().catch(err => { throw err; });
1739
1842
  const wrappedCallback = callback
1740
1843
  ? (error, values, nextPageRequest, rawResponse) => {
1741
1844
  this._log.info('listSpaces values %j', values);
@@ -1808,9 +1911,7 @@ class ChatServiceClient {
1808
1911
  options.otherArgs.headers = options.otherArgs.headers || {};
1809
1912
  const defaultCallSettings = this._defaults['listSpaces'];
1810
1913
  const callSettings = defaultCallSettings.merge(options);
1811
- this.initialize().catch(err => {
1812
- throw err;
1813
- });
1914
+ this.initialize().catch(err => { throw err; });
1814
1915
  this._log.info('listSpaces stream %j', request);
1815
1916
  return this.descriptors.page.listSpaces.createStream(this.innerApiCalls.listSpaces, request, callSettings);
1816
1917
  }
@@ -1875,9 +1976,7 @@ class ChatServiceClient {
1875
1976
  options.otherArgs.headers = options.otherArgs.headers || {};
1876
1977
  const defaultCallSettings = this._defaults['listSpaces'];
1877
1978
  const callSettings = defaultCallSettings.merge(options);
1878
- this.initialize().catch(err => {
1879
- throw err;
1880
- });
1979
+ this.initialize().catch(err => { throw err; });
1881
1980
  this._log.info('listSpaces iterate %j', request);
1882
1981
  return this.descriptors.page.listSpaces.asyncIterate(this.innerApiCalls['listSpaces'], request, callSettings);
1883
1982
  }
@@ -1894,9 +1993,7 @@ class ChatServiceClient {
1894
1993
  options = options || {};
1895
1994
  options.otherArgs = options.otherArgs || {};
1896
1995
  options.otherArgs.headers = options.otherArgs.headers || {};
1897
- this.initialize().catch(err => {
1898
- throw err;
1899
- });
1996
+ this.initialize().catch(err => { throw err; });
1900
1997
  const wrappedCallback = callback
1901
1998
  ? (error, values, nextPageRequest, rawResponse) => {
1902
1999
  this._log.info('searchSpaces values %j', values);
@@ -2056,9 +2153,7 @@ class ChatServiceClient {
2056
2153
  options.otherArgs.headers = options.otherArgs.headers || {};
2057
2154
  const defaultCallSettings = this._defaults['searchSpaces'];
2058
2155
  const callSettings = defaultCallSettings.merge(options);
2059
- this.initialize().catch(err => {
2060
- throw err;
2061
- });
2156
+ this.initialize().catch(err => { throw err; });
2062
2157
  this._log.info('searchSpaces stream %j', request);
2063
2158
  return this.descriptors.page.searchSpaces.createStream(this.innerApiCalls.searchSpaces, request, callSettings);
2064
2159
  }
@@ -2210,9 +2305,7 @@ class ChatServiceClient {
2210
2305
  options.otherArgs.headers = options.otherArgs.headers || {};
2211
2306
  const defaultCallSettings = this._defaults['searchSpaces'];
2212
2307
  const callSettings = defaultCallSettings.merge(options);
2213
- this.initialize().catch(err => {
2214
- throw err;
2215
- });
2308
+ this.initialize().catch(err => { throw err; });
2216
2309
  this._log.info('searchSpaces iterate %j', request);
2217
2310
  return this.descriptors.page.searchSpaces.asyncIterate(this.innerApiCalls['searchSpaces'], request, callSettings);
2218
2311
  }
@@ -2229,13 +2322,10 @@ class ChatServiceClient {
2229
2322
  options = options || {};
2230
2323
  options.otherArgs = options.otherArgs || {};
2231
2324
  options.otherArgs.headers = options.otherArgs.headers || {};
2232
- options.otherArgs.headers['x-goog-request-params'] =
2233
- this._gaxModule.routingHeader.fromParams({
2234
- parent: request.parent ?? '',
2235
- });
2236
- this.initialize().catch(err => {
2237
- throw err;
2325
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2326
+ 'parent': request.parent ?? '',
2238
2327
  });
2328
+ this.initialize().catch(err => { throw err; });
2239
2329
  const wrappedCallback = callback
2240
2330
  ? (error, values, nextPageRequest, rawResponse) => {
2241
2331
  this._log.info('listReactions values %j', values);
@@ -2313,8 +2403,7 @@ class ChatServiceClient {
2313
2403
  * AND user.name = "users/{user}"
2314
2404
  * ```
2315
2405
  *
2316
- * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2317
- * error.
2406
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2318
2407
  * @param {object} [options]
2319
2408
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2320
2409
  * @returns {Stream}
@@ -2331,15 +2420,12 @@ class ChatServiceClient {
2331
2420
  options = options || {};
2332
2421
  options.otherArgs = options.otherArgs || {};
2333
2422
  options.otherArgs.headers = options.otherArgs.headers || {};
2334
- options.otherArgs.headers['x-goog-request-params'] =
2335
- this._gaxModule.routingHeader.fromParams({
2336
- parent: request.parent ?? '',
2337
- });
2423
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2424
+ 'parent': request.parent ?? '',
2425
+ });
2338
2426
  const defaultCallSettings = this._defaults['listReactions'];
2339
2427
  const callSettings = defaultCallSettings.merge(options);
2340
- this.initialize().catch(err => {
2341
- throw err;
2342
- });
2428
+ this.initialize().catch(err => { throw err; });
2343
2429
  this._log.info('listReactions stream %j', request);
2344
2430
  return this.descriptors.page.listReactions.createStream(this.innerApiCalls.listReactions, request, callSettings);
2345
2431
  }
@@ -2408,8 +2494,7 @@ class ChatServiceClient {
2408
2494
  * AND user.name = "users/{user}"
2409
2495
  * ```
2410
2496
  *
2411
- * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2412
- * error.
2497
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2413
2498
  * @param {object} [options]
2414
2499
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2415
2500
  * @returns {Object}
@@ -2427,18 +2512,154 @@ class ChatServiceClient {
2427
2512
  options = options || {};
2428
2513
  options.otherArgs = options.otherArgs || {};
2429
2514
  options.otherArgs.headers = options.otherArgs.headers || {};
2430
- options.otherArgs.headers['x-goog-request-params'] =
2431
- this._gaxModule.routingHeader.fromParams({
2432
- parent: request.parent ?? '',
2433
- });
2515
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2516
+ 'parent': request.parent ?? '',
2517
+ });
2434
2518
  const defaultCallSettings = this._defaults['listReactions'];
2435
2519
  const callSettings = defaultCallSettings.merge(options);
2436
- this.initialize().catch(err => {
2437
- throw err;
2438
- });
2520
+ this.initialize().catch(err => { throw err; });
2439
2521
  this._log.info('listReactions iterate %j', request);
2440
2522
  return this.descriptors.page.listReactions.asyncIterate(this.innerApiCalls['listReactions'], request, callSettings);
2441
2523
  }
2524
+ listCustomEmojis(request, optionsOrCallback, callback) {
2525
+ request = request || {};
2526
+ let options;
2527
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2528
+ callback = optionsOrCallback;
2529
+ options = {};
2530
+ }
2531
+ else {
2532
+ options = optionsOrCallback;
2533
+ }
2534
+ options = options || {};
2535
+ options.otherArgs = options.otherArgs || {};
2536
+ options.otherArgs.headers = options.otherArgs.headers || {};
2537
+ this.initialize().catch(err => { throw err; });
2538
+ const wrappedCallback = callback
2539
+ ? (error, values, nextPageRequest, rawResponse) => {
2540
+ this._log.info('listCustomEmojis values %j', values);
2541
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2542
+ }
2543
+ : undefined;
2544
+ this._log.info('listCustomEmojis request %j', request);
2545
+ return this.innerApiCalls
2546
+ .listCustomEmojis(request, options, wrappedCallback)
2547
+ ?.then(([response, input, output]) => {
2548
+ this._log.info('listCustomEmojis values %j', response);
2549
+ return [response, input, output];
2550
+ });
2551
+ }
2552
+ /**
2553
+ * Equivalent to `listCustomEmojis`, but returns a NodeJS Stream object.
2554
+ * @param {Object} request
2555
+ * The request object that will be sent.
2556
+ * @param {number} [request.pageSize]
2557
+ * Optional. The maximum number of custom emojis returned. The service can
2558
+ * return fewer custom emojis than this value. If unspecified, the default
2559
+ * value is 25. The maximum value is 200; values above 200 are changed to 200.
2560
+ * @param {string} [request.pageToken]
2561
+ * Optional. (If resuming from a previous query.)
2562
+ *
2563
+ * A page token received from a previous list custom emoji call. Provide this
2564
+ * to retrieve the subsequent page.
2565
+ *
2566
+ * When paginating, the filter value should match the call that provided the
2567
+ * page token. Passing a different value might lead to unexpected results.
2568
+ * @param {string} [request.filter]
2569
+ * Optional. A query filter.
2570
+ *
2571
+ * Supports filtering by creator.
2572
+ *
2573
+ * To filter by creator, you must specify a valid value. Currently only
2574
+ * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter
2575
+ * custom emojis by whether they were created by the calling user or not.
2576
+ *
2577
+ * For example, the following query returns custom emojis created by the
2578
+ * caller:
2579
+ * ```
2580
+ * creator("users/me")
2581
+ * ```
2582
+ *
2583
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2584
+ * @param {object} [options]
2585
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2586
+ * @returns {Stream}
2587
+ * An object stream which emits an object representing {@link protos.google.chat.v1.CustomEmoji|CustomEmoji} on 'data' event.
2588
+ * The client library will perform auto-pagination by default: it will call the API as many
2589
+ * times as needed. Note that it can affect your quota.
2590
+ * We recommend using `listCustomEmojisAsync()`
2591
+ * method described below for async iteration which you can stop as needed.
2592
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2593
+ * for more details and examples.
2594
+ */
2595
+ listCustomEmojisStream(request, options) {
2596
+ request = request || {};
2597
+ options = options || {};
2598
+ options.otherArgs = options.otherArgs || {};
2599
+ options.otherArgs.headers = options.otherArgs.headers || {};
2600
+ const defaultCallSettings = this._defaults['listCustomEmojis'];
2601
+ const callSettings = defaultCallSettings.merge(options);
2602
+ this.initialize().catch(err => { throw err; });
2603
+ this._log.info('listCustomEmojis stream %j', request);
2604
+ return this.descriptors.page.listCustomEmojis.createStream(this.innerApiCalls.listCustomEmojis, request, callSettings);
2605
+ }
2606
+ /**
2607
+ * Equivalent to `listCustomEmojis`, but returns an iterable object.
2608
+ *
2609
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
2610
+ * @param {Object} request
2611
+ * The request object that will be sent.
2612
+ * @param {number} [request.pageSize]
2613
+ * Optional. The maximum number of custom emojis returned. The service can
2614
+ * return fewer custom emojis than this value. If unspecified, the default
2615
+ * value is 25. The maximum value is 200; values above 200 are changed to 200.
2616
+ * @param {string} [request.pageToken]
2617
+ * Optional. (If resuming from a previous query.)
2618
+ *
2619
+ * A page token received from a previous list custom emoji call. Provide this
2620
+ * to retrieve the subsequent page.
2621
+ *
2622
+ * When paginating, the filter value should match the call that provided the
2623
+ * page token. Passing a different value might lead to unexpected results.
2624
+ * @param {string} [request.filter]
2625
+ * Optional. A query filter.
2626
+ *
2627
+ * Supports filtering by creator.
2628
+ *
2629
+ * To filter by creator, you must specify a valid value. Currently only
2630
+ * `creator("users/me")` and `NOT creator("users/me")` are accepted to filter
2631
+ * custom emojis by whether they were created by the calling user or not.
2632
+ *
2633
+ * For example, the following query returns custom emojis created by the
2634
+ * caller:
2635
+ * ```
2636
+ * creator("users/me")
2637
+ * ```
2638
+ *
2639
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2640
+ * @param {object} [options]
2641
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2642
+ * @returns {Object}
2643
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2644
+ * When you iterate the returned iterable, each element will be an object representing
2645
+ * {@link protos.google.chat.v1.CustomEmoji|CustomEmoji}. The API will be called under the hood as needed, once per the page,
2646
+ * so you can stop the iteration when you don't need more results.
2647
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2648
+ * for more details and examples.
2649
+ * @example <caption>include:samples/generated/v1/chat_service.list_custom_emojis.js</caption>
2650
+ * region_tag:chat_v1_generated_ChatService_ListCustomEmojis_async
2651
+ */
2652
+ listCustomEmojisAsync(request, options) {
2653
+ request = request || {};
2654
+ options = options || {};
2655
+ options.otherArgs = options.otherArgs || {};
2656
+ options.otherArgs.headers = options.otherArgs.headers || {};
2657
+ const defaultCallSettings = this._defaults['listCustomEmojis'];
2658
+ const callSettings = defaultCallSettings.merge(options);
2659
+ this.initialize().catch(err => { throw err; });
2660
+ this._log.info('listCustomEmojis iterate %j', request);
2661
+ return this.descriptors.page.listCustomEmojis.asyncIterate(this.innerApiCalls['listCustomEmojis'], request, callSettings);
2662
+ }
2442
2663
  listSpaceEvents(request, optionsOrCallback, callback) {
2443
2664
  request = request || {};
2444
2665
  let options;
@@ -2452,13 +2673,10 @@ class ChatServiceClient {
2452
2673
  options = options || {};
2453
2674
  options.otherArgs = options.otherArgs || {};
2454
2675
  options.otherArgs.headers = options.otherArgs.headers || {};
2455
- options.otherArgs.headers['x-goog-request-params'] =
2456
- this._gaxModule.routingHeader.fromParams({
2457
- parent: request.parent ?? '',
2458
- });
2459
- this.initialize().catch(err => {
2460
- throw err;
2676
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2677
+ 'parent': request.parent ?? '',
2461
2678
  });
2679
+ this.initialize().catch(err => { throw err; });
2462
2680
  const wrappedCallback = callback
2463
2681
  ? (error, values, nextPageRequest, rawResponse) => {
2464
2682
  this._log.info('listSpaceEvents values %j', values);
@@ -2564,15 +2782,12 @@ class ChatServiceClient {
2564
2782
  options = options || {};
2565
2783
  options.otherArgs = options.otherArgs || {};
2566
2784
  options.otherArgs.headers = options.otherArgs.headers || {};
2567
- options.otherArgs.headers['x-goog-request-params'] =
2568
- this._gaxModule.routingHeader.fromParams({
2569
- parent: request.parent ?? '',
2570
- });
2785
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2786
+ 'parent': request.parent ?? '',
2787
+ });
2571
2788
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2572
2789
  const callSettings = defaultCallSettings.merge(options);
2573
- this.initialize().catch(err => {
2574
- throw err;
2575
- });
2790
+ this.initialize().catch(err => { throw err; });
2576
2791
  this._log.info('listSpaceEvents stream %j', request);
2577
2792
  return this.descriptors.page.listSpaceEvents.createStream(this.innerApiCalls.listSpaceEvents, request, callSettings);
2578
2793
  }
@@ -2670,15 +2885,12 @@ class ChatServiceClient {
2670
2885
  options = options || {};
2671
2886
  options.otherArgs = options.otherArgs || {};
2672
2887
  options.otherArgs.headers = options.otherArgs.headers || {};
2673
- options.otherArgs.headers['x-goog-request-params'] =
2674
- this._gaxModule.routingHeader.fromParams({
2675
- parent: request.parent ?? '',
2676
- });
2888
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2889
+ 'parent': request.parent ?? '',
2890
+ });
2677
2891
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2678
2892
  const callSettings = defaultCallSettings.merge(options);
2679
- this.initialize().catch(err => {
2680
- throw err;
2681
- });
2893
+ this.initialize().catch(err => { throw err; });
2682
2894
  this._log.info('listSpaceEvents iterate %j', request);
2683
2895
  return this.descriptors.page.listSpaceEvents.asyncIterate(this.innerApiCalls['listSpaceEvents'], request, callSettings);
2684
2896
  }
@@ -2708,8 +2920,7 @@ class ChatServiceClient {
2708
2920
  * @returns {string} A string representing the space.
2709
2921
  */
2710
2922
  matchSpaceFromAttachmentName(attachmentName) {
2711
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2712
- .space;
2923
+ return this.pathTemplates.attachmentPathTemplate.match(attachmentName).space;
2713
2924
  }
2714
2925
  /**
2715
2926
  * Parse the message from Attachment resource.
@@ -2719,8 +2930,7 @@ class ChatServiceClient {
2719
2930
  * @returns {string} A string representing the message.
2720
2931
  */
2721
2932
  matchMessageFromAttachmentName(attachmentName) {
2722
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2723
- .message;
2933
+ return this.pathTemplates.attachmentPathTemplate.match(attachmentName).message;
2724
2934
  }
2725
2935
  /**
2726
2936
  * Parse the attachment from Attachment resource.
@@ -2730,8 +2940,28 @@ class ChatServiceClient {
2730
2940
  * @returns {string} A string representing the attachment.
2731
2941
  */
2732
2942
  matchAttachmentFromAttachmentName(attachmentName) {
2733
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2734
- .attachment;
2943
+ return this.pathTemplates.attachmentPathTemplate.match(attachmentName).attachment;
2944
+ }
2945
+ /**
2946
+ * Return a fully-qualified customEmoji resource name string.
2947
+ *
2948
+ * @param {string} custom_emoji
2949
+ * @returns {string} Resource name string.
2950
+ */
2951
+ customEmojiPath(customEmoji) {
2952
+ return this.pathTemplates.customEmojiPathTemplate.render({
2953
+ custom_emoji: customEmoji,
2954
+ });
2955
+ }
2956
+ /**
2957
+ * Parse the custom_emoji from CustomEmoji resource.
2958
+ *
2959
+ * @param {string} customEmojiName
2960
+ * A fully-qualified path representing CustomEmoji resource.
2961
+ * @returns {string} A string representing the custom_emoji.
2962
+ */
2963
+ matchCustomEmojiFromCustomEmojiName(customEmojiName) {
2964
+ return this.pathTemplates.customEmojiPathTemplate.match(customEmojiName).custom_emoji;
2735
2965
  }
2736
2966
  /**
2737
2967
  * Return a fully-qualified membership resource name string.
@@ -2754,8 +2984,7 @@ class ChatServiceClient {
2754
2984
  * @returns {string} A string representing the space.
2755
2985
  */
2756
2986
  matchSpaceFromMembershipName(membershipName) {
2757
- return this.pathTemplates.membershipPathTemplate.match(membershipName)
2758
- .space;
2987
+ return this.pathTemplates.membershipPathTemplate.match(membershipName).space;
2759
2988
  }
2760
2989
  /**
2761
2990
  * Parse the member from Membership resource.
@@ -2765,8 +2994,7 @@ class ChatServiceClient {
2765
2994
  * @returns {string} A string representing the member.
2766
2995
  */
2767
2996
  matchMemberFromMembershipName(membershipName) {
2768
- return this.pathTemplates.membershipPathTemplate.match(membershipName)
2769
- .member;
2997
+ return this.pathTemplates.membershipPathTemplate.match(membershipName).member;
2770
2998
  }
2771
2999
  /**
2772
3000
  * Return a fully-qualified message resource name string.
@@ -2933,8 +3161,7 @@ class ChatServiceClient {
2933
3161
  * @returns {string} A string representing the space.
2934
3162
  */
2935
3163
  matchSpaceFromSpaceEventName(spaceEventName) {
2936
- return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName)
2937
- .space;
3164
+ return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName).space;
2938
3165
  }
2939
3166
  /**
2940
3167
  * Parse the space_event from SpaceEvent resource.
@@ -2944,8 +3171,7 @@ class ChatServiceClient {
2944
3171
  * @returns {string} A string representing the space_event.
2945
3172
  */
2946
3173
  matchSpaceEventFromSpaceEventName(spaceEventName) {
2947
- return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName)
2948
- .space_event;
3174
+ return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName).space_event;
2949
3175
  }
2950
3176
  /**
2951
3177
  * Return a fully-qualified spaceNotificationSetting resource name string.