listIdentities method

Future<ListIdentitiesResponse> listIdentities({
  1. required String identityPoolId,
  2. required int maxResults,
  3. bool? hideDisabled,
  4. String? nextToken,
})

Lists the identities in an identity pool.

You must use AWS Developer credentials to call this API.

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

Parameter identityPoolId : An identity pool ID in the format REGION:GUID.

Parameter maxResults : The maximum number of identities to return.

Parameter hideDisabled : An optional boolean parameter that allows you to hide disabled identities. If omitted, the ListIdentities API will include disabled identities in the response.

Parameter nextToken : A pagination token.

Implementation

Future<ListIdentitiesResponse> listIdentities({
  required String identityPoolId,
  required int maxResults,
  bool? hideDisabled,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(identityPoolId, 'identityPoolId');
  _s.validateStringLength(
    'identityPoolId',
    identityPoolId,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(maxResults, 'maxResults');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    60,
    isRequired: true,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    65535,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityService.ListIdentities'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IdentityPoolId': identityPoolId,
      'MaxResults': maxResults,
      if (hideDisabled != null) 'HideDisabled': hideDisabled,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListIdentitiesResponse.fromJson(jsonResponse.body);
}