list method

Future<ListSectionsResponse> list(
  1. String parent, {
  2. int? pageSize,
  3. String? pageToken,
  4. String? $fields,
})

Lists sections available to the Chat user.

Sections help users group their conversations and customize the list of spaces displayed in Chat navigation panel. For details, see Create and organize sections in Google Chat. Requires user authentication with the authorization scope:

  • https://www.googleapis.com/auth/chat.users.sections - https://www.googleapis.com/auth/chat.users.sections.readonly

Request parameters:

parent - Required. The parent, which is the user resource name that owns this collection of sections. Only supports listing sections for the calling user. To refer to the calling user, set one of the following: - The me alias. For example, users/me. - Their Workspace email address. For example, users/user@example.com. - Their user id. For example, users/123456789. Format: users/{user} Value must have pattern ^users/\[^/\]+$.

pageSize - Optional. The maximum number of sections to return. The service may return fewer than this value. If unspecified, at most 10 sections will be returned. The maximum value is 100. If you use a value more than 100, it's automatically changed to 100. Negative values return an INVALID_ARGUMENT error.

pageToken - Optional. A page token, received from a previous list sections call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided should match the call that provided the page token. Passing different values to the other parameters might lead to unexpected results.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListSectionsResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ListSectionsResponse> list(
  core.String parent, {
  core.int? pageSize,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'pageSize': ?pageSize == null ? null : ['${pageSize}'],
    'pageToken': ?pageToken == null ? null : [pageToken],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/sections';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListSectionsResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}