refactor(api): Audit and cleanup api_hook_client.py and api_hooks.py
This commit is contained in:
@@ -83,6 +83,7 @@ class ApiHookClient:
|
||||
return res
|
||||
|
||||
def post_project(self, project_data: dict) -> dict[str, Any]:
|
||||
"""Updates the current project configuration."""
|
||||
return self._make_request('POST', '/api/project', data=project_data) or {}
|
||||
|
||||
def get_project(self) -> dict[str, Any]:
|
||||
@@ -98,10 +99,12 @@ class ApiHookClient:
|
||||
return self._make_request('POST', '/api/session', data={"session": {"entries": session_entries}}) or {}
|
||||
|
||||
def get_events(self) -> list[dict[str, Any]]:
|
||||
"""Retrieves any pending events from the API event queue."""
|
||||
res = self._make_request('GET', '/api/events')
|
||||
return res.get("events", []) if res else []
|
||||
|
||||
def clear_events(self) -> list[dict[str, Any]]:
|
||||
"""Retrieves and clears the event queue."""
|
||||
return self.get_events()
|
||||
|
||||
|
||||
@@ -241,20 +244,26 @@ class ApiHookClient:
|
||||
return self._make_request('GET', '/api/patch/status') or {}
|
||||
|
||||
def spawn_mma_worker(self, data: dict) -> dict:
|
||||
"""Spawns a new MMA worker with the provided configuration."""
|
||||
return self._make_request('POST', '/api/mma/workers/spawn', data=data) or {}
|
||||
|
||||
def kill_mma_worker(self, worker_id: str) -> dict:
|
||||
"""Kills an active MMA worker by its ID."""
|
||||
return self._make_request('POST', '/api/mma/workers/kill', data={"worker_id": worker_id}) or {}
|
||||
|
||||
def pause_mma_pipeline(self) -> dict:
|
||||
"""Pauses the MMA execution pipeline."""
|
||||
return self._make_request('POST', '/api/mma/pipeline/pause') or {}
|
||||
|
||||
def resume_mma_pipeline(self) -> dict:
|
||||
"""Resumes the MMA execution pipeline."""
|
||||
return self._make_request('POST', '/api/mma/pipeline/resume') or {}
|
||||
|
||||
def inject_context(self, data: dict) -> dict:
|
||||
"""Injects custom file context into the application."""
|
||||
return self._make_request('POST', '/api/context/inject', data=data) or {}
|
||||
|
||||
def mutate_mma_dag(self, data: dict) -> dict:
|
||||
"""Mutates the MMA DAG (Directed Acyclic Graph) structure."""
|
||||
return self._make_request('POST', '/api/mma/dag/mutate', data=data) or {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user