async def create_protocol_file( protocol_id: str, file: UploadFile = File(...), protocol_manager: ProtocolManager = Depends(get_protocol_manager)): proto = protocol_manager.get(protocol_id) proto.add(file) return route_models.ProtocolResponse(data=_to_response(proto))
async def delete_protocol( protocolId: str, protocol_manager: ProtocolManager = Depends(get_protocol_manager)): proto = protocol_manager.remove(protocolId) return route_models.ProtocolResponse( data=_to_response(proto), links=get_root_links(router), )
async def get_protocol( protocolId: str, protocol_manager: ProtocolManager = Depends(get_protocol_manager)): proto = protocol_manager.get(protocolId) return route_models.ProtocolResponse( data=_to_response(proto), links=get_protocol_links(router, proto.meta.identifier) )
async def create_protocol_file( protocolId: str, file: UploadFile = File(...), protocol_manager: ProtocolManager = Depends(get_protocol_manager)): proto = protocol_manager.get(protocolId) proto.add(file) return route_models.ProtocolResponse( data=_to_response(proto), links=get_protocol_links(router, proto.meta.identifier), )
async def create_protocol( protocol_file: UploadFile = File(..., description="The protocol file"), support_files: typing.List[UploadFile] = Body( default=list(), description="Any support files needed by the protocol (ie data " "files, additional python files)"), protocol_manager=Depends(get_protocol_manager)): """Create protocol from proto file plus optional support files""" new_proto = protocol_manager.create( protocol_file=protocol_file, support_files=support_files, ) return route_models.ProtocolResponse(data=_to_response(new_proto))
async def delete_protocol( protocol_id: str, protocol_manager: ProtocolManager = Depends(get_protocol_manager)): proto = protocol_manager.remove(protocol_id) return route_models.ProtocolResponse(data=_to_response(proto))