@@ -95,7 +95,9 @@ pub async fn delete_print(
9595pub async fn edit_print (
9696 configuration : & configuration:: Configuration ,
9797 print_id : & str ,
98- image : std:: path:: PathBuf ,
98+ image : impl Into < :: std:: borrow:: Cow < ' static , [ u8 ] > > ,
99+ filename : impl Into < :: std:: borrow:: Cow < ' static , str > > ,
100+ mime_type : & str ,
99101 note : Option < & str > ,
100102) -> Result < models:: Print , Error < EditPrintError > > {
101103 // add a prefix to parameters to efficiently prevent name collisions
@@ -116,7 +118,10 @@ pub async fn edit_print(
116118 req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
117119 }
118120 let mut multipart_form = reqwest:: multipart:: Form :: new ( ) ;
119- // TODO: support file upload for 'image' parameter
121+ let part = reqwest:: multipart:: Part :: bytes ( p_form_image)
122+ . file_name ( filename)
123+ . mime_str ( mime_type) ?;
124+ multipart_form = multipart_form. part ( "image" , part) ;
120125 if let Some ( param_value) = p_form_note {
121126 multipart_form = multipart_form. text ( "note" , param_value. to_string ( ) ) ;
122127 }
@@ -250,7 +255,9 @@ pub async fn get_user_prints(
250255/// Uploads and creates a print.
251256pub async fn upload_print (
252257 configuration : & configuration:: Configuration ,
253- image : std:: path:: PathBuf ,
258+ image : impl Into < :: std:: borrow:: Cow < ' static , [ u8 ] > > ,
259+ filename : impl Into < :: std:: borrow:: Cow < ' static , str > > ,
260+ mime_type : & str ,
254261 timestamp : String ,
255262 note : Option < & str > ,
256263 world_id : Option < & str > ,
@@ -272,7 +279,10 @@ pub async fn upload_print(
272279 req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
273280 }
274281 let mut multipart_form = reqwest:: multipart:: Form :: new ( ) ;
275- // TODO: support file upload for 'image' parameter
282+ let part = reqwest:: multipart:: Part :: bytes ( p_form_image)
283+ . file_name ( filename)
284+ . mime_str ( mime_type) ?;
285+ multipart_form = multipart_form. part ( "image" , part) ;
276286 multipart_form = multipart_form. text ( "timestamp" , p_form_timestamp. to_string ( ) ) ;
277287 if let Some ( param_value) = p_form_note {
278288 multipart_form = multipart_form. text ( "note" , param_value. to_string ( ) ) ;
0 commit comments