getAttachment method

Future<GetAttachmentResponse> getAttachment({
  1. required String attachmentId,
  2. required String connectionToken,
})

Provides a pre-signed URL for download of a completed attachment. This is an asynchronous API for use with active contacts.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter attachmentId : A unique identifier for the attachment.

Parameter connectionToken : The authentication token associated with the participant's connection.

Implementation

Future<GetAttachmentResponse> getAttachment({
  required String attachmentId,
  required String connectionToken,
}) async {
  ArgumentError.checkNotNull(attachmentId, 'attachmentId');
  _s.validateStringLength(
    'attachmentId',
    attachmentId,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(connectionToken, 'connectionToken');
  _s.validateStringLength(
    'connectionToken',
    connectionToken,
    1,
    1000,
    isRequired: true,
  );
  final headers = <String, String>{
    'X-Amz-Bearer': connectionToken.toString(),
  };
  final $payload = <String, dynamic>{
    'AttachmentId': attachmentId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/participant/attachment',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetAttachmentResponse.fromJson(response);
}