@google-apps/chat 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +8 -0
  2. package/build/protos/google/chat/v1/action_status.proto +1 -1
  3. package/build/protos/google/chat/v1/annotation.proto +1 -1
  4. package/build/protos/google/chat/v1/attachment.proto +1 -1
  5. package/build/protos/google/chat/v1/chat_service.proto +178 -12
  6. package/build/protos/google/chat/v1/contextual_addon.proto +1 -1
  7. package/build/protos/google/chat/v1/deletion_metadata.proto +1 -1
  8. package/build/protos/google/chat/v1/event_payload.proto +1 -1
  9. package/build/protos/google/chat/v1/group.proto +1 -1
  10. package/build/protos/google/chat/v1/history_state.proto +1 -1
  11. package/build/protos/google/chat/v1/matched_url.proto +1 -1
  12. package/build/protos/google/chat/v1/membership.proto +1 -1
  13. package/build/protos/google/chat/v1/message.proto +41 -0
  14. package/build/protos/google/chat/v1/reaction.proto +1 -1
  15. package/build/protos/google/chat/v1/section.proto +344 -0
  16. package/build/protos/google/chat/v1/slash_command.proto +1 -1
  17. package/build/protos/google/chat/v1/space.proto +81 -1
  18. package/build/protos/google/chat/v1/space_event.proto +1 -1
  19. package/build/protos/google/chat/v1/space_notification_setting.proto +1 -1
  20. package/build/protos/google/chat/v1/space_read_state.proto +1 -1
  21. package/build/protos/google/chat/v1/space_setup.proto +1 -1
  22. package/build/protos/google/chat/v1/thread_read_state.proto +1 -1
  23. package/build/protos/google/chat/v1/user.proto +1 -1
  24. package/build/protos/google/chat/v1/widgets.proto +1 -1
  25. package/build/protos/protos.d.ts +1982 -85
  26. package/build/protos/protos.js +5081 -693
  27. package/build/protos/protos.json +520 -2
  28. package/build/src/v1/chat_service_client.d.ts +797 -11
  29. package/build/src/v1/chat_service_client.js +744 -2
  30. package/build/src/v1/chat_service_client.js.map +1 -1
  31. package/build/src/v1/chat_service_client_config.json +40 -0
  32. package/build/src/v1/chat_service_proto_list.json +1 -0
  33. package/build/src/v1/gapic_metadata.json +92 -0
  34. package/package.json +10 -2
@@ -167,6 +167,8 @@ class ChatServiceClient {
167
167
  messagePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}'),
168
168
  quotedMessageMetadataPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/quotedMessageMetadata/{quoted_message_metadata}'),
169
169
  reactionPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/messages/{message}/reactions/{reaction}'),
170
+ sectionPathTemplate: new this._gaxModule.PathTemplate('users/{user}/sections/{section}'),
171
+ sectionItemPathTemplate: new this._gaxModule.PathTemplate('users/{user}/sections/{section}/items/{item}'),
170
172
  spacePathTemplate: new this._gaxModule.PathTemplate('spaces/{space}'),
171
173
  spaceEventPathTemplate: new this._gaxModule.PathTemplate('spaces/{space}/spaceEvents/{space_event}'),
172
174
  spaceNotificationSettingPathTemplate: new this._gaxModule.PathTemplate('users/{user}/spaces/{space}/spaceNotificationSetting'),
@@ -182,9 +184,12 @@ class ChatServiceClient {
182
184
  listMemberships: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'memberships'),
183
185
  listSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
184
186
  searchSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
187
+ findGroupChats: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
185
188
  listReactions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reactions'),
186
189
  listCustomEmojis: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'customEmojis'),
187
- listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents')
190
+ listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents'),
191
+ listSections: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sections'),
192
+ listSectionItems: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sectionItems')
188
193
  };
189
194
  // Put together the default options sent with requests.
190
195
  this._defaults = this._gaxGrpc.constructSettings('google.chat.v1.ChatService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -219,7 +224,7 @@ class ChatServiceClient {
219
224
  this._protos.google.chat.v1.ChatService, this._opts, this._providedCustomServicePath);
220
225
  // Iterate over each of the methods that the service provides
