Spaces:
Running
Running
| """ | |
| Platform services for connecting to and importing data from external platforms | |
| This module provides functionality for: | |
| 1. Connecting to external platforms (ConnectionService) | |
| 2. Importing data from those platforms (ImportService) | |
| 3. Managing and retrieving trace data (TraceService) | |
| The PlatformService class serves as a façade that combines these functionalities | |
| for backward compatibility with existing code. | |
| """ | |
| from typing import Dict, List, Any, Optional | |
| from .connection_service import ConnectionService | |
| from .import_service import ImportService | |
| from .trace_service import TraceService | |
| # Re-export functionality for backwards compatibility | |
| class PlatformService: | |
| """ | |
| Main platform service that combines functionalities from | |
| connection, import, and trace services | |
| This class follows the Façade pattern, delegating to specialized services | |
| while maintaining a simple interface for clients. | |
| """ | |
| # Connection methods | |
| def connect_platform(*args, **kwargs) -> Dict[str, Any]: | |
| """Connect to a platform. See ConnectionService.connect_platform for details.""" | |
| return ConnectionService.connect_platform(*args, **kwargs) | |
| # Import methods | |
| def import_platform_data(*args, **kwargs) -> Dict[str, Any]: | |
| """Import data from a platform. See ImportService.import_platform_data for details.""" | |
| return ImportService.import_platform_data(*args, **kwargs) | |
| def import_traces_by_id(*args, **kwargs) -> Dict[str, Any]: | |
| """Import traces by their IDs. See ImportService.import_traces_by_id for details.""" | |
| return ImportService.import_traces_by_id(*args, **kwargs) | |
| def import_selected_traces(*args, **kwargs) -> Dict[str, Any]: | |
| """Import selected traces. See ImportService.import_selected_traces for details.""" | |
| return ImportService.import_selected_traces(*args, **kwargs) | |
| def get_recent_imports(*args, **kwargs) -> List[Dict[str, Any]]: | |
| """Get recent imports. See ImportService.get_recent_imports for details.""" | |
| return ImportService.get_recent_imports(*args, **kwargs) | |
| # Trace methods | |
| def get_trace_metadata(*args, **kwargs) -> Dict[str, Any]: | |
| """Get trace metadata. See TraceService.get_trace_metadata for details.""" | |
| return TraceService.get_trace_metadata(*args, **kwargs) | |
| def get_trace_by_id(*args, **kwargs) -> Dict[str, Any]: | |
| """Get a trace by its ID. See TraceService.get_trace_by_id for details.""" | |
| return TraceService.get_trace_by_id(*args, **kwargs) | |
| # These methods are kept private as they are implementation details | |
| def _save_import_record(*args, **kwargs) -> None: | |
| """Save an import record. Private implementation detail.""" | |
| ImportService._save_import_record(*args, **kwargs) | |
| def _load_import_history(*args, **kwargs) -> List[Dict[str, Any]]: | |
| """Load import history. Private implementation detail.""" | |
| return ImportService._load_import_history(*args, **kwargs) | |