diff --git a/main.py b/main.py index 4603fd8..45164d3 100644 --- a/main.py +++ b/main.py @@ -938,6 +938,43 @@ async def fastapi_set_curve_properties(network: str, curve: str, req: Request) - ps = { 'id' : curve } | props return set_curve(network, ChangeSet(ps)) + +############################################################ +# control 13.[CONTROLS] +############################################################ +@app.get('/getcontrolschema') +async def fastapi_get_control_schema(network: str) -> dict[str, dict[str, Any]]: + return get_control_schema(network) + +@app.get("/getcontrolproperties/") +async def fastapi_get_control_properties(control: str) -> dict[str, Any]: + return get_control(control) + +# example: set_control(p, ChangeSet({'control': 'x'})) +@app.post("/setcontrolproperties/") +async def fastapi_set_control(control: str, req: Request) -> ChangeSet: + props = await req.json() + return set_control(control, ChangeSet(props)) + +############################################################ +# rule 14.[RULES] +############################################################ + +@app.get("/getruleschema/") +async def fastapi_get_rule_schema(network: str) -> dict[str, dict[str, Any]]: + return get_rule_schema(network) + +@app.get("/getruleproperties/") +async def fastapi_get_rule(rule: str) -> dict[str, Any]: + return get_rule(rule) + +# example: set_rule(p, ChangeSet({'rule': 'x'})) +@app.post("/setruleproperties/") +async def fastapi_set_rule(rule: str, req: Request) -> ChangeSet: + props = await req.json() + return set_rule(rule, props) + + ############################################################ # emitter 16.[EMITTERS] ############################################################