Merge branch 'main' into drive_files_pagination_fix

This commit is contained in:
Taylor Wilsdon
2026-02-27 13:20:35 -04:00
committed by GitHub
4 changed files with 396 additions and 11 deletions

View File

@@ -182,6 +182,7 @@ def build_drive_list_params(
include_items_from_all_drives: bool = True,
corpora: Optional[str] = None,
page_token: Optional[str] = None,
detailed: bool = True,
) -> Dict[str, Any]:
"""
Helper function to build common list parameters for Drive API calls.
@@ -193,14 +194,20 @@ def build_drive_list_params(
include_items_from_all_drives: Whether to include items from all drives
corpora: Optional corpus specification
page_token: Optional page token for pagination (from a previous nextPageToken)
detailed: Whether to request size, modifiedTime, and webViewLink fields.
Defaults to True to preserve existing behavior.
Returns:
Dictionary of parameters for Drive API list calls
"""
if detailed:
fields = "nextPageToken, files(id, name, mimeType, webViewLink, iconLink, modifiedTime, size)"
else:
fields = "nextPageToken, files(id, name, mimeType)"
list_params = {
"q": query,
"pageSize": page_size,
"fields": "nextPageToken, files(id, name, mimeType, webViewLink, iconLink, modifiedTime, size)",
"fields": fields,
"supportsAllDrives": True,
"includeItemsFromAllDrives": include_items_from_all_drives,
}