addCustomAttributes method

Future<void> addCustomAttributes({
  1. required List<SchemaAttributeType> customAttributes,
  2. required String userPoolId,
})

Adds additional user attributes to the user pool schema.

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

Parameter customAttributes : An array of custom attributes, such as Mutable and Name.

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

Implementation

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