SandboxesClient
Source: src/services/sandboxes.ts
Signature
Section titled “Signature”SandboxesClient(transport: Leap0Transport)Overview
Section titled “Overview”Creates, fetches, pauses, and deletes sandboxes.
Throws
Section titled “Throws”Leap0Error: If request validation, API calls, or response validation fail.
Methods
Section titled “Methods”create
Section titled “create”async create(params: CreateSandboxParams = {}, options: RequestOptions = {}): Promise<T>Creates a sandbox from a template and resource config.
Parameters
Section titled “Parameters”params: Sandbox creation parameters.options: Optional request settings such as timeout and query params.
Returns
Section titled “Returns”- The created sandbox resource.
Throws
Section titled “Throws”Leap0Error: If params are invalid, local OTEL env is missing, or sandbox creation fails.
Examples
Section titled “Examples”const sandbox = await client.sandboxes.create({ templateName: "base", timeoutMin: 30,});async pause(sandbox: SandboxRef, options: RequestOptions = {}): Promise<T>Pauses a running sandbox.
Parameters
Section titled “Parameters”sandbox: Sandbox ID or sandbox-like object.options: Optional request settings such as timeout and query params.
Returns
Section titled “Returns”- The updated sandbox resource.
async get(sandbox: SandboxRef, options: RequestOptions = {}): Promise<T>Fetches a sandbox by ID.
Parameters
Section titled “Parameters”sandbox: Sandbox ID or sandbox-like object.options: Optional request settings such as timeout and query params.
Returns
Section titled “Returns”- The current sandbox resource.
delete
Section titled “delete”async delete(sandbox: SandboxRef, options: RequestOptions = {}): Promise<void>Deletes a sandbox by ID.
Parameters
Section titled “Parameters”sandbox: Sandbox ID or sandbox-like object.options: Optional request settings such as timeout and query params.
invokeUrl
Section titled “invokeUrl”invokeUrl(sandbox: SandboxRef, path = "/", port?: number): stringBuilds the public invoke URL for a sandbox.
Parameters
Section titled “Parameters”sandbox: Sandbox ID or sandbox-like object.path: Route path to append to the sandbox base URL.port: Optional forwarded port.
Returns
Section titled “Returns”- The public HTTPS URL for the sandbox.
websocketUrl
Section titled “websocketUrl”websocketUrl(sandbox: SandboxRef, path = "/", port?: number): stringBuilds the public websocket URL for a sandbox.
Parameters
Section titled “Parameters”sandbox: Sandbox ID or sandbox-like object.path: Route path to append to the sandbox base URL.port: Optional forwarded port.
Returns
Section titled “Returns”- The public websocket URL for the sandbox.