listUserPools method

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

Lists the user pools associated with an AWS account.

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

Parameter maxResults : The maximum number of results you want the request to return when listing the user pools.

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<ListUserPoolsResponse> listUserPools({
  required int maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(maxResults, 'maxResults');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    60,
    isRequired: true,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  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);
}