Skip to content

Commit 4a37c88

Browse files
committed
feat(python): add overloads for CopilotClient.on()
1 parent f9144f1 commit 4a37c88

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

python/copilot/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import threading
2222
from dataclasses import asdict, is_dataclass
2323
from pathlib import Path
24-
from typing import Any, Callable, Optional, cast
24+
from typing import Any, Callable, Optional, cast, overload
2525

2626
from .generated.rpc import ServerRpc
2727
from .generated.session_events import session_event_from_dict
@@ -1006,9 +1006,16 @@ async def set_foreground_session_id(self, session_id: str) -> None:
10061006
error = response.get("error", "Unknown error")
10071007
raise RuntimeError(f"Failed to set foreground session: {error}")
10081008

1009+
@overload
1010+
def on(self, handler: SessionLifecycleHandler, /) -> ...: ...
1011+
1012+
@overload
1013+
def on(self, event_type: SessionLifecycleEventType, /, handler: ...) -> ...: ...
1014+
10091015
def on(
10101016
self,
10111017
event_type_or_handler: SessionLifecycleEventType | SessionLifecycleHandler,
1018+
/,
10121019
handler: Optional[SessionLifecycleHandler] = None,
10131020
) -> Callable[[], None]:
10141021
"""

0 commit comments

Comments
 (0)