pub struct FilesApi<'a> { /* private fields */ }Expand description
Files API façade.
Implementations§
Source§impl<'a> FilesApi<'a>
impl<'a> FilesApi<'a>
Sourcepub fn new(client: &'a DriveClient) -> Self
pub fn new(client: &'a DriveClient) -> Self
Wraps an existing DriveClient for file operations.
Sourcepub async fn search(
&self,
query: Option<&str>,
limit: usize,
page_token: Option<&str>,
) -> Result<FileListResponse>
pub async fn search( &self, query: Option<&str>, limit: usize, page_token: Option<&str>, ) -> Result<FileListResponse>
Searches files matching query, returning a single page.
limit is rejected client-side when it exceeds MAX_PAGE_LIMIT;
use Self::search_all to auto-paginate across pages.
Sourcepub async fn search_all(
&self,
query: Option<&str>,
limit: usize,
) -> Result<FileListResponse>
pub async fn search_all( &self, query: Option<&str>, limit: usize, ) -> Result<FileListResponse>
Searches files, auto-paginating via cursor as needed.
limit == 0 means “fetch every match up to HARD_CAP” — a
deliberate safety limit for this interactive surface.
Sourcepub async fn get_metadata(&self, file_id: &str) -> Result<DriveFile>
pub async fn get_metadata(&self, file_id: &str) -> Result<DriveFile>
Fetches a single file’s metadata (files.get), including
exportLinks.
Sourcepub async fn export(
&self,
file_id: &str,
export_mime_type: &str,
) -> Result<Vec<u8>>
pub async fn export( &self, file_id: &str, export_mime_type: &str, ) -> Result<Vec<u8>>
Exports a Google-native file’s content as export_mime_type
(files.export). Drive limits export responses to 10 MB — a larger
document surfaces as an ApiRequestFailed from
DriveClient::response_to_error.
Sourcepub async fn download(&self, file_id: &str) -> Result<Vec<u8>>
pub async fn download(&self, file_id: &str) -> Result<Vec<u8>>
Downloads a non-Google-native file’s raw bytes
(files.get?alt=media).
Sourcepub async fn rename(&self, file_id: &str, new_name: &str) -> Result<DriveFile>
pub async fn rename(&self, file_id: &str, new_name: &str) -> Result<DriveFile>
Renames a file (files.update with a name body, no parents
change — renaming never affects visibility, see ADR-0070). Requires
the drive.metadata scope (drive auth login --write).
Sourcepub async fn move_to(
&self,
file_id: &str,
add_parents: &str,
remove_parents: &str,
) -> Result<DriveFile>
pub async fn move_to( &self, file_id: &str, add_parents: &str, remove_parents: &str, ) -> Result<DriveFile>
Moves a file between folders (files.update with addParents/
removeParents query params, comma-separated file ids — Drive v3 has
no separate move endpoint). Requires the drive.metadata scope
(drive auth login --write).
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FilesApi<'a>
impl<'a> !UnwindSafe for FilesApi<'a>
impl<'a> Freeze for FilesApi<'a>
impl<'a> Send for FilesApi<'a>
impl<'a> Sync for FilesApi<'a>
impl<'a> Unpin for FilesApi<'a>
impl<'a> UnsafeUnpin for FilesApi<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more