createUser method
- required AuthenticationType authenticationType,
- required String userName,
- String? firstName,
- String? lastName,
- MessageAction? messageAction,
Creates a new user in the user pool.
May throw ResourceAlreadyExistsException. May throw InvalidAccountStatusException. May throw InvalidParameterCombinationException. May throw LimitExceededException. May throw OperationNotPermittedException.
Parameter authenticationType :
The authentication type for the user. You must specify USERPOOL.
Parameter userName :
The email address of the user.
Parameter firstName :
The first name, or given name, of the user.
Parameter lastName :
The last name, or surname, of the user.
Parameter messageAction :
The action to take for the welcome email that is sent to a user after the
user is created in the user pool. If you specify SUPPRESS, no email is
sent. If you specify RESEND, do not specify the first name or last name of
the user. If the value is null, the email is sent.
Implementation
Future<void> createUser({
required AuthenticationType authenticationType,
required String userName,
String? firstName,
String? lastName,
MessageAction? messageAction,
}) async {
ArgumentError.checkNotNull(authenticationType, 'authenticationType');
ArgumentError.checkNotNull(userName, 'userName');
_s.validateStringLength(
'userName',
userName,
1,
128,
isRequired: true,
);
_s.validateStringLength(
'firstName',
firstName,
0,
2048,
);
_s.validateStringLength(
'lastName',
lastName,
0,
2048,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'PhotonAdminProxyService.CreateUser'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AuthenticationType': authenticationType.toValue(),
'UserName': userName,
if (firstName != null) 'FirstName': firstName,
if (lastName != null) 'LastName': lastName,
if (messageAction != null) 'MessageAction': messageAction.toValue(),
},
);
}