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 Amazon Web Services developer credentials to call this operation.

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

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 {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    60,
    isRequired: true,
  );
  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);
}