pub struct Files { /* private fields */ }Implementations§
Source§impl Files
impl Files
Sourcepub async fn create(&self, file: File) -> Result<CreateFileResponse>
pub async fn create(&self, file: File) -> Result<CreateFileResponse>
初始化一个文件的 resumable upload,并返回原始 HTTP headers(含 x-goog-upload-url)。
该方法只执行 start 请求,不会上传文件内容。
§Errors
当配置无效、请求失败或响应解析失败时返回错误。
Sourcepub async fn create_with_config(
&self,
file: File,
config: CreateFileConfig,
) -> Result<CreateFileResponse>
pub async fn create_with_config( &self, file: File, config: CreateFileConfig, ) -> Result<CreateFileResponse>
Sourcepub async fn upload_with_config(
&self,
data: Vec<u8>,
config: UploadFileConfig,
) -> Result<File>
pub async fn upload_with_config( &self, data: Vec<u8>, config: UploadFileConfig, ) -> Result<File>
Sourcepub async fn upload_from_path_with_config(
&self,
path: impl AsRef<Path>,
config: UploadFileConfig,
) -> Result<File>
pub async fn upload_from_path_with_config( &self, path: impl AsRef<Path>, config: UploadFileConfig, ) -> Result<File>
Sourcepub async fn download_with_config(
&self,
name_or_uri: impl AsRef<str>,
config: DownloadFileConfig,
) -> Result<Vec<u8>>
pub async fn download_with_config( &self, name_or_uri: impl AsRef<str>, config: DownloadFileConfig, ) -> Result<Vec<u8>>
Sourcepub async fn list(&self) -> Result<ListFilesResponse>
pub async fn list(&self) -> Result<ListFilesResponse>
Sourcepub async fn list_with_config(
&self,
config: ListFilesConfig,
) -> Result<ListFilesResponse>
pub async fn list_with_config( &self, config: ListFilesConfig, ) -> Result<ListFilesResponse>
Sourcepub async fn all_with_config(
&self,
config: ListFilesConfig,
) -> Result<Vec<File>>
pub async fn all_with_config( &self, config: ListFilesConfig, ) -> Result<Vec<File>>
Sourcepub async fn get_with_config(
&self,
name_or_uri: impl AsRef<str>,
config: GetFileConfig,
) -> Result<File>
pub async fn get_with_config( &self, name_or_uri: impl AsRef<str>, config: GetFileConfig, ) -> Result<File>
Sourcepub async fn delete_with_config(
&self,
name_or_uri: impl AsRef<str>,
config: DeleteFileConfig,
) -> Result<DeleteFileResponse>
pub async fn delete_with_config( &self, name_or_uri: impl AsRef<str>, config: DeleteFileConfig, ) -> Result<DeleteFileResponse>
Sourcepub async fn register_files(
&self,
uris: Vec<String>,
) -> Result<RegisterFilesResponse>
pub async fn register_files( &self, uris: Vec<String>, ) -> Result<RegisterFilesResponse>
注册 Google Cloud Storage 文件(使其可用于 Gemini Developer API)。
该方法要求客户端使用 OAuth/ADC(即 Credentials::OAuth 或 Credentials::ApplicationDefault),
不支持 API key 认证。
§Errors
当配置无效、请求失败或响应解析失败时返回错误。
Sourcepub async fn register_files_with_config(
&self,
uris: Vec<String>,
config: RegisterFilesConfig,
) -> Result<RegisterFilesResponse>
pub async fn register_files_with_config( &self, uris: Vec<String>, config: RegisterFilesConfig, ) -> Result<RegisterFilesResponse>
Sourcepub async fn wait_for_active(
&self,
name_or_uri: impl AsRef<str>,
config: WaitForFileConfig,
) -> Result<File>
pub async fn wait_for_active( &self, name_or_uri: impl AsRef<str>, config: WaitForFileConfig, ) -> Result<File>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Files
impl !RefUnwindSafe for Files
impl Send for Files
impl Sync for Files
impl Unpin for Files
impl UnsafeUnpin for Files
impl !UnwindSafe for Files
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