← Public packages
@cameronpak/box
Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.
src/list-boxes.ts
28 lines · 749 B · TypeScriptimport { boxRequest, type Result } from './client.ts'
import type { Box, PageInfo } from './types.ts'
export type ListBoxesInput = {
/** Maximum items to return, 1 to 200. Defaults to 100. */
limit?: number
cursor?: string | null
sort?: 'asc' | 'desc'
/** Comma-separated state filter, for example "ready,idle,running". */
state?: string
}
export type ListBoxesOutput = { boxes: Array<Box>; pageInfo?: PageInfo }
/** List the boxes owned by this Box account. */
export default async function listBoxes(
input: ListBoxesInput = {},
): Promise<Result<ListBoxesOutput>> {
return boxRequest<ListBoxesOutput>({
path: '/boxes',
query: {
limit: input.limit,
cursor: input.cursor,
sort: input.sort,
state: input.state,
},
})
}