@google-apps/chat 0.14.0 → 0.16.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,11 +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();
337
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
338
+ 'parent': request.parent ?? '',
339
+ });
340
+ this.initialize().catch(err => { throw err; });
377
341
  this._log.info('createMessage request %j', request);
378
342
  const wrappedCallback = callback
379
343
  ? (error, response, options, rawResponse) => {
@@ -381,11 +345,16 @@ class ChatServiceClient {
381
345
  callback(error, response, options, rawResponse); // We verified callback above.
382
346
  }
383
347
  : undefined;
384
- return this.innerApiCalls
385
- .createMessage(request, options, wrappedCallback)
348
+ return this.innerApiCalls.createMessage(request, options, wrappedCallback)
386
349
  ?.then(([response, options, rawResponse]) => {
387
350
  this._log.info('createMessage response %j', response);
388
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;
389
358
  });
390
359
  }
391
360
  getMembership(request, optionsOrCallback, callback) {
@@ -401,11 +370,10 @@ class ChatServiceClient {
401
370
  options = options || {};
402
371
  options.otherArgs = options.otherArgs || {};
403
372
  options.otherArgs.headers = options.otherArgs.headers || {};
404
- options.otherArgs.headers['x-goog-request-params'] =
405
- this._gaxModule.routingHeader.fromParams({
406
- name: request.name ?? '',
407
- });
408
- this.initialize();
373
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
374
+ 'name': request.name ?? '',
375
+ });
376
+ this.initialize().catch(err => { throw err; });
409
377
  this._log.info('getMembership request %j', request);
410
378
  const wrappedCallback = callback
411
379
  ? (error, response, options, rawResponse) => {
@@ -413,11 +381,16 @@ class ChatServiceClient {
413
381
  callback(error, response, options, rawResponse); // We verified callback above.
414
382
  }
415
383
  : undefined;
416
- return this.innerApiCalls
417
- .getMembership(request, options, wrappedCallback)
384
+ return this.innerApiCalls.getMembership(request, options, wrappedCallback)
418
385
  ?.then(([response, options, rawResponse]) => {
419
386
  this._log.info('getMembership response %j', response);
420
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;
421
394
  });
422
395
  }
423
396
  getMessage(request, optionsOrCallback, callback) {
@@ -433,11 +406,10 @@ class ChatServiceClient {
433
406
  options = options || {};
434
407
  options.otherArgs = options.otherArgs || {};
435
408
  options.otherArgs.headers = options.otherArgs.headers || {};
436
- options.otherArgs.headers['x-goog-request-params'] =
437
- this._gaxModule.routingHeader.fromParams({
438
- name: request.name ?? '',
439
- });
440
- this.initialize();
409
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
410
+ 'name': request.name ?? '',
411
+ });
412
+ this.initialize().catch(err => { throw err; });
441
413
  this._log.info('getMessage request %j', request);
442
414
  const wrappedCallback = callback
443
415
  ? (error, response, options, rawResponse) => {
@@ -445,11 +417,16 @@ class ChatServiceClient {
445
417
  callback(error, response, options, rawResponse); // We verified callback above.
446
418
  }
447
419
  : undefined;
448
- return this.innerApiCalls
449
- .getMessage(request, options, wrappedCallback)
420
+ return this.innerApiCalls.getMessage(request, options, wrappedCallback)
450
421
  ?.then(([response, options, rawResponse]) => {
451
422
  this._log.info('getMessage response %j', response);
452
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;
453
430
  });
454
431
  }
455
432
  updateMessage(request, optionsOrCallback, callback) {
@@ -465,11 +442,10 @@ class ChatServiceClient {
465
442
  options = options || {};
466
443
  options.otherArgs = options.otherArgs || {};
467
444
  options.otherArgs.headers = options.otherArgs.headers || {};
468
- options.otherArgs.headers['x-goog-request-params'] =
469
- this._gaxModule.routingHeader.fromParams({
470
- 'message.name': request.message.name ?? '',
471
- });
472
- this.initialize();
445
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
446
+ 'message.name': request.message.name ?? '',
447
+ });
448
+ this.initialize().catch(err => { throw err; });
473
449
  this._log.info('updateMessage request %j', request);
474
450
  const wrappedCallback = callback
475
451
  ? (error, response, options, rawResponse) => {
@@ -477,11 +453,16 @@ class ChatServiceClient {
477
453
  callback(error, response, options, rawResponse); // We verified callback above.
478
454
  }
479
455
  : undefined;
480
- return this.innerApiCalls
481
- .updateMessage(request, options, wrappedCallback)
456
+ return this.innerApiCalls.updateMessage(request, options, wrappedCallback)
482
457
  ?.then(([response, options, rawResponse]) => {
483
458
  this._log.info('updateMessage response %j', response);
484
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;
485
466
  });
486
467
  }
487
468
  deleteMessage(request, optionsOrCallback, callback) {
@@ -497,11 +478,10 @@ class ChatServiceClient {
497
478
  options = options || {};
498
479
  options.otherArgs = options.otherArgs || {};
499
480
  options.otherArgs.headers = options.otherArgs.headers || {};
500
- options.otherArgs.headers['x-goog-request-params'] =
501
- this._gaxModule.routingHeader.fromParams({
502
- name: request.name ?? '',
503
- });
504
- this.initialize();
481
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
482
+ 'name': request.name ?? '',
483
+ });
484
+ this.initialize().catch(err => { throw err; });
505
485
  this._log.info('deleteMessage request %j', request);
506
486
  const wrappedCallback = callback
507
487
  ? (error, response, options, rawResponse) => {
@@ -509,11 +489,16 @@ class ChatServiceClient {
509
489
  callback(error, response, options, rawResponse); // We verified callback above.
510
490
  }
511
491
  : undefined;
512
- return this.innerApiCalls
513
- .deleteMessage(request, options, wrappedCallback)
492
+ return this.innerApiCalls.deleteMessage(request, options, wrappedCallback)
514
493
  ?.then(([response, options, rawResponse]) => {
515
494
  this._log.info('deleteMessage response %j', response);
516
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;
517
502
  });
518
503
  }
