async def _generate_file_entities(
        self, client: httpx.AsyncClient, folder_breadcrumbs: List[Breadcrumb], folder_path: str = ""
    ) -> AsyncGenerator[ChunkEntity, None]:
        """Generate file entities within a given folder using the Dropbox API."""
        # Use list_folder API to get files in the folder
        url = "https://api.dropboxapi.com/2/files/list_folder"
        continue_url = "https://api.dropboxapi.com/2/files/list_folder/continue"

        data = {
            "path": folder_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 files (not folders)
                if entry.get(".tag") == "file":
                    # Skip non-downloadable files
                    if not entry.get("is_downloadable", True):
                        logger.info(
                            f"Skipping non-downloadable file: "
                            f"{entry.get('path_display', 'unknown path')}"
                        )
                        continue

                    # Create file entity with Dropbox-specific download metadata
                    file_entity = self._create_file_entity(entry, folder_breadcrumbs)

                    try:
                        # Use the BaseSource helper method instead of direct file_manager calls
                        processed_entity = await self.process_file_entity(
                            file_entity=file_entity,
                            access_token=self.access_token,
                            headers=file_entity.sync_metadata.get("headers"),
                        )

                        yield processed_entity

                    except Exception as e:
                        logger.error(f"Failed to process file {file_entity.name}: {str(e)}")
                        # Continue with other files even if one fails
                        continue

        except Exception as e:
            logger.error(f"Error listing files in Dropbox folder {folder_path}: {str(e)}")
            raise
Generate file entities within a given folder using the Dropbox API.
backend/airweave/platform/sources/dropbox.py