listGroups method
Lists the groups associated with a user pool.
Calling this action requires developer credentials.
May throw InvalidParameterException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw NotAuthorizedException. May throw InternalErrorException.
Parameter userPoolId
:
The user pool ID for the user pool.
Parameter limit
:
The limit of the request to list groups.
Parameter nextToken
:
An identifier that was returned from the previous call to this operation,
which can be used to return the next set of items in the list.
Implementation
Future<ListGroupsResponse> listGroups({
required String userPoolId,
int? limit,
String? nextToken,
}) async {
ArgumentError.checkNotNull(userPoolId, 'userPoolId');
_s.validateStringLength(
'userPoolId',
userPoolId,
1,
55,
isRequired: true,
);
_s.validateNumRange(
'limit',
limit,
0,
60,
);
_s.validateStringLength(
'nextToken',
nextToken,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.ListGroups'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'UserPoolId': userPoolId,
if (limit != null) 'Limit': limit,
if (nextToken != null) 'NextToken': nextToken,
},
);
return ListGroupsResponse.fromJson(jsonResponse.body);
}