pub struct UploadMultipartRequest {
pub ref: u32,
pub no_exif: u8,
pub revert: u8,
pub previewonly: Option<bool>,
pub alternative: Option<u32>,
}Fields§
§ref: u32The ID of the resource to upload the file to.
no_exif: u8If 1, skips reading EXIF data from the uploaded file.
revert: u8If 1, reverts to the original file instead of uploading a new one.
previewonly: Option<bool>If set, only generates a preview without replacing the stored file.
alternative: Option<u32>ID of an alternative file slot to upload into instead of the primary file.
Implementations§
Source§impl UploadMultipartRequest
impl UploadMultipartRequest
Sourcepub fn new(ref: u32, no_exif: bool, revert: bool) -> Self
pub fn new(ref: u32, no_exif: bool, revert: bool) -> Self
Examples found in repository?
examples/upload.rs (line 27)
7async fn main() {
8 dotenvy::from_path("examples/.env").ok();
9
10 let base_url = std::env::var("RS_BASE_URL").expect("RS_BASE_URL not set");
11 let user = std::env::var("RS_USER").expect("RS_USER not set");
12 let _password = std::env::var("RS_PASS").expect("RS_PASS not set");
13 let key = std::env::var("RS_KEY").expect("RS_KEY not set");
14
15 let client = Client::builder()
16 .base_url(&base_url)
17 .expect("Error when setting base_url")
18 .user_key(&user, &key)
19 // .session_key(&user, &password)
20 .build()
21 .await
22 .expect("Error when building client");
23
24 let result = client
25 .resource()
26 .upload_multipart(
27 UploadMultipartRequest::new(91287, false, false),
28 Path::new("pexels.jpg"),
29 )
30 .await;
31
32 match result {
33 Ok(response) => println!("{:#?}", response),
34 Err(e) => println!("Error: {}", e),
35 }
36}pub fn previewonly(self, previewonly: bool) -> Self
pub fn alternative(self, alternative: u32) -> Self
Trait Implementations§
Source§impl Clone for UploadMultipartRequest
impl Clone for UploadMultipartRequest
Source§fn clone(&self) -> UploadMultipartRequest
fn clone(&self) -> UploadMultipartRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UploadMultipartRequest
impl Debug for UploadMultipartRequest
Source§impl PartialEq for UploadMultipartRequest
impl PartialEq for UploadMultipartRequest
Source§impl Serialize for UploadMultipartRequest
impl Serialize for UploadMultipartRequest
impl StructuralPartialEq for UploadMultipartRequest
Auto Trait Implementations§
impl Freeze for UploadMultipartRequest
impl RefUnwindSafe for UploadMultipartRequest
impl Send for UploadMultipartRequest
impl Sync for UploadMultipartRequest
impl Unpin for UploadMultipartRequest
impl UnsafeUnpin for UploadMultipartRequest
impl UnwindSafe for UploadMultipartRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more