@google-apps/chat 0.22.0 → 0.23.1

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.
@@ -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'),
@@ -184,7 +186,9 @@ class ChatServiceClient {
184
186
  searchSpaces: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaces'),
185
187
  listReactions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'reactions'),
186
188
  listCustomEmojis: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'customEmojis'),
187
- listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents')
189
+ listSpaceEvents: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spaceEvents'),
190
+ listSections: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sections'),
191
+ listSectionItems: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sectionItems')
188
192
  };
189
193
  // Put together the default options sent with requests.
190
194
  this._defaults = this._gaxGrpc.constructSettings('google.chat.v1.ChatService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -219,7 +223,7 @@ class ChatServiceClient {
219
223
  this._protos.google.chat.v1.ChatService, this._opts, this._providedCustomServicePath);
220
224
  // Iterate over each of the methods that the service provides
221
225
  // 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'];
226
+ 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', 'createSection', 'deleteSection', 'updateSection', 'listSections', 'positionSection', 'listSectionItems', 'moveSectionItem'];
223
227
  for (const methodName of chatServiceStubMethods) {
224
228
  const callPromise = this.chatServiceStub.then(stub => (...args) => {
225
229
  if (this._terminated) {
@@ -290,9 +294,11 @@ class ChatServiceClient {
290
294
  'https://www.googleapis.com/auth/chat.admin.spaces.readonly',
291
295
  'https://www.googleapis.com/auth/chat.app.delete',
292
296
  'https://www.googleapis.com/auth/chat.app.memberships',
297
+ 'https://www.googleapis.com/auth/chat.app.memberships.readonly',
293
298
  'https://www.googleapis.com/auth/chat.app.messages.readonly',
294
299
  'https://www.googleapis.com/auth/chat.app.spaces',
295
300
  'https://www.googleapis.com/auth/chat.app.spaces.create',
301
+ 'https://www.googleapis.com/auth/chat.app.spaces.readonly',
296
302
  'https://www.googleapis.com/auth/chat.bot',
297
303
  'https://www.googleapis.com/auth/chat.customemojis',
298
304
  'https://www.googleapis.com/auth/chat.customemojis.readonly',
@@ -312,6 +318,8 @@ class ChatServiceClient {
312
318
  'https://www.googleapis.com/auth/chat.spaces.readonly',
313
319
  'https://www.googleapis.com/auth/chat.users.readstate',
314
320
  'https://www.googleapis.com/auth/chat.users.readstate.readonly',
321
+ 'https://www.googleapis.com/auth/chat.users.sections',
322
+ 'https://www.googleapis.com/auth/chat.users.sections.readonly',
315
323
  'https://www.googleapis.com/auth/chat.users.spacesettings'
316
324
  ];
317
325
  }
@@ -1322,6 +1330,186 @@ class ChatServiceClient {
1322
1330
  throw error;
1323
1331
  });
1324
1332
  }
1333
+ createSection(request, optionsOrCallback, callback) {
1334
+ request = request || {};
1335
+ let options;
1336
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1337
+ callback = optionsOrCallback;
1338
+ options = {};
1339
+ }
1340
+ else {
1341
+ options = optionsOrCallback;
1342
+ }
1343
+ options = options || {};
1344
+ options.otherArgs = options.otherArgs || {};
1345
+ options.otherArgs.headers = options.otherArgs.headers || {};
1346
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1347
+ 'parent': request.parent ?? '',
1348
+ });
1349
+ this.initialize().catch(err => { throw err; });
1350
+ this._log.info('createSection request %j', request);
1351
+ const wrappedCallback = callback
1352
+ ? (error, response, options, rawResponse) => {
1353
+ this._log.info('createSection response %j', response);
1354
+ callback(error, response, options, rawResponse); // We verified callback above.
1355
+ }
1356
+ : undefined;
1357
+ return this.innerApiCalls.createSection(request, options, wrappedCallback)
1358
+ ?.then(([response, options, rawResponse]) => {
1359
+ this._log.info('createSection response %j', response);
1360
+ return [response, options, rawResponse];
1361
+ }).catch((error) => {
1362
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1363
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1364
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1365
+ }
1366
+ throw error;
1367
+ });
1368
+ }
1369
+ deleteSection(request, optionsOrCallback, callback) {
1370
+ request = request || {};
1371
+ let options;
1372
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1373
+ callback = optionsOrCallback;
1374
+ options = {};
1375
+ }
1376
+ else {
1377
+ options = optionsOrCallback;
1378
+ }
1379
+ options = options || {};
1380
+ options.otherArgs = options.otherArgs || {};
1381
+ options.otherArgs.headers = options.otherArgs.headers || {};
1382
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1383
+ 'name': request.name ?? '',
1384
+ });
1385
+ this.initialize().catch(err => { throw err; });
1386
+ this._log.info('deleteSection request %j', request);
1387
+ const wrappedCallback = callback
1388
+ ? (error, response, options, rawResponse) => {
1389
+ this._log.info('deleteSection response %j', response);
1390
+ callback(error, response, options, rawResponse); // We verified callback above.
1391
+ }
1392
+ : undefined;
1393
+ return this.innerApiCalls.deleteSection(request, options, wrappedCallback)
1394
+ ?.then(([response, options, rawResponse]) => {
1395
+ this._log.info('deleteSection response %j', response);
1396
+ return [response, options, rawResponse];
1397
+ }).catch((error) => {
1398
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1399
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1400
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1401
+ }
1402
+ throw error;
1403
+ });
1404
+ }
1405
+ updateSection(request, optionsOrCallback, callback) {
1406
+ request = request || {};
1407
+ let options;
1408
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1409
+ callback = optionsOrCallback;
1410
+ options = {};
1411
+ }
1412
+ else {
1413
+ options = optionsOrCallback;
1414
+ }
1415
+ options = options || {};
1416
+ options.otherArgs = options.otherArgs || {};
1417
+ options.otherArgs.headers = options.otherArgs.headers || {};
1418
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1419
+ 'section.name': request.section.name ?? '',
1420
+ });
1421
+ this.initialize().catch(err => { throw err; });
1422
+ this._log.info('updateSection request %j', request);
1423
+ const wrappedCallback = callback
1424
+ ? (error, response, options, rawResponse) => {
1425
+ this._log.info('updateSection response %j', response);
1426
+ callback(error, response, options, rawResponse); // We verified callback above.
1427
+ }
1428
+ : undefined;
1429
+ return this.innerApiCalls.updateSection(request, options, wrappedCallback)
1430
+ ?.then(([response, options, rawResponse]) => {
1431
+ this._log.info('updateSection response %j', response);
1432
+ return [response, options, rawResponse];
1433
+ }).catch((error) => {
1434
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1435
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1436
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1437
+ }
1438
+ throw error;
1439
+ });
1440
+ }
1441
+ positionSection(request, optionsOrCallback, callback) {
1442
+ request = request || {};
1443
+ let options;
1444
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1445
+ callback = optionsOrCallback;
1446
+ options = {};
1447
+ }
1448
+ else {
1449
+ options = optionsOrCallback;
1450
+ }
1451
+ options = options || {};
1452
+ options.otherArgs = options.otherArgs || {};
1453
+ options.otherArgs.headers = options.otherArgs.headers || {};
1454
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1455
+ 'name': request.name ?? '',
1456
+ });
1457
+ this.initialize().catch(err => { throw err; });
1458
+ this._log.info('positionSection request %j', request);
1459
+ const wrappedCallback = callback
1460
+ ? (error, response, options, rawResponse) => {
1461
+ this._log.info('positionSection response %j', response);
1462
+ callback(error, response, options, rawResponse); // We verified callback above.
1463
+ }
1464
+ : undefined;
1465
+ return this.innerApiCalls.positionSection(request, options, wrappedCallback)
1466
+ ?.then(([response, options, rawResponse]) => {
1467
+ this._log.info('positionSection response %j', response);
1468
+ return [response, options, rawResponse];
1469
+ }).catch((error) => {
1470
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1471
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1472
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1473
+ }
1474
+ throw error;
1475
+ });
1476
+ }
1477
+ moveSectionItem(request, optionsOrCallback, callback) {
1478
+ request = request || {};
1479
+ let options;
1480
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1481
+ callback = optionsOrCallback;
1482
+ options = {};
1483
+ }
1484
+ else {
1485
+ options = optionsOrCallback;
1486
+ }
1487
+ options = options || {};
1488
+ options.otherArgs = options.otherArgs || {};
1489
+ options.otherArgs.headers = options.otherArgs.headers || {};
1490
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1491
+ 'name': request.name ?? '',
1492
+ });
1493
+ this.initialize().catch(err => { throw err; });
1494
+ this._log.info('moveSectionItem request %j', request);
1495
+ const wrappedCallback = callback
1496
+ ? (error, response, options, rawResponse) => {
1497
+ this._log.info('moveSectionItem response %j', response);
1498
+ callback(error, response, options, rawResponse); // We verified callback above.
1499
+ }
1500
+ : undefined;
1501
+ return this.innerApiCalls.moveSectionItem(request, options, wrappedCallback)
1502
+ ?.then(([response, options, rawResponse]) => {
1503
+ this._log.info('moveSectionItem response %j', response);
1504
+ return [response, options, rawResponse];
1505
+ }).catch((error) => {
1506
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1507
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1508
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1509
+ }
1510
+ throw error;
1511
+ });
1512
+ }
1325
1513
  listMessages(request, optionsOrCallback, callback) {
1326
1514
  request = request || {};
1327
1515
  let options;
@@ -2899,6 +3087,316 @@ class ChatServiceClient {
2899
3087
  this._log.info('listSpaceEvents iterate %j', request);
2900
3088
  return this.descriptors.page.listSpaceEvents.asyncIterate(this.innerApiCalls['listSpaceEvents'], request, callSettings);
2901
3089
  }
3090
+ listSections(request, optionsOrCallback, callback) {
3091
+ request = request || {};
3092
+ let options;
3093
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
3094
+ callback = optionsOrCallback;
3095
+ options = {};
3096
+ }
3097
+ else {
3098
+ options = optionsOrCallback;
3099
+ }
3100
+ options = options || {};
3101
+ options.otherArgs = options.otherArgs || {};
3102
+ options.otherArgs.headers = options.otherArgs.headers || {};
3103
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3104
+ 'parent': request.parent ?? '',
3105
+ });
3106
+ this.initialize().catch(err => { throw err; });
3107
+ const wrappedCallback = callback
3108
+ ? (error, values, nextPageRequest, rawResponse) => {
3109
+ this._log.info('listSections values %j', values);
3110
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
3111
+ }
3112
+ : undefined;
3113
+ this._log.info('listSections request %j', request);
3114
+ return this.innerApiCalls
3115
+ .listSections(request, options, wrappedCallback)
3116
+ ?.then(([response, input, output]) => {
3117
+ this._log.info('listSections values %j', response);
3118
+ return [response, input, output];
3119
+ });
3120
+ }
3121
+ /**
3122
+ * Equivalent to `listSections`, but returns a NodeJS Stream object.
3123
+ * @param {Object} request
3124
+ * The request object that will be sent.
3125
+ * @param {string} request.parent
3126
+ * Required. The parent, which is the user resource name that owns this
3127
+ * collection of sections. Only supports listing sections for the calling
3128
+ * user. To refer to the calling user, set one of the following:
3129
+ *
3130
+ * - The `me` alias. For example, `users/me`.
3131
+ *
3132
+ * - Their Workspace email address. For example, `users/user@example.com`.
3133
+ *
3134
+ * - Their user id. For example, `users/123456789`.
3135
+ *
3136
+ * Format: `users/{user}`
3137
+ * @param {number} [request.pageSize]
3138
+ * Optional. The maximum number of sections to return. The service may return
3139
+ * fewer than this value.
3140
+ *
3141
+ * If unspecified, at most 10 sections will be returned.
3142
+ *
3143
+ * The maximum value is 100. If you use a value more than 100, it's
3144
+ * automatically changed to 100.
3145
+ *
3146
+ * Negative values return an `INVALID_ARGUMENT` error.
3147
+ * @param {string} [request.pageToken]
3148
+ * Optional. A page token, received from a previous list sections call.
3149
+ * Provide this to retrieve the subsequent page.
3150
+ *
3151
+ * When paginating, all other parameters provided should match the call that
3152
+ * provided the page token. Passing different values to the other parameters
3153
+ * might lead to unexpected results.
3154
+ * @param {object} [options]
3155
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3156
+ * @returns {Stream}
3157
+ * An object stream which emits an object representing {@link protos.google.chat.v1.Section|Section} on 'data' event.
3158
+ * The client library will perform auto-pagination by default: it will call the API as many
3159
+ * times as needed. Note that it can affect your quota.
3160
+ * We recommend using `listSectionsAsync()`
3161
+ * method described below for async iteration which you can stop as needed.
3162
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3163
+ * for more details and examples.
3164
+ */
3165
+ listSectionsStream(request, options) {
3166
+ request = request || {};
3167
+ options = options || {};
3168
+ options.otherArgs = options.otherArgs || {};
3169
+ options.otherArgs.headers = options.otherArgs.headers || {};
3170
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3171
+ 'parent': request.parent ?? '',
3172
+ });
3173
+ const defaultCallSettings = this._defaults['listSections'];
3174
+ const callSettings = defaultCallSettings.merge(options);
3175
+ this.initialize().catch(err => { throw err; });
3176
+ this._log.info('listSections stream %j', request);
3177
+ return this.descriptors.page.listSections.createStream(this.innerApiCalls.listSections, request, callSettings);
3178
+ }
3179
+ /**
3180
+ * Equivalent to `listSections`, but returns an iterable object.
3181
+ *
3182
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
3183
+ * @param {Object} request
3184
+ * The request object that will be sent.
3185
+ * @param {string} request.parent
3186
+ * Required. The parent, which is the user resource name that owns this
3187
+ * collection of sections. Only supports listing sections for the calling
3188
+ * user. To refer to the calling user, set one of the following:
3189
+ *
3190
+ * - The `me` alias. For example, `users/me`.
3191
+ *
3192
+ * - Their Workspace email address. For example, `users/user@example.com`.
3193
+ *
3194
+ * - Their user id. For example, `users/123456789`.
3195
+ *
3196
+ * Format: `users/{user}`
3197
+ * @param {number} [request.pageSize]
3198
+ * Optional. The maximum number of sections to return. The service may return
3199
+ * fewer than this value.
3200
+ *
3201
+ * If unspecified, at most 10 sections will be returned.
3202
+ *
3203
+ * The maximum value is 100. If you use a value more than 100, it's
3204
+ * automatically changed to 100.
3205
+ *
3206
+ * Negative values return an `INVALID_ARGUMENT` error.
3207
+ * @param {string} [request.pageToken]
3208
+ * Optional. A page token, received from a previous list sections call.
3209
+ * Provide this to retrieve the subsequent page.
3210
+ *
3211
+ * When paginating, all other parameters provided should match the call that
3212
+ * provided the page token. Passing different values to the other parameters
3213
+ * might lead to unexpected results.
3214
+ * @param {object} [options]
3215
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3216
+ * @returns {Object}
3217
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
3218
+ * When you iterate the returned iterable, each element will be an object representing
3219
+ * {@link protos.google.chat.v1.Section|Section}. The API will be called under the hood as needed, once per the page,
3220
+ * so you can stop the iteration when you don't need more results.
3221
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3222
+ * for more details and examples.
3223
+ * @example <caption>include:samples/generated/v1/chat_service.list_sections.js</caption>
3224
+ * region_tag:chat_v1_generated_ChatService_ListSections_async
3225
+ */
3226
+ listSectionsAsync(request, options) {
3227
+ request = request || {};
3228
+ options = options || {};
3229
+ options.otherArgs = options.otherArgs || {};
3230
+ options.otherArgs.headers = options.otherArgs.headers || {};
3231
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3232
+ 'parent': request.parent ?? '',
3233
+ });
3234
+ const defaultCallSettings = this._defaults['listSections'];
3235
+ const callSettings = defaultCallSettings.merge(options);
3236
+ this.initialize().catch(err => { throw err; });
3237
+ this._log.info('listSections iterate %j', request);
3238
+ return this.descriptors.page.listSections.asyncIterate(this.innerApiCalls['listSections'], request, callSettings);
3239
+ }
3240
+ listSectionItems(request, optionsOrCallback, callback) {
3241
+ request = request || {};
3242
+ let options;
3243
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
3244
+ callback = optionsOrCallback;
3245
+ options = {};
3246
+ }
3247
+ else {
3248
+ options = optionsOrCallback;
3249
+ }
3250
+ options = options || {};
3251
+ options.otherArgs = options.otherArgs || {};
3252
+ options.otherArgs.headers = options.otherArgs.headers || {};
3253
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3254
+ 'parent': request.parent ?? '',
3255
+ });
3256
+ this.initialize().catch(err => { throw err; });
3257
+ const wrappedCallback = callback
3258
+ ? (error, values, nextPageRequest, rawResponse) => {
3259
+ this._log.info('listSectionItems values %j', values);
3260
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
3261
+ }
3262
+ : undefined;
3263
+ this._log.info('listSectionItems request %j', request);
3264
+ return this.innerApiCalls
3265
+ .listSectionItems(request, options, wrappedCallback)
3266
+ ?.then(([response, input, output]) => {
3267
+ this._log.info('listSectionItems values %j', response);
3268
+ return [response, input, output];
3269
+ });
3270
+ }
3271
+ /**
3272
+ * Equivalent to `listSectionItems`, but returns a NodeJS Stream object.
3273
+ * @param {Object} request
3274
+ * The request object that will be sent.
3275
+ * @param {string} request.parent
3276
+ * Required. The parent, which is the section resource name that owns this
3277
+ * collection of section items. Only supports listing section items for the
3278
+ * calling user.
3279
+ *
3280
+ * When you're filtering by space, use the wildcard `-` to search across all
3281
+ * sections. For example, `users/{user}/sections/-`.
3282
+ *
3283
+ * Format: `users/{user}/sections/{section}`
3284
+ * @param {number} [request.pageSize]
3285
+ * Optional. The maximum number of section items to return. The service may
3286
+ * return fewer than this value.
3287
+ *
3288
+ * If unspecified, at most 10 section items will be returned.
3289
+ *
3290
+ * The maximum value is 100. If you use a value more than 100, it's
3291
+ * automatically changed to 100.
3292
+ *
3293
+ * Negative values return an `INVALID_ARGUMENT` error.
3294
+ * @param {string} [request.pageToken]
3295
+ * Optional. A page token, received from a previous list section items call.
3296
+ * Provide this to retrieve the subsequent page.
3297
+ *
3298
+ * When paginating, all other parameters provided should match the call that
3299
+ * provided the page token. Passing different values to the other parameters
3300
+ * might lead to unexpected results.
3301
+ * @param {string} [request.filter]
3302
+ * Optional. A query filter.
3303
+ *
3304
+ * Currently only supports filtering by space.
3305
+ *
3306
+ * For example, `space = spaces/{space}`.
3307
+ *
3308
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
3309
+ * @param {object} [options]
3310
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3311
+ * @returns {Stream}
3312
+ * An object stream which emits an object representing {@link protos.google.chat.v1.SectionItem|SectionItem} on 'data' event.
3313
+ * The client library will perform auto-pagination by default: it will call the API as many
3314
+ * times as needed. Note that it can affect your quota.
3315
+ * We recommend using `listSectionItemsAsync()`
3316
+ * method described below for async iteration which you can stop as needed.
3317
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3318
+ * for more details and examples.
3319
+ */
3320
+ listSectionItemsStream(request, options) {
3321
+ request = request || {};
3322
+ options = options || {};
3323
+ options.otherArgs = options.otherArgs || {};
3324
+ options.otherArgs.headers = options.otherArgs.headers || {};
3325
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3326
+ 'parent': request.parent ?? '',
3327
+ });
3328
+ const defaultCallSettings = this._defaults['listSectionItems'];
3329
+ const callSettings = defaultCallSettings.merge(options);
3330
+ this.initialize().catch(err => { throw err; });
3331
+ this._log.info('listSectionItems stream %j', request);
3332
+ return this.descriptors.page.listSectionItems.createStream(this.innerApiCalls.listSectionItems, request, callSettings);
3333
+ }
3334
+ /**
3335
+ * Equivalent to `listSectionItems`, but returns an iterable object.
3336
+ *
3337
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
3338
+ * @param {Object} request
3339
+ * The request object that will be sent.
3340
+ * @param {string} request.parent
3341
+ * Required. The parent, which is the section resource name that owns this
3342
+ * collection of section items. Only supports listing section items for the
3343
+ * calling user.
3344
+ *
3345
+ * When you're filtering by space, use the wildcard `-` to search across all
3346
+ * sections. For example, `users/{user}/sections/-`.
3347
+ *
3348
+ * Format: `users/{user}/sections/{section}`
3349
+ * @param {number} [request.pageSize]
3350
+ * Optional. The maximum number of section items to return. The service may
3351
+ * return fewer than this value.
3352
+ *
3353
+ * If unspecified, at most 10 section items will be returned.
3354
+ *
3355
+ * The maximum value is 100. If you use a value more than 100, it's
3356
+ * automatically changed to 100.
3357
+ *
3358
+ * Negative values return an `INVALID_ARGUMENT` error.
3359
+ * @param {string} [request.pageToken]
3360
+ * Optional. A page token, received from a previous list section items call.
3361
+ * Provide this to retrieve the subsequent page.
3362
+ *
3363
+ * When paginating, all other parameters provided should match the call that
3364
+ * provided the page token. Passing different values to the other parameters
3365
+ * might lead to unexpected results.
3366
+ * @param {string} [request.filter]
3367
+ * Optional. A query filter.
3368
+ *
3369
+ * Currently only supports filtering by space.
3370
+ *
3371
+ * For example, `space = spaces/{space}`.
3372
+ *
3373
+ * Invalid queries are rejected with an `INVALID_ARGUMENT` error.
3374
+ * @param {object} [options]
3375
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
3376
+ * @returns {Object}
3377
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
3378
+ * When you iterate the returned iterable, each element will be an object representing
3379
+ * {@link protos.google.chat.v1.SectionItem|SectionItem}. The API will be called under the hood as needed, once per the page,
3380
+ * so you can stop the iteration when you don't need more results.
3381
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
3382
+ * for more details and examples.
3383
+ * @example <caption>include:samples/generated/v1/chat_service.list_section_items.js</caption>
3384
+ * region_tag:chat_v1_generated_ChatService_ListSectionItems_async
3385
+ */
3386
+ listSectionItemsAsync(request, options) {
3387
+ request = request || {};
3388
+ options = options || {};
3389
+ options.otherArgs = options.otherArgs || {};
3390
+ options.otherArgs.headers = options.otherArgs.headers || {};
3391
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
3392
+ 'parent': request.parent ?? '',
3393
+ });
3394
+ const defaultCallSettings = this._defaults['listSectionItems'];
3395
+ const callSettings = defaultCallSettings.merge(options);
3396
+ this.initialize().catch(err => { throw err; });
3397
+ this._log.info('listSectionItems iterate %j', request);
3398
+ return this.descriptors.page.listSectionItems.asyncIterate(this.innerApiCalls['listSectionItems'], request, callSettings);
3399
+ }
2902
3400
  // --------------------