221
226
  // and create an API call method for each.
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'];
227
+ const chatServiceStubMethods = ['createMessage', 'listMessages', 'listMemberships', 'getMembership', 'getMessage', 'updateMessage', 'deleteMessage', 'getAttachment', 'uploadAttachment', 'listSpaces', 'searchSpaces', 'getSpace', 'createSpace', 'setUpSpace', 'updateSpace', 'deleteSpace', 'completeImportSpace', 'findDirectMessage', 'findGroupChats', 'createMembership', 'updateMembership', 'deleteMembership', 'createReaction', 'listReactions', 'deleteReaction', 'createCustomEmoji', 'getCustomEmoji', 'listCustomEmojis', 'deleteCustomEmoji', 'getSpaceReadState', 'updateSpaceReadState', 'getThreadReadState', 'getSpaceEvent', 'listSpaceEvents', 'getSpaceNotificationSetting', 'updateSpaceNotificationSetting', 'createSection', 'deleteSection', 'updateSection', 'listSections', 'positionSection', 'listSectionItems', 'moveSectionItem'];
223
228
  for (const methodName of chatServiceStubMethods) {
224
229
  const callPromise = this.chatServiceStub.then(stub => (...args) => {
225
230
  if (this._terminated) {
@@ -290,9 +295,11 @@ class ChatServiceClient {
290
295
  'https://www.googleapis.com/auth/chat.admin.spaces.readonly',
291
296
  'https://www.googleapis.com/auth/chat.app.delete',
292
297
  'https://www.googleapis.com/auth/chat.app.memberships',
298
+ 'https://www.googleapis.com/auth/chat.app.memberships.readonly',
293
299
  'https://www.googleapis.com/auth/chat.app.messages.readonly',
294
300
  'https://www.googleapis.com/auth/chat.app.spaces',
295
301
  'https://www.googleapis.com/auth/chat.app.spaces.create',
302
+ 'https://www.googleapis.com/auth/chat.app.spaces.readonly',
296
303
  'https://www.googleapis.com/auth/chat.bot',
297
304
  'https://www.googleapis.com/auth/chat.customemojis',
298
305
  'https://www.googleapis.com/auth/chat.customemojis.readonly',
@@ -312,6 +319,8 @@ class ChatServiceClient {
312
319
  'https://www.googleapis.com/auth/chat.spaces.readonly',
313
320
  'https://www.googleapis.com/auth/chat.users.readstate',
314
321
  'https://www.googleapis.com/auth/chat.users.readstate.readonly',
322
+ 'https://www.googleapis.com/auth/chat.users.sections',
323
+ 'https://www.googleapis.com/auth/chat.users.sections.readonly',
315
324
  'https://www.googleapis.com/auth/chat.users.spacesettings'
316
325
  ];
317
326
  }
@@ -1322,6 +1331,186 @@ class ChatServiceClient {
1322
1331
  throw error;
1323
1332
  });
1324
1333
  }
1334
+ createSection(request, optionsOrCallback, callback) {
1335
+ request = request || {};
1336
+ let options;
1337
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1338
+ callback = optionsOrCallback;
1339
+ options = {};
1340
+ }
1341
+ else {
1342
+ options = optionsOrCallback;
1343
+ }
1344
+ options = options || {};
1345
+ options.otherArgs = options.otherArgs || {};
1346
+ options.otherArgs.headers = options.otherArgs.headers || {};
1347
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1348
+ 'parent': request.parent ?? '',
1349
+ });
1350
+ this.initialize().catch(err => { throw err; });
1351
+ this._log.info('createSection request %j', request);
1352
+ const wrappedCallback = callback
1353
+ ? (error, response, options, rawResponse) => {
1354
+ this._log.info('createSection response %j', response);
1355
+ callback(error, response, options, rawResponse); // We verified callback above.
1356
+ }
1357
+ : undefined;
1358
+ return this.innerApiCalls.createSection(request, options, wrappedCallback)
1359
+ ?.then(([response, options, rawResponse]) => {
1360
+ this._log.info('createSection response %j', response);
1361
+ return [response, options, rawResponse];
1362
+ }).catch((error) => {
1363
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1364
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1365
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1366
+ }
1367
+ throw error;
1368
+ });
1369
+ }
1370
+ deleteSection(request, optionsOrCallback, callback) {
1371
+ request = request || {};
1372
+ let options;
1373
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1374
+ callback = optionsOrCallback;
1375
+ options = {};
1376
+ }
1377
+ else {
1378
+ options = optionsOrCallback;
1379
+ }
1380
+ options = options || {};
1381
+ options.otherArgs = options.otherArgs || {};
1382
+ options.otherArgs.headers = options.otherArgs.headers || {};
1383
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1384
+ 'name': request.name ?? '',
1385
+ });
1386
+ this.initialize().catch(err => { throw err; });
1387
+ this._log.info('deleteSection request %j', request);
1388
+ const wrappedCallback = callback
1389
+ ? (error, response, options, rawResponse) => {
1390
+ this._log.info('deleteSection response %j', response);
1391
+ callback(error, response, options, rawResponse); // We verified callback above.
1392
+ }
1393
+ : undefined;
1394
+ return this.innerApiCalls.deleteSection(request, options, wrappedCallback)
1395
+ ?.then(([response, options, rawResponse]) => {
1396
+ this._log.info('deleteSection response %j', response);
1397
+ return [response, options, rawResponse];
1398
+ }).catch((error) => {
1399
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1400
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1401
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1402
+ }
1403
+ throw error;
1404
+ });
1405
+ }
1406
+ updateSection(request, optionsOrCallback, callback) {
1407
+ request = request || {};
1408
+ let options;
1409
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1410
+ callback = optionsOrCallback;
1411
+ options = {};
1412
+ }
1413
+ else {
1414
+ options = optionsOrCallback;
1415
+ }
1416
+ options = options || {};
1417
+ options.otherArgs = options.otherArgs || {};
1418
+ options.otherArgs.headers = options.otherArgs.headers || {};
1419
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1420
+ 'section.name': request.section.name ?? '',
1421
+ });
1422
+ this.initialize().catch(err => { throw err; });
1423
+ this._log.info('updateSection request %j', request);
1424
+ const wrappedCallback = callback
1425
+ ? (error, response, options, rawResponse) => {
1426
+ this._log.info('updateSection response %j', response);
1427
+ callback(error, response, options, rawResponse); // We verified callback above.
1428
+ }
1429
+ : undefined;
1430
+ return this.innerApiCalls.updateSection(request, options, wrappedCallback)
1431
+ ?.then(([response, options, rawResponse]) => {
1432
+ this._log.info('updateSection response %j', response);
1433
+ return [response, options, rawResponse];
1434
+ }).catch((error) => {
1435
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1436
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1437
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1438
+ }
1439
+ throw error;
1440
+ });
1441
+ }
1442
+ positionSection(request, optionsOrCallback, callback) {
1443
+ request = request || {};
1444
+ let options;
1445
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1446
+ callback = optionsOrCallback;
1447
+ options = {};
1448
+ }
1449
+ else {
1450
+ options = optionsOrCallback;
1451
+ }
1452
+ options = options || {};
1453
+ options.otherArgs = options.otherArgs || {};
1454
+ options.otherArgs.headers = options.otherArgs.headers || {};
1455
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1456
+ 'name': request.name ?? '',
1457
+ });
1458
+ this.initialize().catch(err => { throw err; });
1459
+ this._log.info('positionSection request %j', request);
1460
+ const wrappedCallback = callback
1461
+ ? (error, response, options, rawResponse) => {
1462
+ this._log.info('positionSection response %j', response);
1463
+ callback(error, response, options, rawResponse); // We verified callback above.
1464
+ }
1465
+ : undefined;
1466
+ return this.innerApiCalls.positionSection(request, options, wrappedCallback)
1467
+ ?.then(([response, options, rawResponse]) => {
1468
+ this._log.info('positionSection response %j', response);
1469
+ return [response, options, rawResponse];
1470
+ }).catch((error) => {
1471
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1472
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1473
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1474
+ }
1475
+ throw error;
1476
+ });
1477
+ }
1478
+ moveSectionItem(request, optionsOrCallback, callback) {
1479
+ request = request || {};
1480
+ let options;
1481
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1482
+ callback = optionsOrCallback;
1483
+ options = {};
1484
+ }
1485
+ else {
1486
+ options = optionsOrCallback;
1487
+ }
1488
+ options = options || {};
1489
+ options.otherArgs = options.otherArgs || {};
1490
+ options.otherArgs.headers = options.otherArgs.headers || {};
1491
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1492
+ 'name': request.name ?? '',
1493
+ });
1494
+ this.initialize().catch(err => { throw err; });
1495
+ this._log.info('moveSectionItem request %j', request);
1496
+ const wrappedCallback = callback
1497
+ ? (error, response, options, rawResponse) => {
1498
+ this._log.info('moveSectionItem response %j', response);
1499
+ callback(error, response, options, rawResponse); // We verified callback above.
1500
+ }
1501
+ : undefined;
1502
+ return this.innerApiCalls.moveSectionItem(request, options, wrappedCallback)
1503
+ ?.then(([response, options, rawResponse]) => {
1504
+ this._log.info('moveSectionItem response %j', response);
1505
+ return [response, options, rawResponse];
1506
+ }).catch((error) => {
1507
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1508
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1509
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1510
+ }
1511
+ throw error;
1512
+ });
1513
+ }
1325
1514
  listMessages(request, optionsOrCallback, callback) {
1326
1515
  request = request || {};
1327
1516
  let options;
@@ -2314,6 +2503,171 @@ class ChatServiceClient {
2314
2503
  this._log.info('searchSpaces iterate %j', request);
2315
2504
  return this.descriptors.page.searchSpaces.asyncIterate(this.innerApiCalls['searchSpaces'], request, callSettings);
2316
2505
  }
2506
+ findGroupChats(request, optionsOrCallback, callback) {
2507
+ request = request || {};
2508
+ let options;
2509
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2510
+ callback = optionsOrCallback;
2511
+ options = {};
2512
+ }
2513
+ else {
2514
+ options = optionsOrCallback;
2515
+ }
2516
+ options = options || {};
2517
+ options.otherArgs = options.otherArgs || {};
2518
+ options.otherArgs.headers = options.otherArgs.headers || {};
2519
+ this.initialize().catch(err => { throw err; });
2520
+ const wrappedCallback = callback
2521
+ ? (error, values, nextPageRequest, rawResponse) => {
2522
+ this._log.info('findGroupChats values %j', values);
2523
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2524
+ }
2525
+ : undefined;
2526
+ this._log.info('findGroupChats request %j', request);
2527
+ return this.innerApiCalls
2528
+ .findGroupChats(request, options, wrappedCallback)
2529
+ ?.then(([response, input, output]) => {
2530
+ this._log.info('findGroupChats values %j', response);
2531
+ return [response, input, output];
2532
+ });
2533
+ }
2534
+ /**
2535
+ * Equivalent to `findGroupChats`, but returns a NodeJS Stream object.
2536
+ * @param {Object} request
2537
+ * The request object that will be sent.
2538
+ * @param {string[]} [request.users]
2539
+ * Optional. Resource names of all human users in group chat with the calling
2540
+ * user. Chat apps can't be included in the request.
2541
+ *
2542
+ * The maximum number of users that can be specified in a single request is
2543
+ * `49`.
2544
+ *
2545
+ * Format: `users/{user}`, where `{user}` is either the `id` for the
2546
+ * [person](https://developers.google.com/people/api/rest/v1/people) from the
2547
+ * People API, or the `id` for the
2548
+ * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
2549
+ * in the Directory API. For example, to find all group chats with the calling
2550
+ * user and two other users, with People API profile IDs `123456789` and
2551
+ * `987654321`, you can use `users/123456789` and `users/987654321`.
2552
+ * You can also use the email as an alias for `{user}`. For example,
2553
+ * `users/example@gmail.com` where `example@gmail.com` is the email of the
2554
+ * Google Chat user.
2555
+ * @param {number} [request.pageSize]
2556
+ * Optional. The maximum number of spaces to return. The service might return
2557
+ * fewer than this value.
2558
+ *
2559
+ * If unspecified, at most 10 spaces are returned.
2560
+ *
2561
+ * The maximum value is 30. If you use a value more than 30, it's
2562
+ * automatically changed to 30.
2563
+ *
2564
+ * Negative values return an `INVALID_ARGUMENT` error.
2565
+ * @param {string} [request.pageToken]
2566
+ * Optional. A page token, received from a previous call to find group chats.
2567
+ * Provide this parameter to retrieve the subsequent page.
2568
+ *
2569
+ * When paginating, all other parameters provided should match the call that
2570
+ * provided the token. Passing different values may lead to unexpected
2571
+ * results.
2572
+ * @param {google.chat.v1.SpaceView} request.spaceView
2573
+ * Requested space view type. If unset, defaults to
2574
+ * `SPACE_VIEW_RESOURCE_NAME_ONLY`. Requests that specify
2575
+ * `SPACE_VIEW_EXPANDED` must include scopes that allow reading space data,
2576
+ * for example,
2577
+ * https://www.googleapis.com/auth/chat.spaces or
2578
+ * https://www.googleapis.com/auth/chat.spaces.readonly.
2579
+ * @param {object} [options]
2580
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2581
+ * @returns {Stream}
2582
+ * An object stream which emits an object representing {@link protos.google.chat.v1.Space|Space} on 'data' event.
2583
+ * The client library will perform auto-pagination by default: it will call the API as many
2584
+ * times as needed. Note that it can affect your quota.
2585
+ * We recommend using `findGroupChatsAsync()`
2586
+ * method described below for async iteration which you can stop as needed.
2587
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2588
+ * for more details and examples.
2589
+ */
2590
+ findGroupChatsStream(request, options) {
2591
+ request = request || {};
2592
+ options = options || {};
2593
+ options.otherArgs = options.otherArgs || {};
2594
+ options.otherArgs.headers = options.otherArgs.headers || {};
2595
+ const defaultCallSettings = this._defaults['findGroupChats'];
2596
+ const callSettings = defaultCallSettings.merge(options);
2597
+ this.initialize().catch(err => { throw err; });
2598
+ this._log.info('findGroupChats stream %j', request);
2599
+ return this.descriptors.page.findGroupChats.createStream(this.innerApiCalls.findGroupChats, request, callSettings);
2600
+ }
2601
+ /**
2602
+ * Equivalent to `findGroupChats`, but returns an iterable object.
2603
+ *
2604
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
2605
+ * @param {Object} request
2606
+ * The request object that will be sent.
2607
+ * @param {string[]} [request.users]
2608
+ * Optional. Resource names of all human users in group chat with the calling
2609
+ * user. Chat apps can't be included in the request.
2610
+ *
2611
+ * The maximum number of users that can be specified in a single request is
2612
+ * `49`.
2613
+ *
2614
+ * Format: `users/{user}`, where `{user}` is either the `id` for the
2615
+ * [person](https://developers.google.com/people/api/rest/v1/people) from the
2616
+ * People API, or the `id` for the
2617
+ * [user](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users)
2618
+ * in the Directory API. For example, to find all group chats with the calling
2619
+ * user and two other users, with People API profile IDs `123456789` and
2620
+ * `987654321`, you can use `users/123456789` and `users/987654321`.
2621
+ * You can also use the email as an alias for `{user}`. For example,
2622
+ * `users/example@gmail.com` where `example@gmail.com` is the email of the
2623
+ * Google Chat user.
2624
+ * @param {number} [request.pageSize]
2625
+ * Optional. The maximum number of spaces to return. The service might return
2626
+ * fewer than this value.
2627
+ *
2628
+ * If unspecified, at most 10 spaces are returned.
2629
+ *
2630
+ * The maximum value is 30. If you use a value more than 30, it's
2631
+ * automatically changed to 30.
2632
+ *
2633
+ * Negative values return an `INVALID_ARGUMENT` error.
2634
+ * @param {string} [request.pageToken]
2635
+ * Optional. A page token, received from a previous call to find group chats.
2636
+ * Provide this parameter to retrieve the subsequent page.
2637
+ *
2638
+ * When paginating, all other parameters provided should match the call that
2639
+ * provided the token. Passing different values may lead to unexpected
2640
+ * results.
2641
+ * @param {google.chat.v1.SpaceView} request.spaceView
2642
+ * Requested space view type. If unset, defaults to
2643
+ * `SPACE_VIEW_RESOURCE_NAME_ONLY`. Requests that specify
2644
+ * `SPACE_VIEW_EXPANDED` must include scopes that allow reading space data,
2645
+ * for example,
2646
+ * https://www.googleapis.com/auth/chat.spaces or
2647
+ * https://www.googleapis.com/auth/chat.spaces.readonly.
2648
+ * @param {object} [options]
2649
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2650
+ * @returns {Object}
2651
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2652
+ * When you iterate the returned iterable, each element will be an object representing
2653
+ * {@link protos.google.chat.v1.Space|Space}. The API will be called under the hood as needed, once per the page,
2654
+ * so you can stop the iteration when you don't need more results.
2655
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2656
+ * for more details and examples.
2657
+ * @example <caption>include:samples/generated/v1/chat_service.find_group_chats.js</caption>
2658
+ * region_tag:chat_v1_generated_ChatService_FindGroupChats_async
2659
+ */
2660
+ findGroupChatsAsync(request, options) {
2661
+ request = request || {};
2662
+ options = options || {};
2663
+ options.otherArgs = options.otherArgs || {};
2664
+ options.otherArgs.headers = options.otherArgs.headers || {};
2665
+ const defaultCallSettings = this._defaults['findGroupChats'];
2666
+ const callSettings = defaultCallSettings.merge(options);
2667
+ this.initialize().catch(err => { throw err; });
2668
+ this._log.info('findGroupChats iterate %j', request);
2669
+ return this.descriptors.page.findGroupChats.asyncIterate(this.innerApiCalls['findGroupChats'], request, callSettings);
2670
+ }
2317
2671
  listReactions(request, optionsOrCallback, callback) {
2318
2672
  request = request || {};
2319
2673
  let options;
@@ -2899,6 +3253,316 @@ class ChatServiceClient {
2899
3253
  this._log.info('listSpaceEvents iterate %j', request);
2900
3254
  return this.descriptors.page.listSpaceEvents.asyncIterate(this.innerApiCalls['listSpaceEvents'], request, callSettings);
2901
3255
  }
3256
+ listSections(request, optionsOrCallback, callback) {
3257
+ request = request || {};
3258
+ let options;
3259
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
3260
+ callback = optionsOrCallback;
3261
+ options = {};
3262
+ }
3263
+ else {
3264
+ options = optionsOrCallback;
3265
+ }
3266
+ options = options || {};
3267
+ options.otherArgs = options.otherArgs || {};
3268
+ options.otherArgs.headers = options.otherArgs.headers || {};
3269
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3270
+ 'parent': request.parent ?? '',
3271
+ });
3272
+ this.initialize().catch(err => { throw err; });
3273
+ const wrappedCallback = callback
3274
+ ? (error, values, nextPageRequest, rawResponse) => {
3275
+ this._log.info('listSections values %j', values);
3276
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
3277
+ }
3278
+ : undefined;
3279
+ this._log.info('listSections request %j', request);
3280
+ return this.innerApiCalls
3281
+ .listSections(request, options, wrappedCallback)
3282
+ ?.then(([response, input, output]) => {
3283
+ this._log.info('listSections values %j', response);
3284
+ return [response, input, output];
3285
+ });
3286
+ }
3287
+ /**
3288
+ * Equivalent to `listSections`, but returns a NodeJS Stream object.
3289
+ * @param {Object} request
3290
+ * The request object that will be sent.
3291
+ * @param {string} request.parent
3292
+ * Required. The parent, which is the user resource name that owns this
3293
+ * collection of sections. Only supports listing sections for the calling
3294
+ * user. To refer to the calling user, set one of the following:
3295
+ *
3296
+ * - The `me` alias. For example, `users/me`.
3297
+ *
3298
+ * - Their Workspace email address. For example, `users/user@example.com`.
3299
+ *
3300
+ * - Their user id. For example, `users/123456789`.
3301
+ *
3302
+ * Format: `users/{user}`
3303
+ * @param {number} [request.pageSize]
3304
+ * Optional. The maximum number of sections to return. The service may return
3305
+ * fewer than this value.
3306
+ *
3307
+ * If unspecified, at most 10 sections will be returned.
3308
+ *
3309
+ * The maximum value is 100. If you use a value more than 100, it's
3310
+ * automatically changed to 100.
3311
+ *
3312
+ * Negative values return an `INVALID_ARGUMENT` error.
3313
+ * @param {string} [request.pageToken]
3314
+ * Optional. A page token, received from a previous list sections call.
3315
+ * Provide this to retrieve the subsequent page.
3316
+ *
3317
+ * When paginating, all other parameters provided should match the call that
3318
+ * provided the page token. Passing different values to the other parameters
3319
+ * might lead to unexpected results.
3320
+ * @param {object} [options]
3321
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3322
+ * @returns {Stream}
3323
+ * An object stream which emits an object representing {@link protos.google.chat.v1.Section|Section} on 'data' event.
3324
+ * The client library will perform auto-pagination by default: it will call the API as many
3325
+ * times as needed. Note that it can affect your quota.
3326
+ * We recommend using `listSectionsAsync()`
3327
+ * method described below for async iteration which you can stop as needed.
3328
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3329
+ * for more details and examples.
3330
+ */
3331
+ listSectionsStream(request, options) {
3332
+ request = request || {};
3333
+ options = options || {};
3334
+ options.otherArgs = options.otherArgs || {};
3335
+ options.otherArgs.headers = options.otherArgs.headers || {};
3336
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3337
+ 'parent': request.parent ?? '',
3338
+ });
3339
+ const defaultCallSettings = this._defaults['listSections'];
3340
+ const callSettings = defaultCallSettings.merge(options);
3341
+ this.initialize().catch(err => { throw err; });
3342
+ this._log.info('listSections stream %j', request);
3343
+ return this.descriptors.page.listSections.createStream(this.innerApiCalls.listSections, request, callSettings);
3344
+ }
3345
+ /**
3346
+ * Equivalent to `listSections`, but returns an iterable object.
3347
+ *
3348
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
3349
+ * @param {Object} request
3350
+ * The request object that will be sent.
3351
+ * @param {string} request.parent
3352
+ * Required. The parent, which is the user resource name that owns this
3353
+ * collection of sections. Only supports listing sections for the calling
3354
+ * user. To refer to the calling user, set one of the following:
3355
+ *
3356
+ * - The `me` alias. For example, `users/me`.
3357
+ *
3358
+ * - Their Workspace email address. For example, `users/user@example.com`.
3359
+ *
3360
+ * - Their user id. For example, `users/123456789`.
3361
+ *
3362
+ * Format: `users/{user}`
3363
+ * @param {number} [request.pageSize]
3364
+ * Optional. The maximum number of sections to return. The service may return
3365
+ * fewer than this value.
3366
+ *
3367
+ * If unspecified, at most 10 sections will be returned.
3368
+ *
3369
+ * The maximum value is 100. If you use a value more than 100, it's
3370
+ * automatically changed to 100.
3371
+ *
3372
+ * Negative values return an `INVALID_ARGUMENT` error.
3373
+ * @param {string} [request.pageToken]
3374
+ * Optional. A page token, received from a previous list sections call.
3375
+ * Provide this to retrieve the subsequent page.
3376
+ *
3377
+ * When paginating, all other parameters provided should match the call that
3378
+ * provided the page token. Passing different values to the other parameters
3379
+ * might lead to unexpected results.
3380
+ * @param {object} [options]
3381
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3382
+ * @returns {Object}
3383
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
3384
+ * When you iterate the returned iterable, each element will be an object representing
3385
+ * {@link protos.google.chat.v1.Section|Section}. The API will be called under the hood as needed, once per the page,
3386
+ * so you can stop the iteration when you don't need more results.
3387
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3388
+ * for more details and examples.
3389
+ * @example <caption>include:samples/generated/v1/chat_service.list_sections.js</caption>
3390
+ * region_tag:chat_v1_generated_ChatService_ListSections_async
3391
+ */
3392
+ listSectionsAsync(request, options) {
3393
+ request = request || {};
3394
+ options = options || {};
3395
+ options.otherArgs = options.otherArgs || {};
3396
+ options.otherArgs.headers = options.otherArgs.headers || {};
3397
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3398
+ 'parent': request.parent ?? '',
3399
+ });
3400
+ const defaultCallSettings = this._defaults['listSections'];
3401
+ const callSettings = defaultCallSettings.merge(options);
3402
+ this.initialize().catch(err => { throw err; });
3403
+ this._log.info('listSections iterate %j', request);
3404
+ return this.descriptors.page.listSections.asyncIterate(this.innerApiCalls['listSections'], request, callSettings);
3405
+ }
3406
+ listSectionItems(request, optionsOrCallback, callback) {
3407
+ request = request || {};
3408
+ let options;
3409
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
3410
+ callback = optionsOrCallback;
3411
+ options = {};
3412
+ }
3413
+ else {
3414
+ options = optionsOrCallback;
3415
+ }
3416
+ options = options || {};
3417
+ options.otherArgs = options.otherArgs || {};
3418
+ options.otherArgs.headers = options.otherArgs.headers || {};
3419
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3420
+ 'parent': request.parent ?? '',
3421
+ });
3422
+ this.initialize().catch(err => { throw err; });
3423
+ const wrappedCallback = callback
3424
+ ? (error, values, nextPageRequest, rawResponse) => {
3425
+ this._log.info('listSectionItems values %j', values);
3426
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
3427
+ }
3428
+ : undefined;
3429
+ this._log.info('listSectionItems request %j', request);
3430
+ return this.innerApiCalls
3431
+ .listSectionItems(request, options, wrappedCallback)
3432
+ ?.then(([response, input, output]) => {
3433
+ this._log.info('listSectionItems values %j', response);
3434
+ return [response, input, output];
3435
+ });
3436
+ }
3437
+ /**
3438
+ * Equivalent to `listSectionItems`, but returns a NodeJS Stream object.
3439
+ * @param {Object} request
3440
+ * The request object that will be sent.
3441
+ * @param {string} request.parent
3442
+ * Required. The parent, which is the section resource name that owns this
3443
+ * collection of section items. Only supports listing section items for the
3444
+ * calling user.
3445
+ *
3446
+ * When you're filtering by space, use the wildcard `-` to search across all
3447
+ * sections. For example, `users/{user}/sections/-`.
3448
+ *
3449
+ * Format: `users/{user}/sections/{section}`
3450
+ * @param {number} [request.pageSize]
3451
+ * Optional. The maximum number of section items to return. The service may
3452
+ * return fewer than this value.
3453
+ *
3454
+ * If unspecified, at most 10 section items will be returned.
3455
+ *
3456
+ * The maximum value is 100. If you use a value more than 100, it's
3457
+ * automatically changed to 100.
3458
+ *
3459
+ * Negative values return an `INVALID_ARGUMENT` error.
3460
+ * @param {string} [request.pageToken]
3461
+ * Optional. A page token, received from a previous list section items call.
3462
+ * Provide this to retrieve the subsequent page.
3463
+ *
3464
+ * When paginating, all other parameters provided should match the call that
3465
+ * provided the page token. Passing different values to the other parameters
3466
+ * might lead to unexpected results.
3467
+ * @param {string} [request.filter]
3468
+ * Optional. A query filter.
3469
+ *
3470
+ * Currently only supports filtering by space.
3471
+ *
3472
+ * For example, `space = spaces/{space}`.
3473
+ *
3474
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
3475
+ * @param {object} [options]
3476
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3477
+ * @returns {Stream}
3478
+ * An object stream which emits an object representing {@link protos.google.chat.v1.SectionItem|SectionItem} on 'data' event.
3479
+ * The client library will perform auto-pagination by default: it will call the API as many
3480
+ * times as needed. Note that it can affect your quota.
3481
+ * We recommend using `listSectionItemsAsync()`
3482
+ * method described below for async iteration which you can stop as needed.
3483
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3484
+ * for more details and examples.
3485
+ */
3486
+ listSectionItemsStream(request, options) {
3487
+ request = request || {};
3488
+ options = options || {};
3489
+ options.otherArgs = options.otherArgs || {};
3490
+ options.otherArgs.headers = options.otherArgs.headers || {};
3491
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3492
+ 'parent': request.parent ?? '',
3493
+ });
3494
+ const defaultCallSettings = this._defaults['listSectionItems'];
3495
+ const callSettings = defaultCallSettings.merge(options);
3496
+ this.initialize().catch(err => { throw err; });
3497
+ this._log.info('listSectionItems stream %j', request);
3498
+ return this.descriptors.page.listSectionItems.createStream(this.innerApiCalls.listSectionItems, request, callSettings);
3499
+ }
3500
+ /**
3501
+ * Equivalent to `listSectionItems`, but returns an iterable object.
3502
+ *
3503
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
3504
+ * @param {Object} request
3505
+ * The request object that will be sent.
3506
+ * @param {string} request.parent
3507
+ * Required. The parent, which is the section resource name that owns this
3508
+ * collection of section items. Only supports listing section items for the
3509
+ * calling user.
3510
+ *
3511
+ * When you're filtering by space, use the wildcard `-` to search across all
3512
+ * sections. For example, `users/{user}/sections/-`.
3513
+ *
3514
+ * Format: `users/{user}/sections/{section}`
3515
+ * @param {number} [request.pageSize]
3516
+ * Optional. The maximum number of section items to return. The service may
3517
+ * return fewer than this value.
3518
+ *
3519
+ * If unspecified, at most 10 section items will be returned.
3520
+ *
3521
+ * The maximum value is 100. If you use a value more than 100, it's
3522
+ * automatically changed to 100.
3523
+ *
3524
+ * Negative values return an `INVALID_ARGUMENT` error.
3525
+ * @param {string} [request.pageToken]
3526
+ * Optional. A page token, received from a previous list section items call.
3527
+ * Provide this to retrieve the subsequent page.
3528
+ *
3529
+ * When paginating, all other parameters provided should match the call that
3530
+ * provided the page token. Passing different values to the other parameters
3531
+ * might lead to unexpected results.
3532
+ * @param {string} [request.filter]
3533
+ * Optional. A query filter.
3534
+ *
3535
+ * Currently only supports filtering by space.
3536
+ *
3537
+ * For example, `space = spaces/{space}`.
3538
+ *
3539
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
3540
+ * @param {object} [options]
3541
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3542
+ * @returns {Object}
3543
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
3544
+ * When you iterate the returned iterable, each element will be an object representing
3545
+ * {@link protos.google.chat.v1.SectionItem|SectionItem}. The API will be called under the hood as needed, once per the page,
3546
+ * so you can stop the iteration when you don't need more results.
3547
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3548
+ * for more details and examples.
3549
+ * @example <caption>include:samples/generated/v1/chat_service.list_section_items.js</caption>
3550
+ * region_tag:chat_v1_generated_ChatService_ListSectionItems_async
3551
+ */
3552
+ listSectionItemsAsync(request, options) {
3553
+ request = request || {};
3554
+ options = options || {};
3555
+ options.otherArgs = options.otherArgs || {};
3556
+ options.otherArgs.headers = options.otherArgs.headers || {};
3557
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3558
+ 'parent': request.parent ?? '',
3559
+ });
3560
+ const defaultCallSettings = this._defaults['listSectionItems'];
3561
+ const callSettings = defaultCallSettings.merge(options);
3562
+ this.initialize().catch(err => { throw err; });
3563
+ this._log.info('listSectionItems iterate %j', request);
3564
+ return this.descriptors.page.listSectionItems.asyncIterate(this.innerApiCalls['listSectionItems'], request, callSettings);
3565
+ }
2902
3566
  // --------------------
