listGroups method

Future<ListGroupsResponse> listGroups({
  1. required String applicationId,
  2. required String indexId,
  3. required DateTime updatedEarlierThan,
  4. String? dataSourceId,
  5. int? maxResults,
  6. String? nextToken,
})

Provides a list of groups that are mapped to users.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter applicationId : The identifier of the application for getting a list of groups mapped to users.

Parameter indexId : The identifier of the index for getting a list of groups mapped to users.

Parameter updatedEarlierThan : The timestamp identifier used for the latest PUT or DELETE action for mapping users to their groups.

Parameter dataSourceId : The identifier of the data source for getting a list of groups mapped to users.

Parameter maxResults : The maximum number of returned groups that are mapped to users.

Parameter nextToken : If the previous response was incomplete (because there is more data to retrieve), Amazon Q Business returns a pagination token in the response. You can use this pagination token to retrieve the next set of groups that are mapped to users.

Implementation

Future<ListGroupsResponse> listGroups({
  required String applicationId,
  required String indexId,
  required DateTime updatedEarlierThan,
  String? dataSourceId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    10,
  );
  final $query = <String, List<String>>{
    'updatedEarlierThan': [_s.iso8601ToJson(updatedEarlierThan).toString()],
    if (dataSourceId != null) 'dataSourceId': [dataSourceId],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/applications/${Uri.encodeComponent(applicationId)}/indices/${Uri.encodeComponent(indexId)}/groups',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListGroupsResponse.fromJson(response);
}