pub struct File {
pub id: String,
pub object: String,
pub bytes: usize,
pub created_at: usize,
pub filename: String,
pub purpose: String,
}
Expand description
Upload, download and delete a file from the openai platform.
Fields§
§id: String
The unique id for this uploaded the in the openai platform. This id is generated by openai for each uploaded file.
object: String
The object type uploaded. ie: “file”
bytes: usize
The size in bytes of the uploaded file.
created_at: usize
Unix timestamp, seconds since epoch, of when the file was uploaded.
filename: String
The name of the file uploaded.
purpose: String
The purpose of the file. ie: “fine-tine”
Implementations§
Source§impl File
impl File
Sourcepub fn builder() -> FileUploadBuilder
pub fn builder() -> FileUploadBuilder
New FileUploadBuilder
Sourcepub async fn delete(
id: &str,
credentials: Credentials,
) -> ApiResponseOrError<DeletedFile>
pub async fn delete( id: &str, credentials: Credentials, ) -> ApiResponseOrError<DeletedFile>
Delete a file from openai platform by id.
Sourcepub async fn get(id: &str) -> ApiResponseOrError<File>
👎Deprecated since 1.0.0-alpha.16: use fetch
instead
pub async fn get(id: &str) -> ApiResponseOrError<File>
fetch
insteadGet a file from openai platform by id.
Sourcepub async fn fetch(
id: &str,
credentials: Credentials,
) -> ApiResponseOrError<File>
pub async fn fetch( id: &str, credentials: Credentials, ) -> ApiResponseOrError<File>
Get a file from openai platform by id.
Sourcepub async fn get_content_bytes(id: &str) -> ApiResponseOrError<Vec<u8>>
👎Deprecated since 1.0.0-alpha.16: use fetch_content_bytes
instead
pub async fn get_content_bytes(id: &str) -> ApiResponseOrError<Vec<u8>>
fetch_content_bytes
insteadDownload a file as bytes into memory by id.
Sourcepub async fn fetch_content_bytes(
id: &str,
credentials: Credentials,
) -> ApiResponseOrError<Vec<u8>>
pub async fn fetch_content_bytes( id: &str, credentials: Credentials, ) -> ApiResponseOrError<Vec<u8>>
Download a file as bytes into memory by id.
Sourcepub async fn download_content_to_file(
id: &str,
file_path: &str,
credentials: Credentials,
) -> ApiResponseOrError<()>
pub async fn download_content_to_file( id: &str, file_path: &str, credentials: Credentials, ) -> ApiResponseOrError<()>
Download a file to a new local file by id.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for File
impl<'de> Deserialize<'de> for File
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
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