Skip to content
← Public packages

@cameronpak/box

Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.

src/list-snapshots.ts

26 lines · 695 B · TypeScript
import { boxRequest, type Result } from './client.ts'
import type { PageInfo, SnapshotSummary } from './types.ts'

export type ListSnapshotsInput = {
	limit?: number
	cursor?: string | null
	sort?: 'asc' | 'desc'
}

export type ListSnapshotsOutput = {
	snapshots: Array<SnapshotSummary>
	pageInfo?: PageInfo
}

/**
 * List visible completed snapshots across all of your boxes.
 * Follow nextCursor through the complete history.
 */
export default async function listSnapshots(
	input: ListSnapshotsInput = {},
): Promise<Result<ListSnapshotsOutput>> {
	return boxRequest<ListSnapshotsOutput>({
		path: '/snapshots',
		query: { limit: input.limit, cursor: input.cursor, sort: input.sort },
	})
}