Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Add playground; Add playground tools [WIP]

Tomáš Valentae7dd6969a6ce
diff --git a/api-service/playground_client/.openapi-generator-ignore b/api-service/.openapi-generator-ignore
similarity index 100%
rename from api-service/playground_client/.openapi-generator-ignore
rename to api-service/.openapi-generator-ignore
diff --git a/api-service/.openapi-generator/FILES b/api-service/.openapi-generator/FILES
new file mode 100644
index 000000000..42d8057ef
--- /dev/null
+++ b/api-service/.openapi-generator/FILES
@@ -0,0 +1,51 @@
+playground_client/__init__.py
+playground_client/api/__init__.py
+playground_client/api/default_api.py
+playground_client/api_client.py
+playground_client/configuration.py
+playground_client/docs/CreateSessionResponse.md
+playground_client/docs/CreateSessionsRequest.md
+playground_client/docs/DefaultApi.md
+playground_client/docs/EntryInfo.md
+playground_client/docs/ListFilesystemDirResponse.md
+playground_client/docs/OutStderrResponse.md
+playground_client/docs/OutStdoutResponse.md
+playground_client/docs/OutType.md
+playground_client/docs/OutTypeStderr.md
+playground_client/docs/OutTypeStdout.md
+playground_client/docs/ReadFilesystemFileResponse.md
+playground_client/docs/RunProcessParams.md
+playground_client/docs/RunProcessResponse.md
+playground_client/docs/WriteFilesystemFileRequest.md
+playground_client/exceptions.py
+playground_client/models/__init__.py
+playground_client/models/create_session_response.py
+playground_client/models/create_sessions_request.py
+playground_client/models/entry_info.py
+playground_client/models/list_filesystem_dir_response.py
+playground_client/models/out_stderr_response.py
+playground_client/models/out_stdout_response.py
+playground_client/models/out_type.py
+playground_client/models/out_type_stderr.py
+playground_client/models/out_type_stdout.py
+playground_client/models/read_filesystem_file_response.py
+playground_client/models/run_process_params.py
+playground_client/models/run_process_response.py
+playground_client/models/write_filesystem_file_request.py
+playground_client/rest.py
+playground_client/test/__init__.py
+playground_client/test/test_create_session_response.py
+playground_client/test/test_create_sessions_request.py
+playground_client/test/test_default_api.py
+playground_client/test/test_entry_info.py
+playground_client/test/test_list_filesystem_dir_response.py
+playground_client/test/test_out_stderr_response.py
+playground_client/test/test_out_stdout_response.py
+playground_client/test/test_out_type.py
+playground_client/test/test_out_type_stderr.py
+playground_client/test/test_out_type_stdout.py
+playground_client/test/test_read_filesystem_file_response.py
+playground_client/test/test_run_process_params.py
+playground_client/test/test_run_process_response.py
+playground_client/test/test_write_filesystem_file_request.py
+playground_client_README.md
diff --git a/api-service/playground_client/.openapi-generator/VERSION b/api-service/.openapi-generator/VERSION
similarity index 100%
rename from api-service/playground_client/.openapi-generator/VERSION
rename to api-service/.openapi-generator/VERSION
diff --git a/api-service/Dockerfile b/api-service/Dockerfile
index a912a5bba..c56bc9d63 100644
--- a/api-service/Dockerfile
+++ b/api-service/Dockerfile
@@ -51,6 +51,7 @@ RUN --mount=type=cache,target=/home/.cache/pypoetry/cache \
poetry install --without dev --no-root --no-ansi --no-interaction
COPY . ./
+RUN rm -rf ./playground
WORKDIR /playground
COPY --from=playground-modules ./playground/ ./
diff --git a/api-service/playground_client/Makefile b/api-service/Makefile
similarity index 59%
rename from api-service/playground_client/Makefile
rename to api-service/Makefile
index cacf965ac..b57877615 100644
--- a/api-service/playground_client/Makefile
+++ b/api-service/Makefile
@@ -1,9 +1,9 @@
-generate:
- rm -rf ./openapi_client
+generate-playground-client:
+ rm -rf ./playground_client
npx @openapitools/openapi-generator-cli generate \
- -i ../playground/swagger.json \
+ -i ./playground/swagger.json \
-g python-nextgen \
-o ./ \
--additional-properties=generateSourceCodeOnly=true \
--additional-properties=disallowAdditionalPropertiesIfNotPresent=false \
- --additional-properties=projectName=playground_client
+ --additional-properties=packageName=playground_client
diff --git a/api-service/app.py b/api-service/app.py
index 847d8b996..a4a0b00f3 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -1,17 +1,18 @@
-from typing import Dict
import os
import uuid
import subprocess
+from typing import Dict
from flask import Flask, request
from flask_cors import CORS
-from codegen.base import generate_req_handler
-from codegen.db.base import Database, DeploymentState
-from playground_client.playground import NodeJSPlayground
+from codegen import generate_req_handler
+from database import Database, DeploymentState
+from codegen.tools.playground.playground import NodeJSPlayground
url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_KEY")
+
db = Database(url, key)
app = Flask(__name__)
@@ -50,22 +51,16 @@ def generate():
route = body["route"]
envs = body["envs"]
- db.create_deployment(
- run_id=run_id, project_id=project_id, route_id=route_id)
-
- playground = NodeJSPlayground()
+ db.create_deployment(run_id=run_id, project_id=project_id, route_id=route_id)
final_prompt, js_code = generate_req_handler(
db=db,
- playground=playground,
run_id=run_id,
blocks=blocks,
method=method,
envs=envs,
)
- playground.close()
-
db.update_state(run_id=run_id, state=DeploymentState.Deploying)
cf_worker_dir_path = (
diff --git a/api-service/codegen/__init__.py b/api-service/codegen/__init__.py
index e69de29bb..388180603 100644
--- a/api-service/codegen/__init__.py
+++ b/api-service/codegen/__init__.py
@@ -0,0 +1 @@
+from .codegen import generate_req_handler
diff --git a/api-service/codegen/base.py b/api-service/codegen/codegen.py
similarity index 77%
rename from api-service/codegen/base.py
rename to api-service/codegen/codegen.py
index a48327a4c..1c05222dc 100644
--- a/api-service/codegen/base.py
+++ b/api-service/codegen/codegen.py
@@ -1,22 +1,23 @@
from typing import List, Dict
-from playground_client.playground import NodeJSPlayground
-
from langchain.llms.openai import OpenAIChat, OpenAI
-from codegen.tools.documentation.tool import ReadDocumentation
-from codegen.js_agent.base import create_js_agent
+
+from codegen.tools.documentation import ReadDocumentation
+from codegen.js_agent import create_js_agent
from codegen.prompt import PREFIX, SUFFIX
-from codegen.db.base import Database
from codegen.tools.playground import create_playground_tools
+from codegen.tools.javascript import JavascriptEvalTool
+from database import Database
def generate_req_handler(
db: Database,
- playground: NodeJSPlayground,
run_id: str,
blocks: List[str],
method: str,
envs: List[Dict[str, str]],
) -> str:
+ # playground, tools = create_playground_tools()
+
executor = create_js_agent(
db=db,
run_id=run_id,
@@ -25,7 +26,8 @@ def generate_req_handler(
# llm=OpenAIChat(temperature=0, max_tokens=1000),
tools=[
# ReadDocumentation()
- *create_playground_tools(playground)
+ JavascriptEvalTool(),
+ # *playground_tools,
],
verbose=True,
)
@@ -41,6 +43,9 @@ def generate_req_handler(
prompt = prompt + "\n" + SUFFIX.format(method=method)
handler_code = executor.run(prompt).strip("`").strip()
+
+ # playground.close()
+
return prompt, handler_code
# server_code = server_template.replace('[HANDLER]', handler_code)
# return server_code
diff --git a/api-service/codegen/js_agent/__init__.py b/api-service/codegen/js_agent/__init__.py
index e69de29bb..971867346 100644
--- a/api-service/codegen/js_agent/__init__.py
+++ b/api-service/codegen/js_agent/__init__.py
@@ -0,0 +1 @@
+from .agent import create_js_agent
diff --git a/api-service/codegen/js_agent/base.py b/api-service/codegen/js_agent/agent.py
similarity index 77%
rename from api-service/codegen/js_agent/base.py
rename to api-service/codegen/js_agent/agent.py
index 389affe81..f1b63d471 100644
--- a/api-service/codegen/js_agent/base.py
+++ b/api-service/codegen/js_agent/agent.py
@@ -6,16 +6,13 @@ from langchain.llms.base import BaseLLM
from langchain.agents.mrkl.base import ZeroShotAgent
from langchain.chains.llm import LLMChain
from langchain.callbacks.shared import SharedCallbackManager
-
-from codegen.js_agent.prompt import PREFIX
from langchain.tools.base import BaseTool
-# from codegen.tools.javascript.tool import JavascriptEvalTool
+from codegen.js_agent.prompt import PREFIX
from codegen.js_agent.callbacks.log import LoggerCallbackHandler
-from codegen.db.base import Database
+from database import Database
# from js_agent.prompt import PREFIX
-# from tools.javascript.tool import JavascriptEvalTool
def create_js_agent(
@@ -36,15 +33,10 @@ def create_js_agent(
callback_manager=callback_manager,
)
tool_names = [tool.name for tool in tools]
- agent = ZeroShotAgent(llm_chain=llm_chain,
- allowed_tools=tool_names, **kwargs)
+ agent = ZeroShotAgent(llm_chain=llm_chain, allowed_tools=tool_names, **kwargs)
cb_manager = SharedCallbackManager()
- cb_manager.set_handler(
- LoggerCallbackHandler(
- db=db, run_id=run_id
- )
- )
+ cb_manager.set_handler(LoggerCallbackHandler(db=db, run_id=run_id))
return AgentExecutor.from_agent_and_tools(
agent=agent, tools=tools, verbose=verbose, callback_manager=cb_manager
)
diff --git a/api-service/codegen/js_agent/callbacks/log.py b/api-service/codegen/js_agent/callbacks/log.py
index b879977c4..81d238cdb 100644
--- a/api-service/codegen/js_agent/callbacks/log.py
+++ b/api-service/codegen/js_agent/callbacks/log.py
@@ -1,11 +1,9 @@
from typing import List, Dict, Optional, Any, Union
-
from langchain.callbacks.base import BaseCallbackHandler
from langchain.input import print_text, get_colored_text
from langchain.schema import AgentAction, AgentFinish, LLMResult
-# from codegen.db.base import push_logs
-from codegen.db.base import Database
+from database import Database
class LoggerCallbackHandler(BaseCallbackHandler):
diff --git a/api-service/codegen/tools/documentation/__init__.py b/api-service/codegen/tools/documentation/__init__.py
index e69de29bb..dfd0aa7bf 100644
--- a/api-service/codegen/tools/documentation/__init__.py
+++ b/api-service/codegen/tools/documentation/__init__.py
@@ -0,0 +1 @@
+from .tool import ReadDocumentation
diff --git a/api-service/codegen/tools/javascript/__init__.py b/api-service/codegen/tools/javascript/__init__.py
new file mode 100644
index 000000000..960bc57e4
--- /dev/null
+++ b/api-service/codegen/tools/javascript/__init__.py
@@ -0,0 +1 @@
+from .tool import JavascriptEvalTool
diff --git a/api-service/codegen/tools/javascript/eval.py b/api-service/codegen/tools/javascript/eval.py
new file mode 100644
index 000000000..ed24be027
--- /dev/null
+++ b/api-service/codegen/tools/javascript/eval.py
@@ -0,0 +1,21 @@
+import requests
+import os
+
+
+if os.environ.get("ENV") == "dev":
+ url = "http://localhost:3000/api/exec/js"
+else:
+ url = "https://ai-api-gray.vercel.app/api/exec/js"
+
+
+def eval(code: str):
+ json = {
+ "code": code,
+ }
+
+ resp = requests.post(url=url, json=json)
+ resp_json = resp.json()
+
+ if "message" in json:
+ return resp_json["message"]
+ return ""
diff --git a/api-service/codegen/tools/javascript/tool.py b/api-service/codegen/tools/javascript/tool.py
new file mode 100644
index 000000000..7b3ade6e1
--- /dev/null
+++ b/api-service/codegen/tools/javascript/tool.py
@@ -0,0 +1,19 @@
+"""A tool for running javascript code in eval() on remote endpoint"""
+
+from langchain.tools.base import BaseTool
+from codegen.tools.javascript.eval import eval as js_eval
+
+
+class JavascriptEvalTool(BaseTool):
+ name = "JavaScriptCodeExecution"
+ description = (
+ "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
+ "Input should be a valid javascript code. "
+ )
+
+ def _run(self, query: str) -> str:
+ query = query.strip().strip("`")
+ return js_eval(query)
+
+ async def _arun(self, query: str) -> str:
+ return NotImplementedError("JavascriptEval does not support async")
diff --git a/api-service/codegen/tools/playground/main.py b/api-service/codegen/tools/playground/main.py
index 3a2ea869b..c2af255b5 100644
--- a/api-service/codegen/tools/playground/main.py
+++ b/api-service/codegen/tools/playground/main.py
@@ -1,17 +1,25 @@
from typing import List
from langchain.tools.base import BaseTool
-from playground_client.playground import NodeJSPlayground
-from .tools.filesystem import PlaygroundFilesystemTool
-from .tools.dependencies import PlaygroundDependenciesTool
-from .tools.process import PlaygroundProcessTool
-from .tools.code import PlaygroundJavaScriptTool, PlaygroundTypeScriptTool
+from .playground import NodeJSPlayground, Playground
+from .tools.filesystem import create_filesystem_tools
+from .tools.process import create_process_tools
+from .tools.code import create_code_tools
-def create_playground_tools(playground: NodeJSPlayground) -> List[BaseTool]:
- return [
- PlaygroundTypeScriptTool(playground),
- PlaygroundJavaScriptTool(playground),
- PlaygroundFilesystemTool(playground),
- PlaygroundDependenciesTool(playground),
- PlaygroundProcessTool(playground),
+
+# TODO: Improve all descriptions of tools
+def create_playground_tools() -> tuple[List[BaseTool], Playground]:
+ playground = NodeJSPlayground()
+ subtools = [
+ tool
+ for tools in (
+ tool_factory(playground)
+ for tool_factory in [
+ create_filesystem_tools,
+ create_process_tools,
+ create_code_tools,
+ ]
+ )
+ for tool in tools
]
+ return playground, subtools
diff --git a/api-service/playground_client/playground.py b/api-service/codegen/tools/playground/playground.py
similarity index 83%
rename from api-service/playground_client/playground.py
rename to api-service/codegen/tools/playground/playground.py
index 6af69987e..2a2e6be95 100644
--- a/api-service/playground_client/playground.py
+++ b/api-service/codegen/tools/playground/playground.py
@@ -1,13 +1,18 @@
from enum import Enum
from typing import TypedDict, Union
-from openapi_client import ApiClient, DefaultApi, Configuration
-from openapi_client import CreateSessionParams, RunProcessParams, WriteFilesystemFileParams
+import playground_client
-configuration = Configuration(
- host="https://localhost:9001",
+
+configuration = playground_client.Configuration(
+ host="http://localhost:9001",
)
+# Configuration for local server
+configuration.verify_ssl = False
+configuration.ssl_ca_cert = None
+configuration.cert_file = None
+
class FilesystemEntryType(Enum):
FILE = "file"
@@ -26,10 +31,10 @@ class CommandOutput(TypedDict):
class Playground:
def __init__(self, env_id: str):
- self.client = ApiClient(configuration)
- self.api = DefaultApi(self.client)
- self.session = self.api.create_session(
- CreateSessionParams(env_id)
+ self.client = playground_client.ApiClient(configuration)
+ self.api = playground_client.DefaultApi(self.client)
+ self.session = self.api.create_sessions(
+ playground_client.CreateSessionsRequest(env_id)
)
self.is_closed = False
@@ -44,7 +49,7 @@ class Playground:
def run_command(self, cmd: str):
result = self.api.run_process(
- self.session.id, RunProcessParams(cmd)
+ self.session.id, playground_client.RunProcessParams(cmd)
)
err_lines = [err.line for err in result.stderr]
out_lines = [out.line for out in result.stdout]
@@ -78,7 +83,7 @@ class Playground:
def write_file(self, path: str, content: str):
self.api.write_filesystem_file(
- self.session.id, path, WriteFilesystemFileParams(content)
+ self.session.id, path, playground_client.WriteFilesystemFileRequest(content)
)
def make_dir(self, path: str):
diff --git a/api-service/codegen/tools/playground/tools/base.py b/api-service/codegen/tools/playground/tools/base.py
deleted file mode 100644
index 366016743..000000000
--- a/api-service/codegen/tools/playground/tools/base.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from langchain.tools.base import BaseTool
-from playground_client.playground import NodeJSPlayground
-
-class PlaygroundBaseTool(BaseTool):
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__()
- self.playground = playground
-
- @staticmethod
- def extract_escaped_query(query: str):
- raise NotImplementedError('Not implemented')
diff --git a/api-service/codegen/tools/playground/tools/code.py b/api-service/codegen/tools/playground/tools/code.py
index 5a2e03d9d..fe9b05b50 100644
--- a/api-service/codegen/tools/playground/tools/code.py
+++ b/api-service/codegen/tools/playground/tools/code.py
@@ -1,36 +1,41 @@
-from .base import PlaygroundBaseTool
-from playground_client.playground import NodeJSPlayground
+from langchain.agents import tool
+from codegen.tools.playground.playground import NodeJSPlayground
+from codegen.tools.playground.tools.process import encode_command_output
-class PlaygroundJavaScriptTool(PlaygroundBaseTool):
- # name = "JavaScriptCodeExecution"
- # description = (
- # "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
- # "Input should be a valid javascript code. "
- # )
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__(playground)
+def create_code_tools(playground: NodeJSPlayground):
+ @tool("InstallDependencies")
+ def install_dependencies(dependencies: str) -> str:
+ """Install specified dependecies with NPM and return errors."""
+ output = playground.install_dependencies(dependencies)
+ return encode_command_output(output, only_errors=True)
- def _run(self, command: str) -> str:
- self.playground.run_command(command)
+ yield install_dependencies
- async def _arun(self, command: str) -> str:
- return NotImplementedError("JavascriptEval does not support async")
+ # TODO: Escape code
+ @tool("RunTypeScriptCode")
+ def run_typescript_code(code: str) -> str:
+ """Run the specified TypeScript code and return errors and output."""
+ output = playground.run_typescript_code(code)
+ return encode_command_output(output)
+ yield run_typescript_code
-class PlaygroundTypeScriptTool(PlaygroundBaseTool):
- # name = "JavaScriptCodeExecution"
- # description = (
- # "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
- # "Input should be a valid javascript code. "
- # )
+ # TODO: Escape code
+ @tool("CheckTypeScriptTypes")
+ def check_typescript_types(code: str) -> str:
+ """Check TypeScript types in the specified code and return errors."""
+ output = playground.check_typescript_code(code)
+ return encode_command_output(output)
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__(playground)
+ yield check_typescript_types
- def _run(self, command: str) -> str:
- self.playground.run_command(command)
+ # TODO: Escape code
+ @tool("RunJavaScriptCode")
+ def run_javascript_code(code: str) -> str:
+ """Run the specified JavaScript code and return errors and output."""
+ output = playground.run_javascript_code(code)
+ return encode_command_output(output)
- async def _arun(self, command: str) -> str:
- return NotImplementedError("JavascriptEval does not support async")
+ yield run_javascript_code
diff --git a/api-service/codegen/tools/playground/tools/dependencies.py b/api-service/codegen/tools/playground/tools/dependencies.py
deleted file mode 100644
index f162c3e2b..000000000
--- a/api-service/codegen/tools/playground/tools/dependencies.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from .base import PlaygroundBaseTool
-from playground_client.playground import NodeJSPlayground
-
-
-class PlaygroundDependenciesTool(PlaygroundBaseTool):
- # name = "JavaScriptCodeExecution"
- # description = (
- # "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
- # "Input should be a valid javascript code. "
- # )
-
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__(playground)
-
- def _run(self, command: str) -> str:
- self.playground.run_command(command)
-
- async def _arun(self, command: str) -> str:
- return NotImplementedError("JavascriptEval does not support async")
diff --git a/api-service/codegen/tools/playground/tools/filesystem.py b/api-service/codegen/tools/playground/tools/filesystem.py
index 3756902b0..479f58b8c 100644
--- a/api-service/codegen/tools/playground/tools/filesystem.py
+++ b/api-service/codegen/tools/playground/tools/filesystem.py
@@ -1,19 +1,54 @@
-from .base import PlaygroundBaseTool
-from playground_client.playground import NodeJSPlayground
+from langchain.agents import tool
+from typing import List
+from codegen.tools.playground.playground import NodeJSPlayground, FilesystemEntry
-class PlaygroundFilesystemTool(PlaygroundBaseTool):
- # name = "JavaScriptCodeExecution"
- # description = (
- # "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
- # "Input should be a valid javascript code. "
- # )
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__(playground)
+def encode_directory_listing(entries: List[FilesystemEntry]) -> str:
+ return "\n".join([f"{entry.name} {entry.type}" for entry in entries])
- def _run(self, command: str) -> str:
- self.playground.run_command(command)
- async def _arun(self, command: str) -> str:
- return NotImplementedError("JavascriptEval does not support async")
+def create_filesystem_tools(playground: NodeJSPlayground):
+ @tool("ReadFile")
+ def read_file(path: str) -> str:
+ """Read content of the file from filesystem."""
+ return playground.read_file(path)
+
+ yield read_file
+
+ # TODO: Escape file content?
+ @tool("WriteFile")
+ def write_file(input: str) -> str:
+ """Write content to a file in the filesystem.
+ The input should be a path to a file followed by the content of the file.
+ Separate the path and content by a newline character.
+ """
+ path, content = input.split("\n", 1)
+ playground.write_file(path, content)
+ return ""
+
+ yield write_file
+
+ @tool("DeleteFile")
+ def delete_file(path: str) -> str:
+ """Delete the file."""
+ playground.delete_file(path)
+ return ""
+
+ yield delete_file
+
+ @tool("ListDirectory")
+ def list_directory(path: str) -> str:
+ """List all files and subdirectories from the directory."""
+ entries = playground.list_dir(path)
+ return encode_directory_listing(entries)
+
+ yield list_directory
+
+ @tool("DeleteDirectory")
+ def delete_directory(path: str) -> str:
+ """Delete the directory."""
+ playground.delete_dir(path)
+ return ""
+
+ yield delete_directory
diff --git a/api-service/codegen/tools/playground/tools/process.py b/api-service/codegen/tools/playground/tools/process.py
index ea71e4a17..79cd98e7f 100644
--- a/api-service/codegen/tools/playground/tools/process.py
+++ b/api-service/codegen/tools/playground/tools/process.py
@@ -1,19 +1,23 @@
-from .base import PlaygroundBaseTool
-from playground_client.playground import NodeJSPlayground
+from langchain.agents import tool
+from codegen.tools.playground.playground import NodeJSPlayground, CommandOutput
-class PlaygroundProcessTool(PlaygroundBaseTool):
- # name = "JavaScriptCodeExecution"
- # description = (
- # "JavaScript eval() function that can execute code. Use this to execute and evaluate javascript code. "
- # "Input should be a valid javascript code. "
- # )
- def __init__(self, playground: NodeJSPlayground) -> None:
- super().__init__(playground)
+def encode_command_output(output: CommandOutput, only_errors: bool = False) -> str:
+ if only_errors:
+ if output.error is not None:
+ return f"Errors: {output.error}"
+ return ""
+ errors = f"Errors: {output.error}\n" if output.error is not None else ""
+ return errors + f"Output: {output.output}"
- def _run(self, command: str) -> str:
- self.playground.run_command(command)
- async def _arun(self, command: str) -> str:
- return NotImplementedError("JavascriptEval does not support async")
+def create_process_tools(playground: NodeJSPlayground):
+ # TODO: Escape command
+ @tool("RunCommand")
+ def run_command(command: str) -> str:
+ """Run specified command in the terminal and return output and errors."""
+ output = playground.run_command(command)
+ return encode_command_output(output)
+
+ yield run_command
diff --git a/api-service/database/__init__.py b/api-service/database/__init__.py
new file mode 100644
index 000000000..56a4d9a6c
--- /dev/null
+++ b/api-service/database/__init__.py
@@ -0,0 +1 @@
+from .database import Database, DeploymentState
diff --git a/api-service/codegen/db/base.py b/api-service/database/database.py
similarity index 87%
rename from api-service/codegen/db/base.py
rename to api-service/database/database.py
index 94724a5cb..5f502db6a 100644
--- a/api-service/codegen/db/base.py
+++ b/api-service/database/database.py
@@ -17,9 +17,7 @@ class Database:
def __init__(self, url: str, key: str):
self.client = create_client(url, key)
- def create_deployment(
- self, run_id: str, project_id: str, route_id: str
- ) -> None:
+ def create_deployment(self, run_id: str, project_id: str, route_id: str) -> None:
self.client.table(deploymentsTable).insert(
{
"id": run_id,
@@ -29,9 +27,7 @@ class Database:
},
).execute()
- def push_logs(
- self, run_id: str, logs: List[str]
- ) -> None:
+ def push_logs(self, run_id: str, logs: List[str]) -> None:
if len(logs) > 0:
self.client.table(deploymentsTable).update(
{
diff --git a/api-service/playground_client/openapitools.json b/api-service/openapitools.json
similarity index 100%
rename from api-service/playground_client/openapitools.json
rename to api-service/openapitools.json
diff --git a/api-service/playground/nodemon-tsoa.json b/api-service/playground/nodemon-tsoa.json
new file mode 100644
index 000000000..8490aef30
--- /dev/null
+++ b/api-service/playground/nodemon-tsoa.json
@@ -0,0 +1,7 @@
+{
+ "watch": [
+ "src/**/*Controller.ts"
+ ],
+ "ext": ".ts",
+ "exec": "tsoa spec-and-routes"
+}
\ No newline at end of file
diff --git a/api-service/playground/nodemon.json b/api-service/playground/nodemon.json
index 924822918..6b4fe763f 100644
--- a/api-service/playground/nodemon.json
+++ b/api-service/playground/nodemon.json
@@ -2,9 +2,7 @@
"watch": [
"src"
],
- "ignore": [
- "src/generated/**/*"
- ],
+ "ignore": [],
"ext": ".ts",
"exec": "export PORT=9001; export NODE_ENV=dev; ./scripts/build.js && node ./lib/server.js"
}
\ No newline at end of file
diff --git a/api-service/playground/package.json b/api-service/playground/package.json
index e6e907881..220e5d62d 100644
--- a/api-service/playground/package.json
+++ b/api-service/playground/package.json
@@ -18,10 +18,10 @@
},
"main": "lib/server.js",
"scripts": {
- "dev": "concurrently \"nodemon -q\" \"nodemon -x tsoa spec-and-routes\"",
+ "dev": "concurrently \"nodemon -q\" \"nodemon --config nodemon-tsoa.json \"",
"generate": "tsoa spec-and-routes",
"check-types": "tsx --noEmit",
"build": "./scripts/build.js",
"start": "node lib/server.js"
}
-}
\ No newline at end of file
+}
diff --git a/api-service/playground/src/app.ts b/api-service/playground/src/app.ts
index 0db3ce4d8..30d8c762c 100644
--- a/api-service/playground/src/app.ts
+++ b/api-service/playground/src/app.ts
@@ -1,4 +1,11 @@
-import express, { json, urlencoded } from 'express'
+import express, {
+ json,
+ urlencoded,
+ Response as ExResponse,
+ Request as ExRequest,
+ NextFunction,
+} from 'express'
+import { ValidateError } from 'tsoa'
import { RegisterRoutes } from './generated/routes'
@@ -9,6 +16,36 @@ app.use(
extended: true,
})
)
+
app.use(json())
RegisterRoutes(app)
+
+app.use(
+ function notFoundHandler(_req, res: ExResponse) {
+ res.status(404).send({
+ message: 'Not Found',
+ })
+ },
+ function errorHandler(
+ err: unknown,
+ req: ExRequest,
+ res: ExResponse,
+ next: NextFunction
+ ): ExResponse | void {
+ if (err instanceof ValidateError) {
+ console.warn(`Caught Validation Error for ${req.path}:`, err.fields)
+ return res.status(422).json({
+ message: 'Validation Failed',
+ details: err?.fields,
+ })
+ }
+ if (err instanceof Error) {
+ console.warn(`Caught Internal Error for ${req.path}:`, err)
+ return res.status(500).json({
+ message: 'Internal Server Error',
+ })
+ }
+ next()
+ },
+)
diff --git a/api-service/playground/src/generated/routes.ts b/api-service/playground/src/generated/routes.ts
index 823f9ad45..93c42b057 100644
--- a/api-service/playground/src/generated/routes.ts
+++ b/api-service/playground/src/generated/routes.ts
@@ -7,7 +7,7 @@ import { FilesystemController } from './../sessions/filesystemController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { ProcessController } from './../sessions/processController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
-import { UsersController } from './../sessions/sessionsController';
+import { SessionsController } from './../sessions/sessionsController';
import type { RequestHandler, Router } from 'express';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@@ -38,14 +38,6 @@ const models: TsoaRoute.Models = {
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
- "WriteFilesystemFileParams": {
- "dataType": "refObject",
- "properties": {
- "content": {"dataType":"string","required":true},
- },
- "additionalProperties": false,
- },
- // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"OutType.Stderr": {
"dataType": "refEnum",
"enums": ["Stderr"],
@@ -113,14 +105,6 @@ const models: TsoaRoute.Models = {
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
- "CreateSessionParams": {
- "dataType": "refObject",
- "properties": {
- "envID": {"dataType":"string","required":true},
- },
- "additionalProperties": false,
- },
- // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
};
const validationService = new ValidationService(models);
@@ -243,7 +227,7 @@ export function RegisterRoutes(app: Router) {
const args = {
id: {"in":"path","name":"id","required":true,"dataType":"string"},
path: {"in":"query","name":"path","required":true,"dataType":"string"},
- requestBody: {"in":"body","name":"requestBody","required":true,"ref":"WriteFilesystemFileParams"},
+ content: {"in":"body-prop","name":"content","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@@ -289,12 +273,12 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/sessions',
- ...(fetchMiddlewares<RequestHandler>(UsersController)),
- ...(fetchMiddlewares<RequestHandler>(UsersController.prototype.createSession)),
+ ...(fetchMiddlewares<RequestHandler>(SessionsController)),
+ ...(fetchMiddlewares<RequestHandler>(SessionsController.prototype.createSessions)),
- function UsersController_createSession(request: any, response: any, next: any) {
+ function SessionsController_createSessions(request: any, response: any, next: any) {
const args = {
- requestBody: {"in":"body","name":"requestBody","required":true,"ref":"CreateSessionParams"},
+ envID: {"in":"body-prop","name":"envID","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@@ -303,10 +287,10 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
- const controller = new UsersController();
+ const controller = new SessionsController();
- const promise = controller.createSession.apply(controller, validatedArgs as any);
+ const promise = controller.createSessions.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
} catch (err) {
return next(err);
@@ -314,10 +298,10 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.delete('/sessions/:id',
- ...(fetchMiddlewares<RequestHandler>(UsersController)),
- ...(fetchMiddlewares<RequestHandler>(UsersController.prototype.deleteSession)),
+ ...(fetchMiddlewares<RequestHandler>(SessionsController)),
+ ...(fetchMiddlewares<RequestHandler>(SessionsController.prototype.deleteSession)),
- function UsersController_deleteSession(request: any, response: any, next: any) {
+ function SessionsController_deleteSession(request: any, response: any, next: any) {
const args = {
id: {"in":"path","name":"id","required":true,"dataType":"string"},
};
@@ -328,7 +312,7 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
- const controller = new UsersController();
+ const controller = new SessionsController();
const promise = controller.deleteSession.apply(controller, validatedArgs as any);
diff --git a/api-service/playground/src/sessions/filesystemController.ts b/api-service/playground/src/sessions/filesystemController.ts
index f00b48411..6e52a5e27 100644
--- a/api-service/playground/src/sessions/filesystemController.ts
+++ b/api-service/playground/src/sessions/filesystemController.ts
@@ -2,11 +2,11 @@ import {
Controller,
Path,
Get,
- Body,
Delete,
Put,
Query,
Route,
+ BodyProp,
} from 'tsoa'
import { FileInfo as EntryInfo } from '@devbookhq/sdk'
@@ -20,10 +20,6 @@ interface ReadFilesystemFileResponse {
content: string
}
-interface WriteFilesystemFileParams {
- content: string
-}
-
@Route('sessions')
export class FilesystemController extends Controller {
@Get('{id}/filesystem/dir')
@@ -72,9 +68,9 @@ export class FilesystemController extends Controller {
public async writeFilesystemFile(
@Path() id: string,
@Query() path: string,
- @Body() requestBody: WriteFilesystemFileParams,
+ @BodyProp('content') content: string,
) {
const session = retrieveSession(id)
- await session.filesystem!.write(path, requestBody.content)
+ await session.filesystem!.write(path, content)
}
}
diff --git a/api-service/playground/src/sessions/processController.ts b/api-service/playground/src/sessions/processController.ts
index de29f642e..182e167e5 100644
--- a/api-service/playground/src/sessions/processController.ts
+++ b/api-service/playground/src/sessions/processController.ts
@@ -14,9 +14,7 @@ import {
import { retrieveSession } from './sessions'
-interface RunProcessParams extends Pick<Parameters<ProcessManager['start']>[0], 'cmd' | 'envVars' | 'rootdir'> {
-
-}
+interface RunProcessParams extends Pick<Parameters<ProcessManager['start']>[0], 'cmd' | 'envVars' | 'rootdir'> { }
interface RunProcessResponse {
stderr: OutStderrResponse[]
diff --git a/api-service/playground/src/sessions/sessions.ts b/api-service/playground/src/sessions/sessions.ts
index 12656747a..d54144b62 100644
--- a/api-service/playground/src/sessions/sessions.ts
+++ b/api-service/playground/src/sessions/sessions.ts
@@ -1,9 +1,19 @@
import { Session } from '@devbookhq/sdk'
import NodeCache from 'node-cache'
-const sessionCache = new NodeCache({
+export const sessionCache = new NodeCache({
stdTTL: 60000,
checkperiod: 5000,
+ useClones: false,
+ deleteOnExpire: true,
+})
+
+sessionCache.on('del', async function (_, session: Session) {
+ try {
+ await session.close()
+ } catch (err) {
+ console.error(err)
+ }
})
export async function initSession(envID: string) {
diff --git a/api-service/playground/src/sessions/sessionsController.ts b/api-service/playground/src/sessions/sessionsController.ts
index 4b772e1d8..56d37b647 100644
--- a/api-service/playground/src/sessions/sessionsController.ts
+++ b/api-service/playground/src/sessions/sessionsController.ts
@@ -1,29 +1,25 @@
import {
- Body,
Controller,
Delete,
Path,
Post,
+ BodyProp,
Route,
} from 'tsoa'
import { closeSession, initSession } from './sessions'
-interface CreateSessionParams {
- envID: string
-}
-
interface CreateSessionResponse {
id: string
}
@Route('sessions')
-export class UsersController extends Controller {
+export class SessionsController extends Controller {
@Post()
- public async createSession(
- @Body() requestBody: CreateSessionParams,
+ public async createSessions(
+ @BodyProp('envID') envID: string,
): Promise<CreateSessionResponse> {
- const id = await initSession(requestBody.envID)
+ const id = await initSession(envID)
return { id }
}
diff --git a/api-service/playground/swagger.json b/api-service/playground/swagger.json
index 9662cb327..8fd020b95 100644
--- a/api-service/playground/swagger.json
+++ b/api-service/playground/swagger.json
@@ -49,18 +49,6 @@
"type": "object",
"additionalProperties": false
},
- "WriteFilesystemFileParams": {
- "properties": {
- "content": {
- "type": "string"
- }
- },
- "required": [
- "content"
- ],
- "type": "object",
- "additionalProperties": false
- },
"OutType.Stderr": {
"enum": [
"Stderr"
@@ -180,18 +168,6 @@
],
"type": "object",
"additionalProperties": false
- },
- "CreateSessionParams": {
- "properties": {
- "envID": {
- "type": "string"
- }
- },
- "required": [
- "envID"
- ],
- "type": "object",
- "additionalProperties": false
}
},
"securitySchemes": {}
@@ -364,7 +340,15 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/WriteFilesystemFileParams"
+ "properties": {
+ "content": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "content"
+ ],
+ "type": "object"
}
}
}
@@ -411,7 +395,7 @@
},
"/sessions": {
"post": {
- "operationId": "CreateSession",
+ "operationId": "CreateSessions",
"responses": {
"200": {
"description": "Ok",
@@ -431,7 +415,15 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/CreateSessionParams"
+ "properties": {
+ "envID": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "envID"
+ ],
+ "type": "object"
}
}
}
diff --git a/api-service/playground_client/.openapi-generator/FILES b/api-service/playground_client/.openapi-generator/FILES
deleted file mode 100644
index 34bc37598..000000000
--- a/api-service/playground_client/.openapi-generator/FILES
+++ /dev/null
@@ -1,51 +0,0 @@
-openapi_client/__init__.py
-openapi_client/api/__init__.py
-openapi_client/api/default_api.py
-openapi_client/api_client.py
-openapi_client/configuration.py
-openapi_client/docs/CreateSessionParams.md
-openapi_client/docs/CreateSessionResponse.md
-openapi_client/docs/DefaultApi.md
-openapi_client/docs/EntryInfo.md
-openapi_client/docs/ListFilesystemDirResponse.md
-openapi_client/docs/OutStderrResponse.md
-openapi_client/docs/OutStdoutResponse.md
-openapi_client/docs/OutType.md
-openapi_client/docs/OutTypeStderr.md
-openapi_client/docs/OutTypeStdout.md
-openapi_client/docs/ReadFilesystemFileResponse.md
-openapi_client/docs/RunProcessParams.md
-openapi_client/docs/RunProcessResponse.md
-openapi_client/docs/WriteFilesystemFileParams.md
-openapi_client/exceptions.py
-openapi_client/models/__init__.py
-openapi_client/models/create_session_params.py
-openapi_client/models/create_session_response.py
-openapi_client/models/entry_info.py
-openapi_client/models/list_filesystem_dir_response.py
-openapi_client/models/out_stderr_response.py
-openapi_client/models/out_stdout_response.py
-openapi_client/models/out_type.py
-openapi_client/models/out_type_stderr.py
-openapi_client/models/out_type_stdout.py
-openapi_client/models/read_filesystem_file_response.py
-openapi_client/models/run_process_params.py
-openapi_client/models/run_process_response.py
-openapi_client/models/write_filesystem_file_params.py
-openapi_client/rest.py
-openapi_client/test/__init__.py
-openapi_client/test/test_create_session_params.py
-openapi_client/test/test_create_session_response.py
-openapi_client/test/test_default_api.py
-openapi_client/test/test_entry_info.py
-openapi_client/test/test_list_filesystem_dir_response.py
-openapi_client/test/test_out_stderr_response.py
-openapi_client/test/test_out_stdout_response.py
-openapi_client/test/test_out_type.py
-openapi_client/test/test_out_type_stderr.py
-openapi_client/test/test_out_type_stdout.py
-openapi_client/test/test_read_filesystem_file_response.py
-openapi_client/test/test_run_process_params.py
-openapi_client/test/test_run_process_response.py
-openapi_client/test/test_write_filesystem_file_params.py
-openapi_client_README.md
diff --git a/api-service/playground_client/__init__.py b/api-service/playground_client/__init__.py
new file mode 100644
index 000000000..31b0eb47f
--- /dev/null
+++ b/api-service/playground_client/__init__.py
@@ -0,0 +1,44 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+ playground
+
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
+
+ The version of the OpenAPI document: 1.0.0
+ Generated by: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+__version__ = "1.0.0"
+
+# import apis into sdk package
+from playground_client.api.default_api import DefaultApi
+
+# import ApiClient
+from playground_client.api_client import ApiClient
+from playground_client.configuration import Configuration
+from playground_client.exceptions import OpenApiException
+from playground_client.exceptions import ApiTypeError
+from playground_client.exceptions import ApiValueError
+from playground_client.exceptions import ApiKeyError
+from playground_client.exceptions import ApiAttributeError
+from playground_client.exceptions import ApiException
+# import models into sdk package
+from playground_client.models.create_session_response import CreateSessionResponse
+from playground_client.models.create_sessions_request import CreateSessionsRequest
+from playground_client.models.entry_info import EntryInfo
+from playground_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
+from playground_client.models.out_stderr_response import OutStderrResponse
+from playground_client.models.out_stdout_response import OutStdoutResponse
+from playground_client.models.out_type import OutType
+from playground_client.models.out_type_stderr import OutTypeStderr
+from playground_client.models.out_type_stdout import OutTypeStdout
+from playground_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
+from playground_client.models.run_process_params import RunProcessParams
+from playground_client.models.run_process_response import RunProcessResponse
+from playground_client.models.write_filesystem_file_request import WriteFilesystemFileRequest
diff --git a/api-service/playground_client/openapi_client/api/__init__.py b/api-service/playground_client/api/__init__.py
similarity index 60%
rename from api-service/playground_client/openapi_client/api/__init__.py
rename to api-service/playground_client/api/__init__.py
index c8f7c0ca1..e64b08f0b 100644
--- a/api-service/playground_client/openapi_client/api/__init__.py
+++ b/api-service/playground_client/api/__init__.py
@@ -3,4 +3,4 @@ from __future__ import absolute_import
# flake8: noqa
# import apis into api package
-from openapi_client.api.default_api import DefaultApi
+from playground_client.api.default_api import DefaultApi
diff --git a/api-service/playground_client/openapi_client/api/default_api.py b/api-service/playground_client/api/default_api.py
similarity index 94%
rename from api-service/playground_client/openapi_client/api/default_api.py
rename to api-service/playground_client/api/default_api.py
index d3b919871..4de9c899d 100644
--- a/api-service/playground_client/openapi_client/api/default_api.py
+++ b/api-service/playground_client/api/default_api.py
@@ -19,16 +19,16 @@ from typing_extensions import Annotated
from pydantic import StrictStr
-from openapi_client.models.create_session_params import CreateSessionParams
-from openapi_client.models.create_session_response import CreateSessionResponse
-from openapi_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
-from openapi_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
-from openapi_client.models.run_process_params import RunProcessParams
-from openapi_client.models.run_process_response import RunProcessResponse
-from openapi_client.models.write_filesystem_file_params import WriteFilesystemFileParams
-
-from openapi_client.api_client import ApiClient
-from openapi_client.exceptions import ( # noqa: F401
+from playground_client.models.create_session_response import CreateSessionResponse
+from playground_client.models.create_sessions_request import CreateSessionsRequest
+from playground_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
+from playground_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
+from playground_client.models.run_process_params import RunProcessParams
+from playground_client.models.run_process_response import RunProcessResponse
+from playground_client.models.write_filesystem_file_request import WriteFilesystemFileRequest
+
+from playground_client.api_client import ApiClient
+from playground_client.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
@@ -47,17 +47,17 @@ class DefaultApi(object):
self.api_client = api_client
@validate_arguments
- def create_session(self, create_session_params : CreateSessionParams, **kwargs) -> CreateSessionResponse: # noqa: E501
- """create_session # noqa: E501
+ def create_sessions(self, create_sessions_request : CreateSessionsRequest, **kwargs) -> CreateSessionResponse: # noqa: E501
+ """create_sessions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.create_session(create_session_params, async_req=True)
+ >>> thread = api.create_sessions(create_sessions_request, async_req=True)
>>> result = thread.get()
- :param create_session_params: (required)
- :type create_session_params: CreateSessionParams
+ :param create_sessions_request: (required)
+ :type create_sessions_request: CreateSessionsRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
@@ -74,20 +74,20 @@ class DefaultApi(object):
:rtype: CreateSessionResponse
"""
kwargs['_return_http_data_only'] = True
- return self.create_session_with_http_info(create_session_params, **kwargs) # noqa: E501
+ return self.create_sessions_with_http_info(create_sessions_request, **kwargs) # noqa: E501
@validate_arguments
- def create_session_with_http_info(self, create_session_params : CreateSessionParams, **kwargs): # noqa: E501
- """create_session # noqa: E501
+ def create_sessions_with_http_info(self, create_sessions_request : CreateSessionsRequest, **kwargs): # noqa: E501
+ """create_sessions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.create_session_with_http_info(create_session_params, async_req=True)
+ >>> thread = api.create_sessions_with_http_info(create_sessions_request, async_req=True)
>>> result = thread.get()
- :param create_session_params: (required)
- :type create_session_params: CreateSessionParams
+ :param create_sessions_request: (required)
+ :type create_sessions_request: CreateSessionsRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
@@ -115,7 +115,7 @@ class DefaultApi(object):
_params = locals()
_all_params = [
- 'create_session_params'
+ 'create_sessions_request'
]
_all_params.extend(
[
@@ -134,7 +134,7 @@ class DefaultApi(object):
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
- " to method create_session" % _key
+ " to method create_sessions" % _key
)
_params[_key] = _val
del _params['kwargs']
@@ -156,8 +156,8 @@ class DefaultApi(object):
# process the body parameter
_body_params = None
- if _params['create_session_params']:
- _body_params = _params['create_session_params']
+ if _params['create_sessions_request']:
+ _body_params = _params['create_sessions_request']
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
@@ -1065,21 +1065,21 @@ class DefaultApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
- def write_filesystem_file(self, id : StrictStr, path : StrictStr, write_filesystem_file_params : WriteFilesystemFileParams, **kwargs) -> None: # noqa: E501
+ def write_filesystem_file(self, id : StrictStr, path : StrictStr, write_filesystem_file_request : WriteFilesystemFileRequest, **kwargs) -> None: # noqa: E501
"""write_filesystem_file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.write_filesystem_file(id, path, write_filesystem_file_params, async_req=True)
+ >>> thread = api.write_filesystem_file(id, path, write_filesystem_file_request, async_req=True)
>>> result = thread.get()
:param id: (required)
:type id: str
:param path: (required)
:type path: str
- :param write_filesystem_file_params: (required)
- :type write_filesystem_file_params: WriteFilesystemFileParams
+ :param write_filesystem_file_request: (required)
+ :type write_filesystem_file_request: WriteFilesystemFileRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
@@ -1096,24 +1096,24 @@ class DefaultApi(object):
:rtype: None
"""
kwargs['_return_http_data_only'] = True
- return self.write_filesystem_file_with_http_info(id, path, write_filesystem_file_params, **kwargs) # noqa: E501
+ return self.write_filesystem_file_with_http_info(id, path, write_filesystem_file_request, **kwargs) # noqa: E501
@validate_arguments
- def write_filesystem_file_with_http_info(self, id : StrictStr, path : StrictStr, write_filesystem_file_params : WriteFilesystemFileParams, **kwargs): # noqa: E501
+ def write_filesystem_file_with_http_info(self, id : StrictStr, path : StrictStr, write_filesystem_file_request : WriteFilesystemFileRequest, **kwargs): # noqa: E501
"""write_filesystem_file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
- >>> thread = api.write_filesystem_file_with_http_info(id, path, write_filesystem_file_params, async_req=True)
+ >>> thread = api.write_filesystem_file_with_http_info(id, path, write_filesystem_file_request, async_req=True)
>>> result = thread.get()
:param id: (required)
:type id: str
:param path: (required)
:type path: str
- :param write_filesystem_file_params: (required)
- :type write_filesystem_file_params: WriteFilesystemFileParams
+ :param write_filesystem_file_request: (required)
+ :type write_filesystem_file_request: WriteFilesystemFileRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
@@ -1143,7 +1143,7 @@ class DefaultApi(object):
_all_params = [
'id',
'path',
- 'write_filesystem_file_params'
+ 'write_filesystem_file_request'
]
_all_params.extend(
[
@@ -1188,8 +1188,8 @@ class DefaultApi(object):
# process the body parameter
_body_params = None
- if _params['write_filesystem_file_params']:
- _body_params = _params['write_filesystem_file_params']
+ if _params['write_filesystem_file_request']:
+ _body_params = _params['write_filesystem_file_request']
# set the HTTP header `Content-Type`
_content_types_list = _params.get('_content_type',
diff --git a/api-service/playground_client/openapi_client/api_client.py b/api-service/playground_client/api_client.py
similarity index 99%
rename from api-service/playground_client/openapi_client/api_client.py
rename to api-service/playground_client/api_client.py
index ff5ccad27..a216e00d4 100644
--- a/api-service/playground_client/openapi_client/api_client.py
+++ b/api-service/playground_client/api_client.py
@@ -22,10 +22,10 @@ import tempfile
from urllib.parse import quote
-from openapi_client.configuration import Configuration
-import openapi_client.models
-from openapi_client import rest
-from openapi_client.exceptions import ApiValueError, ApiException
+from playground_client.configuration import Configuration
+import playground_client.models
+from playground_client import rest
+from playground_client.exceptions import ApiValueError, ApiException
class ApiClient(object):
@@ -339,7 +339,7 @@ class ApiClient(object):
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
- klass = getattr(openapi_client.models, klass)
+ klass = getattr(playground_client.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
diff --git a/api-service/playground_client/openapi_client/configuration.py b/api-service/playground_client/configuration.py
similarity index 99%
rename from api-service/playground_client/openapi_client/configuration.py
rename to api-service/playground_client/configuration.py
index 4805e7bb2..9627f447f 100644
--- a/api-service/playground_client/openapi_client/configuration.py
+++ b/api-service/playground_client/configuration.py
@@ -19,7 +19,7 @@ import sys
import urllib3
import http.client as httplib
-from openapi_client.exceptions import ApiValueError
+from playground_client.exceptions import ApiValueError
JSON_SCHEMA_VALIDATION_KEYWORDS = {
@@ -111,7 +111,7 @@ class Configuration(object):
self.logger = {}
"""Logging Settings
"""
- self.logger["package_logger"] = logging.getLogger("openapi_client")
+ self.logger["package_logger"] = logging.getLogger("playground_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
"""Log format
diff --git a/api-service/playground_client/openapi_client/docs/CreateSessionResponse.md b/api-service/playground_client/docs/CreateSessionResponse.md
similarity index 91%
rename from api-service/playground_client/openapi_client/docs/CreateSessionResponse.md
rename to api-service/playground_client/docs/CreateSessionResponse.md
index d4ced8389..a20c893c4 100644
--- a/api-service/playground_client/openapi_client/docs/CreateSessionResponse.md
+++ b/api-service/playground_client/docs/CreateSessionResponse.md
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.create_session_response import CreateSessionResponse
+from playground_client.models.create_session_response import CreateSessionResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/docs/CreateSessionsRequest.md b/api-service/playground_client/docs/CreateSessionsRequest.md
new file mode 100644
index 000000000..d2979faea
--- /dev/null
+++ b/api-service/playground_client/docs/CreateSessionsRequest.md
@@ -0,0 +1,28 @@
+# CreateSessionsRequest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**env_id** | **str** | |
+
+## Example
+
+```python
+from playground_client.models.create_sessions_request import CreateSessionsRequest
+
+# TODO update the JSON string below
+json = "{}"
+# create an instance of CreateSessionsRequest from a JSON string
+create_sessions_request_instance = CreateSessionsRequest.from_json(json)
+# print the JSON string representation of the object
+print CreateSessionsRequest.to_json()
+
+# convert the object into a dict
+create_sessions_request_dict = create_sessions_request_instance.to_dict()
+# create an instance of CreateSessionsRequest from a dict
+create_sessions_request_form_dict = create_sessions_request.from_dict(create_sessions_request_dict)
+```
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/api-service/playground_client/openapi_client/docs/DefaultApi.md b/api-service/playground_client/docs/DefaultApi.md
similarity index 80%
rename from api-service/playground_client/openapi_client/docs/DefaultApi.md
rename to api-service/playground_client/docs/DefaultApi.md
index a607b0f85..4317a4d72 100644
--- a/api-service/playground_client/openapi_client/docs/DefaultApi.md
+++ b/api-service/playground_client/docs/DefaultApi.md
@@ -1,10 +1,10 @@
-# openapi_client.DefaultApi
+# playground_client.DefaultApi
All URIs are relative to *https://localhost:9001*
Method | HTTP request | Description
------------- | ------------- | -------------
-[**create_session**](DefaultApi.md#create_session) | **POST** /sessions |
+[**create_sessions**](DefaultApi.md#create_sessions) | **POST** /sessions |
[**delete_filesystem_entry**](DefaultApi.md#delete_filesystem_entry) | **DELETE** /sessions/{id}/filesystem |
[**delete_session**](DefaultApi.md#delete_session) | **DELETE** /sessions/{id} |
[**list_filesystem_dir**](DefaultApi.md#list_filesystem_dir) | **GET** /sessions/{id}/filesystem/dir |
@@ -14,8 +14,8 @@ Method | HTTP request | Description
[**write_filesystem_file**](DefaultApi.md#write_filesystem_file) | **PUT** /sessions/{id}/filesystem/file |
-# **create_session**
-> CreateSessionResponse create_session(create_session_params)
+# **create_sessions**
+> CreateSessionResponse create_sessions(create_sessions_request)
@@ -25,35 +25,35 @@ Method | HTTP request | Description
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
- create_session_params = openapi_client.CreateSessionParams() # CreateSessionParams |
+ api_instance = playground_client.DefaultApi(api_client)
+ create_sessions_request = playground_client.CreateSessionsRequest() # CreateSessionsRequest |
try:
- api_response = api_instance.create_session(create_session_params)
- print("The response of DefaultApi->create_session:\n")
+ api_response = api_instance.create_sessions(create_sessions_request)
+ print("The response of DefaultApi->create_sessions:\n")
pprint(api_response)
except Exception as e:
- print("Exception when calling DefaultApi->create_session: %s\n" % e)
+ print("Exception when calling DefaultApi->create_sessions: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
- **create_session_params** | [**CreateSessionParams**](CreateSessionParams.md)| |
+ **create_sessions_request** | [**CreateSessionsRequest**](CreateSessionsRequest.md)| |
### Return type
@@ -86,20 +86,20 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
path = 'path_example' # str |
@@ -147,20 +147,20 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
try:
@@ -206,20 +206,20 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
path = 'path_example' # str |
@@ -269,20 +269,20 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
path = 'path_example' # str |
@@ -330,20 +330,20 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
path = 'path_example' # str |
@@ -393,22 +393,22 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
- run_process_params = openapi_client.RunProcessParams() # RunProcessParams |
+ run_process_params = playground_client.RunProcessParams() # RunProcessParams |
try:
api_response = api_instance.run_process(id, run_process_params)
@@ -446,7 +446,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **write_filesystem_file**
-> write_filesystem_file(id, path, write_filesystem_file_params)
+> write_filesystem_file(id, path, write_filesystem_file_request)
@@ -456,26 +456,26 @@ No authorization required
from __future__ import print_function
import time
import os
-import openapi_client
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://localhost:9001
# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
+configuration = playground_client.Configuration(
host = "https://localhost:9001"
)
# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
+with playground_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
+ api_instance = playground_client.DefaultApi(api_client)
id = 'id_example' # str |
path = 'path_example' # str |
- write_filesystem_file_params = openapi_client.WriteFilesystemFileParams() # WriteFilesystemFileParams |
+ write_filesystem_file_request = playground_client.WriteFilesystemFileRequest() # WriteFilesystemFileRequest |
try:
- api_instance.write_filesystem_file(id, path, write_filesystem_file_params)
+ api_instance.write_filesystem_file(id, path, write_filesystem_file_request)
except Exception as e:
print("Exception when calling DefaultApi->write_filesystem_file: %s\n" % e)
```
@@ -486,7 +486,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| |
**path** | **str**| |
- **write_filesystem_file_params** | [**WriteFilesystemFileParams**](WriteFilesystemFileParams.md)| |
+ **write_filesystem_file_request** | [**WriteFilesystemFileRequest**](WriteFilesystemFileRequest.md)| |
### Return type
diff --git a/api-service/playground_client/openapi_client/docs/EntryInfo.md b/api-service/playground_client/docs/EntryInfo.md
similarity index 93%
rename from api-service/playground_client/openapi_client/docs/EntryInfo.md
rename to api-service/playground_client/docs/EntryInfo.md
index b65d8b867..f8aedf795 100644
--- a/api-service/playground_client/openapi_client/docs/EntryInfo.md
+++ b/api-service/playground_client/docs/EntryInfo.md
@@ -10,7 +10,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.entry_info import EntryInfo
+from playground_client.models.entry_info import EntryInfo
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/ListFilesystemDirResponse.md b/api-service/playground_client/docs/ListFilesystemDirResponse.md
similarity index 91%
rename from api-service/playground_client/openapi_client/docs/ListFilesystemDirResponse.md
rename to api-service/playground_client/docs/ListFilesystemDirResponse.md
index 689ed5f9a..c062a5329 100644
--- a/api-service/playground_client/openapi_client/docs/ListFilesystemDirResponse.md
+++ b/api-service/playground_client/docs/ListFilesystemDirResponse.md
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
+from playground_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/OutStderrResponse.md b/api-service/playground_client/docs/OutStderrResponse.md
similarity index 92%
rename from api-service/playground_client/openapi_client/docs/OutStderrResponse.md
rename to api-service/playground_client/docs/OutStderrResponse.md
index fe76934c7..7ab2acf19 100644
--- a/api-service/playground_client/openapi_client/docs/OutStderrResponse.md
+++ b/api-service/playground_client/docs/OutStderrResponse.md
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.out_stderr_response import OutStderrResponse
+from playground_client.models.out_stderr_response import OutStderrResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/OutStdoutResponse.md b/api-service/playground_client/docs/OutStdoutResponse.md
similarity index 92%
rename from api-service/playground_client/openapi_client/docs/OutStdoutResponse.md
rename to api-service/playground_client/docs/OutStdoutResponse.md
index 73e255365..064cfedb1 100644
--- a/api-service/playground_client/openapi_client/docs/OutStdoutResponse.md
+++ b/api-service/playground_client/docs/OutStdoutResponse.md
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.out_stdout_response import OutStdoutResponse
+from playground_client.models.out_stdout_response import OutStdoutResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/OutType.md b/api-service/playground_client/docs/OutType.md
similarity index 100%
rename from api-service/playground_client/openapi_client/docs/OutType.md
rename to api-service/playground_client/docs/OutType.md
diff --git a/api-service/playground_client/openapi_client/docs/OutTypeStderr.md b/api-service/playground_client/docs/OutTypeStderr.md
similarity index 100%
rename from api-service/playground_client/openapi_client/docs/OutTypeStderr.md
rename to api-service/playground_client/docs/OutTypeStderr.md
diff --git a/api-service/playground_client/openapi_client/docs/OutTypeStdout.md b/api-service/playground_client/docs/OutTypeStdout.md
similarity index 100%
rename from api-service/playground_client/openapi_client/docs/OutTypeStdout.md
rename to api-service/playground_client/docs/OutTypeStdout.md
diff --git a/api-service/playground_client/openapi_client/docs/ReadFilesystemFileResponse.md b/api-service/playground_client/docs/ReadFilesystemFileResponse.md
similarity index 91%
rename from api-service/playground_client/openapi_client/docs/ReadFilesystemFileResponse.md
rename to api-service/playground_client/docs/ReadFilesystemFileResponse.md
index d296d8a0c..3c892939f 100644
--- a/api-service/playground_client/openapi_client/docs/ReadFilesystemFileResponse.md
+++ b/api-service/playground_client/docs/ReadFilesystemFileResponse.md
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
+from playground_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/RunProcessParams.md b/api-service/playground_client/docs/RunProcessParams.md
similarity index 92%
rename from api-service/playground_client/openapi_client/docs/RunProcessParams.md
rename to api-service/playground_client/docs/RunProcessParams.md
index 4217a6843..1372ce0a2 100644
--- a/api-service/playground_client/openapi_client/docs/RunProcessParams.md
+++ b/api-service/playground_client/docs/RunProcessParams.md
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.run_process_params import RunProcessParams
+from playground_client.models.run_process_params import RunProcessParams
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/openapi_client/docs/RunProcessResponse.md b/api-service/playground_client/docs/RunProcessResponse.md
similarity index 92%
rename from api-service/playground_client/openapi_client/docs/RunProcessResponse.md
rename to api-service/playground_client/docs/RunProcessResponse.md
index 7ab4068d8..40843e883 100644
--- a/api-service/playground_client/openapi_client/docs/RunProcessResponse.md
+++ b/api-service/playground_client/docs/RunProcessResponse.md
@@ -10,7 +10,7 @@ Name | Type | Description | Notes
## Example
```python
-from openapi_client.models.run_process_response import RunProcessResponse
+from playground_client.models.run_process_response import RunProcessResponse
# TODO update the JSON string below
json = "{}"
diff --git a/api-service/playground_client/docs/WriteFilesystemFileRequest.md b/api-service/playground_client/docs/WriteFilesystemFileRequest.md
new file mode 100644
index 000000000..a1f431f16
--- /dev/null
+++ b/api-service/playground_client/docs/WriteFilesystemFileRequest.md
@@ -0,0 +1,28 @@
+# WriteFilesystemFileRequest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**content** | **str** | |
+
+## Example
+
+```python
+from playground_client.models.write_filesystem_file_request import WriteFilesystemFileRequest
+
+# TODO update the JSON string below
+json = "{}"
+# create an instance of WriteFilesystemFileRequest from a JSON string
+write_filesystem_file_request_instance = WriteFilesystemFileRequest.from_json(json)
+# print the JSON string representation of the object
+print WriteFilesystemFileRequest.to_json()
+
+# convert the object into a dict
+write_filesystem_file_request_dict = write_filesystem_file_request_instance.to_dict()
+# create an instance of WriteFilesystemFileRequest from a dict
+write_filesystem_file_request_form_dict = write_filesystem_file_request.from_dict(write_filesystem_file_request_dict)
+```
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/api-service/playground_client/openapi_client/exceptions.py b/api-service/playground_client/exceptions.py
similarity index 100%
rename from api-service/playground_client/openapi_client/exceptions.py
rename to api-service/playground_client/exceptions.py
diff --git a/api-service/playground_client/models/__init__.py b/api-service/playground_client/models/__init__.py
new file mode 100644
index 000000000..8138b0463
--- /dev/null
+++ b/api-service/playground_client/models/__init__.py
@@ -0,0 +1,29 @@
+# coding: utf-8
+
+# flake8: noqa
+"""
+ playground
+
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
+
+ The version of the OpenAPI document: 1.0.0
+ Generated by: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+# import models into model package
+from playground_client.models.create_session_response import CreateSessionResponse
+from playground_client.models.create_sessions_request import CreateSessionsRequest
+from playground_client.models.entry_info import EntryInfo
+from playground_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
+from playground_client.models.out_stderr_response import OutStderrResponse
+from playground_client.models.out_stdout_response import OutStdoutResponse
+from playground_client.models.out_type import OutType
+from playground_client.models.out_type_stderr import OutTypeStderr
+from playground_client.models.out_type_stdout import OutTypeStdout
+from playground_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
+from playground_client.models.run_process_params import RunProcessParams
+from playground_client.models.run_process_response import RunProcessResponse
+from playground_client.models.write_filesystem_file_request import WriteFilesystemFileRequest
diff --git a/api-service/playground_client/openapi_client/models/create_session_response.py b/api-service/playground_client/models/create_session_response.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/create_session_response.py
rename to api-service/playground_client/models/create_session_response.py
diff --git a/api-service/playground_client/openapi_client/models/create_session_params.py b/api-service/playground_client/models/create_sessions_request.py
similarity index 65%
rename from api-service/playground_client/openapi_client/models/create_session_params.py
rename to api-service/playground_client/models/create_sessions_request.py
index 247c64dfb..3f20dee6e 100644
--- a/api-service/playground_client/openapi_client/models/create_session_params.py
+++ b/api-service/playground_client/models/create_sessions_request.py
@@ -20,13 +20,14 @@ import json
from pydantic import BaseModel, Field, StrictStr
-class CreateSessionParams(BaseModel):
+class CreateSessionsRequest(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
env_id: StrictStr = Field(..., alias="envID")
+ additional_properties: Dict[str, Any] = {}
__properties = ["envID"]
class Config:
@@ -42,34 +43,40 @@ class CreateSessionParams(BaseModel):
return json.dumps(self.to_dict())
@classmethod
- def from_json(cls, json_str: str) -> CreateSessionParams:
- """Create an instance of CreateSessionParams from a JSON string"""
+ def from_json(cls, json_str: str) -> CreateSessionsRequest:
+ """Create an instance of CreateSessionsRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
+ "additional_properties"
},
exclude_none=True)
+ # puts key-value pairs in additional_properties in the top level
+ if self.additional_properties is not None:
+ for _key, _value in self.additional_properties.items():
+ _dict[_key] = _value
+
return _dict
@classmethod
- def from_dict(cls, obj: dict) -> CreateSessionParams:
- """Create an instance of CreateSessionParams from a dict"""
+ def from_dict(cls, obj: dict) -> CreateSessionsRequest:
+ """Create an instance of CreateSessionsRequest from a dict"""
if obj is None:
return None
if type(obj) is not dict:
- return CreateSessionParams.parse_obj(obj)
+ return CreateSessionsRequest.parse_obj(obj)
- # raise errors for additional fields in the input
+ _obj = CreateSessionsRequest.parse_obj({
+ "env_id": obj.get("envID")
+ })
+ # store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
- raise ValueError("Error due to additional fields (not defined in CreateSessionParams) in the input: " + obj)
+ _obj.additional_properties[_key] = obj.get(_key)
- _obj = CreateSessionParams.parse_obj({
- "env_id": obj.get("envID")
- })
return _obj
diff --git a/api-service/playground_client/openapi_client/models/entry_info.py b/api-service/playground_client/models/entry_info.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/entry_info.py
rename to api-service/playground_client/models/entry_info.py
diff --git a/api-service/playground_client/openapi_client/models/list_filesystem_dir_response.py b/api-service/playground_client/models/list_filesystem_dir_response.py
similarity index 97%
rename from api-service/playground_client/openapi_client/models/list_filesystem_dir_response.py
rename to api-service/playground_client/models/list_filesystem_dir_response.py
index b5decc490..ddc8ad837 100644
--- a/api-service/playground_client/openapi_client/models/list_filesystem_dir_response.py
+++ b/api-service/playground_client/models/list_filesystem_dir_response.py
@@ -19,7 +19,7 @@ import json
from typing import List
from pydantic import BaseModel
-from openapi_client.models.entry_info import EntryInfo
+from playground_client.models.entry_info import EntryInfo
class ListFilesystemDirResponse(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
diff --git a/api-service/playground_client/openapi_client/models/out_stderr_response.py b/api-service/playground_client/models/out_stderr_response.py
similarity index 97%
rename from api-service/playground_client/openapi_client/models/out_stderr_response.py
rename to api-service/playground_client/models/out_stderr_response.py
index 325930595..6434f41f5 100644
--- a/api-service/playground_client/openapi_client/models/out_stderr_response.py
+++ b/api-service/playground_client/models/out_stderr_response.py
@@ -19,7 +19,7 @@ import json
from pydantic import BaseModel, StrictFloat, StrictStr
-from openapi_client.models.out_type_stderr import OutTypeStderr
+from playground_client.models.out_type_stderr import OutTypeStderr
class OutStderrResponse(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
diff --git a/api-service/playground_client/openapi_client/models/out_stdout_response.py b/api-service/playground_client/models/out_stdout_response.py
similarity index 97%
rename from api-service/playground_client/openapi_client/models/out_stdout_response.py
rename to api-service/playground_client/models/out_stdout_response.py
index 498be020e..afbab1258 100644
--- a/api-service/playground_client/openapi_client/models/out_stdout_response.py
+++ b/api-service/playground_client/models/out_stdout_response.py
@@ -19,7 +19,7 @@ import json
from pydantic import BaseModel, StrictFloat, StrictStr
-from openapi_client.models.out_type_stdout import OutTypeStdout
+from playground_client.models.out_type_stdout import OutTypeStdout
class OutStdoutResponse(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
diff --git a/api-service/playground_client/openapi_client/models/out_type.py b/api-service/playground_client/models/out_type.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/out_type.py
rename to api-service/playground_client/models/out_type.py
diff --git a/api-service/playground_client/openapi_client/models/out_type_stderr.py b/api-service/playground_client/models/out_type_stderr.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/out_type_stderr.py
rename to api-service/playground_client/models/out_type_stderr.py
diff --git a/api-service/playground_client/openapi_client/models/out_type_stdout.py b/api-service/playground_client/models/out_type_stdout.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/out_type_stdout.py
rename to api-service/playground_client/models/out_type_stdout.py
diff --git a/api-service/playground_client/openapi_client/models/read_filesystem_file_response.py b/api-service/playground_client/models/read_filesystem_file_response.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/read_filesystem_file_response.py
rename to api-service/playground_client/models/read_filesystem_file_response.py
diff --git a/api-service/playground_client/openapi_client/models/run_process_params.py b/api-service/playground_client/models/run_process_params.py
similarity index 100%
rename from api-service/playground_client/openapi_client/models/run_process_params.py
rename to api-service/playground_client/models/run_process_params.py
diff --git a/api-service/playground_client/openapi_client/models/run_process_response.py b/api-service/playground_client/models/run_process_response.py
similarity index 95%
rename from api-service/playground_client/openapi_client/models/run_process_response.py
rename to api-service/playground_client/models/run_process_response.py
index 9015ea76d..d9f8e7e68 100644
--- a/api-service/playground_client/openapi_client/models/run_process_response.py
+++ b/api-service/playground_client/models/run_process_response.py
@@ -19,8 +19,8 @@ import json
from typing import List
from pydantic import BaseModel
-from openapi_client.models.out_stderr_response import OutStderrResponse
-from openapi_client.models.out_stdout_response import OutStdoutResponse
+from playground_client.models.out_stderr_response import OutStderrResponse
+from playground_client.models.out_stdout_response import OutStdoutResponse
class RunProcessResponse(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
diff --git a/api-service/playground_client/openapi_client/models/write_filesystem_file_params.py b/api-service/playground_client/models/write_filesystem_file_request.py
similarity index 64%
rename from api-service/playground_client/openapi_client/models/write_filesystem_file_params.py
rename to api-service/playground_client/models/write_filesystem_file_request.py
index 7a329f069..0611e3766 100644
--- a/api-service/playground_client/openapi_client/models/write_filesystem_file_params.py
+++ b/api-service/playground_client/models/write_filesystem_file_request.py
@@ -20,13 +20,14 @@ import json
from pydantic import BaseModel, StrictStr
-class WriteFilesystemFileParams(BaseModel):
+class WriteFilesystemFileRequest(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
content: StrictStr = ...
+ additional_properties: Dict[str, Any] = {}
__properties = ["content"]
class Config:
@@ -42,34 +43,40 @@ class WriteFilesystemFileParams(BaseModel):
return json.dumps(self.to_dict())
@classmethod
- def from_json(cls, json_str: str) -> WriteFilesystemFileParams:
- """Create an instance of WriteFilesystemFileParams from a JSON string"""
+ def from_json(cls, json_str: str) -> WriteFilesystemFileRequest:
+ """Create an instance of WriteFilesystemFileRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
exclude={
+ "additional_properties"
},
exclude_none=True)
+ # puts key-value pairs in additional_properties in the top level
+ if self.additional_properties is not None:
+ for _key, _value in self.additional_properties.items():
+ _dict[_key] = _value
+
return _dict
@classmethod
- def from_dict(cls, obj: dict) -> WriteFilesystemFileParams:
- """Create an instance of WriteFilesystemFileParams from a dict"""
+ def from_dict(cls, obj: dict) -> WriteFilesystemFileRequest:
+ """Create an instance of WriteFilesystemFileRequest from a dict"""
if obj is None:
return None
if type(obj) is not dict:
- return WriteFilesystemFileParams.parse_obj(obj)
+ return WriteFilesystemFileRequest.parse_obj(obj)
- # raise errors for additional fields in the input
+ _obj = WriteFilesystemFileRequest.parse_obj({
+ "content": obj.get("content")
+ })
+ # store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
- raise ValueError("Error due to additional fields (not defined in WriteFilesystemFileParams) in the input: " + obj)
+ _obj.additional_properties[_key] = obj.get(_key)
- _obj = WriteFilesystemFileParams.parse_obj({
- "content": obj.get("content")
- })
return _obj
diff --git a/api-service/playground_client/openapi_client/__init__.py b/api-service/playground_client/openapi_client/__init__.py
deleted file mode 100644
index 8d76fbba1..000000000
--- a/api-service/playground_client/openapi_client/__init__.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-
-"""
- playground
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
-
- The version of the OpenAPI document: 1.0.0
- Generated by: https://openapi-generator.tech
-"""
-
-
-from __future__ import absolute_import
-
-__version__ = "1.0.0"
-
-# import apis into sdk package
-from openapi_client.api.default_api import DefaultApi
-
-# import ApiClient
-from openapi_client.api_client import ApiClient
-from openapi_client.configuration import Configuration
-from openapi_client.exceptions import OpenApiException
-from openapi_client.exceptions import ApiTypeError
-from openapi_client.exceptions import ApiValueError
-from openapi_client.exceptions import ApiKeyError
-from openapi_client.exceptions import ApiAttributeError
-from openapi_client.exceptions import ApiException
-# import models into sdk package
-from openapi_client.models.create_session_params import CreateSessionParams
-from openapi_client.models.create_session_response import CreateSessionResponse
-from openapi_client.models.entry_info import EntryInfo
-from openapi_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
-from openapi_client.models.out_stderr_response import OutStderrResponse
-from openapi_client.models.out_stdout_response import OutStdoutResponse
-from openapi_client.models.out_type import OutType
-from openapi_client.models.out_type_stderr import OutTypeStderr
-from openapi_client.models.out_type_stdout import OutTypeStdout
-from openapi_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
-from openapi_client.models.run_process_params import RunProcessParams
-from openapi_client.models.run_process_response import RunProcessResponse
-from openapi_client.models.write_filesystem_file_params import WriteFilesystemFileParams
diff --git a/api-service/playground_client/openapi_client/docs/CreateSessionParams.md b/api-service/playground_client/openapi_client/docs/CreateSessionParams.md
deleted file mode 100644
index e8964dd73..000000000
--- a/api-service/playground_client/openapi_client/docs/CreateSessionParams.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# CreateSessionParams
-
-
-## Properties
-Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
-**env_id** | **str** | |
-
-## Example
-
-```python
-from openapi_client.models.create_session_params import CreateSessionParams
-
-# TODO update the JSON string below
-json = "{}"
-# create an instance of CreateSessionParams from a JSON string
-create_session_params_instance = CreateSessionParams.from_json(json)
-# print the JSON string representation of the object
-print CreateSessionParams.to_json()
-
-# convert the object into a dict
-create_session_params_dict = create_session_params_instance.to_dict()
-# create an instance of CreateSessionParams from a dict
-create_session_params_form_dict = create_session_params.from_dict(create_session_params_dict)
-```
-[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
-
-
diff --git a/api-service/playground_client/openapi_client/docs/WriteFilesystemFileParams.md b/api-service/playground_client/openapi_client/docs/WriteFilesystemFileParams.md
deleted file mode 100644
index 381fd9d1e..000000000
--- a/api-service/playground_client/openapi_client/docs/WriteFilesystemFileParams.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# WriteFilesystemFileParams
-
-
-## Properties
-Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
-**content** | **str** | |
-
-## Example
-
-```python
-from openapi_client.models.write_filesystem_file_params import WriteFilesystemFileParams
-
-# TODO update the JSON string below
-json = "{}"
-# create an instance of WriteFilesystemFileParams from a JSON string
-write_filesystem_file_params_instance = WriteFilesystemFileParams.from_json(json)
-# print the JSON string representation of the object
-print WriteFilesystemFileParams.to_json()
-
-# convert the object into a dict
-write_filesystem_file_params_dict = write_filesystem_file_params_instance.to_dict()
-# create an instance of WriteFilesystemFileParams from a dict
-write_filesystem_file_params_form_dict = write_filesystem_file_params.from_dict(write_filesystem_file_params_dict)
-```
-[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
-
-
diff --git a/api-service/playground_client/openapi_client/models/__init__.py b/api-service/playground_client/openapi_client/models/__init__.py
deleted file mode 100644
index 8545a1f92..000000000
--- a/api-service/playground_client/openapi_client/models/__init__.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# coding: utf-8
-
-# flake8: noqa
-"""
- playground
-
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
-
- The version of the OpenAPI document: 1.0.0
- Generated by: https://openapi-generator.tech
-"""
-
-
-from __future__ import absolute_import
-
-# import models into model package
-from openapi_client.models.create_session_params import CreateSessionParams
-from openapi_client.models.create_session_response import CreateSessionResponse
-from openapi_client.models.entry_info import EntryInfo
-from openapi_client.models.list_filesystem_dir_response import ListFilesystemDirResponse
-from openapi_client.models.out_stderr_response import OutStderrResponse
-from openapi_client.models.out_stdout_response import OutStdoutResponse
-from openapi_client.models.out_type import OutType
-from openapi_client.models.out_type_stderr import OutTypeStderr
-from openapi_client.models.out_type_stdout import OutTypeStdout
-from openapi_client.models.read_filesystem_file_response import ReadFilesystemFileResponse
-from openapi_client.models.run_process_params import RunProcessParams
-from openapi_client.models.run_process_response import RunProcessResponse
-from openapi_client.models.write_filesystem_file_params import WriteFilesystemFileParams
diff --git a/api-service/playground_client/openapi_client/test/__init__.py b/api-service/playground_client/openapi_client/test/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/api-service/playground_client/openapi_client_README.md b/api-service/playground_client/openapi_client_README.md
deleted file mode 100644
index 05ee4007a..000000000
--- a/api-service/playground_client/openapi_client_README.md
+++ /dev/null
@@ -1,102 +0,0 @@
-# playground_client
-No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
-
-The `openapi_client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
-
-- API version: 1.0.0
-- Package version: 1.0.0
-- Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen
-
-## Requirements.
-
-Python 3.7+
-
-## Installation & Usage
-
-This python library package is generated without supporting files like setup.py or requirements files
-
-To be able to use it, you will need these dependencies in your own package that uses this library:
-
-* urllib3 >= 1.25.3
-* python-dateutil
-* pydantic
-* aenum
-
-## Getting Started
-
-In your own code, to use this library to connect and interact with playground_client,
-you can run the following:
-
-```python
-from __future__ import print_function
-
-import time
-import openapi_client
-from openapi_client.rest import ApiException
-from pprint import pprint
-
-# Defining the host is optional and defaults to https://localhost:9001
-# See configuration.py for a list of all supported configuration parameters.
-configuration = openapi_client.Configuration(
- host = "https://localhost:9001"
-)
-
-
-
-# Enter a context with an instance of the API client
-with openapi_client.ApiClient(configuration) as api_client:
- # Create an instance of the API class
- api_instance = openapi_client.DefaultApi(api_client)
- create_session_params = openapi_client.CreateSessionParams() # CreateSessionParams |
-
- try:
- api_response = api_instance.create_session(create_session_params)
- print("The response of DefaultApi->create_session:\n")
- pprint(api_response)
- except ApiException as e:
- print("Exception when calling DefaultApi->create_session: %s\n" % e)
-
-```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *https://localhost:9001*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-*DefaultApi* | [**create_session**](openapi_client/docs/DefaultApi.md#create_session) | **POST** /sessions |
-*DefaultApi* | [**delete_filesystem_entry**](openapi_client/docs/DefaultApi.md#delete_filesystem_entry) | **DELETE** /sessions/{id}/filesystem |
-*DefaultApi* | [**delete_session**](openapi_client/docs/DefaultApi.md#delete_session) | **DELETE** /sessions/{id} |
-*DefaultApi* | [**list_filesystem_dir**](openapi_client/docs/DefaultApi.md#list_filesystem_dir) | **GET** /sessions/{id}/filesystem/dir |
-*DefaultApi* | [**make_filesystem_dir**](openapi_client/docs/DefaultApi.md#make_filesystem_dir) | **PUT** /sessions/{id}/filesystem/dir |
-*DefaultApi* | [**read_filesystem_file**](openapi_client/docs/DefaultApi.md#read_filesystem_file) | **GET** /sessions/{id}/filesystem/file |
-*DefaultApi* | [**run_process**](openapi_client/docs/DefaultApi.md#run_process) | **POST** /sessions/{id}/process |
-*DefaultApi* | [**write_filesystem_file**](openapi_client/docs/DefaultApi.md#write_filesystem_file) | **PUT** /sessions/{id}/filesystem/file |
-
-
-## Documentation For Models
-
- - [CreateSessionParams](openapi_client/docs/CreateSessionParams.md)
- - [CreateSessionResponse](openapi_client/docs/CreateSessionResponse.md)
- - [EntryInfo](openapi_client/docs/EntryInfo.md)
- - [ListFilesystemDirResponse](openapi_client/docs/ListFilesystemDirResponse.md)
- - [OutStderrResponse](openapi_client/docs/OutStderrResponse.md)
- - [OutStdoutResponse](openapi_client/docs/OutStdoutResponse.md)
- - [OutType](openapi_client/docs/OutType.md)
- - [OutTypeStderr](openapi_client/docs/OutTypeStderr.md)
- - [OutTypeStdout](openapi_client/docs/OutTypeStdout.md)
- - [ReadFilesystemFileResponse](openapi_client/docs/ReadFilesystemFileResponse.md)
- - [RunProcessParams](openapi_client/docs/RunProcessParams.md)
- - [RunProcessResponse](openapi_client/docs/RunProcessResponse.md)
- - [WriteFilesystemFileParams](openapi_client/docs/WriteFilesystemFileParams.md)
-
-
-## Documentation For Authorization
-
- All endpoints do not require authorization.
-
-## Author
-
-
-
-
diff --git a/api-service/playground_client/openapi_client/rest.py b/api-service/playground_client/rest.py
similarity index 98%
rename from api-service/playground_client/openapi_client/rest.py
rename to api-service/playground_client/rest.py
index 75d52ca5e..4ee97c21b 100644
--- a/api-service/playground_client/openapi_client/rest.py
+++ b/api-service/playground_client/rest.py
@@ -21,7 +21,7 @@ import ssl
from urllib.parse import urlencode, quote_plus
import urllib3
-from openapi_client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
+from playground_client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
logger = logging.getLogger(__name__)
diff --git a/api-service/codegen/db/__init__.py b/api-service/playground_client/test/__init__.py
similarity index 100%
rename from api-service/codegen/db/__init__.py
rename to api-service/playground_client/test/__init__.py
diff --git a/api-service/playground_client/openapi_client/test/test_create_session_response.py b/api-service/playground_client/test/test_create_session_response.py
similarity index 83%
rename from api-service/playground_client/openapi_client/test/test_create_session_response.py
rename to api-service/playground_client/test/test_create_session_response.py
index 29ae94944..2a1ad592a 100644
--- a/api-service/playground_client/openapi_client/test/test_create_session_response.py
+++ b/api-service/playground_client/test/test_create_session_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.create_session_response import CreateSessionResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.create_session_response import CreateSessionResponse # noqa: E501
+from playground_client.rest import ApiException
class TestCreateSessionResponse(unittest.TestCase):
"""CreateSessionResponse unit test stubs"""
@@ -35,7 +35,7 @@ class TestCreateSessionResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `CreateSessionResponse`
"""
- model = openapi_client.models.create_session_response.CreateSessionResponse() # noqa: E501
+ model = playground_client.models.create_session_response.CreateSessionResponse() # noqa: E501
if include_optional :
return CreateSessionResponse(
id = ''
diff --git a/api-service/playground_client/openapi_client/test/test_create_session_params.py b/api-service/playground_client/test/test_create_sessions_request.py
similarity index 63%
rename from api-service/playground_client/openapi_client/test/test_create_session_params.py
rename to api-service/playground_client/test/test_create_sessions_request.py
index 81b62b320..44e9b8466 100644
--- a/api-service/playground_client/openapi_client/test/test_create_session_params.py
+++ b/api-service/playground_client/test/test_create_sessions_request.py
@@ -15,12 +15,12 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.create_session_params import CreateSessionParams # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.create_sessions_request import CreateSessionsRequest # noqa: E501
+from playground_client.rest import ApiException
-class TestCreateSessionParams(unittest.TestCase):
- """CreateSessionParams unit test stubs"""
+class TestCreateSessionsRequest(unittest.TestCase):
+ """CreateSessionsRequest unit test stubs"""
def setUp(self):
pass
@@ -29,25 +29,25 @@ class TestCreateSessionParams(unittest.TestCase):
pass
def make_instance(self, include_optional):
- """Test CreateSessionParams
+ """Test CreateSessionsRequest
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
- # uncomment below to create an instance of `CreateSessionParams`
+ # uncomment below to create an instance of `CreateSessionsRequest`
"""
- model = openapi_client.models.create_session_params.CreateSessionParams() # noqa: E501
+ model = playground_client.models.create_sessions_request.CreateSessionsRequest() # noqa: E501
if include_optional :
- return CreateSessionParams(
+ return CreateSessionsRequest(
env_id = ''
)
else :
- return CreateSessionParams(
+ return CreateSessionsRequest(
env_id = '',
)
"""
- def testCreateSessionParams(self):
- """Test CreateSessionParams"""
+ def testCreateSessionsRequest(self):
+ """Test CreateSessionsRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
diff --git a/api-service/playground_client/openapi_client/test/test_default_api.py b/api-service/playground_client/test/test_default_api.py
similarity index 81%
rename from api-service/playground_client/openapi_client/test/test_default_api.py
rename to api-service/playground_client/test/test_default_api.py
index 921895103..4cf7745ef 100644
--- a/api-service/playground_client/openapi_client/test/test_default_api.py
+++ b/api-service/playground_client/test/test_default_api.py
@@ -14,22 +14,22 @@ from __future__ import absolute_import
import unittest
-import openapi_client
-from openapi_client.api.default_api import DefaultApi # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.api.default_api import DefaultApi # noqa: E501
+from playground_client.rest import ApiException
class TestDefaultApi(unittest.TestCase):
"""DefaultApi unit test stubs"""
def setUp(self):
- self.api = openapi_client.api.default_api.DefaultApi() # noqa: E501
+ self.api = playground_client.api.default_api.DefaultApi() # noqa: E501
def tearDown(self):
pass
- def test_create_session(self):
- """Test case for create_session
+ def test_create_sessions(self):
+ """Test case for create_sessions
"""
pass
diff --git a/api-service/playground_client/openapi_client/test/test_entry_info.py b/api-service/playground_client/test/test_entry_info.py
similarity index 85%
rename from api-service/playground_client/openapi_client/test/test_entry_info.py
rename to api-service/playground_client/test/test_entry_info.py
index 0057032e8..e62a89692 100644
--- a/api-service/playground_client/openapi_client/test/test_entry_info.py
+++ b/api-service/playground_client/test/test_entry_info.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.entry_info import EntryInfo # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.entry_info import EntryInfo # noqa: E501
+from playground_client.rest import ApiException
class TestEntryInfo(unittest.TestCase):
"""EntryInfo unit test stubs"""
@@ -35,7 +35,7 @@ class TestEntryInfo(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `EntryInfo`
"""
- model = openapi_client.models.entry_info.EntryInfo() # noqa: E501
+ model = playground_client.models.entry_info.EntryInfo() # noqa: E501
if include_optional :
return EntryInfo(
is_dir = True,
diff --git a/api-service/playground_client/openapi_client/test/test_list_filesystem_dir_response.py b/api-service/playground_client/test/test_list_filesystem_dir_response.py
similarity index 78%
rename from api-service/playground_client/openapi_client/test/test_list_filesystem_dir_response.py
rename to api-service/playground_client/test/test_list_filesystem_dir_response.py
index a908a41af..9e761c50d 100644
--- a/api-service/playground_client/openapi_client/test/test_list_filesystem_dir_response.py
+++ b/api-service/playground_client/test/test_list_filesystem_dir_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.list_filesystem_dir_response import ListFilesystemDirResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.list_filesystem_dir_response import ListFilesystemDirResponse # noqa: E501
+from playground_client.rest import ApiException
class TestListFilesystemDirResponse(unittest.TestCase):
"""ListFilesystemDirResponse unit test stubs"""
@@ -35,11 +35,11 @@ class TestListFilesystemDirResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `ListFilesystemDirResponse`
"""
- model = openapi_client.models.list_filesystem_dir_response.ListFilesystemDirResponse() # noqa: E501
+ model = playground_client.models.list_filesystem_dir_response.ListFilesystemDirResponse() # noqa: E501
if include_optional :
return ListFilesystemDirResponse(
entries = [
- openapi_client.models.entry_info.EntryInfo(
+ playground_client.models.entry_info.EntryInfo(
is_dir = True,
name = '', )
]
@@ -47,7 +47,7 @@ class TestListFilesystemDirResponse(unittest.TestCase):
else :
return ListFilesystemDirResponse(
entries = [
- openapi_client.models.entry_info.EntryInfo(
+ playground_client.models.entry_info.EntryInfo(
is_dir = True,
name = '', )
],
diff --git a/api-service/playground_client/openapi_client/test/test_out_stderr_response.py b/api-service/playground_client/test/test_out_stderr_response.py
similarity index 85%
rename from api-service/playground_client/openapi_client/test/test_out_stderr_response.py
rename to api-service/playground_client/test/test_out_stderr_response.py
index c0cd648f1..a95d3a630 100644
--- a/api-service/playground_client/openapi_client/test/test_out_stderr_response.py
+++ b/api-service/playground_client/test/test_out_stderr_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.out_stderr_response import OutStderrResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.out_stderr_response import OutStderrResponse # noqa: E501
+from playground_client.rest import ApiException
class TestOutStderrResponse(unittest.TestCase):
"""OutStderrResponse unit test stubs"""
@@ -35,7 +35,7 @@ class TestOutStderrResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `OutStderrResponse`
"""
- model = openapi_client.models.out_stderr_response.OutStderrResponse() # noqa: E501
+ model = playground_client.models.out_stderr_response.OutStderrResponse() # noqa: E501
if include_optional :
return OutStderrResponse(
type = 'Stderr',
diff --git a/api-service/playground_client/openapi_client/test/test_out_stdout_response.py b/api-service/playground_client/test/test_out_stdout_response.py
similarity index 85%
rename from api-service/playground_client/openapi_client/test/test_out_stdout_response.py
rename to api-service/playground_client/test/test_out_stdout_response.py
index b8a0e56ae..c994bbb7c 100644
--- a/api-service/playground_client/openapi_client/test/test_out_stdout_response.py
+++ b/api-service/playground_client/test/test_out_stdout_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.out_stdout_response import OutStdoutResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.out_stdout_response import OutStdoutResponse # noqa: E501
+from playground_client.rest import ApiException
class TestOutStdoutResponse(unittest.TestCase):
"""OutStdoutResponse unit test stubs"""
@@ -35,7 +35,7 @@ class TestOutStdoutResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `OutStdoutResponse`
"""
- model = openapi_client.models.out_stdout_response.OutStdoutResponse() # noqa: E501
+ model = playground_client.models.out_stdout_response.OutStdoutResponse() # noqa: E501
if include_optional :
return OutStdoutResponse(
type = 'Stdout',
diff --git a/api-service/playground_client/openapi_client/test/test_out_type.py b/api-service/playground_client/test/test_out_type.py
similarity index 81%
rename from api-service/playground_client/openapi_client/test/test_out_type.py
rename to api-service/playground_client/test/test_out_type.py
index 5449b6c81..f405874fb 100644
--- a/api-service/playground_client/openapi_client/test/test_out_type.py
+++ b/api-service/playground_client/test/test_out_type.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.out_type import OutType # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.out_type import OutType # noqa: E501
+from playground_client.rest import ApiException
class TestOutType(unittest.TestCase):
"""OutType unit test stubs"""
diff --git a/api-service/playground_client/openapi_client/test/test_out_type_stderr.py b/api-service/playground_client/test/test_out_type_stderr.py
similarity index 80%
rename from api-service/playground_client/openapi_client/test/test_out_type_stderr.py
rename to api-service/playground_client/test/test_out_type_stderr.py
index 64d3ebbaf..0294cd45f 100644
--- a/api-service/playground_client/openapi_client/test/test_out_type_stderr.py
+++ b/api-service/playground_client/test/test_out_type_stderr.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.out_type_stderr import OutTypeStderr # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.out_type_stderr import OutTypeStderr # noqa: E501
+from playground_client.rest import ApiException
class TestOutTypeStderr(unittest.TestCase):
"""OutTypeStderr unit test stubs"""
diff --git a/api-service/playground_client/openapi_client/test/test_out_type_stdout.py b/api-service/playground_client/test/test_out_type_stdout.py
similarity index 80%
rename from api-service/playground_client/openapi_client/test/test_out_type_stdout.py
rename to api-service/playground_client/test/test_out_type_stdout.py
index c7d3d4d43..17dfe7d14 100644
--- a/api-service/playground_client/openapi_client/test/test_out_type_stdout.py
+++ b/api-service/playground_client/test/test_out_type_stdout.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.out_type_stdout import OutTypeStdout # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.out_type_stdout import OutTypeStdout # noqa: E501
+from playground_client.rest import ApiException
class TestOutTypeStdout(unittest.TestCase):
"""OutTypeStdout unit test stubs"""
diff --git a/api-service/playground_client/openapi_client/test/test_read_filesystem_file_response.py b/api-service/playground_client/test/test_read_filesystem_file_response.py
similarity index 82%
rename from api-service/playground_client/openapi_client/test/test_read_filesystem_file_response.py
rename to api-service/playground_client/test/test_read_filesystem_file_response.py
index 929a8587a..7078adaa6 100644
--- a/api-service/playground_client/openapi_client/test/test_read_filesystem_file_response.py
+++ b/api-service/playground_client/test/test_read_filesystem_file_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.read_filesystem_file_response import ReadFilesystemFileResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.read_filesystem_file_response import ReadFilesystemFileResponse # noqa: E501
+from playground_client.rest import ApiException
class TestReadFilesystemFileResponse(unittest.TestCase):
"""ReadFilesystemFileResponse unit test stubs"""
@@ -35,7 +35,7 @@ class TestReadFilesystemFileResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `ReadFilesystemFileResponse`
"""
- model = openapi_client.models.read_filesystem_file_response.ReadFilesystemFileResponse() # noqa: E501
+ model = playground_client.models.read_filesystem_file_response.ReadFilesystemFileResponse() # noqa: E501
if include_optional :
return ReadFilesystemFileResponse(
content = ''
diff --git a/api-service/playground_client/openapi_client/test/test_run_process_params.py b/api-service/playground_client/test/test_run_process_params.py
similarity index 84%
rename from api-service/playground_client/openapi_client/test/test_run_process_params.py
rename to api-service/playground_client/test/test_run_process_params.py
index b121979f2..e148b0b1b 100644
--- a/api-service/playground_client/openapi_client/test/test_run_process_params.py
+++ b/api-service/playground_client/test/test_run_process_params.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.run_process_params import RunProcessParams # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.run_process_params import RunProcessParams # noqa: E501
+from playground_client.rest import ApiException
class TestRunProcessParams(unittest.TestCase):
"""RunProcessParams unit test stubs"""
@@ -35,7 +35,7 @@ class TestRunProcessParams(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `RunProcessParams`
"""
- model = openapi_client.models.run_process_params.RunProcessParams() # noqa: E501
+ model = playground_client.models.run_process_params.RunProcessParams() # noqa: E501
if include_optional :
return RunProcessParams(
cmd = '',
diff --git a/api-service/playground_client/openapi_client/test/test_run_process_response.py b/api-service/playground_client/test/test_run_process_response.py
similarity index 76%
rename from api-service/playground_client/openapi_client/test/test_run_process_response.py
rename to api-service/playground_client/test/test_run_process_response.py
index 8fd73fed0..2a50e0ac2 100644
--- a/api-service/playground_client/openapi_client/test/test_run_process_response.py
+++ b/api-service/playground_client/test/test_run_process_response.py
@@ -15,9 +15,9 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.run_process_response import RunProcessResponse # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.run_process_response import RunProcessResponse # noqa: E501
+from playground_client.rest import ApiException
class TestRunProcessResponse(unittest.TestCase):
"""RunProcessResponse unit test stubs"""
@@ -35,17 +35,17 @@ class TestRunProcessResponse(unittest.TestCase):
optional params are included """
# uncomment below to create an instance of `RunProcessResponse`
"""
- model = openapi_client.models.run_process_response.RunProcessResponse() # noqa: E501
+ model = playground_client.models.run_process_response.RunProcessResponse() # noqa: E501
if include_optional :
return RunProcessResponse(
stderr = [
- openapi_client.models.out_stderr_response.OutStderrResponse(
+ playground_client.models.out_stderr_response.OutStderrResponse(
type = 'Stderr',
timestamp = 1.337,
line = '', )
],
stdout = [
- openapi_client.models.out_stdout_response.OutStdoutResponse(
+ playground_client.models.out_stdout_response.OutStdoutResponse(
type = 'Stdout',
timestamp = 1.337,
line = '', )
@@ -54,13 +54,13 @@ class TestRunProcessResponse(unittest.TestCase):
else :
return RunProcessResponse(
stderr = [
- openapi_client.models.out_stderr_response.OutStderrResponse(
+ playground_client.models.out_stderr_response.OutStderrResponse(
type = 'Stderr',
timestamp = 1.337,
line = '', )
],
stdout = [
- openapi_client.models.out_stdout_response.OutStdoutResponse(
+ playground_client.models.out_stdout_response.OutStdoutResponse(
type = 'Stdout',
timestamp = 1.337,
line = '', )
diff --git a/api-service/playground_client/openapi_client/test/test_write_filesystem_file_params.py b/api-service/playground_client/test/test_write_filesystem_file_request.py
similarity index 61%
rename from api-service/playground_client/openapi_client/test/test_write_filesystem_file_params.py
rename to api-service/playground_client/test/test_write_filesystem_file_request.py
index 90340b10c..d83dd84f7 100644
--- a/api-service/playground_client/openapi_client/test/test_write_filesystem_file_params.py
+++ b/api-service/playground_client/test/test_write_filesystem_file_request.py
@@ -15,12 +15,12 @@ from __future__ import absolute_import
import unittest
import datetime
-import openapi_client
-from openapi_client.models.write_filesystem_file_params import WriteFilesystemFileParams # noqa: E501
-from openapi_client.rest import ApiException
+import playground_client
+from playground_client.models.write_filesystem_file_request import WriteFilesystemFileRequest # noqa: E501
+from playground_client.rest import ApiException
-class TestWriteFilesystemFileParams(unittest.TestCase):
- """WriteFilesystemFileParams unit test stubs"""
+class TestWriteFilesystemFileRequest(unittest.TestCase):
+ """WriteFilesystemFileRequest unit test stubs"""
def setUp(self):
pass
@@ -29,25 +29,25 @@ class TestWriteFilesystemFileParams(unittest.TestCase):
pass
def make_instance(self, include_optional):
- """Test WriteFilesystemFileParams
+ """Test WriteFilesystemFileRequest
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
- # uncomment below to create an instance of `WriteFilesystemFileParams`
+ # uncomment below to create an instance of `WriteFilesystemFileRequest`
"""
- model = openapi_client.models.write_filesystem_file_params.WriteFilesystemFileParams() # noqa: E501
+ model = playground_client.models.write_filesystem_file_request.WriteFilesystemFileRequest() # noqa: E501
if include_optional :
- return WriteFilesystemFileParams(
+ return WriteFilesystemFileRequest(
content = ''
)
else :
- return WriteFilesystemFileParams(
+ return WriteFilesystemFileRequest(
content = '',
)
"""
- def testWriteFilesystemFileParams(self):
- """Test WriteFilesystemFileParams"""
+ def testWriteFilesystemFileRequest(self):
+ """Test WriteFilesystemFileRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
diff --git a/api-service/playground_client_README.md b/api-service/playground_client_README.md
new file mode 100644
index 000000000..0845f990c
--- /dev/null
+++ b/api-service/playground_client_README.md
@@ -0,0 +1,102 @@
+# playground-client
+No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
+
+The `playground_client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: 1.0.0
+- Package version: 1.0.0
+- Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen
+
+## Requirements.
+
+Python 3.7+
+
+## Installation & Usage
+
+This python library package is generated without supporting files like setup.py or requirements files
+
+To be able to use it, you will need these dependencies in your own package that uses this library:
+
+* urllib3 >= 1.25.3
+* python-dateutil
+* pydantic
+* aenum
+
+## Getting Started
+
+In your own code, to use this library to connect and interact with playground-client,
+you can run the following:
+
+```python
+from __future__ import print_function
+
+import time
+import playground_client
+from playground_client.rest import ApiException
+from pprint import pprint
+
+# Defining the host is optional and defaults to https://localhost:9001
+# See configuration.py for a list of all supported configuration parameters.
+configuration = playground_client.Configuration(
+ host = "https://localhost:9001"
+)
+
+
+
+# Enter a context with an instance of the API client
+with playground_client.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = playground_client.DefaultApi(api_client)
+ create_sessions_request = playground_client.CreateSessionsRequest() # CreateSessionsRequest |
+
+ try:
+ api_response = api_instance.create_sessions(create_sessions_request)
+ print("The response of DefaultApi->create_sessions:\n")
+ pprint(api_response)
+ except ApiException as e:
+ print("Exception when calling DefaultApi->create_sessions: %s\n" % e)
+
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *https://localhost:9001*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*DefaultApi* | [**create_sessions**](playground_client/docs/DefaultApi.md#create_sessions) | **POST** /sessions |
+*DefaultApi* | [**delete_filesystem_entry**](playground_client/docs/DefaultApi.md#delete_filesystem_entry) | **DELETE** /sessions/{id}/filesystem |
+*DefaultApi* | [**delete_session**](playground_client/docs/DefaultApi.md#delete_session) | **DELETE** /sessions/{id} |
+*DefaultApi* | [**list_filesystem_dir**](playground_client/docs/DefaultApi.md#list_filesystem_dir) | **GET** /sessions/{id}/filesystem/dir |
+*DefaultApi* | [**make_filesystem_dir**](playground_client/docs/DefaultApi.md#make_filesystem_dir) | **PUT** /sessions/{id}/filesystem/dir |
+*DefaultApi* | [**read_filesystem_file**](playground_client/docs/DefaultApi.md#read_filesystem_file) | **GET** /sessions/{id}/filesystem/file |
+*DefaultApi* | [**run_process**](playground_client/docs/DefaultApi.md#run_process) | **POST** /sessions/{id}/process |
+*DefaultApi* | [**write_filesystem_file**](playground_client/docs/DefaultApi.md#write_filesystem_file) | **PUT** /sessions/{id}/filesystem/file |
+
+
+## Documentation For Models
+
+ - [CreateSessionResponse](playground_client/docs/CreateSessionResponse.md)
+ - [CreateSessionsRequest](playground_client/docs/CreateSessionsRequest.md)
+ - [EntryInfo](playground_client/docs/EntryInfo.md)
+ - [ListFilesystemDirResponse](playground_client/docs/ListFilesystemDirResponse.md)
+ - [OutStderrResponse](playground_client/docs/OutStderrResponse.md)
+ - [OutStdoutResponse](playground_client/docs/OutStdoutResponse.md)
+ - [OutType](playground_client/docs/OutType.md)
+ - [OutTypeStderr](playground_client/docs/OutTypeStderr.md)
+ - [OutTypeStdout](playground_client/docs/OutTypeStdout.md)
+ - [ReadFilesystemFileResponse](playground_client/docs/ReadFilesystemFileResponse.md)
+ - [RunProcessParams](playground_client/docs/RunProcessParams.md)
+ - [RunProcessResponse](playground_client/docs/RunProcessResponse.md)
+ - [WriteFilesystemFileRequest](playground_client/docs/WriteFilesystemFileRequest.md)
+
+
+## Documentation For Authorization
+
+ All endpoints do not require authorization.
+
+## Author
+
+
+
+
diff --git a/api-service/poetry.lock b/api-service/poetry.lock
index 779503e09..c9e205d9b 100644
--- a/api-service/poetry.lock
+++ b/api-service/poetry.lock
@@ -1486,6 +1486,21 @@ files = [
[package.dependencies]
six = ">=1.5"
+[[package]]
+name = "python-dotenv"
+version = "1.0.0"
+description = "Read key-value pairs from a .env file and set them as environment variables"
+category = "main"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "python-dotenv-1.0.0.tar.gz", hash = "sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba"},
+ {file = "python_dotenv-1.0.0-py3-none-any.whl", hash = "sha256:f5971a9226b701070a4bf2c38c89e5a3f0d64de8debda981d1db98583009122a"},
+]
+
+[package.extras]
+cli = ["click (>=5.0)"]
+
[[package]]
name = "python-gitlab"
version = "3.13.0"
@@ -2278,4 +2293,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
[metadata]
lock-version = "2.0"
python-versions = ">=3.8.1,<4.0"
-content-hash = "81ec377e282253dce652d91257d59b63ee8f5d401cdef4a09a02467a1330b709"
+content-hash = "c619909405e7b7e4495447ff9f2f7f8ecb5655eb9489869c414fab9a3c60c913"
diff --git a/api-service/pyproject.toml b/api-service/pyproject.toml
index a421eba8d..2b9d08ed4 100644
--- a/api-service/pyproject.toml
+++ b/api-service/pyproject.toml
@@ -17,6 +17,7 @@ python-dateutil = "^2.8.2"
urllib3 = "^1.26.14"
pydantic = "^1.10.6"
aenum = "^3.1.11"
+python-dotenv = "^1.0.0"
[build-system]
requires = ["poetry-core>=1.3.0"]
diff --git a/package.json b/package.json
index f1d244f35..73ae633e3 100644
--- a/package.json
+++ b/package.json
@@ -3,11 +3,12 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "npx concurrently \"next dev\" \"cd api-service && PYTHONUNBUFFERED=1 poetry run flask --app app.py --debug run\" \"cd api-service/playground && yarn dev\"",
- "dev:api": "cd api-service && poetry run flask --app app.py --debug run",
+ "dev": "npx concurrently \"next dev\" \"yarn start:api\" \"yarn start:playground\"",
+ "dev:api-service": "npx concurrently \"yarn start:api\" \"yarn start:playground\"",
"build": "next build",
- "install:api": "cd api-service && poetry install",
- "install:playground": "cd api-service/playground && yarn",
+ "start:api": "cd api-service && PYTHONUNBUFFERED=1 poetry run flask --app app.py --debug run",
+ "start:playground": "cd api-service/playground && yarn dev",
+ "install:api-service": "cd api-service && poetry install && cd playground && yarn",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
diff --git a/pages/api/exec/js.ts b/pages/api/exec/js.ts
new file mode 100644
index 000000000..a2ac785b8
--- /dev/null
+++ b/pages/api/exec/js.ts
@@ -0,0 +1,36 @@
+import { NextApiRequest, NextApiResponse } from 'next'
+import vm from 'vm'
+
+// Just a hack so express is available when running eval
+const express = require('express')
+console.log(express.name)
+
+async function postExecJS(req: NextApiRequest, res: NextApiResponse) {
+ const { code } = req.body
+ try {
+ const context = {}
+ vm.createContext(context)
+ const output = vm.runInNewContext(code, context)
+ res.status(200).json({ message: output })
+ } catch (err: any) {
+ // It's a still valid response of evaluating code (that's why status 200),
+ // we just want to communicate the error.
+ res.status(200).json({ message: err.message })
+ }
+}
+
+async function handler(
+ req: NextApiRequest,
+ res: NextApiResponse,
+) {
+ if (req.method === 'POST') {
+ await postExecJS(req, res)
+ return
+ }
+
+ res.setHeader('Allow', 'POST')
+ res.status(405).json({ statusCode: 405, message: 'Method Not Allowed' })
+ return
+}
+
+export default handler