export type NetworkConfig = {allow_out?: Array | undefined, deny_out?: Array | undefined}; export type SandboxPatch = {network?: NetworkConfig | undefined}; export type PatchApiSandboxesSandboxIdArgs = {body: SandboxPatch}; export type PatchApiSandboxesSandboxIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partially update a running sandbox * * PATCH /sandboxes/{sandbox_id} */ export const patchApiSandboxesSandboxId = async (args: PatchApiSandboxesSandboxIdArgs, options?: PatchApiSandboxesSandboxIdOptions) => { const {baseUrl = "https://api-staging.superserve.ai", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("X-API-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/sandboxes/${encodeURIComponent(String(args.sandbox_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };