diff --git a/main.py b/main.py index 55dd907..3b54284 100644 --- a/main.py +++ b/main.py @@ -837,7 +837,30 @@ async def fastapi_delete_link(network: str, link: str) -> ChangeSet: elif is_valve(network, link): return delete_valve(network, ChangeSet(ps)) +############################################################ +# tag 8.[TAGS] +############################################################ +# +# TAG_TYPE_NODE = api.TAG_TYPE_NODE +# TAG_TYPE_LINK = api.TAG_TYPE_LINK +# +@app.get('/gettagschema/') +async def fastapi_get_tag_schema(network: str) -> dict[str, dict[str, Any]]: + return get_tag_schema(network) + +@app.get('/gettagproperties/') +async def fastapi_get_tag(network: str, t_type: str, id: str) -> dict[str, Any]: + return get_tag(network, t_type, id) + +# example: +# set_tag(p, ChangeSet({'t_type': TAG_TYPE_NODE, 'id': 'j1', 'tag': 'j1t' })) +# set_tag(p, ChangeSet({'t_type': TAG_TYPE_LINK, 'id': 'p0', 'tag': 'p0t' })) +@app.post('/settagproperties/') +async def set_tag(network: str, req: Request) -> ChangeSet: + props = await req.json() + return set_tag(network, ChangeSet(props)) + ############################################################ # demand 9.[DEMANDS] ############################################################ @@ -1075,6 +1098,13 @@ async def fastapi_set_option_properties(network: str, req: Request) -> ChangeSet return set_option(network, ChangeSet(props)) +############################################################ +# coord 24.[COORDINATES] +############################################################ +@app.get("/getnodecoord/") +async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] | None: + return get_node_coord(network, node) + ############################################################ # vertex 25.[VERTICES] ############################################################