Add method for tag and operation

This commit is contained in:
DingZQ
2023-02-27 23:17:35 +08:00
parent 0e8388859a
commit 2e5705e2f2

16
main.py
View File

@@ -163,6 +163,22 @@ async def fastapi_redo(network: str):
async def fastapi_have_snapshot(network: str, tag: str) -> bool:
return have_snapshot(network, tag)
@app.get('/havesnapshotforoperation/')
async def fastapi_have_snapshot_for_operation(network: str, operation: int) -> bool:
return have_snapshot_for_operation(network, operation)
@app.get('/havesnapshotforcurrentoperation/')
async def fastapi_have_snapshot_for_current_operation(network: str) -> bool:
return have_snapshot_for_current_operation(network)
@app.post('/takesnapshotforoperation/')
async def fastapi_take_snapshot_for_operation(network: str, operation: int, tag: str) -> None:
return take_snapshot_for_operation(network, operation, tag)
@app.post('takenapshotforcurrentoperation')
async def fastapi_take_snapshot_for_current_operation(network: str, tag: str) -> None:
return take_snapshot_for_current_operation(network, tag)
@app.post('/takesnapshot/')
def fastapi_take_snapshot(network: str, tag: str) -> int | None:
return take_snapshot(network, tag)