createRegistrationAttachment method
Create a new registration attachment to use for uploading a file or a URL to a file. The maximum file size is 500KB and valid file extensions are PDF, JPEG and PNG. For example, many sender ID registrations require a signed “letter of authorization” (LOA) to be submitted.
Use either AttachmentUrl or AttachmentBody to
upload your attachment. If both are specified then an exception is
returned.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter attachmentBody :
The registration file to upload. The maximum file size is 500KB and valid
file extensions are PDF, JPEG and PNG.
Parameter attachmentUrl :
Registration files have to be stored in an Amazon S3 bucket. The URI to
use when sending is in the format s3://BucketName/FileName.
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
attachment.
Implementation
Future<CreateRegistrationAttachmentResult> createRegistrationAttachment({
Uint8List? attachmentBody,
String? attachmentUrl,
String? clientToken,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'PinpointSMSVoiceV2.CreateRegistrationAttachment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (attachmentBody != null)
'AttachmentBody': base64Encode(attachmentBody),
if (attachmentUrl != null) 'AttachmentUrl': attachmentUrl,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
},
);
return CreateRegistrationAttachmentResult.fromJson(jsonResponse.body);
}