@google-apps/chat 0.30.0 → 0.32.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.
@@ -172,6 +172,7 @@ class ChatServiceClient {
172
172
  customEmojiPathTemplate: new this._gaxModule.PathTemplate('customEmojis/{custom_emoji}'),
173
173
  membershipPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/members/{member}'),
174
174
  messagePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}'),
175
+ messagePinPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messagePins/{message_pin}'),
175
176
  quotedMessageMetadataPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/quotedMessageMetadata/{quoted_message_metadata}'),
176
177
  reactionPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/reactions/{reaction}'),
177
178
  sectionPathTemplate: new this._gaxModule.PathTemplate('users/{user}/sections/{section}'),
@@ -194,6 +195,7 @@ class ChatServiceClient {
194
195
  searchSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
195
196
  findGroupChats: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
196
197
  listReactions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reactions'),
198
+ listMessagePins: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'messagePins'),
197
199
  listCustomEmojis: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'customEmojis'),
198
200
  listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents'),
199
201
  listSections: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sections'),
@@ -259,6 +261,9 @@ class ChatServiceClient {
259
261
  'createReaction',
260
262
  'listReactions',
261
263
  'deleteReaction',
264
+ 'listMessagePins',
265
+ 'createMessagePin',
266
+ 'deleteMessagePin',
262
267
  'createCustomEmoji',
263
268
  'getCustomEmoji',
264
269
  'listCustomEmojis',
@@ -284,7 +289,7 @@ class ChatServiceClient {
284
289
  'moveSectionItem',
285
290
  ];
286
291
  for (const methodName of chatServiceStubMethods) {
287
- const callPromise = this.chatServiceStub.then((stub) => (...args) => {
292
+ const callPromise = this.chatServiceStub.then(stub => (...args) => {
288
293
  if (this._terminated) {
289
294
  return Promise.reject('The client has already been closed.');
290
295
  }
@@ -378,6 +383,8 @@ class ChatServiceClient {
378
383
  'https://www.googleapis.com/auth/chat.messages.readonly',
379
384
  'https://www.googleapis.com/auth/chat.spaces',
380
385
  'https://www.googleapis.com/auth/chat.spaces.create',
386
+ 'https://www.googleapis.com/auth/chat.spaces.pins',
387
+ 'https://www.googleapis.com/auth/chat.spaces.pins.readonly',
381
388
  'https://www.googleapis.com/auth/chat.spaces.readonly',
382
389
  'https://www.googleapis.com/auth/chat.users.availability',
383
390
  'https://www.googleapis.com/auth/chat.users.availability.readonly',
@@ -416,7 +423,7 @@ class ChatServiceClient {
416
423
  this._gaxModule.routingHeader.fromParams({
417
424
  parent: request.parent ?? '',
418
425
  });
419
- this.initialize().catch((err) => {
426
+ this.initialize().catch(err => {
420
427
  throw err;
421
428
  });
422
429
  this._log.info('createMessage request %j', request);
@@ -459,7 +466,7 @@ class ChatServiceClient {
459
466
  this._gaxModule.routingHeader.fromParams({
460
467
  name: request.name ?? '',
461
468
  });
462
- this.initialize().catch((err) => {
469
+ this.initialize().catch(err => {
463
470
  throw err;
464
471
  });
465
472
  this._log.info('getMembership request %j', request);
@@ -502,7 +509,7 @@ class ChatServiceClient {
502
509
  this._gaxModule.routingHeader.fromParams({
503
510
  name: request.name ?? '',
504
511
  });
505
- this.initialize().catch((err) => {
512
+ this.initialize().catch(err => {
506
513
  throw err;
507
514
  });
508
515
  this._log.info('getMessage request %j', request);
@@ -545,7 +552,7 @@ class ChatServiceClient {
545
552
  this._gaxModule.routingHeader.fromParams({
546
553
  'message.name': request.message.name ?? '',
547
554
  });
548
- this.initialize().catch((err) => {
555
+ this.initialize().catch(err => {
549
556
  throw err;
550
557
  });
551
558
  this._log.info('updateMessage request %j', request);
@@ -588,7 +595,7 @@ class ChatServiceClient {
588
595
  this._gaxModule.routingHeader.fromParams({
589
596
  name: request.name ?? '',
590
597
  });
591
- this.initialize().catch((err) => {
598
+ this.initialize().catch(err => {
592
599
  throw err;
593
600
  });
594
601
  this._log.info('deleteMessage request %j', request);
@@ -631,7 +638,7 @@ class ChatServiceClient {
631
638
  this._gaxModule.routingHeader.fromParams({
632
639
  name: request.name ?? '',
633
640
  });
634
- this.initialize().catch((err) => {
641
+ this.initialize().catch(err => {
635
642
  throw err;
636
643
  });
637
644
  this._log.info('getAttachment request %j', request);
@@ -674,7 +681,7 @@ class ChatServiceClient {
674
681
  this._gaxModule.routingHeader.fromParams({
675
682
  parent: request.parent ?? '',
676
683
  });
677
- this.initialize().catch((err) => {
684
+ this.initialize().catch(err => {
678
685
  throw err;
679
686
  });
680
687
  this._log.info('uploadAttachment request %j', request);
@@ -717,7 +724,7 @@ class ChatServiceClient {
717
724
  this._gaxModule.routingHeader.fromParams({
718
725
  name: request.name ?? '',
719
726
  });
720
- this.initialize().catch((err) => {
727
+ this.initialize().catch(err => {
721
728
  throw err;
722
729
  });
723
730
  this._log.info('getSpace request %j', request);
@@ -756,7 +763,7 @@ class ChatServiceClient {
756
763
  options = options || {};
757
764
  options.otherArgs = options.otherArgs || {};
758
765
  options.otherArgs.headers = options.otherArgs.headers || {};
759
- this.initialize().catch((err) => {
766
+ this.initialize().catch(err => {
760
767
  throw err;
761
768
  });
762
769
  this._log.info('createSpace request %j', request);
@@ -795,7 +802,7 @@ class ChatServiceClient {
795
802
  options = options || {};
796
803
  options.otherArgs = options.otherArgs || {};
797
804
  options.otherArgs.headers = options.otherArgs.headers || {};
798
- this.initialize().catch((err) => {
805
+ this.initialize().catch(err => {
799
806
  throw err;
800
807
  });
801
808
  this._log.info('setUpSpace request %j', request);
@@ -838,7 +845,7 @@ class ChatServiceClient {
838
845
  this._gaxModule.routingHeader.fromParams({
839
846
  'space.name': request.space.name ?? '',
840
847
  });
841
- this.initialize().catch((err) => {
848
+ this.initialize().catch(err => {
842
849
  throw err;
843
850
  });
844
851
  this._log.info('updateSpace request %j', request);
@@ -881,7 +888,7 @@ class ChatServiceClient {
881
888
  this._gaxModule.routingHeader.fromParams({
882
889
  name: request.name ?? '',
883
890
  });
884
- this.initialize().catch((err) => {
891
+ this.initialize().catch(err => {
885
892
  throw err;
886
893
  });
887
894
  this._log.info('deleteSpace request %j', request);
@@ -924,7 +931,7 @@ class ChatServiceClient {
924
931
  this._gaxModule.routingHeader.fromParams({
925
932
  name: request.name ?? '',
926
933
  });
927
- this.initialize().catch((err) => {
934
+ this.initialize().catch(err => {
928
935
  throw err;
929
936
  });
930
937
  this._log.info('completeImportSpace request %j', request);
@@ -963,7 +970,7 @@ class ChatServiceClient {
963
970
  options = options || {};
964
971
  options.otherArgs = options.otherArgs || {};
965
972
  options.otherArgs.headers = options.otherArgs.headers || {};
966
- this.initialize().catch((err) => {
973
+ this.initialize().catch(err => {
967
974
  throw err;
968
975
  });
969
976
  this._log.info('findDirectMessage request %j', request);
@@ -1006,7 +1013,7 @@ class ChatServiceClient {
1006
1013
  this._gaxModule.routingHeader.fromParams({
1007
1014
  parent: request.parent ?? '',
1008
1015
  });
1009
- this.initialize().catch((err) => {
1016
+ this.initialize().catch(err => {
1010
1017
  throw err;
1011
1018
  });
1012
1019
  this._log.info('createMembership request %j', request);
@@ -1049,7 +1056,7 @@ class ChatServiceClient {
1049
1056
  this._gaxModule.routingHeader.fromParams({
1050
1057
  'membership.name': request.membership.name ?? '',
1051
1058
  });
1052
- this.initialize().catch((err) => {
1059
+ this.initialize().catch(err => {
1053
1060
  throw err;
1054
1061
  });
1055
1062
  this._log.info('updateMembership request %j', request);
@@ -1092,7 +1099,7 @@ class ChatServiceClient {
1092
1099
  this._gaxModule.routingHeader.fromParams({
1093
1100
  name: request.name ?? '',
1094
1101
  });
1095
- this.initialize().catch((err) => {
1102
+ this.initialize().catch(err => {
1096
1103
  throw err;
1097
1104
  });
1098
1105
  this._log.info('deleteMembership request %j', request);
@@ -1135,7 +1142,7 @@ class ChatServiceClient {
1135
1142
  this._gaxModule.routingHeader.fromParams({
1136
1143
  parent: request.parent ?? '',
1137
1144
  });
1138
- this.initialize().catch((err) => {
1145
+ this.initialize().catch(err => {
1139
1146
  throw err;
1140
1147
  });
1141
1148
  this._log.info('createReaction request %j', request);
@@ -1178,7 +1185,7 @@ class ChatServiceClient {
1178
1185
  this._gaxModule.routingHeader.fromParams({
1179
1186
  name: request.name ?? '',
1180
1187
  });
1181
- this.initialize().catch((err) => {
1188
+ this.initialize().catch(err => {
1182
1189
  throw err;
1183
1190
  });
1184
1191
  this._log.info('deleteReaction request %j', request);
@@ -1204,6 +1211,92 @@ class ChatServiceClient {
1204
1211
  throw error;
1205
1212
  });
1206
1213
  }
1214
+ createMessagePin(request, optionsOrCallback, callback) {
1215
+ request = request || {};
1216
+ let options;
1217
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1218
+ callback = optionsOrCallback;
1219
+ options = {};
1220
+ }
1221
+ else {
1222
+ options = optionsOrCallback;
1223
+ }
1224
+ options = options || {};
1225
+ options.otherArgs = options.otherArgs || {};
1226
+ options.otherArgs.headers = options.otherArgs.headers || {};
1227
+ options.otherArgs.headers['x-goog-request-params'] =
1228
+ this._gaxModule.routingHeader.fromParams({
1229
+ parent: request.parent ?? '',
1230
+ });
1231
+ this.initialize().catch(err => {
1232
+ throw err;
1233
+ });
1234
+ this._log.info('createMessagePin request %j', request);
1235
+ const wrappedCallback = callback
1236
+ ? (error, response, options, rawResponse) => {
1237
+ this._log.info('createMessagePin response %j', response);
1238
+ callback(error, response, options, rawResponse); // We verified callback above.
1239
+ }
1240
+ : undefined;
1241
+ return this.innerApiCalls
1242
+ .createMessagePin(request, options, wrappedCallback)
1243
+ ?.then(([response, options, rawResponse]) => {
1244
+ this._log.info('createMessagePin response %j', response);
1245
+ return [response, options, rawResponse];
1246
+ })
1247
+ .catch((error) => {
1248
+ if (error &&
1249
+ 'statusDetails' in error &&
1250
+ error.statusDetails instanceof Array) {
1251
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1252
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1253
+ }
1254
+ throw error;
1255
+ });
1256
+ }
1257
+ deleteMessagePin(request, optionsOrCallback, callback) {
1258
+ request = request || {};
1259
+ let options;
1260
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1261
+ callback = optionsOrCallback;
1262
+ options = {};
1263
+ }
1264
+ else {
1265
+ options = optionsOrCallback;
1266
+ }
1267
+ options = options || {};
1268
+ options.otherArgs = options.otherArgs || {};
1269
+ options.otherArgs.headers = options.otherArgs.headers || {};
1270
+ options.otherArgs.headers['x-goog-request-params'] =
1271
+ this._gaxModule.routingHeader.fromParams({
1272
+ name: request.name ?? '',
1273
+ });
1274
+ this.initialize().catch(err => {
1275
+ throw err;
1276
+ });
1277
+ this._log.info('deleteMessagePin request %j', request);
1278
+ const wrappedCallback = callback
1279
+ ? (error, response, options, rawResponse) => {
1280
+ this._log.info('deleteMessagePin response %j', response);
1281
+ callback(error, response, options, rawResponse); // We verified callback above.
1282
+ }
1283
+ : undefined;
1284
+ return this.innerApiCalls
1285
+ .deleteMessagePin(request, options, wrappedCallback)
1286
+ ?.then(([response, options, rawResponse]) => {
1287
+ this._log.info('deleteMessagePin response %j', response);
1288
+ return [response, options, rawResponse];
1289
+ })
1290
+ .catch((error) => {
1291
+ if (error &&
1292
+ 'statusDetails' in error &&
1293
+ error.statusDetails instanceof Array) {
1294
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1295
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1296
+ }
1297
+ throw error;
1298
+ });
1299
+ }
1207
1300
  createCustomEmoji(request, optionsOrCallback, callback) {
1208
1301
  request = request || {};
1209
1302
  let options;
@@ -1217,7 +1310,7 @@ class ChatServiceClient {
1217
1310
  options = options || {};
1218
1311
  options.otherArgs = options.otherArgs || {};
1219
1312
  options.otherArgs.headers = options.otherArgs.headers || {};
1220
- this.initialize().catch((err) => {
1313
+ this.initialize().catch(err => {
1221
1314
  throw err;
1222
1315
  });
1223
1316
  this._log.info('createCustomEmoji request %j', request);
@@ -1260,7 +1353,7 @@ class ChatServiceClient {
1260
1353
  this._gaxModule.routingHeader.fromParams({
1261
1354
  name: request.name ?? '',
1262
1355
  });
1263
- this.initialize().catch((err) => {
1356
+ this.initialize().catch(err => {
1264
1357
  throw err;
1265
1358
  });
1266
1359
  this._log.info('getCustomEmoji request %j', request);
@@ -1303,7 +1396,7 @@ class ChatServiceClient {
1303
1396
  this._gaxModule.routingHeader.fromParams({
1304
1397
  name: request.name ?? '',
1305
1398
  });
1306
- this.initialize().catch((err) => {
1399
+ this.initialize().catch(err => {
1307
1400
  throw err;
1308
1401
  });
1309
1402
  this._log.info('deleteCustomEmoji request %j', request);
@@ -1346,7 +1439,7 @@ class ChatServiceClient {
1346
1439
  this._gaxModule.routingHeader.fromParams({
1347
1440
  name: request.name ?? '',
1348
1441
  });
1349
- this.initialize().catch((err) => {
1442
+ this.initialize().catch(err => {
1350
1443
  throw err;
1351
1444
  });
1352
1445
  this._log.info('getSpaceReadState request %j', request);
@@ -1389,7 +1482,7 @@ class ChatServiceClient {
1389
1482
  this._gaxModule.routingHeader.fromParams({
1390
1483
  'space_read_state.name': request.spaceReadState.name ?? '',
1391
1484
  });
1392
- this.initialize().catch((err) => {
1485
+ this.initialize().catch(err => {
1393
1486
  throw err;
1394
1487
  });
1395
1488
  this._log.info('updateSpaceReadState request %j', request);
@@ -1432,7 +1525,7 @@ class ChatServiceClient {
1432
1525
  this._gaxModule.routingHeader.fromParams({
1433
1526
  name: request.name ?? '',
1434
1527
  });
1435
- this.initialize().catch((err) => {
1528
+ this.initialize().catch(err => {
1436
1529
  throw err;
1437
1530
  });
1438
1531
  this._log.info('getThreadReadState request %j', request);
@@ -1475,7 +1568,7 @@ class ChatServiceClient {
1475
1568
  this._gaxModule.routingHeader.fromParams({
1476
1569
  name: request.name ?? '',
1477
1570
  });
1478
- this.initialize().catch((err) => {
1571
+ this.initialize().catch(err => {
1479
1572
  throw err;
1480
1573
  });
1481
1574
  this._log.info('getAvailability request %j', request);
@@ -1518,7 +1611,7 @@ class ChatServiceClient {
1518
1611
  this._gaxModule.routingHeader.fromParams({
1519
1612
  name: request.name ?? '',
1520
1613
  });
1521
- this.initialize().catch((err) => {
1614
+ this.initialize().catch(err => {
1522
1615
  throw err;
1523
1616
  });
1524
1617
  this._log.info('markAsActive request %j', request);
@@ -1561,7 +1654,7 @@ class ChatServiceClient {
1561
1654
  this._gaxModule.routingHeader.fromParams({
1562
1655
  name: request.name ?? '',
1563
1656
  });
1564
- this.initialize().catch((err) => {
1657
+ this.initialize().catch(err => {
1565
1658
  throw err;
1566
1659
  });
1567
1660
  this._log.info('markAsAway request %j', request);
@@ -1604,7 +1697,7 @@ class ChatServiceClient {
1604
1697
  this._gaxModule.routingHeader.fromParams({
1605
1698
  name: request.name ?? '',
1606
1699
  });
1607
- this.initialize().catch((err) => {
1700
+ this.initialize().catch(err => {
1608
1701
  throw err;
1609
1702
  });
1610
1703
  this._log.info('markAsDoNotDisturb request %j', request);
@@ -1647,7 +1740,7 @@ class ChatServiceClient {
1647
1740
  this._gaxModule.routingHeader.fromParams({
1648
1741
  'availability.name': request.availability.name ?? '',
1649
1742
  });
1650
- this.initialize().catch((err) => {
1743
+ this.initialize().catch(err => {
1651
1744
  throw err;
1652
1745
  });
1653
1746
  this._log.info('updateAvailability request %j', request);
@@ -1690,7 +1783,7 @@ class ChatServiceClient {
1690
1783
  this._gaxModule.routingHeader.fromParams({
1691
1784
  name: request.name ?? '',
1692
1785
  });
1693
- this.initialize().catch((err) => {
1786
+ this.initialize().catch(err => {
1694
1787
  throw err;
1695
1788
  });
1696
1789
  this._log.info('getSpaceEvent request %j', request);
@@ -1733,7 +1826,7 @@ class ChatServiceClient {
1733
1826
  this._gaxModule.routingHeader.fromParams({
1734
1827
  name: request.name ?? '',
1735
1828
  });
1736
- this.initialize().catch((err) => {
1829
+ this.initialize().catch(err => {
1737
1830
  throw err;
1738
1831
  });
1739
1832
  this._log.info('getSpaceNotificationSetting request %j', request);
@@ -1776,7 +1869,7 @@ class ChatServiceClient {
1776
1869
  this._gaxModule.routingHeader.fromParams({
1777
1870
  'space_notification_setting.name': request.spaceNotificationSetting.name ?? '',
1778
1871
  });
1779
- this.initialize().catch((err) => {
1872
+ this.initialize().catch(err => {
1780
1873
  throw err;
1781
1874
  });
1782
1875
  this._log.info('updateSpaceNotificationSetting request %j', request);
@@ -1819,7 +1912,7 @@ class ChatServiceClient {
1819
1912
  this._gaxModule.routingHeader.fromParams({
1820
1913
  parent: request.parent ?? '',
1821
1914
  });
1822
- this.initialize().catch((err) => {
1915
+ this.initialize().catch(err => {
1823
1916
  throw err;
1824
1917
  });
1825
1918
  this._log.info('createSection request %j', request);
@@ -1862,7 +1955,7 @@ class ChatServiceClient {
1862
1955
  this._gaxModule.routingHeader.fromParams({
1863
1956
  name: request.name ?? '',
1864
1957
  });
1865
- this.initialize().catch((err) => {
1958
+ this.initialize().catch(err => {
1866
1959
  throw err;
1867
1960
  });
1868
1961
  this._log.info('deleteSection request %j', request);
@@ -1905,7 +1998,7 @@ class ChatServiceClient {
1905
1998
  this._gaxModule.routingHeader.fromParams({
1906
1999
  'section.name': request.section.name ?? '',
1907
2000
  });
1908
- this.initialize().catch((err) => {
2001
+ this.initialize().catch(err => {
1909
2002
  throw err;
1910
2003
  });
1911
2004
  this._log.info('updateSection request %j', request);
@@ -1948,7 +2041,7 @@ class ChatServiceClient {
1948
2041
  this._gaxModule.routingHeader.fromParams({
1949
2042
  name: request.name ?? '',
1950
2043
  });
1951
- this.initialize().catch((err) => {
2044
+ this.initialize().catch(err => {
1952
2045
  throw err;
1953
2046
  });
1954
2047
  this._log.info('positionSection request %j', request);
@@ -1991,7 +2084,7 @@ class ChatServiceClient {
1991
2084
  this._gaxModule.routingHeader.fromParams({
1992
2085
  name: request.name ?? '',
1993
2086
  });
1994
- this.initialize().catch((err) => {
2087
+ this.initialize().catch(err => {
1995
2088
  throw err;
1996
2089
  });
1997
2090
  this._log.info('moveSectionItem request %j', request);
@@ -2034,7 +2127,7 @@ class ChatServiceClient {
2034
2127
  this._gaxModule.routingHeader.fromParams({
2035
2128
  parent: request.parent ?? '',
2036
2129
  });
2037
- this.initialize().catch((err) => {
2130
+ this.initialize().catch(err => {
2038
2131
  throw err;
2039
2132
  });
2040
2133
  const wrappedCallback = callback
@@ -2152,7 +2245,7 @@ class ChatServiceClient {
2152
2245
  });
2153
2246
  const defaultCallSettings = this._defaults['listMessages'];
2154
2247
  const callSettings = defaultCallSettings.merge(options);
2155
- this.initialize().catch((err) => {
2248
+ this.initialize().catch(err => {
2156
2249
  throw err;
2157
2250
  });
2158
2251
  this._log.info('listMessages stream %j', request);
@@ -2262,7 +2355,7 @@ class ChatServiceClient {
2262
2355
  });
2263
2356
  const defaultCallSettings = this._defaults['listMessages'];
2264
2357
  const callSettings = defaultCallSettings.merge(options);
2265
- this.initialize().catch((err) => {
2358
+ this.initialize().catch(err => {
2266
2359
  throw err;
2267
2360
  });
2268
2361
  this._log.info('listMessages iterate %j', request);
@@ -2285,7 +2378,7 @@ class ChatServiceClient {
2285
2378
  this._gaxModule.routingHeader.fromParams({
2286
2379
  parent: request.parent ?? '',
2287
2380
  });
2288
- this.initialize().catch((err) => {
2381
+ this.initialize().catch(err => {
2289
2382
  throw err;
2290
2383
  });
2291
2384
  const wrappedCallback = callback
@@ -2418,7 +2511,7 @@ class ChatServiceClient {
2418
2511
  });
2419
2512
  const defaultCallSettings = this._defaults['listMemberships'];
2420
2513
  const callSettings = defaultCallSettings.merge(options);
2421
- this.initialize().catch((err) => {
2514
+ this.initialize().catch(err => {
2422
2515
  throw err;
2423
2516
  });
2424
2517
  this._log.info('listMemberships stream %j', request);
@@ -2543,7 +2636,7 @@ class ChatServiceClient {
2543
2636
  });
2544
2637
  const defaultCallSettings = this._defaults['listMemberships'];
2545
2638
  const callSettings = defaultCallSettings.merge(options);
2546
- this.initialize().catch((err) => {
2639
+ this.initialize().catch(err => {
2547
2640
  throw err;
2548
2641
  });
2549
2642
  this._log.info('listMemberships iterate %j', request);
@@ -2566,7 +2659,7 @@ class ChatServiceClient {
2566
2659
  this._gaxModule.routingHeader.fromParams({
2567
2660
  parent: request.parent ?? '',
2568
2661
  });
2569
- this.initialize().catch((err) => {
2662
+ this.initialize().catch(err => {
2570
2663
  throw err;
2571
2664
  });
2572
2665
  const wrappedCallback = callback
@@ -2777,7 +2870,7 @@ class ChatServiceClient {
2777
2870
  });
2778
2871
  const defaultCallSettings = this._defaults['searchMessages'];
2779
2872
  const callSettings = defaultCallSettings.merge(options);
2780
- this.initialize().catch((err) => {
2873
+ this.initialize().catch(err => {
2781
2874
  throw err;
2782
2875
  });
2783
2876
  this._log.info('searchMessages stream %j', request);
@@ -2980,7 +3073,7 @@ class ChatServiceClient {
2980
3073
  });
2981
3074
  const defaultCallSettings = this._defaults['searchMessages'];
2982
3075
  const callSettings = defaultCallSettings.merge(options);
2983
- this.initialize().catch((err) => {
3076
+ this.initialize().catch(err => {
2984
3077
  throw err;
2985
3078
  });
2986
3079
  this._log.info('searchMessages iterate %j', request);
@@ -2999,7 +3092,7 @@ class ChatServiceClient {
2999
3092
  options = options || {};
3000
3093
  options.otherArgs = options.otherArgs || {};
3001
3094
  options.otherArgs.headers = options.otherArgs.headers || {};
3002
- this.initialize().catch((err) => {
3095
+ this.initialize().catch(err => {
3003
3096
  throw err;
3004
3097
  });
3005
3098
  const wrappedCallback = callback
@@ -3074,7 +3167,7 @@ class ChatServiceClient {
3074
3167
  options.otherArgs.headers = options.otherArgs.headers || {};
3075
3168
  const defaultCallSettings = this._defaults['listSpaces'];
3076
3169
  const callSettings = defaultCallSettings.merge(options);
3077
- this.initialize().catch((err) => {
3170
+ this.initialize().catch(err => {
3078
3171
  throw err;
3079
3172
  });
3080
3173
  this._log.info('listSpaces stream %j', request);
@@ -3141,7 +3234,7 @@ class ChatServiceClient {
3141
3234
  options.otherArgs.headers = options.otherArgs.headers || {};
3142
3235
  const defaultCallSettings = this._defaults['listSpaces'];
3143
3236
  const callSettings = defaultCallSettings.merge(options);
3144
- this.initialize().catch((err) => {
3237
+ this.initialize().catch(err => {
3145
3238
  throw err;
3146
3239
  });
3147
3240
  this._log.info('listSpaces iterate %j', request);
@@ -3160,7 +3253,7 @@ class ChatServiceClient {
3160
3253
  options = options || {};
3161
3254
  options.otherArgs = options.otherArgs || {};
3162
3255
  options.otherArgs.headers = options.otherArgs.headers || {};
3163
- this.initialize().catch((err) => {
3256
+ this.initialize().catch(err => {
3164
3257
  throw err;
3165
3258
  });
3166
3259
  const wrappedCallback = callback
@@ -3355,7 +3448,7 @@ class ChatServiceClient {
3355
3448
  options.otherArgs.headers = options.otherArgs.headers || {};
3356
3449
  const defaultCallSettings = this._defaults['searchSpaces'];
3357
3450
  const callSettings = defaultCallSettings.merge(options);
3358
- this.initialize().catch((err) => {
3451
+ this.initialize().catch(err => {
3359
3452
  throw err;
3360
3453
  });
3361
3454
  this._log.info('searchSpaces stream %j', request);
@@ -3542,7 +3635,7 @@ class ChatServiceClient {
3542
3635
  options.otherArgs.headers = options.otherArgs.headers || {};
3543
3636
  const defaultCallSettings = this._defaults['searchSpaces'];
3544
3637
  const callSettings = defaultCallSettings.merge(options);
3545
- this.initialize().catch((err) => {
3638
+ this.initialize().catch(err => {
3546
3639
  throw err;
3547
3640
  });
3548
3641
  this._log.info('searchSpaces iterate %j', request);
@@ -3561,7 +3654,7 @@ class ChatServiceClient {
3561
3654
  options = options || {};
3562
3655
  options.otherArgs = options.otherArgs || {};
3563
3656
  options.otherArgs.headers = options.otherArgs.headers || {};
3564
- this.initialize().catch((err) => {
3657
+ this.initialize().catch(err => {
3565
3658
  throw err;
3566
3659
  });
3567
3660
  const wrappedCallback = callback
@@ -3641,7 +3734,7 @@ class ChatServiceClient {
3641
3734
  options.otherArgs.headers = options.otherArgs.headers || {};
3642
3735
  const defaultCallSettings = this._defaults['findGroupChats'];
3643
3736
  const callSettings = defaultCallSettings.merge(options);
3644
- this.initialize().catch((err) => {
3737
+ this.initialize().catch(err => {
3645
3738
  throw err;
3646
3739
  });
3647
3740
  this._log.info('findGroupChats stream %j', request);
@@ -3713,7 +3806,7 @@ class ChatServiceClient {
3713
3806
  options.otherArgs.headers = options.otherArgs.headers || {};
3714
3807
  const defaultCallSettings = this._defaults['findGroupChats'];
3715
3808
  const callSettings = defaultCallSettings.merge(options);
3716
- this.initialize().catch((err) => {
3809
+ this.initialize().catch(err => {
3717
3810
  throw err;
3718
3811
  });
3719
3812
  this._log.info('findGroupChats iterate %j', request);
@@ -3736,7 +3829,7 @@ class ChatServiceClient {
3736
3829
  this._gaxModule.routingHeader.fromParams({
3737
3830
  parent: request.parent ?? '',
3738
3831
  });
3739
- this.initialize().catch((err) => {
3832
+ this.initialize().catch(err => {
3740
3833
  throw err;
3741
3834
  });
3742
3835
  const wrappedCallback = callback
@@ -3839,7 +3932,7 @@ class ChatServiceClient {
3839
3932
  });
3840
3933
  const defaultCallSettings = this._defaults['listReactions'];
3841
3934
  const callSettings = defaultCallSettings.merge(options);
3842
- this.initialize().catch((err) => {
3935
+ this.initialize().catch(err => {
3843
3936
  throw err;
3844
3937
  });
3845
3938
  this._log.info('listReactions stream %j', request);
@@ -3934,12 +4027,145 @@ class ChatServiceClient {
3934
4027
  });
3935
4028
  const defaultCallSettings = this._defaults['listReactions'];
3936
4029
  const callSettings = defaultCallSettings.merge(options);
3937
- this.initialize().catch((err) => {
4030
+ this.initialize().catch(err => {
3938
4031
  throw err;
3939
4032
  });
3940
4033
  this._log.info('listReactions iterate %j', request);
3941
4034
  return this.descriptors.page.listReactions.asyncIterate(this.innerApiCalls['listReactions'], request, callSettings);
3942
4035
  }
4036
+ listMessagePins(request, optionsOrCallback, callback) {
4037
+ request = request || {};
4038
+ let options;
4039
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
4040
+ callback = optionsOrCallback;
4041
+ options = {};
4042
+ }
4043
+ else {
4044
+ options = optionsOrCallback;
4045
+ }
4046
+ options = options || {};
4047
+ options.otherArgs = options.otherArgs || {};
4048
+ options.otherArgs.headers = options.otherArgs.headers || {};
4049
+ options.otherArgs.headers['x-goog-request-params'] =
4050
+ this._gaxModule.routingHeader.fromParams({
4051
+ parent: request.parent ?? '',
4052
+ });
4053
+ this.initialize().catch(err => {
4054
+ throw err;
4055
+ });
4056
+ const wrappedCallback = callback
4057
+ ? (error, values, nextPageRequest, rawResponse) => {
4058
+ this._log.info('listMessagePins values %j', values);
4059
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
4060
+ }
4061
+ : undefined;
4062
+ this._log.info('listMessagePins request %j', request);
4063
+ return this.innerApiCalls
4064
+ .listMessagePins(request, options, wrappedCallback)
4065
+ ?.then(([response, input, output]) => {
4066
+ this._log.info('listMessagePins values %j', response);
4067
+ return [response, input, output];
4068
+ });
4069
+ }
4070
+ /**
4071
+ * Equivalent to `listMessagePins`, but returns a NodeJS Stream object.
4072
+ * @param {Object} request
4073
+ * The request object that will be sent.
4074
+ * @param {string} request.parent
4075
+ * Required. The parent space which owns the collection of pinned items
4076
+ * Format: `spaces/{space}`
4077
+ * @param {number} [request.pageSize]
4078
+ * Optional. The maximum number of message pins returned. The service might
4079
+ * return fewer messages than this value. The maximum value is 100. If you use
4080
+ * a value more than 100, it's automatically changed to 100. If unspecified,
4081
+ * at most 100 message pins will be returned. Negative values return an
4082
+ * `INVALID_ARGUMENT` error.
4083
+ * @param {string} [request.pageToken]
4084
+ * Optional. A page token received from a previous list message pins call.
4085
+ * Provide this parameter to retrieve the subsequent page.
4086
+ *
4087
+ * When paginating, all other parameters provided should match the call that
4088
+ * provided the page token. Passing different values to the other parameters
4089
+ * might lead to unexpected results.
4090
+ * @param {object} [options]
4091
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
4092
+ * @returns {Stream}
4093
+ * An object stream which emits an object representing {@link protos.google.chat.v1.MessagePin|MessagePin} on 'data' event.
4094
+ * The client library will perform auto-pagination by default: it will call the API as many
4095
+ * times as needed. Note that it can affect your quota.
4096
+ * We recommend using `listMessagePinsAsync()`
4097
+ * method described below for async iteration which you can stop as needed.
4098
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
4099
+ * for more details and examples.
4100
+ */
4101
+ listMessagePinsStream(request, options) {
4102
+ request = request || {};
4103
+ options = options || {};
4104
+ options.otherArgs = options.otherArgs || {};
4105
+ options.otherArgs.headers = options.otherArgs.headers || {};
4106
+ options.otherArgs.headers['x-goog-request-params'] =
4107
+ this._gaxModule.routingHeader.fromParams({
4108
+ parent: request.parent ?? '',
4109
+ });
4110
+ const defaultCallSettings = this._defaults['listMessagePins'];
4111
+ const callSettings = defaultCallSettings.merge(options);
4112
+ this.initialize().catch(err => {
4113
+ throw err;
4114
+ });
4115
+ this._log.info('listMessagePins stream %j', request);
4116
+ return this.descriptors.page.listMessagePins.createStream(this.innerApiCalls.listMessagePins, request, callSettings);
4117
+ }
4118
+ /**
4119
+ * Equivalent to `listMessagePins`, but returns an iterable object.
4120
+ *
4121
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
4122
+ * @param {Object} request
4123
+ * The request object that will be sent.
4124
+ * @param {string} request.parent
4125
+ * Required. The parent space which owns the collection of pinned items
4126
+ * Format: `spaces/{space}`
4127
+ * @param {number} [request.pageSize]
4128
+ * Optional. The maximum number of message pins returned. The service might
4129
+ * return fewer messages than this value. The maximum value is 100. If you use
4130
+ * a value more than 100, it's automatically changed to 100. If unspecified,
4131
+ * at most 100 message pins will be returned. Negative values return an
4132
+ * `INVALID_ARGUMENT` error.
4133
+ * @param {string} [request.pageToken]
4134
+ * Optional. A page token received from a previous list message pins call.
4135
+ * Provide this parameter to retrieve the subsequent page.
4136
+ *
4137
+ * When paginating, all other parameters provided should match the call that
4138
+ * provided the page token. Passing different values to the other parameters
4139
+ * might lead to unexpected results.
4140
+ * @param {object} [options]
4141
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
4142
+ * @returns {Object}
4143
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
4144
+ * When you iterate the returned iterable, each element will be an object representing
4145
+ * {@link protos.google.chat.v1.MessagePin|MessagePin}. The API will be called under the hood as needed, once per the page,
4146
+ * so you can stop the iteration when you don't need more results.
4147
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
4148
+ * for more details and examples.
4149
+ * @example <caption>include:samples/generated/v1/chat_service.list_message_pins.js</caption>
4150
+ * region_tag:chat_v1_generated_ChatService_ListMessagePins_async
4151
+ */
4152
+ listMessagePinsAsync(request, options) {
4153
+ request = request || {};
4154
+ options = options || {};
4155
+ options.otherArgs = options.otherArgs || {};
4156
+ options.otherArgs.headers = options.otherArgs.headers || {};
4157
+ options.otherArgs.headers['x-goog-request-params'] =
4158
+ this._gaxModule.routingHeader.fromParams({
4159
+ parent: request.parent ?? '',
4160
+ });
4161
+ const defaultCallSettings = this._defaults['listMessagePins'];
4162
+ const callSettings = defaultCallSettings.merge(options);
4163
+ this.initialize().catch(err => {
4164
+ throw err;
4165
+ });
4166
+ this._log.info('listMessagePins iterate %j', request);
4167
+ return this.descriptors.page.listMessagePins.asyncIterate(this.innerApiCalls['listMessagePins'], request, callSettings);
4168
+ }
3943
4169
  listCustomEmojis(request, optionsOrCallback, callback) {
3944
4170
  request = request || {};
3945
4171
  let options;
@@ -3953,7 +4179,7 @@ class ChatServiceClient {
3953
4179
  options = options || {};
3954
4180
  options.otherArgs = options.otherArgs || {};
3955
4181
  options.otherArgs.headers = options.otherArgs.headers || {};
3956
- this.initialize().catch((err) => {
4182
+ this.initialize().catch(err => {
3957
4183
  throw err;
3958
4184
  });
3959
4185
  const wrappedCallback = callback
@@ -4020,7 +4246,7 @@ class ChatServiceClient {
4020
4246
  options.otherArgs.headers = options.otherArgs.headers || {};
4021
4247
  const defaultCallSettings = this._defaults['listCustomEmojis'];
4022
4248
  const callSettings = defaultCallSettings.merge(options);
4023
- this.initialize().catch((err) => {
4249
+ this.initialize().catch(err => {
4024
4250
  throw err;
4025
4251
  });
4026
4252
  this._log.info('listCustomEmojis stream %j', request);
@@ -4079,7 +4305,7 @@ class ChatServiceClient {
4079
4305
  options.otherArgs.headers = options.otherArgs.headers || {};
4080
4306
  const defaultCallSettings = this._defaults['listCustomEmojis'];
4081
4307
  const callSettings = defaultCallSettings.merge(options);
4082
- this.initialize().catch((err) => {
4308
+ this.initialize().catch(err => {
4083
4309
  throw err;
4084
4310
  });
4085
4311
  this._log.info('listCustomEmojis iterate %j', request);
@@ -4102,7 +4328,7 @@ class ChatServiceClient {
4102
4328
  this._gaxModule.routingHeader.fromParams({
4103
4329
  parent: request.parent ?? '',
4104
4330
  });
4105
- this.initialize().catch((err) => {
4331
+ this.initialize().catch(err => {
4106
4332
  throw err;
4107
4333
  });
4108
4334
  const wrappedCallback = callback
@@ -4216,7 +4442,7 @@ class ChatServiceClient {
4216
4442
  });
4217
4443
  const defaultCallSettings = this._defaults['listSpaceEvents'];
4218
4444
  const callSettings = defaultCallSettings.merge(options);
4219
- this.initialize().catch((err) => {
4445
+ this.initialize().catch(err => {
4220
4446
  throw err;
4221
4447
  });
4222
4448
  this._log.info('listSpaceEvents stream %j', request);
@@ -4322,7 +4548,7 @@ class ChatServiceClient {
4322
4548
  });
4323
4549
  const defaultCallSettings = this._defaults['listSpaceEvents'];
4324
4550
  const callSettings = defaultCallSettings.merge(options);
4325
- this.initialize().catch((err) => {
4551
+ this.initialize().catch(err => {
4326
4552
  throw err;
4327
4553
  });
4328
4554
  this._log.info('listSpaceEvents iterate %j', request);
@@ -4345,7 +4571,7 @@ class ChatServiceClient {
4345
4571
  this._gaxModule.routingHeader.fromParams({
4346
4572
  parent: request.parent ?? '',
4347
4573
  });
4348
- this.initialize().catch((err) => {
4574
+ this.initialize().catch(err => {
4349
4575
  throw err;
4350
4576
  });
4351
4577
  const wrappedCallback = callback
@@ -4417,7 +4643,7 @@ class ChatServiceClient {
4417
4643
  });
4418
4644
  const defaultCallSettings = this._defaults['listSections'];
4419
4645
  const callSettings = defaultCallSettings.merge(options);
4420
- this.initialize().catch((err) => {
4646
+ this.initialize().catch(err => {
4421
4647
  throw err;
4422
4648
  });
4423
4649
  this._log.info('listSections stream %j', request);
@@ -4481,7 +4707,7 @@ class ChatServiceClient {
4481
4707
  });
4482
4708
  const defaultCallSettings = this._defaults['listSections'];
4483
4709
  const callSettings = defaultCallSettings.merge(options);
4484
- this.initialize().catch((err) => {
4710
+ this.initialize().catch(err => {
4485
4711
  throw err;
4486
4712
  });
4487
4713
  this._log.info('listSections iterate %j', request);
@@ -4504,7 +4730,7 @@ class ChatServiceClient {
4504
4730
  this._gaxModule.routingHeader.fromParams({
4505
4731
  parent: request.parent ?? '',
4506
4732
  });
4507
- this.initialize().catch((err) => {
4733
+ this.initialize().catch(err => {
4508
4734
  throw err;
4509
4735
  });
4510
4736
  const wrappedCallback = callback
@@ -4581,7 +4807,7 @@ class ChatServiceClient {
4581
4807
  });
4582
4808
  const defaultCallSettings = this._defaults['listSectionItems'];
4583
4809
  const callSettings = defaultCallSettings.merge(options);
4584
- this.initialize().catch((err) => {
4810
+ this.initialize().catch(err => {
4585
4811
  throw err;
4586
4812
  });
4587
4813
  this._log.info('listSectionItems stream %j', request);
@@ -4650,7 +4876,7 @@ class ChatServiceClient {
4650
4876
  });
4651
4877
  const defaultCallSettings = this._defaults['listSectionItems'];
4652
4878
  const callSettings = defaultCallSettings.merge(options);
4653
- this.initialize().catch((err) => {
4879
+ this.initialize().catch(err => {
4654
4880
  throw err;
4655
4881
  });
4656
4882
  this._log.info('listSectionItems iterate %j', request);
@@ -4819,6 +5045,41 @@ class ChatServiceClient {
4819
5045
  matchMessageFromMessageName(messageName) {
4820
5046
  return this.pathTemplates.messagePathTemplate.match(messageName).message;
4821
5047
  }
5048
+ /**
5049
+ * Return a fully-qualified messagePin resource name string.
5050
+ *
5051
+ * @param {string} space
5052
+ * @param {string} message_pin
5053
+ * @returns {string} Resource name string.
5054
+ */
5055
+ messagePinPath(space, messagePin) {
5056
+ return this.pathTemplates.messagePinPathTemplate.render({
5057
+ space: space,
5058
+ message_pin: messagePin,
5059
+ });
5060
+ }
5061
+ /**
5062
+ * Parse the space from MessagePin resource.
5063
+ *
5064
+ * @param {string} messagePinName
5065
+ * A fully-qualified path representing MessagePin resource.
5066
+ * @returns {string} A string representing the space.
5067
+ */
5068
+ matchSpaceFromMessagePinName(messagePinName) {
5069
+ return this.pathTemplates.messagePinPathTemplate.match(messagePinName)
5070
+ .space;
5071
+ }
5072
+ /**
5073
+ * Parse the message_pin from MessagePin resource.
5074
+ *
5075
+ * @param {string} messagePinName
5076
+ * A fully-qualified path representing MessagePin resource.
5077
+ * @returns {string} A string representing the message_pin.
5078
+ */
5079
+ matchMessagePinFromMessagePinName(messagePinName) {
5080
+ return this.pathTemplates.messagePinPathTemplate.match(messagePinName)
5081
+ .message_pin;
5082
+ }
4822
5083
  /**
4823
5084
  * Return a fully-qualified quotedMessageMetadata resource name string.
4824
5085
  *
@@ -5198,7 +5459,7 @@ class ChatServiceClient {
5198
5459
  */
5199
5460
  close() {
5200
5461
  if (this.chatServiceStub && !this._terminated) {
5201
- return this.chatServiceStub.then((stub) => {
5462
+ return this.chatServiceStub.then(stub => {
5202
5463
  this._log.info('ending gRPC channel');
5203
5464
  this._terminated = true;
5204
5465
  stub.close();