519
504
  getAttachment(request, optionsOrCallback, callback) {
@@ -529,11 +514,10 @@ class ChatServiceClient {
529
514
  options = options || {};
530
515
  options.otherArgs = options.otherArgs || {};
531
516
  options.otherArgs.headers = options.otherArgs.headers || {};
532
- options.otherArgs.headers['x-goog-request-params'] =
533
- this._gaxModule.routingHeader.fromParams({
534
- name: request.name ?? '',
535
- });
536
- this.initialize();
517
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
518
+ 'name': request.name ?? '',
519
+ });
520
+ this.initialize().catch(err => { throw err; });
537
521
  this._log.info('getAttachment request %j', request);
538
522
  const wrappedCallback = callback
539
523
  ? (error, response, options, rawResponse) => {
@@ -541,11 +525,16 @@ class ChatServiceClient {
541
525
  callback(error, response, options, rawResponse); // We verified callback above.
542
526
  }
543
527
  : undefined;
544
- return this.innerApiCalls
545
- .getAttachment(request, options, wrappedCallback)
528
+ return this.innerApiCalls.getAttachment(request, options, wrappedCallback)
546
529
  ?.then(([response, options, rawResponse]) => {
547
530
  this._log.info('getAttachment response %j', response);
548
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;
549
538
  });
550
539
  }
551
540
  uploadAttachment(request, optionsOrCallback, callback) {
@@ -561,11 +550,10 @@ class ChatServiceClient {
561
550
  options = options || {};
562
551
  options.otherArgs = options.otherArgs || {};
563
552
  options.otherArgs.headers = options.otherArgs.headers || {};
564
- options.otherArgs.headers['x-goog-request-params'] =
565
- this._gaxModule.routingHeader.fromParams({
566
- parent: request.parent ?? '',
567
- });
568
- this.initialize();
553
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
554
+ 'parent': request.parent ?? '',
555
+ });
556
+ this.initialize().catch(err => { throw err; });
569
557
  this._log.info('uploadAttachment request %j', request);
570
558
  const wrappedCallback = callback
571
559
  ? (error, response, options, rawResponse) => {
@@ -573,11 +561,16 @@ class ChatServiceClient {
573
561
  callback(error, response, options, rawResponse); // We verified callback above.
574
562
  }
575
563
  : undefined;
576
- return this.innerApiCalls
577
- .uploadAttachment(request, options, wrappedCallback)
564
+ return this.innerApiCalls.uploadAttachment(request, options, wrappedCallback)
578
565
  ?.then(([response, options, rawResponse]) => {
579
566
  this._log.info('uploadAttachment response %j', response);
580
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;
581
574
  });
582
575
  }
583
576
  getSpace(request, optionsOrCallback, callback) {
@@ -593,11 +586,10 @@ class ChatServiceClient {
593
586
  options = options || {};
594
587
  options.otherArgs = options.otherArgs || {};
595
588
  options.otherArgs.headers = options.otherArgs.headers || {};
596
- options.otherArgs.headers['x-goog-request-params'] =
597
- this._gaxModule.routingHeader.fromParams({
598
- name: request.name ?? '',
599
- });
600
- this.initialize();
589
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
590
+ 'name': request.name ?? '',
591
+ });
592
+ this.initialize().catch(err => { throw err; });
601
593
  this._log.info('getSpace request %j', request);
602
594
  const wrappedCallback = callback
603
595
  ? (error, response, options, rawResponse) => {
@@ -605,11 +597,16 @@ class ChatServiceClient {
605
597
  callback(error, response, options, rawResponse); // We verified callback above.
606
598
  }
607
599
  : undefined;
608
- return this.innerApiCalls
609
- .getSpace(request, options, wrappedCallback)
600
+ return this.innerApiCalls.getSpace(request, options, wrappedCallback)
610
601
  ?.then(([response, options, rawResponse]) => {
611
602
  this._log.info('getSpace response %j', response);
612
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;
613
610
  });
614
611
  }
