async def root(): """ Return home page of api """ response = {"title": "Graph DB API"} response.update({'links': get_links(app)}) return response
async def get_activities(self, response: Response): """ Get activities from database """ get_response = self.activity_service.get_activities() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_recordings(self, response: Response): """ Get recordingss from database """ get_response = self.recording_service.get_recordings() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_node(self, id: int, response: Response): """ Get node with same id as given """ node = self.node_service.get_node(id) if node.errors is not None: response.status_code = 404 node.links = get_links(router) return node
async def get_participant_states(self, response: Response): """ Get participant states from database """ get_response = self.participant_state_service.get_participant_states() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_time_series_nodes(self, response: Response): """ Get time series nodes from database """ get_response = self.time_series_service.get_time_series_nodes() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_measures(self, response: Response): """ Get measures from database """ get_response = self.measure_service.get_measures() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_nodes(self, label: str, response: Response): """ Get nodes with same label as given """ nodes = self.node_service.get_nodes(label) if nodes.errors is not None: response.status_code = 422 nodes.links = get_links(router) return nodes
async def get_channels(self, response: Response): """ Get channels from database """ get_response = self.channel_service.get_channels() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_experiments(self, response: Response): """ Get experiments from database """ get_response = self.experiment_service.get_experiments() # add links from hateoas get_response.links = get_links(router) return get_response
async def get_observable_informations(self, response: Response): """ Get observable information from database """ get_response = self.observable_information_service.get_observable_informations( ) # add links from hateoas get_response.links = get_links(router) return get_response
async def get_activity(self, activity_id: int, response: Response): """ Get activity from database """ get_response = self.activity_service.get_activity(activity_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def delete_time_series(self, time_series_id: int, response: Response): """ Delete time series from database """ get_response = self.time_series_service.delete_time_series(time_series_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def get_arrangement(self, arrangement_id: int, response: Response): """ Get arrangement from database """ get_response = self.arrangement_service.get_arrangement(arrangement_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def get_scenario(self, node_id: int, response: Response): """ Get scenario from database """ get_response = self.scenario_service.get_scenario(node_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def create_scenario(self, scenario: ScenarioIn, response: Response): """ Create scenario in database """ create_response = self.scenario_service.save_scenario(scenario) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response
async def get_channel(self, channel_id: int, response: Response): """ Get channel from database """ get_response = self.channel_service.get_channel(channel_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def delete_recording(self, recording_id: int, response: Response): """ Delete recordings from database """ get_response = self.recording_service.delete_recording(recording_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def update_experiment(self, experiment_id: int, experiment: ExperimentIn, response: Response): """ Update experiment model in database """ update_response = self.experiment_service.update_experiment(experiment_id, experiment) if update_response.errors is not None: response.status_code = 404 # add links from hateoas update_response.links = get_links(router) return update_response
async def delete_experiment(self, experiment_id: int, response: Response): """ Delete experiment from database """ get_response = self.experiment_service.delete_experiment(experiment_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def create_experiment(self, experiment: ExperimentIn, response: Response): """ Create experiment in database """ create_response = self.experiment_service.save_experiment(experiment) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response
async def delete_node(self, id: int, response: Response): """ Delete node by id """ delete_response = self.node_service.delete_node(id) if delete_response.errors is not None: response.status_code = 404 # add links from hateoas delete_response.links = get_links(router) return delete_response
async def get_node_relationships(self, id: int, response: Response): """ Get relationships for node with given id """ get_response = self.node_service.get_relationships(id) if get_response.errors is not None: response.status_code = 422 # add links from hateoas get_response.links = get_links(router) return get_response
async def create_node(self, node: NodeIn, response: Response): """ Create node with optional labels """ create_response = self.node_service.save_node(node) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response
async def delete_measure(self, measure_id: int, response: Response): """ Delete measure from database """ get_response = self.measure_service.delete_measure(measure_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def create_recording(self, recording: RecordingIn, response: Response): """ Create Recording in database """ create_response = self.recording_service.save_recording(recording) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response
async def get_appearance(self, appearance_id: int, response: Response): """ Get appearance from database """ get_response = self.appearance_service.get_appearance(appearance_id) if get_response.errors is not None: response.status_code = 404 # add links from hateoas get_response.links = get_links(router) return get_response
async def change_order(self, order_change: OrderChangeIn, response: Response): """ Change order of one activity execution in scenario """ put_response = self.scenario_service.change_order(order_change) if put_response.errors is not None: response.status_code = 422 # add links from hateoas put_response.links = get_links(router) return put_response
async def create_time_series(self, time_series: TimeSeriesIn, response: Response): """ Create time series in database """ create_response = self.time_series_service.save_time_series(time_series) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response
async def create_measure(self, measure: MeasureIn, response: Response): """ Create measure in database """ create_response = self.measure_service.save_measure(measure) if create_response.errors is not None: response.status_code = 422 # add links from hateoas create_response.links = get_links(router) return create_response