fix: Fix session API format and missing client methods
This commit is contained in:
@@ -53,6 +53,10 @@ class ApiHookClient:
|
||||
return {}
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def post_project(self, project_data: dict) -> dict[str, Any]:
|
||||
return self._make_request('POST', '/api/project', data=project_data) or {}
|
||||
def get_project(self) -> dict[str, Any]:
|
||||
"""Retrieves the current project state."""
|
||||
return self._make_request('GET', '/api/project') or {}
|
||||
@@ -63,7 +67,15 @@ class ApiHookClient:
|
||||
|
||||
def post_session(self, session_entries: list[dict]) -> dict[str, Any]:
|
||||
"""Updates the session history."""
|
||||
return self._make_request('POST', '/api/session', data={"entries": session_entries}) or {}
|
||||
return self._make_request('POST', '/api/session', data={"session": {"entries": session_entries}}) or {}
|
||||
|
||||
|
||||
def get_events(self) -> list[dict[str, Any]]:
|
||||
res = self._make_request('GET', '/api/events')
|
||||
return res.get("events", []) if res else []
|
||||
|
||||
def clear_events(self) -> list[dict[str, Any]]:
|
||||
return self.get_events()
|
||||
|
||||
def post_gui(self, payload: dict) -> dict[str, Any]:
|
||||
"""Pushes an event to the GUI's SyncEventQueue via the /api/gui endpoint."""
|
||||
|
||||
Reference in New Issue
Block a user