File size: 3,196 Bytes
c2ea5ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
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
    @staticmethod
    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
    @staticmethod
    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)
    
    @staticmethod
    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)
    
    @staticmethod
    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)
    
    @staticmethod
    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
    @staticmethod
    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)
    
    @staticmethod
    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
    @staticmethod
    def _save_import_record(*args, **kwargs) -> None:
        """Save an import record. Private implementation detail."""
        ImportService._save_import_record(*args, **kwargs)
    
    @staticmethod
    def _load_import_history(*args, **kwargs) -> List[Dict[str, Any]]:
        """Load import history. Private implementation detail."""
        return ImportService._load_import_history(*args, **kwargs)