async def _generate_folder_entities(
        self,
        client: httpx.AsyncClient,
        account_breadcrumb: Breadcrumb,
    ) -> AsyncGenerator[ChunkEntity, None]:
        """Generate folder entities for a given Dropbox account."""
        # Start with the root folder
        url = "https://api.dropboxapi.com/2/files/list_folder"
        continue_url = "https://api.dropboxapi.com/2/files/list_folder/continue"

        # Process all folders breadth-first
        folders_to_process = [("", "Root")]  # Start with root (path, name)

        while folders_to_process:
            current_path, current_name = folders_to_process.pop(0)

            # Configure to list the current folder
            data = {
                "path": current_path,
                "recursive": False,
                "include_deleted": False,
                "include_has_explicit_shared_members": True,
                "include_mounted_folders": True,
                "include_non_downloadable_files": True,
            }

            try:
                # Use our reusable pagination helper
                async for entry in self._get_paginated_entries(client, url, data, continue_url):
                    # Only process folders
                    if entry.get(".tag") == "folder":
                        # Create entity and get path for further processing
                        folder_entity, folder_path = self._create_folder_entity(
                            entry, account_breadcrumb
                        )
                        yield folder_entity

                        # Add this folder to be processed (for recursion)
                        folders_to_process.append((folder_path, folder_entity.name))

            except Exception as e:
                logger.error(f"Error listing Dropbox folder {current_path}: {str(e)}")
                raise
Generate folder entities for a given Dropbox account.
backend/airweave/platform/sources/dropbox.py