@@ -130,10 +130,11 @@ impl Timeline {
130
130
. reply ( params. reply_params . map ( |p| p. try_into ( ) ) . transpose ( ) ?) ;
131
131
132
132
let handle = SendAttachmentJoinHandle :: new ( get_runtime_handle ( ) . spawn ( async move {
133
- let source = if let Some ( bytes) = params. file_data {
134
- AttachmentSource :: Data { bytes, filename : params. filename }
135
- } else {
136
- AttachmentSource :: File ( params. filename . into ( ) )
133
+ let source = match params. source {
134
+ UploadSource :: Data { data, filename } => {
135
+ AttachmentSource :: Data { bytes : data, filename }
136
+ }
137
+ UploadSource :: File { filename } => AttachmentSource :: File ( filename. into ( ) ) ,
137
138
} ;
138
139
let mut request = self . inner . send_attachment ( source, mime_type, attachment_config) ;
139
140
@@ -205,10 +206,8 @@ fn build_thumbnail_info(
205
206
206
207
#[ derive( uniffi:: Record ) ]
207
208
pub struct UploadParameters {
208
- /// Filename (previously called "url") for the media to be sent.
209
- filename : String ,
210
- /// Optional file data - if not present, then data is read from `filename`
211
- file_data : Option < Vec < u8 > > ,
209
+ /// Source from which to upload data
210
+ source : UploadSource ,
212
211
/// Optional non-formatted caption, for clients that support it.
213
212
caption : Option < String > ,
214
213
/// Optional HTML-formatted caption, for clients that support it.
0 commit comments