pub struct FileUploadRequest { /* private fields */ }Expand description
File upload request (multipart/form-data)
Sends a multipart request with fields:
- purpose:
FileUploadPurpose - file: file content
Implementations§
Source§impl FileUploadRequest
impl FileUploadRequest
Sourcepub fn new(purpose: FileUploadPurpose, file_path: impl Into<PathBuf>) -> Self
pub fn new(purpose: FileUploadPurpose, file_path: impl Into<PathBuf>) -> Self
Create a new upload request for the given purpose and local file path.
Sourcepub fn with_file_name(self, name: impl Into<String>) -> Self
pub fn with_file_name(self, name: impl Into<String>) -> Self
Override the uploaded file name (defaults to the path’s file name).
Sourcepub fn with_content_type(self, ct: impl Into<String>) -> Self
pub fn with_content_type(self, ct: impl Into<String>) -> Self
Override the MIME content type of the upload.
Sourcepub async fn send_via(
&self,
client: &ZaiClient,
) -> ZaiResult<FileUploadResponse>
pub async fn send_via( &self, client: &ZaiClient, ) -> ZaiResult<FileUploadResponse>
Send the upload request and parse the returned FileObject.
The local file is reopened, revalidated, and streamed for each transport attempt. It is never buffered in full by this request builder.
Auto Trait Implementations§
impl Freeze for FileUploadRequest
impl RefUnwindSafe for FileUploadRequest
impl Send for FileUploadRequest
impl Sync for FileUploadRequest
impl Unpin for FileUploadRequest
impl UnsafeUnpin for FileUploadRequest
impl UnwindSafe for FileUploadRequest
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