createUploadFileRequest static method
Creates an UploadFileRequest scoped to one destination and one batch.
receiverId is the recipient user's uid or group's guid;
receiverType is 'user' or 'group'. Every file uploaded through the
returned request presigns against this destination.
Upload is decoupled from send: upload files through the request, then
build a MediaMessage from its attachments (getAttachments /
getAttachmentsByType), optionally setCaption(...) and setMuid(...),
and call sendMediaMessage when ready (send is instant — the bytes are
already uploaded). Call clearAll() on the request after a successful send
to release the batch.
Implementation
static UploadFileRequest createUploadFileRequest(
String receiverId,
String receiverType, {
int? parentMessageId,
}) {
final sdk = SdkRegistry.getInstance();
final request = UploadFileRequest.internal(
sdk.uploads,
receiverId,
receiverType,
);
if (parentMessageId != null) request.setParentMessageId(parentMessageId);
return request;
}