@@ -323,7 +323,9 @@ pub async fn invite_user(
323323pub async fn invite_user_with_photo (
324324 configuration : & configuration:: Configuration ,
325325 user_id : & str ,
326- image : std:: path:: PathBuf ,
326+ image : impl Into < :: std:: borrow:: Cow < ' static , [ u8 ] > > ,
327+ filename : impl Into < :: std:: borrow:: Cow < ' static , str > > ,
328+ mime_type : & str ,
327329 data : models:: InviteRequest ,
328330) -> Result < models:: SentNotification , Error < InviteUserWithPhotoError > > {
329331 // add a prefix to parameters to efficiently prevent name collisions
@@ -344,7 +346,10 @@ pub async fn invite_user_with_photo(
344346 req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
345347 }
346348 let mut multipart_form = reqwest:: multipart:: Form :: new ( ) ;
347- // TODO: support file upload for 'image' parameter
349+ let part = reqwest:: multipart:: Part :: bytes ( p_form_image)
350+ . file_name ( filename)
351+ . mime_str ( mime_type) ?;
352+ multipart_form = multipart_form. part ( "image" , part) ;
348353 multipart_form = multipart_form. text ( "data" , serde_json:: to_string_pretty ( & p_form_data) ?) ;
349354 req_builder = req_builder. multipart ( multipart_form) ;
350355
@@ -434,7 +439,9 @@ pub async fn request_invite(
434439pub async fn request_invite_with_photo (
435440 configuration : & configuration:: Configuration ,
436441 user_id : & str ,
437- image : std:: path:: PathBuf ,
442+ image : impl Into < :: std:: borrow:: Cow < ' static , [ u8 ] > > ,
443+ filename : impl Into < :: std:: borrow:: Cow < ' static , str > > ,
444+ mime_type : & str ,
438445 data : models:: RequestInviteRequest ,
439446) -> Result < models:: Notification , Error < RequestInviteWithPhotoError > > {
440447 // add a prefix to parameters to efficiently prevent name collisions
@@ -455,7 +462,10 @@ pub async fn request_invite_with_photo(
455462 req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
456463 }
457464 let mut multipart_form = reqwest:: multipart:: Form :: new ( ) ;
458- // TODO: support file upload for 'image' parameter
465+ let part = reqwest:: multipart:: Part :: bytes ( p_form_image)
466+ . file_name ( filename)
467+ . mime_str ( mime_type) ?;
468+ multipart_form = multipart_form. part ( "image" , part) ;
459469 multipart_form = multipart_form. text ( "data" , serde_json:: to_string_pretty ( & p_form_data) ?) ;
460470 req_builder = req_builder. multipart ( multipart_form) ;
461471
@@ -601,7 +611,9 @@ pub async fn respond_invite(
601611pub async fn respond_invite_with_photo (
602612 configuration : & configuration:: Configuration ,
603613 notification_id : & str ,
604- image : std:: path:: PathBuf ,
614+ image : impl Into < :: std:: borrow:: Cow < ' static , [ u8 ] > > ,
615+ filename : impl Into < :: std:: borrow:: Cow < ' static , str > > ,
616+ mime_type : & str ,
605617 data : models:: InviteResponse ,
606618) -> Result < models:: Notification , Error < RespondInviteWithPhotoError > > {
607619 // add a prefix to parameters to efficiently prevent name collisions
@@ -622,7 +634,10 @@ pub async fn respond_invite_with_photo(
622634 req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
623635 }
624636 let mut multipart_form = reqwest:: multipart:: Form :: new ( ) ;
625- // TODO: support file upload for 'image' parameter
637+ let part = reqwest:: multipart:: Part :: bytes ( p_form_image)
638+ . file_name ( filename)
639+ . mime_str ( mime_type) ?;
640+ multipart_form = multipart_form. part ( "image" , part) ;
626641 multipart_form = multipart_form. text ( "data" , serde_json:: to_string_pretty ( & p_form_data) ?) ;
627642 req_builder = req_builder. multipart ( multipart_form) ;
628643
0 commit comments