/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { MemoryMount, MemoryMount$inboundSchema, MemoryMount$Outbound, MemoryMount$outboundSchema, } from "./memorymount.js"; import { SandboxFeature, SandboxFeature$inboundSchema, SandboxFeature$outboundSchema, } from "./sandboxfeature.js"; import { SandboxResourceClass, SandboxResourceClass$inboundSchema, SandboxResourceClass$outboundSchema, } from "./sandboxresourceclass.js"; import { SandboxRuntimeProfile, SandboxRuntimeProfile$inboundSchema, SandboxRuntimeProfile$outboundSchema, } from "./sandboxruntimeprofile.js"; import { SessionKind, SessionKind$inboundSchema, SessionKind$outboundSchema, } from "./sessionkind.js"; export type CreateSessionRequest = { sessionId: string; sessionKey?: string | null | undefined; userId?: string | undefined; sessionKind?: SessionKind | undefined; resourceClass?: SandboxResourceClass | null | undefined; ttlSeconds?: number | undefined; sandboxFeatures?: Array | undefined; runtimeProfile?: SandboxRuntimeProfile | undefined; memoryMounts?: Array | undefined; queueIfFull?: boolean | undefined; skipLlmCredentialExchange?: boolean | undefined; }; /** @internal */ export const CreateSessionRequest$inboundSchema: z.ZodType< CreateSessionRequest, z.ZodTypeDef, unknown > = z.object({ session_id: z.string(), session_key: z.nullable(z.string()).optional(), user_id: z.string().default("demo-user"), session_kind: SessionKind$inboundSchema.optional(), resource_class: z.nullable(SandboxResourceClass$inboundSchema).optional(), ttl_seconds: z.number().int().default(600), sandbox_features: z.array(SandboxFeature$inboundSchema).optional(), runtime_profile: SandboxRuntimeProfile$inboundSchema.optional(), memory_mounts: z.array(MemoryMount$inboundSchema).optional(), queue_if_full: z.boolean().default(false), skip_llm_credential_exchange: z.boolean().default(false), }).transform((v) => { return remap$(v, { "session_id": "sessionId", "session_key": "sessionKey", "user_id": "userId", "session_kind": "sessionKind", "resource_class": "resourceClass", "ttl_seconds": "ttlSeconds", "sandbox_features": "sandboxFeatures", "runtime_profile": "runtimeProfile", "memory_mounts": "memoryMounts", "queue_if_full": "queueIfFull", "skip_llm_credential_exchange": "skipLlmCredentialExchange", }); }); /** @internal */ export type CreateSessionRequest$Outbound = { session_id: string; session_key?: string | null | undefined; user_id: string; session_kind?: string | undefined; resource_class?: string | null | undefined; ttl_seconds: number; sandbox_features?: Array | undefined; runtime_profile?: string | undefined; memory_mounts?: Array | undefined; queue_if_full: boolean; skip_llm_credential_exchange: boolean; }; /** @internal */ export const CreateSessionRequest$outboundSchema: z.ZodType< CreateSessionRequest$Outbound, z.ZodTypeDef, CreateSessionRequest > = z.object({ sessionId: z.string(), sessionKey: z.nullable(z.string()).optional(), userId: z.string().default("demo-user"), sessionKind: SessionKind$outboundSchema.optional(), resourceClass: z.nullable(SandboxResourceClass$outboundSchema).optional(), ttlSeconds: z.number().int().default(600), sandboxFeatures: z.array(SandboxFeature$outboundSchema).optional(), runtimeProfile: SandboxRuntimeProfile$outboundSchema.optional(), memoryMounts: z.array(MemoryMount$outboundSchema).optional(), queueIfFull: z.boolean().default(false), skipLlmCredentialExchange: z.boolean().default(false), }).transform((v) => { return remap$(v, { sessionId: "session_id", sessionKey: "session_key", userId: "user_id", sessionKind: "session_kind", resourceClass: "resource_class", ttlSeconds: "ttl_seconds", sandboxFeatures: "sandbox_features", runtimeProfile: "runtime_profile", memoryMounts: "memory_mounts", queueIfFull: "queue_if_full", skipLlmCredentialExchange: "skip_llm_credential_exchange", }); }); export function createSessionRequestToJSON( createSessionRequest: CreateSessionRequest, ): string { return JSON.stringify( CreateSessionRequest$outboundSchema.parse(createSessionRequest), ); } export function createSessionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateSessionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSessionRequest' from JSON`, ); }