@@ -469,7 +469,7 @@ def row_dict_to_api_dict(self, table_row: Dict[str, Any]) -> Dict[str, Any]:
469469 return ret
470470
471471 @locked
472- def sql_query (self , query : str , data : tuple ) -> List [Dict [str , Any ]]:
472+ def sql_query (self , query : str , data : tuple = tuple () ) -> List [Dict [str , Any ]]:
473473 """
474474 Directly run a query and return the matching rows.
475475
@@ -651,6 +651,12 @@ def get_regular_children(self, parent_id: str) -> List[Dict[str, Any]]:
651651 "parent_id = ? AND shortcut_target IS NULL AND mime_type != ?" ,
652652 (parent_id , 'application/vnd.google-apps.folder' ,)
653653 )
654+
655+ def get_root_my_drive_children (self ) -> List [Dict [str , Any ]]:
656+ return self .sql_query ("length(parent_id) = 19" )
657+
658+ def get_root_shared_with_me_items (self ) -> List [Dict [str , Any ]]:
659+ return self .sql_query ("owner > 1 AND parent_id IS NULL" )
654660
655661 def search_by_name_containing (self , partial_name : str , additional_filters : str = None , additional_params : tuple = None ) -> List [Dict [str , Any ]]:
656662 """
@@ -726,6 +732,8 @@ def get_cache_path_for_file(self, file: dict) -> Path | None:
726732 return self .file_cache_dir / hashval [:2 ] / f"{ hashval [2 :]} { extension } "
727733
728734 def download_file_to_cache (self , file : dict , verbose : bool = False ) -> Path | None :
735+ if not self .file_cache_dir :
736+ return None
729737 if file ['mimeType' ] == 'application/vnd.google-apps.shortcut' :
730738 tfile = self .get_item (file ['shortcutDetails' ]['targetId' ])
731739 if not tfile :
0 commit comments