615
612
  createSpace(request, optionsOrCallback, callback) {
@@ -625,7 +622,7 @@ class ChatServiceClient {
625
622
  options = options || {};
626
623
  options.otherArgs = options.otherArgs || {};
627
624
  options.otherArgs.headers = options.otherArgs.headers || {};
628
- this.initialize();
625
+ this.initialize().catch(err => { throw err; });
629
626
  this._log.info('createSpace request %j', request);
630
627
  const wrappedCallback = callback
631
628
  ? (error, response, options, rawResponse) => {
@@ -633,11 +630,16 @@ class ChatServiceClient {
633
630
  callback(error, response, options, rawResponse); // We verified callback above.
634
631
  }
635
632
  : undefined;
636
- return this.innerApiCalls
637
- .createSpace(request, options, wrappedCallback)
633
+ return this.innerApiCalls.createSpace(request, options, wrappedCallback)
638
634
  ?.then(([response, options, rawResponse]) => {
639
635
  this._log.info('createSpace response %j', response);
640
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;
641
643
  });
642
644
  }
643
645
  setUpSpace(request, optionsOrCallback, callback) {
@@ -653,7 +655,7 @@ class ChatServiceClient {
653
655
  options = options || {};
654
656
  options.otherArgs = options.otherArgs || {};
655
657
  options.otherArgs.headers = options.otherArgs.headers || {};
656
- this.initialize();
658
+ this.initialize().catch(err => { throw err; });
657
659
  this._log.info('setUpSpace request %j', request);
658
660
  const wrappedCallback = callback
659
661
  ? (error, response, options, rawResponse) => {
@@ -661,11 +663,16 @@ class ChatServiceClient {
661
663
  callback(error, response, options, rawResponse); // We verified callback above.
662
664
  }
663
665
  : undefined;
664
- return this.innerApiCalls
665
- .setUpSpace(request, options, wrappedCallback)
666
+ return this.innerApiCalls.setUpSpace(request, options, wrappedCallback)
666
667
  ?.then(([response, options, rawResponse]) => {
667
668
  this._log.info('setUpSpace response %j', response);
668
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;
669
676
  });
670
677
  }
671
678
  updateSpace(request, optionsOrCallback, callback) {
@@ -681,11 +688,10 @@ class ChatServiceClient {
681
688
  options = options || {};
682
689
  options.otherArgs = options.otherArgs || {};
683
690
  options.otherArgs.headers = options.otherArgs.headers || {};
684
- options.otherArgs.headers['x-goog-request-params'] =
685
- this._gaxModule.routingHeader.fromParams({
686
- 'space.name': request.space.name ?? '',
687
- });
688
- this.initialize();
691
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
692
+ 'space.name': request.space.name ?? '',
693
+ });
694
+ this.initialize().catch(err => { throw err; });
689
695
  this._log.info('updateSpace request %j', request);
690
696
  const wrappedCallback = callback
691
697
  ? (error, response, options, rawResponse) => {
@@ -693,11 +699,16 @@ class ChatServiceClient {
693
699
  callback(error, response, options, rawResponse); // We verified callback above.
694
700
  }
695
701
  : undefined;
696
- return this.innerApiCalls
697
- .updateSpace(request, options, wrappedCallback)
702
+ return this.innerApiCalls.updateSpace(request, options, wrappedCallback)
698
703
  ?.then(([response, options, rawResponse]) => {
699
704
  this._log.info('updateSpace response %j', response);
700
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;
701
712
  });
702
713
  }
703
714
  deleteSpace(request, optionsOrCallback, callback) {
@@ -713,11 +724,10 @@ class ChatServiceClient {
713
724
  options = options || {};
714
725
  options.otherArgs = options.otherArgs || {};
715
726
  options.otherArgs.headers = options.otherArgs.headers || {};
716
- options.otherArgs.headers['x-goog-request-params'] =
717
- this._gaxModule.routingHeader.fromParams({
718
- name: request.name ?? '',
719
- });
720
- this.initialize();
727
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
728
+ 'name': request.name ?? '',
729
+ });
730
+ this.initialize().catch(err => { throw err; });
721
731
  this._log.info('deleteSpace request %j', request);
722
732
  const wrappedCallback = callback
723
733
  ? (error, response, options, rawResponse) => {
@@ -725,11 +735,16 @@ class ChatServiceClient {
725
735
  callback(error, response, options, rawResponse); // We verified callback above.
726
736
  }
727
737
  : undefined;
728
- return this.innerApiCalls
729
- .deleteSpace(request, options, wrappedCallback)
738
+ return this.innerApiCalls.deleteSpace(request, options, wrappedCallback)
730
739
  ?.then(([response, options, rawResponse]) => {
731
740
  this._log.info('deleteSpace response %j', response);
732
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;
733
748
  });
734
749
  }
735
750
  completeImportSpace(request, optionsOrCallback, callback) {
@@ -745,11 +760,10 @@ class ChatServiceClient {
745
760
  options = options || {};
746
761
  options.otherArgs = options.otherArgs || {};
747
762
  options.otherArgs.headers = options.otherArgs.headers || {};
748
- options.otherArgs.headers['x-goog-request-params'] =
749
- this._gaxModule.routingHeader.fromParams({
750
- name: request.name ?? '',
751
- });
752
- this.initialize();
763
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
764
+ 'name': request.name ?? '',
765
+ });
766
+ this.initialize().catch(err => { throw err; });
753
767
  this._log.info('completeImportSpace request %j', request);
754
768
  const wrappedCallback = callback
755
769
  ? (error, response, options, rawResponse) => {
@@ -757,11 +771,16 @@ class ChatServiceClient {
757
771
  callback(error, response, options, rawResponse); // We verified callback above.
758
772
  }
759
773
  : undefined;
760
- return this.innerApiCalls
761
- .completeImportSpace(request, options, wrappedCallback)
774
+ return this.innerApiCalls.completeImportSpace(request, options, wrappedCallback)
762
775
  ?.then(([response, options, rawResponse]) => {
763
776
  this._log.info('completeImportSpace response %j', response);
764
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;
765
784
  });
766
785
  }
767
786
  findDirectMessage(request, optionsOrCallback, callback) {
@@ -777,7 +796,7 @@ class ChatServiceClient {
777
796
  options = options || {};
778
797
  options.otherArgs = options.otherArgs || {};
779
798
  options.otherArgs.headers = options.otherArgs.headers || {};
780
- this.initialize();
799
+ this.initialize().catch(err => { throw err; });
781
800
  this._log.info('findDirectMessage request %j', request);
782
801
  const wrappedCallback = callback
783
802
  ? (error, response, options, rawResponse) => {
@@ -785,11 +804,16 @@ class ChatServiceClient {
785
804
  callback(error, response, options, rawResponse); // We verified callback above.
786
805
  }
787
806
  : undefined;
788
- return this.innerApiCalls
789
- .findDirectMessage(request, options, wrappedCallback)
807
+ return this.innerApiCalls.findDirectMessage(request, options, wrappedCallback)
790
808
  ?.then(([response, options, rawResponse]) => {
791
809
  this._log.info('findDirectMessage response %j', response);
792
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;
793
817
  });
794
818
  }
795
819
  createMembership(request, optionsOrCallback, callback) {
@@ -805,11 +829,10 @@ class ChatServiceClient {
805
829
  options = options || {};
806
830
  options.otherArgs = options.otherArgs || {};
807
831
  options.otherArgs.headers = options.otherArgs.headers || {};
808
- options.otherArgs.headers['x-goog-request-params'] =
809
- this._gaxModule.routingHeader.fromParams({
810
- parent: request.parent ?? '',
811
- });
812
- this.initialize();
832
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
833
+ 'parent': request.parent ?? '',
834
+ });
835
+ this.initialize().catch(err => { throw err; });
813
836
  this._log.info('createMembership request %j', request);
814
837
  const wrappedCallback = callback
815
838
  ? (error, response, options, rawResponse) => {
@@ -817,11 +840,16 @@ class ChatServiceClient {
817
840
  callback(error, response, options, rawResponse); // We verified callback above.
818
841
  }
819
842
  : undefined;
820
- return this.innerApiCalls
821
- .createMembership(request, options, wrappedCallback)
843
+ return this.innerApiCalls.createMembership(request, options, wrappedCallback)
822
844
  ?.then(([response, options, rawResponse]) => {
823
845
  this._log.info('createMembership response %j', response);
824
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;
825
853
  });
826
854
  }
827
855
  updateMembership(request, optionsOrCallback, callback) {
@@ -837,11 +865,10 @@ class ChatServiceClient {
837
865
  options = options || {};
838
866
  options.otherArgs = options.otherArgs || {};
839
867
  options.otherArgs.headers = options.otherArgs.headers || {};
840
- options.otherArgs.headers['x-goog-request-params'] =
841
- this._gaxModule.routingHeader.fromParams({
842
- 'membership.name': request.membership.name ?? '',
843
- });
844
- this.initialize();
868
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
869
+ 'membership.name': request.membership.name ?? '',
870
+ });
871
+ this.initialize().catch(err => { throw err; });
845
872
  this._log.info('updateMembership request %j', request);
846
873
  const wrappedCallback = callback
847
874
  ? (error, response, options, rawResponse) => {
@@ -849,11 +876,16 @@ class ChatServiceClient {
849
876
  callback(error, response, options, rawResponse); // We verified callback above.
850
877
  }
851
878
  : undefined;
852
- return this.innerApiCalls
853
- .updateMembership(request, options, wrappedCallback)
879
+ return this.innerApiCalls.updateMembership(request, options, wrappedCallback)
854
880
  ?.then(([response, options, rawResponse]) => {
855
881
  this._log.info('updateMembership response %j', response);
856
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;
857
889
  });
858
890
  }
859
891
  deleteMembership(request, optionsOrCallback, callback) {
@@ -869,11 +901,10 @@ class ChatServiceClient {
869
901
  options = options || {};
870
902
  options.otherArgs = options.otherArgs || {};
871
903
  options.otherArgs.headers = options.otherArgs.headers || {};
872
- options.otherArgs.headers['x-goog-request-params'] =
873
- this._gaxModule.routingHeader.fromParams({
874
- name: request.name ?? '',
875
- });
876
- this.initialize();
904
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
905
+ 'name': request.name ?? '',
906
+ });
907
+ this.initialize().catch(err => { throw err; });
877
908
  this._log.info('deleteMembership request %j', request);
878
909
  const wrappedCallback = callback
879
910
  ? (error, response, options, rawResponse) => {
@@ -881,11 +912,16 @@ class ChatServiceClient {
881
912
  callback(error, response, options, rawResponse); // We verified callback above.
882
913
  }
883
914
  : undefined;
884
- return this.innerApiCalls
885
- .deleteMembership(request, options, wrappedCallback)
915
+ return this.innerApiCalls.deleteMembership(request, options, wrappedCallback)
886
916
  ?.then(([response, options, rawResponse]) => {
887
917
  this._log.info('deleteMembership response %j', response);
888
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;
889
925
  });
890
926
  }
891
927
  createReaction(request, optionsOrCallback, callback) {
@@ -901,11 +937,10 @@ class ChatServiceClient {
901
937
  options = options || {};
902
938
  options.otherArgs = options.otherArgs || {};
903
939
  options.otherArgs.headers = options.otherArgs.headers || {};
904
- options.otherArgs.headers['x-goog-request-params'] =
905
- this._gaxModule.routingHeader.fromParams({
906
- parent: request.parent ?? '',
907
- });
908
- this.initialize();
940
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
941
+ 'parent': request.parent ?? '',
942
+ });
943
+ this.initialize().catch(err => { throw err; });
909
944
  this._log.info('createReaction request %j', request);
910
945
  const wrappedCallback = callback
911
946
  ? (error, response, options, rawResponse) => {
@@ -913,11 +948,16 @@ class ChatServiceClient {
913
948
  callback(error, response, options, rawResponse); // We verified callback above.
914
949
  }
915
950
  : undefined;
916
- return this.innerApiCalls
917
- .createReaction(request, options, wrappedCallback)
951
+ return this.innerApiCalls.createReaction(request, options, wrappedCallback)
918
952
  ?.then(([response, options, rawResponse]) => {
919
953
  this._log.info('createReaction response %j', response);
920
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;
921
961
  });
922
962
  }
923
963
  deleteReaction(request, optionsOrCallback, callback) {
@@ -933,11 +973,10 @@ class ChatServiceClient {
933
973
  options = options || {};
934
974
  options.otherArgs = options.otherArgs || {};
935
975
  options.otherArgs.headers = options.otherArgs.headers || {};
936
- options.otherArgs.headers['x-goog-request-params'] =
937
- this._gaxModule.routingHeader.fromParams({
938
- name: request.name ?? '',
939
- });
940
- this.initialize();
976
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
977
+ 'name': request.name ?? '',
978
+ });
979
+ this.initialize().catch(err => { throw err; });
941
980
  this._log.info('deleteReaction request %j', request);
942
981
  const wrappedCallback = callback
943
982
  ? (error, response, options, rawResponse) => {
@@ -945,11 +984,121 @@ class ChatServiceClient {
945
984
  callback(error, response, options, rawResponse); // We verified callback above.
946
985
  }
947
986
  : undefined;
948
- return this.innerApiCalls
949
- .deleteReaction(request, options, wrappedCallback)
987
+ return this.innerApiCalls.deleteReaction(request, options, wrappedCallback)
950
988
  ?.then(([response, options, rawResponse]) => {
951
989
  this._log.info('deleteReaction response %j', response);
952
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;
953
1102
  });
954
1103
  }
955
1104
  getSpaceReadState(request, optionsOrCallback, callback) {
@@ -965,11 +1114,10 @@ class ChatServiceClient {
965
1114
  options = options || {};
966
1115
  options.otherArgs = options.otherArgs || {};
967
1116
  options.otherArgs.headers = options.otherArgs.headers || {};
968
- options.otherArgs.headers['x-goog-request-params'] =
969
- this._gaxModule.routingHeader.fromParams({
970
- name: request.name ?? '',
971
- });
972
- this.initialize();
1117
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1118
+ 'name': request.name ?? '',
1119
+ });
1120
+ this.initialize().catch(err => { throw err; });
973
1121
  this._log.info('getSpaceReadState request %j', request);
974
1122
  const wrappedCallback = callback
975
1123
  ? (error, response, options, rawResponse) => {
@@ -977,11 +1125,16 @@ class ChatServiceClient {
977
1125
  callback(error, response, options, rawResponse); // We verified callback above.
978
1126
  }
979
1127
  : undefined;
980
- return this.innerApiCalls
981
- .getSpaceReadState(request, options, wrappedCallback)
1128
+ return this.innerApiCalls.getSpaceReadState(request, options, wrappedCallback)
982
1129
  ?.then(([response, options, rawResponse]) => {
983
1130
  this._log.info('getSpaceReadState response %j', response);
984
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;
985
1138
  });
986
1139
  }
987
1140
  updateSpaceReadState(request, optionsOrCallback, callback) {
@@ -997,11 +1150,10 @@ class ChatServiceClient {
997
1150
  options = options || {};
998
1151
  options.otherArgs = options.otherArgs || {};
999
1152
  options.otherArgs.headers = options.otherArgs.headers || {};
1000
- options.otherArgs.headers['x-goog-request-params'] =
1001
- this._gaxModule.routingHeader.fromParams({
1002
- 'space_read_state.name': request.spaceReadState.name ?? '',
1003
- });
1004
- this.initialize();
1153
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1154
+ 'space_read_state.name': request.spaceReadState.name ?? '',
1155
+ });
1156
+ this.initialize().catch(err => { throw err; });
1005
1157
  this._log.info('updateSpaceReadState request %j', request);
1006
1158
  const wrappedCallback = callback
1007
1159
  ? (error, response, options, rawResponse) => {
@@ -1009,11 +1161,16 @@ class ChatServiceClient {
1009
1161
  callback(error, response, options, rawResponse); // We verified callback above.
1010
1162
  }
1011
1163
  : undefined;
1012
- return this.innerApiCalls
1013
- .updateSpaceReadState(request, options, wrappedCallback)
1164
+ return this.innerApiCalls.updateSpaceReadState(request, options, wrappedCallback)
1014
1165
  ?.then(([response, options, rawResponse]) => {
1015
1166
  this._log.info('updateSpaceReadState response %j', response);
1016
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;
1017
1174
  });
1018
1175
  }
1019
1176
  getThreadReadState(request, optionsOrCallback, callback) {
@@ -1029,11 +1186,10 @@ class ChatServiceClient {
1029
1186
  options = options || {};
1030
1187
  options.otherArgs = options.otherArgs || {};
1031
1188
  options.otherArgs.headers = options.otherArgs.headers || {};
1032
- options.otherArgs.headers['x-goog-request-params'] =
1033
- this._gaxModule.routingHeader.fromParams({
1034
- name: request.name ?? '',
1035
- });
1036
- this.initialize();
1189
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1190
+ 'name': request.name ?? '',
1191
+ });
1192
+ this.initialize().catch(err => { throw err; });
1037
1193
  this._log.info('getThreadReadState request %j', request);
1038
1194
  const wrappedCallback = callback
1039
1195
  ? (error, response, options, rawResponse) => {
@@ -1041,11 +1197,16 @@ class ChatServiceClient {
1041
1197
  callback(error, response, options, rawResponse); // We verified callback above.
1042
1198
  }
1043
1199
  : undefined;
1044
- return this.innerApiCalls
1045
- .getThreadReadState(request, options, wrappedCallback)
1200
+ return this.innerApiCalls.getThreadReadState(request, options, wrappedCallback)
1046
1201
  ?.then(([response, options, rawResponse]) => {
1047
1202
  this._log.info('getThreadReadState response %j', response);
1048
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;
1049
1210
  });
1050
1211
  }
1051
1212
  getSpaceEvent(request, optionsOrCallback, callback) {
@@ -1061,11 +1222,10 @@ class ChatServiceClient {
1061
1222
  options = options || {};
1062
1223
  options.otherArgs = options.otherArgs || {};
1063
1224
  options.otherArgs.headers = options.otherArgs.headers || {};
1064
- options.otherArgs.headers['x-goog-request-params'] =
1065
- this._gaxModule.routingHeader.fromParams({
1066
- name: request.name ?? '',
1067
- });
1068
- this.initialize();
1225
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1226
+ 'name': request.name ?? '',
1227
+ });
1228
+ this.initialize().catch(err => { throw err; });
1069
1229
  this._log.info('getSpaceEvent request %j', request);
1070
1230
  const wrappedCallback = callback
1071
1231
  ? (error, response, options, rawResponse) => {
@@ -1073,11 +1233,16 @@ class ChatServiceClient {
1073
1233
  callback(error, response, options, rawResponse); // We verified callback above.
1074
1234
  }
1075
1235
  : undefined;
1076
- return this.innerApiCalls
1077
- .getSpaceEvent(request, options, wrappedCallback)
1236
+ return this.innerApiCalls.getSpaceEvent(request, options, wrappedCallback)
1078
1237
  ?.then(([response, options, rawResponse]) => {
1079
1238
  this._log.info('getSpaceEvent response %j', response);
1080
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;
1081
1246
  });
1082
1247
  }
1083
1248
  getSpaceNotificationSetting(request, optionsOrCallback, callback) {
@@ -1093,11 +1258,10 @@ class ChatServiceClient {
1093
1258
  options = options || {};
1094
1259
  options.otherArgs = options.otherArgs || {};
1095
1260
  options.otherArgs.headers = options.otherArgs.headers || {};
1096
- options.otherArgs.headers['x-goog-request-params'] =
1097
- this._gaxModule.routingHeader.fromParams({
1098
- name: request.name ?? '',
1099
- });
1100
- this.initialize();
1261
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1262
+ 'name': request.name ?? '',
1263
+ });
1264
+ this.initialize().catch(err => { throw err; });
1101
1265
  this._log.info('getSpaceNotificationSetting request %j', request);
1102
1266
  const wrappedCallback = callback
1103
1267
  ? (error, response, options, rawResponse) => {
@@ -1105,11 +1269,16 @@ class ChatServiceClient {
1105
1269
  callback(error, response, options, rawResponse); // We verified callback above.
1106
1270
  }
1107
1271
  : undefined;
1108
- return this.innerApiCalls
1109
- .getSpaceNotificationSetting(request, options, wrappedCallback)
1272
+ return this.innerApiCalls.getSpaceNotificationSetting(request, options, wrappedCallback)
1110
1273
  ?.then(([response, options, rawResponse]) => {
1111
1274
  this._log.info('getSpaceNotificationSetting response %j', response);
1112
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;
1113
1282
  });
1114
1283
  }
1115
1284
  updateSpaceNotificationSetting(request, optionsOrCallback, callback) {
@@ -1125,11 +1294,10 @@ class ChatServiceClient {
1125
1294
  options = options || {};
1126
1295
  options.otherArgs = options.otherArgs || {};
1127
1296
  options.otherArgs.headers = options.otherArgs.headers || {};
1128
- options.otherArgs.headers['x-goog-request-params'] =
1129
- this._gaxModule.routingHeader.fromParams({
1130
- 'space_notification_setting.name': request.spaceNotificationSetting.name ?? '',
1131
- });
1132
- this.initialize();
1297
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1298
+ 'space_notification_setting.name': request.spaceNotificationSetting.name ?? '',
1299
+ });
1300
+ this.initialize().catch(err => { throw err; });
1133
1301
  this._log.info('updateSpaceNotificationSetting request %j', request);
1134
1302
  const wrappedCallback = callback
1135
1303
  ? (error, response, options, rawResponse) => {
@@ -1137,11 +1305,16 @@ class ChatServiceClient {
1137
1305
  callback(error, response, options, rawResponse); // We verified callback above.
1138
1306
  }
1139
1307
  : undefined;
1140
- return this.innerApiCalls
1141
- .updateSpaceNotificationSetting(request, options, wrappedCallback)
1308
+ return this.innerApiCalls.updateSpaceNotificationSetting(request, options, wrappedCallback)
1142
1309
  ?.then(([response, options, rawResponse]) => {
1143
1310
  this._log.info('updateSpaceNotificationSetting response %j', response);
1144
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;
1145
1318
  });
1146
1319
  }
1147
1320
  listMessages(request, optionsOrCallback, callback) {
@@ -1157,11 +1330,10 @@ class ChatServiceClient {
1157
1330
  options = options || {};
1158
1331
  options.otherArgs = options.otherArgs || {};
1159
1332
  options.otherArgs.headers = options.otherArgs.headers || {};
1160
- options.otherArgs.headers['x-goog-request-params'] =
1161
- this._gaxModule.routingHeader.fromParams({
1162
- parent: request.parent ?? '',
1163
- });
1164
- this.initialize();
1333
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1334
+ 'parent': request.parent ?? '',
1335
+ });
1336
+ this.initialize().catch(err => { throw err; });
1165
1337
  const wrappedCallback = callback
1166
1338
  ? (error, values, nextPageRequest, rawResponse) => {
1167
1339
  this._log.info('listMessages values %j', values);
@@ -1268,13 +1440,12 @@ class ChatServiceClient {
1268
1440
  options = options || {};
1269
1441
  options.otherArgs = options.otherArgs || {};
1270
1442
  options.otherArgs.headers = options.otherArgs.headers || {};
1271
- options.otherArgs.headers['x-goog-request-params'] =
1272
- this._gaxModule.routingHeader.fromParams({
1273
- parent: request.parent ?? '',
1274
- });
1443
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1444
+ 'parent': request.parent ?? '',
1445
+ });
1275
1446
  const defaultCallSettings = this._defaults['listMessages'];
1276
1447
  const callSettings = defaultCallSettings.merge(options);
1277
- this.initialize();
1448
+ this.initialize().catch(err => { throw err; });
1278
1449
  this._log.info('listMessages stream %j', request);
1279
1450
  return this.descriptors.page.listMessages.createStream(this.innerApiCalls.listMessages, request, callSettings);
1280
1451
  }
@@ -1373,13 +1544,12 @@ class ChatServiceClient {
1373
1544
  options = options || {};
1374
1545
  options.otherArgs = options.otherArgs || {};
1375
1546
  options.otherArgs.headers = options.otherArgs.headers || {};
1376
- options.otherArgs.headers['x-goog-request-params'] =
1377
- this._gaxModule.routingHeader.fromParams({
1378
- parent: request.parent ?? '',
1379
- });
1547
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1548
+ 'parent': request.parent ?? '',
1549
+ });
1380
1550
  const defaultCallSettings = this._defaults['listMessages'];
1381
1551
  const callSettings = defaultCallSettings.merge(options);
1382
- this.initialize();
1552
+ this.initialize().catch(err => { throw err; });
1383
1553
  this._log.info('listMessages iterate %j', request);
1384
1554
  return this.descriptors.page.listMessages.asyncIterate(this.innerApiCalls['listMessages'], request, callSettings);
1385
1555
  }
@@ -1396,11 +1566,10 @@ class ChatServiceClient {
1396
1566
  options = options || {};
1397
1567
  options.otherArgs = options.otherArgs || {};
1398
1568
  options.otherArgs.headers = options.otherArgs.headers || {};
1399
- options.otherArgs.headers['x-goog-request-params'] =
1400
- this._gaxModule.routingHeader.fromParams({
1401
- parent: request.parent ?? '',
1402
- });
1403
- this.initialize();
1569
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1570
+ 'parent': request.parent ?? '',
1571
+ });
1572
+ this.initialize().catch(err => { throw err; });
1404
1573
  const wrappedCallback = callback
1405
1574
  ? (error, values, nextPageRequest, rawResponse) => {
1406
1575
  this._log.info('listMemberships values %j', values);
@@ -1525,13 +1694,12 @@ class ChatServiceClient {
1525
1694
  options = options || {};
1526
1695
  options.otherArgs = options.otherArgs || {};
1527
1696
  options.otherArgs.headers = options.otherArgs.headers || {};
1528
- options.otherArgs.headers['x-goog-request-params'] =
1529
- this._gaxModule.routingHeader.fromParams({
1530
- parent: request.parent ?? '',
1531
- });
1697
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1698
+ 'parent': request.parent ?? '',
1699
+ });
1532
1700
  const defaultCallSettings = this._defaults['listMemberships'];
1533
1701
  const callSettings = defaultCallSettings.merge(options);
1534
- this.initialize();
1702
+ this.initialize().catch(err => { throw err; });
1535
1703
  this._log.info('listMemberships stream %j', request);
1536
1704
  return this.descriptors.page.listMemberships.createStream(this.innerApiCalls.listMemberships, request, callSettings);
1537
1705
  }
@@ -1648,13 +1816,12 @@ class ChatServiceClient {
1648
1816
  options = options || {};
1649
1817
  options.otherArgs = options.otherArgs || {};
1650
1818
  options.otherArgs.headers = options.otherArgs.headers || {};
1651
- options.otherArgs.headers['x-goog-request-params'] =
1652
- this._gaxModule.routingHeader.fromParams({
1653
- parent: request.parent ?? '',
1654
- });
1819
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1820
+ 'parent': request.parent ?? '',
1821
+ });
1655
1822
  const defaultCallSettings = this._defaults['listMemberships'];
