adminDeleteUserAttributes method

Future<void> adminDeleteUserAttributes({
  1. required List<String> userAttributeNames,
  2. required String userPoolId,
  3. required String username,
})

Deletes the user attributes in a user pool as an administrator. Works on any user.

Calling this action requires developer credentials.

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

Parameter userAttributeNames : An array of strings representing the user attribute names you wish to delete.

For custom attributes, you must prepend the custom: prefix to the attribute name.

Parameter userPoolId : The user pool ID for the user pool where you want to delete user attributes.

Parameter username : The user name of the user from which you would like to delete attributes.

Implementation

Future<void> adminDeleteUserAttributes({
  required List<String> userAttributeNames,
  required String userPoolId,
  required String username,
}) async {
  ArgumentError.checkNotNull(userAttributeNames, 'userAttributeNames');
  ArgumentError.checkNotNull(userPoolId, 'userPoolId');
  _s.validateStringLength(
    'userPoolId',
    userPoolId,
    1,
    55,
    isRequired: true,
  );
  ArgumentError.checkNotNull(username, 'username');
  _s.validateStringLength(
    'username',
    username,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSCognitoIdentityProviderService.AdminDeleteUserAttributes'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'UserAttributeNames': userAttributeNames,
      'UserPoolId': userPoolId,
      'Username': username,
    },
  );
}