INNER CODE UNIT · Python
get_leader
cmu-sei/GHOSTS · experimental/grms/grms/main.py:311
async def get_leader(leader_id: UUID):
if leader_id not in leaders:
raise HTTPException(404, "Leader not found")
return leaders[leader_id]
@app.put("/api/v1/leaders/{leader_id}/context", response_model=LeaderProfile)
async def update_leader_context(leader_id: UUID, context: LeaderDecisionContext):
if leader_id not in leaders:
raise HTTPException(404, "Leader not found")
leaders[leader_id].decision_context = context
return leaders[leader_id]
@app.get("/api/v1/leaders", response_model=list[LeaderProfile])
async def list_leaders(period: str | None = None):
if period:
return [l for l in leaders.values() if l.period == period]