1656
1823
  const callSettings = defaultCallSettings.merge(options);
1657
- this.initialize();
1824
+ this.initialize().catch(err => { throw err; });
1658
1825
  this._log.info('listMemberships iterate %j', request);
1659
1826
  return this.descriptors.page.listMemberships.asyncIterate(this.innerApiCalls['listMemberships'], request, callSettings);
1660
1827
  }
@@ -1671,7 +1838,7 @@ class ChatServiceClient {
1671
1838
  options = options || {};
1672
1839
  options.otherArgs = options.otherArgs || {};
1673
1840
  options.otherArgs.headers = options.otherArgs.headers || {};
1674
- this.initialize();
1841
+ this.initialize().catch(err => { throw err; });
1675
1842
  const wrappedCallback = callback
1676
1843
  ? (error, values, nextPageRequest, rawResponse) => {
1677
1844
  this._log.info('listSpaces values %j', values);
@@ -1744,7 +1911,7 @@ class ChatServiceClient {
1744
1911
  options.otherArgs.headers = options.otherArgs.headers || {};
1745
1912
  const defaultCallSettings = this._defaults['listSpaces'];
1746
1913
  const callSettings = defaultCallSettings.merge(options);
1747
- this.initialize();
1914
+ this.initialize().catch(err => { throw err; });
1748
1915
  this._log.info('listSpaces stream %j', request);
1749
1916
  return this.descriptors.page.listSpaces.createStream(this.innerApiCalls.listSpaces, request, callSettings);
1750
1917
  }
@@ -1809,7 +1976,7 @@ class ChatServiceClient {
1809
1976
  options.otherArgs.headers = options.otherArgs.headers || {};
1810
1977
  const defaultCallSettings = this._defaults['listSpaces'];
1811
1978
  const callSettings = defaultCallSettings.merge(options);
1812
- this.initialize();
1979
+ this.initialize().catch(err => { throw err; });
1813
1980
  this._log.info('listSpaces iterate %j', request);
1814
1981
  return this.descriptors.page.listSpaces.asyncIterate(this.innerApiCalls['listSpaces'], request, callSettings);
1815
1982
  }
@@ -1826,7 +1993,7 @@ class ChatServiceClient {
1826
1993
  options = options || {};
1827
1994
  options.otherArgs = options.otherArgs || {};
1828
1995
  options.otherArgs.headers = options.otherArgs.headers || {};
1829
- this.initialize();
1996
+ this.initialize().catch(err => { throw err; });
1830
1997
  const wrappedCallback = callback
1831
1998
  ? (error, values, nextPageRequest, rawResponse) => {
1832
1999
  this._log.info('searchSpaces values %j', values);
@@ -1986,7 +2153,7 @@ class ChatServiceClient {
1986
2153
  options.otherArgs.headers = options.otherArgs.headers || {};
1987
2154
  const defaultCallSettings = this._defaults['searchSpaces'];
1988
2155
  const callSettings = defaultCallSettings.merge(options);
1989
- this.initialize();
2156
+ this.initialize().catch(err => { throw err; });
1990
2157
  this._log.info('searchSpaces stream %j', request);
1991
2158
  return this.descriptors.page.searchSpaces.createStream(this.innerApiCalls.searchSpaces, request, callSettings);
1992
2159
  }
@@ -2138,7 +2305,7 @@ class ChatServiceClient {
2138
2305
  options.otherArgs.headers = options.otherArgs.headers || {};
2139
2306
  const defaultCallSettings = this._defaults['searchSpaces'];
2140
2307
  const callSettings = defaultCallSettings.merge(options);
2141
- this.initialize();
2308
+ this.initialize().catch(err => { throw err; });
2142
2309
  this._log.info('searchSpaces iterate %j', request);
2143
2310
  return this.descriptors.page.searchSpaces.asyncIterate(this.innerApiCalls['searchSpaces'], request, callSettings);
2144
2311
  }
@@ -2155,11 +2322,10 @@ class ChatServiceClient {
2155
2322
  options = options || {};
2156
2323
  options.otherArgs = options.otherArgs || {};
2157
2324
  options.otherArgs.headers = options.otherArgs.headers || {};
2158
- options.otherArgs.headers['x-goog-request-params'] =
2159
- this._gaxModule.routingHeader.fromParams({
2160
- parent: request.parent ?? '',
2161
- });
2162
- this.initialize();
2325
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2326
+ 'parent': request.parent ?? '',
2327
+ });
2328
+ this.initialize().catch(err => { throw err; });
2163
2329
  const wrappedCallback = callback
2164
2330
  ? (error, values, nextPageRequest, rawResponse) => {
2165
2331
  this._log.info('listReactions values %j', values);
@@ -2237,8 +2403,7 @@ class ChatServiceClient {
2237
2403
  * AND user.name = "users/{user}"
2238
2404
  * ```
2239
2405
  *
2240
- * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2241
- * error.
2406
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2242
2407
  * @param {object} [options]
2243
2408
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2244
2409
  * @returns {Stream}
@@ -2255,13 +2420,12 @@ class ChatServiceClient {
2255
2420
  options = options || {};
2256
2421
  options.otherArgs = options.otherArgs || {};
2257
2422
  options.otherArgs.headers = options.otherArgs.headers || {};
2258
- options.otherArgs.headers['x-goog-request-params'] =
2259
- this._gaxModule.routingHeader.fromParams({
2260
- parent: request.parent ?? '',
2261
- });
2423
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2424
+ 'parent': request.parent ?? '',
2425
+ });
2262
2426
  const defaultCallSettings = this._defaults['listReactions'];
2263
2427
  const callSettings = defaultCallSettings.merge(options);
2264
- this.initialize();
2428
+ this.initialize().catch(err => { throw err; });
2265
2429
  this._log.info('listReactions stream %j', request);
2266
2430
  return this.descriptors.page.listReactions.createStream(this.innerApiCalls.listReactions, request, callSettings);
2267
2431
  }
@@ -2330,8 +2494,7 @@ class ChatServiceClient {
2330
2494
  * AND user.name = "users/{user}"
2331
2495
  * ```
2332
2496
  *
2333
- * Invalid queries are rejected by the server with an `INVALID_ARGUMENT`
2334
- * error.
2497
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
2335
2498
  * @param {object} [options]
2336
2499
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2337
2500
  * @returns {Object}
@@ -2349,16 +2512,154 @@ class ChatServiceClient {
2349
2512
  options = options || {};
2350
2513
  options.otherArgs = options.otherArgs || {};
2351
2514
  options.otherArgs.headers = options.otherArgs.headers || {};
2352
- options.otherArgs.headers['x-goog-request-params'] =
2353
- this._gaxModule.routingHeader.fromParams({
2354
- parent: request.parent ?? '',
2355
- });
2515
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2516
+ 'parent': request.parent ?? '',
2517
+ });
2356
2518
  const defaultCallSettings = this._defaults['listReactions'];
2357
2519
  const callSettings = defaultCallSettings.merge(options);
2358
- this.initialize();
2520
+ this.initialize().catch(err => { throw err; });
2359
2521
  this._log.info('listReactions iterate %j', request);
2360
2522
  return this.descriptors.page.listReactions.asyncIterate(this.innerApiCalls['listReactions'], request, callSettings);
2361
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
+ }
2362
2663
  listSpaceEvents(request, optionsOrCallback, callback) {
2363
2664
  request = request || {};
2364
2665
  let options;
@@ -2372,11 +2673,10 @@ class ChatServiceClient {
2372
2673
  options = options || {};
2373
2674
  options.otherArgs = options.otherArgs || {};
2374
2675
  options.otherArgs.headers = options.otherArgs.headers || {};
2375
- options.otherArgs.headers['x-goog-request-params'] =
2376
- this._gaxModule.routingHeader.fromParams({
2377
- parent: request.parent ?? '',
2378
- });
2379
- this.initialize();
2676
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2677
+ 'parent': request.parent ?? '',
2678
+ });
2679
+ this.initialize().catch(err => { throw err; });
2380
2680
  const wrappedCallback = callback
2381
2681
  ? (error, values, nextPageRequest, rawResponse) => {
2382
2682
  this._log.info('listSpaceEvents values %j', values);
@@ -2482,13 +2782,12 @@ class ChatServiceClient {
2482
2782
  options = options || {};
2483
2783
  options.otherArgs = options.otherArgs || {};
2484
2784
  options.otherArgs.headers = options.otherArgs.headers || {};
2485
- options.otherArgs.headers['x-goog-request-params'] =
2486
- this._gaxModule.routingHeader.fromParams({
2487
- parent: request.parent ?? '',
2488
- });
2785
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2786
+ 'parent': request.parent ?? '',
2787
+ });
2489
2788
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2490
2789
  const callSettings = defaultCallSettings.merge(options);
2491
- this.initialize();
2790
+ this.initialize().catch(err => { throw err; });
2492
2791
  this._log.info('listSpaceEvents stream %j', request);
2493
2792
  return this.descriptors.page.listSpaceEvents.createStream(this.innerApiCalls.listSpaceEvents, request, callSettings);
2494
2793
  }
@@ -2586,13 +2885,12 @@ class ChatServiceClient {
2586
2885
  options = options || {};
2587
2886
  options.otherArgs = options.otherArgs || {};
2588
2887
  options.otherArgs.headers = options.otherArgs.headers || {};
2589
- options.otherArgs.headers['x-goog-request-params'] =
2590
- this._gaxModule.routingHeader.fromParams({
2591
- parent: request.parent ?? '',
2592
- });
2888
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
2889
+ 'parent': request.parent ?? '',
2890
+ });
2593
2891
  const defaultCallSettings = this._defaults['listSpaceEvents'];
2594
2892
  const callSettings = defaultCallSettings.merge(options);
2595
- this.initialize();
2893
+ this.initialize().catch(err => { throw err; });
2596
2894
  this._log.info('listSpaceEvents iterate %j', request);
2597
2895
  return this.descriptors.page.listSpaceEvents.asyncIterate(this.innerApiCalls['listSpaceEvents'], request, callSettings);
2598
2896
  }
