initial commit
This commit is contained in:
24
domain/ports.py
Normal file
24
domain/ports.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
from domain.entities import ApiResponse
|
||||
|
||||
|
||||
class RailwayApiPort(ABC):
|
||||
"""Port (interfejs) do komunikacji z API kolejowym."""
|
||||
|
||||
@abstractmethod
|
||||
def send_action(self, action: str, **params: Any) -> ApiResponse:
|
||||
...
|
||||
|
||||
|
||||
class EventBusPort(ABC):
|
||||
"""Port do architektury opartej o zdarzenia (event-driven)."""
|
||||
|
||||
@abstractmethod
|
||||
def emit(self, event: str, data: dict[str, Any]) -> None:
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def on(self, event: str, callback: Any) -> None:
|
||||
...
|
||||
Reference in New Issue
Block a user