2903
3567
  // -- Path templates --
2904
3568
  // --------------------
@@ -3124,6 +3788,84 @@ class ChatServiceClient {
3124
3788
  matchReactionFromReactionName(reactionName) {
3125
3789
  return this.pathTemplates.reactionPathTemplate.match(reactionName).reaction;
3126
3790
  }
3791
+ /**
3792
+ * Return a fully-qualified section resource name string.
3793
+ *
3794
+ * @param {string} user
3795
+ * @param {string} section
3796
+ * @returns {string} Resource name string.
3797
+ */
3798
+ sectionPath(user, section) {
3799
+ return this.pathTemplates.sectionPathTemplate.render({
3800
+ user: user,
3801
+ section: section,
3802
+ });
3803
+ }
3804
+ /**
3805
+ * Parse the user from Section resource.
3806
+ *
3807
+ * @param {string} sectionName
3808
+ * A fully-qualified path representing Section resource.
3809
+ * @returns {string} A string representing the user.
3810
+ */
3811
+ matchUserFromSectionName(sectionName) {
3812
+ return this.pathTemplates.sectionPathTemplate.match(sectionName).user;
3813
+ }
3814
+ /**
3815
+ * Parse the section from Section resource.
3816
+ *
3817
+ * @param {string} sectionName
3818
+ * A fully-qualified path representing Section resource.
3819
+ * @returns {string} A string representing the section.
3820
+ */
3821
+ matchSectionFromSectionName(sectionName) {
3822
+ return this.pathTemplates.sectionPathTemplate.match(sectionName).section;
3823
+ }
3824
+ /**
3825
+ * Return a fully-qualified sectionItem resource name string.
3826
+ *
3827
+ * @param {string} user
3828
+ * @param {string} section
3829
+ * @param {string} item
3830
+ * @returns {string} Resource name string.
3831
+ */
3832
+ sectionItemPath(user, section, item) {
3833
+ return this.pathTemplates.sectionItemPathTemplate.render({
3834
+ user: user,
3835
+ section: section,
3836
+ item: item,
3837
+ });
3838
+ }
3839
+ /**
3840
+ * Parse the user from SectionItem resource.
3841
+ *
3842
+ * @param {string} sectionItemName
3843
+ * A fully-qualified path representing SectionItem resource.
3844
+ * @returns {string} A string representing the user.
3845
+ */
3846
+ matchUserFromSectionItemName(sectionItemName) {
3847
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).user;
3848
+ }
3849
+ /**
3850
+ * Parse the section from SectionItem resource.
3851
+ *
3852
+ * @param {string} sectionItemName
3853
+ * A fully-qualified path representing SectionItem resource.
3854
+ * @returns {string} A string representing the section.
3855
+ */
3856
+ matchSectionFromSectionItemName(sectionItemName) {
3857
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).section;
3858
+ }
3859
+ /**
3860
+ * Parse the item from SectionItem resource.
3861
+ *
3862
+ * @param {string} sectionItemName
3863
+ * A fully-qualified path representing SectionItem resource.
3864
+ * @returns {string} A string representing the item.
3865
+ */
3866
+ matchItemFromSectionItemName(sectionItemName) {
3867
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).item;
3868
+ }
3127
3869
  /**
3128
3870
  * Return a fully-qualified space resource name string.
3129
3871
  *