adminListUserAuthEvents method

Future<AdminListUserAuthEventsResponse> adminListUserAuthEvents({
  1. required String userPoolId,
  2. required String username,
  3. int? maxResults,
  4. String? nextToken,
})

Lists a history of user activity and any risks detected as part of Amazon Cognito advanced security.

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

Parameter userPoolId : The user pool ID.

Parameter username : The user pool username or an alias.

Parameter maxResults : The maximum number of authentication events to return.

Parameter nextToken : A pagination token.

Implementation

Future<AdminListUserAuthEventsResponse> adminListUserAuthEvents({
  required String userPoolId,
  required String username,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(username, 'username');
  _s.validateStringLength(
    'username',
    username,
    1,
    128,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    60,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSCognitoIdentityProviderService.AdminListUserAuthEvents'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'UserPoolId': userPoolId,
      'Username': username,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return AdminListUserAuthEventsResponse.fromJson(jsonResponse.body);
}