listUserPools method

Future<ListUserPoolsResponse> listUserPools({
  1. required int maxResults,
  2. String? nextToken,
})

Lists user pools and their details in the current Amazon Web Services account.

Learn more

May throw InternalErrorException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw TooManyRequestsException.

Parameter maxResults : The maximum number of user pools that you want Amazon Cognito to return in the response.

Parameter nextToken : This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

Implementation

Future<ListUserPoolsResponse> listUserPools({
  required int maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    60,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.ListUserPools'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListUserPoolsResponse.fromJson(jsonResponse.body);
}