createRegistration method
Creates a new registration based on the RegistrationType field.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter registrationType :
The type of registration form to create. The list of
RegistrationTypes can be found using the
DescribeRegistrationTypeDefinitions action.
Parameter clientToken :
Unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If you don't specify a client token, a
randomly generated token is used for the request to ensure idempotency.
Parameter tags :
An array of tags (key and value pairs) to associate with the registration.
Implementation
Future<CreateRegistrationResult> createRegistration({
required String registrationType,
String? clientToken,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.CreateRegistration'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'RegistrationType': registrationType,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
},
);
return CreateRegistrationResult.fromJson(jsonResponse.body);
}