@@ -2622,8 +2920,7 @@ class ChatServiceClient {
2622
2920
  * @returns {string} A string representing the space.
2623
2921
  */
2624
2922
  matchSpaceFromAttachmentName(attachmentName) {
2625
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2626
- .space;
2923
+ return this.pathTemplates.attachmentPathTemplate.match(attachmentName).space;
2627
2924
  }
2628
2925
  /**
2629
2926
  * Parse the message from Attachment resource.
@@ -2633,8 +2930,7 @@ class ChatServiceClient {
2633
2930
  * @returns {string} A string representing the message.
2634
2931
  */
2635
2932
  matchMessageFromAttachmentName(attachmentName) {
2636
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2637
- .message;
2933
+ return this.pathTemplates.attachmentPathTemplate.match(attachmentName).message;
2638
2934
  }
2639
2935
  /**
2640
2936
  * Parse the attachment from Attachment resource.
@@ -2644,8 +2940,28 @@ class ChatServiceClient {
2644
2940
  * @returns {string} A string representing the attachment.
2645
2941
  */
2646
2942
  matchAttachmentFromAttachmentName(attachmentName) {
2647
- return this.pathTemplates.attachmentPathTemplate.match(attachmentName)
2648
- .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;
2649
2965
  }
2650
2966
  /**
2651
2967
  * Return a fully-qualified membership resource name string.
@@ -2668,8 +2984,7 @@ class ChatServiceClient {
2668
2984
  * @returns {string} A string representing the space.
2669
2985
  */
2670
2986
  matchSpaceFromMembershipName(membershipName) {
2671
- return this.pathTemplates.membershipPathTemplate.match(membershipName)
2672
- .space;
2987
+ return this.pathTemplates.membershipPathTemplate.match(membershipName).space;
2673
2988
  }
2674
2989
  /**
2675
2990
  * Parse the member from Membership resource.
@@ -2679,8 +2994,7 @@ class ChatServiceClient {
2679
2994
  * @returns {string} A string representing the member.
2680
2995
  */
2681
2996
  matchMemberFromMembershipName(membershipName) {
2682
- return this.pathTemplates.membershipPathTemplate.match(membershipName)
2683
- .member;
2997
+ return this.pathTemplates.membershipPathTemplate.match(membershipName).member;
2684
2998
  }
2685
2999
  /**
2686
3000
  * Return a fully-qualified message resource name string.
@@ -2847,8 +3161,7 @@ class ChatServiceClient {
2847
3161
  * @returns {string} A string representing the space.
2848
3162
  */
2849
3163
  matchSpaceFromSpaceEventName(spaceEventName) {
2850
- return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName)
2851
- .space;
3164
+ return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName).space;
2852
3165
  }
2853
3166
  /**
2854
3167
  * Parse the space_event from SpaceEvent resource.
@@ -2858,8 +3171,7 @@ class ChatServiceClient {
2858
3171
  * @returns {string} A string representing the space_event.
2859
3172
  */
2860
3173
  matchSpaceEventFromSpaceEventName(spaceEventName) {
2861
- return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName)
2862
- .space_event;
3174
+ return this.pathTemplates.spaceEventPathTemplate.match(spaceEventName).space_event;
2863
3175
  }
2864
3176
  /**
2865
3177
  * Return a fully-qualified spaceNotificationSetting resource name string.