def get_record(self, **kwargs): api_controller = ApiController.load() return api_controller.get_translation( self.get_type_object(), kwargs["pk"], kwargs["service_name"], kwargs["lang"], access_token=kwargs["access_token"])
def create(self, request, pk=None): api_controller = ApiController.load() # TODO put it in another place api_controller.stepik_oauth() params = self.get_params() if not self.check_required_params(params): return self.error_response(404) obj = api_controller.create_translation(self.get_type_object(), params["pk"], params["service_name"], params["lang"]) if obj is None: return self.error_response(404) serializer = self.get_serializer(instance=obj, many=True) return Response(serializer.data)
def update(self, request, pk, **kwargs): params = self.get_params() json_source = request.data api_controller = ApiController.load() if not self.check_required_params(params): return self.error_response(404) data = api_controller.update_translation(self.get_type_object(), params["pk"], json_source, params["service_name"], params["lang"]) if data is None: return self.error_response(404) serializer = self.get_serializer(instance=data, many=True) return Response(serializer.data)
def get_record(self, **kwargs): api_controller = ApiController.load() return api_controller.get_translated_attempt(kwargs["pk"], kwargs["service_name"], kwargs["lang"], kwargs["access_token"])
def get_record(self, **kwargs): api_controller = ApiController.load() return api_controller.get_available_languages(kwargs["pk"], kwargs["obj_type"], kwargs["service_name"])
def get_record(self, **kwargs): api_controller = ApiController.load() return api_controller.get_translational_ratio(kwargs["pk"], kwargs["obj_type"], kwargs["lang"], kwargs["service_name"])