Get metadata for a specific session by ID. This provides an efficient O(1) lookup of a single session's metadata instead of listing all sessions. Returns None if the session is not found. Args: session_id: The ID of the session to look up. Retu
(self, session_id: str)
| 3013 | return [SessionMetadata.from_dict(session) for session in sessions_data] |
| 3014 | |
| 3015 | async def get_session_metadata(self, session_id: str) -> SessionMetadata | None: |
| 3016 | """ |
| 3017 | Get metadata for a specific session by ID. |
| 3018 | |
| 3019 | This provides an efficient O(1) lookup of a single session's metadata |
| 3020 | instead of listing all sessions. Returns None if the session is not found. |
| 3021 | |
| 3022 | Args: |
| 3023 | session_id: The ID of the session to look up. |
| 3024 | |
| 3025 | Returns: |
| 3026 | A SessionMetadata object, or None if the session was not found. |
| 3027 | |
| 3028 | Raises: |
| 3029 | RuntimeError: If the client is not connected. |
| 3030 | |
| 3031 | Example: |
| 3032 | >>> metadata = await client.get_session_metadata("session-123") |
| 3033 | >>> if metadata: |
| 3034 | ... print(f"Session started at: {metadata.start_time}") |
| 3035 | """ |
| 3036 | if not self._client: |
| 3037 | raise RuntimeError("Client not connected") |
| 3038 | |
| 3039 | response = await self._client.request("session.getMetadata", {"sessionId": session_id}) |
| 3040 | session_data = response.get("session") |
| 3041 | if session_data is None: |
| 3042 | return None |
| 3043 | return SessionMetadata.from_dict(session_data) |
| 3044 | |
| 3045 | async def delete_session(self, session_id: str) -> None: |
| 3046 | """ |