Expose stop timer through rest api.

This commit is contained in:
Toke Stuart Jepsen 2021-07-30 12:12:56 +01:00
parent c9d90c1c3c
commit 7ec2cf7352

View file

@ -3,6 +3,7 @@ from openpype.api import Logger
log = Logger().get_logger("Event processor")
class TimersManagerModuleRestApi:
"""
REST API endpoint used for calling from hosts when context change
@ -22,6 +23,11 @@ class TimersManagerModuleRestApi:
self.prefix + "/start_timer",
self.start_timer
)
self.server_manager.add_route(
"POST",
self.prefix + "/stop_timer",
self.stop_timer
)
async def start_timer(self, request):
data = await request.json()
@ -38,3 +44,7 @@ class TimersManagerModuleRestApi:
self.module.stop_timers()
self.module.start_timer(project_name, asset_name, task_name, hierarchy)
return Response(status=200)
async def stop_timer(self, request):
self.module.stop_timers()
return Response(status=200)