← Public packages
@cameronpak/box
Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.
src/get-box.ts
14 lines · 554 B · TypeScriptimport { assertBoxId, boxRequest, failure, type Result } from './client.ts'
import type { Box } from './types.ts'
export type GetBoxInput = { boxId: string }
export type GetBoxOutput = { box: Box }
/** Read one box, including its current state. Poll this after create, stop, resume, or fork. */
export default async function getBox(input: GetBoxInput): Promise<Result<GetBoxOutput>> {
const invalid = assertBoxId(input?.boxId)
if (invalid) return failure<GetBoxOutput>(invalid)
return boxRequest<GetBoxOutput>({ path: '/boxes/' + input.boxId })
}