def get(self): """ Get information about all jobs. """ auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return JobService.get_jobs_by_user_id(user_id)
def get(self): """ Get all scripts. """ auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return ScriptService.get_all_by_user(user_id)
def get(self, job_id: str): """ Get information about the given job ID. """ auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return JobService.get_job_by_id(job_id=job_id, user_id=user_id)
def post(self, script_name: str): """ Execute a given script. Accepts an arbitrary JSON object """ auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return ScriptService.execute(user_id, script_name, placeholder_dict=request.get_json())
def post(self): """ Log yourself out. """ auth_token = get_bearer_token() UserService.logout_user(auth_token) return { "message": "Successfully logged out", "auth_token": auth_token }, 200
def post(self): """ Register a script with the backend. """ auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) script_obj = request.parsed_obj script_obj["user"] = user_id return ScriptService.create(script_obj)
def delete(self, script_name: str): """ Delete the script. """ version = request.args.get("version") delete_all = request.args.get("delete_all") if (version is not None) and (delete_all is not None): raise UserException( "Please specify only one of `version` or `delete_all`.", 400) auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return ScriptService.delete(user_id, script_name, version=version, delete_all=delete_all)
def get(self, script_name: str): auth_token = get_bearer_token() user_id = User.decode_auth_token(auth_token) return ScriptService.get_script_by_user_and_name( user_id, script_name, version=request.args.get("version"))