pub struct FileUploadRequest {
pub key: String,
/* private fields */
}Expand description
File upload request (multipart/form-data)
Sends a multipart request with fields:
- purpose:
FilePurpose - file: file content
Fields§
§key: StringImplementations§
Source§impl FileUploadRequest
impl FileUploadRequest
pub fn new( key: String, purpose: FilePurpose, file_path: impl Into<PathBuf>, ) -> Self
pub fn with_file_name(self, name: impl Into<String>) -> Self
pub fn with_content_type(self, ct: impl Into<String>) -> Self
Sourcepub async fn send(&self) -> ZaiResult<FileObject>
pub async fn send(&self) -> ZaiResult<FileObject>
Send the upload request and parse typed response (FileObject)
Trait Implementations§
Source§impl HttpClient for FileUploadRequest
impl HttpClient for FileUploadRequest
type Body = ()
type ApiUrl = &'static str
type ApiKey = String
fn api_url(&self) -> &Self::ApiUrl
fn api_key(&self) -> &Self::ApiKey
fn body(&self) -> &Self::Body
Source§fn post(&self) -> impl Future<Output = ZaiResult<Response>> + Send
fn post(&self) -> impl Future<Output = ZaiResult<Response>> + Send
Sends a POST request to the API endpoint. Read more
Source§fn http_config(&self) -> Arc<HttpClientConfig>
fn http_config(&self) -> Arc<HttpClientConfig>
Get HTTP client configuration for this request Read more
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