2903
3401
  // -- Path templates --
2904
3402
  // --------------------
@@ -3124,6 +3622,84 @@ class ChatServiceClient {
3124
3622
  matchReactionFromReactionName(reactionName) {
3125
3623
  return this.pathTemplates.reactionPathTemplate.match(reactionName).reaction;
3126
3624
  }
3625
+ /**
3626
+ * Return a fully-qualified section resource name string.
3627
+ *
3628
+ * @param {string} user
3629
+ * @param {string} section
3630
+ * @returns {string} Resource name string.
3631
+ */
3632
+ sectionPath(user, section) {
3633
+ return this.pathTemplates.sectionPathTemplate.render({
3634
+ user: user,
3635
+ section: section,
3636
+ });
3637
+ }
3638
+ /**
3639
+ * Parse the user from Section resource.
3640
+ *
3641
+ * @param {string} sectionName
3642
+ * A fully-qualified path representing Section resource.
3643
+ * @returns {string} A string representing the user.
3644
+ */
3645
+ matchUserFromSectionName(sectionName) {
3646
+ return this.pathTemplates.sectionPathTemplate.match(sectionName).user;
3647
+ }
3648
+ /**
3649
+ * Parse the section from Section resource.
3650
+ *
3651
+ * @param {string} sectionName
3652
+ * A fully-qualified path representing Section resource.
3653
+ * @returns {string} A string representing the section.
3654
+ */
3655
+ matchSectionFromSectionName(sectionName) {
3656
+ return this.pathTemplates.sectionPathTemplate.match(sectionName).section;
3657
+ }
3658
+ /**
3659
+ * Return a fully-qualified sectionItem resource name string.
3660
+ *
3661
+ * @param {string} user
3662
+ * @param {string} section
3663
+ * @param {string} item
3664
+ * @returns {string} Resource name string.
3665
+ */
3666
+ sectionItemPath(user, section, item) {
3667
+ return this.pathTemplates.sectionItemPathTemplate.render({
3668
+ user: user,
3669
+ section: section,
3670
+ item: item,
3671
+ });
3672
+ }
3673
+ /**
3674
+ * Parse the user from SectionItem resource.
3675
+ *
3676
+ * @param {string} sectionItemName
3677
+ * A fully-qualified path representing SectionItem resource.
3678
+ * @returns {string} A string representing the user.
3679
+ */
3680
+ matchUserFromSectionItemName(sectionItemName) {
3681
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).user;
3682
+ }
3683
+ /**
3684
+ * Parse the section from SectionItem resource.
3685
+ *
3686
+ * @param {string} sectionItemName
3687
+ * A fully-qualified path representing SectionItem resource.
3688
+ * @returns {string} A string representing the section.
3689
+ */
3690
+ matchSectionFromSectionItemName(sectionItemName) {
3691
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).section;
3692
+ }
3693
+ /**
3694
+ * Parse the item from SectionItem resource.
3695
+ *
3696
+ * @param {string} sectionItemName
3697
+ * A fully-qualified path representing SectionItem resource.
3698
+ * @returns {string} A string representing the item.
3699
+ */
3700
+ matchItemFromSectionItemName(sectionItemName) {
3701
+ return this.pathTemplates.sectionItemPathTemplate.match(sectionItemName).item;
3702
+ }
3127
3703
  /**
3128
3704
  * Return a fully-qualified space resource name string.
3129
3705
  *