UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

104 lines (95 loc) 3.02 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { NamedSandbox, NamedSandbox$inboundSchema } from "./namedsandbox.js"; import { SandboxPublicRoute, SandboxPublicRoute$inboundSchema, } from "./sandboxpublicroute.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; import { Session, Session$inboundSchema } from "./session.js"; export type GetNamedSandboxRequest = { /** * Name for the sandbox. Must be unique per project and URL-safe (alphanumeric, hyphens, underscores). */ name: string; /** * The project ID or name (required when not using OIDC token). */ projectId?: string | undefined; /** * Whether to automatically resume a stopped named sandbox by creating a new instance from its snapshot. Defaults to false. */ resume?: boolean | undefined; /** * The Team identifier to perform the request on behalf of. */ teamId?: string | undefined; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; }; export type GetNamedSandboxResponseBody = { /** * This object contains information related to a Vercel NamedSandbox. */ sandbox: NamedSandbox; /** * This object contains information related to a Vercel Sandbox Session. v2 endpoints return "session" instead of "sandbox" as the response wrapper key. */ session: Session; routes: Array<SandboxPublicRoute>; resumed: boolean; }; /** @internal */ export type GetNamedSandboxRequest$Outbound = { name: string; projectId?: string | undefined; resume: boolean; teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetNamedSandboxRequest$outboundSchema: z.ZodType< GetNamedSandboxRequest$Outbound, z.ZodTypeDef, GetNamedSandboxRequest > = z.object({ name: z.string(), projectId: z.string().optional(), resume: z.boolean().default(false), teamId: z.string().optional(), slug: z.string().optional(), }); export function getNamedSandboxRequestToJSON( getNamedSandboxRequest: GetNamedSandboxRequest, ): string { return JSON.stringify( GetNamedSandboxRequest$outboundSchema.parse(getNamedSandboxRequest), ); } /** @internal */ export const GetNamedSandboxResponseBody$inboundSchema: z.ZodType< GetNamedSandboxResponseBody, z.ZodTypeDef, unknown > = z.object({ sandbox: NamedSandbox$inboundSchema, session: Session$inboundSchema, routes: z.array(SandboxPublicRoute$inboundSchema), resumed: types.boolean(), }); export function getNamedSandboxResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetNamedSandboxResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetNamedSandboxResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetNamedSandboxResponseBody' from JSON`, ); }