← Public packages
@cameronpak/box
Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.
src/delete-named-snapshot.ts
28 lines · 733 B · TypeScriptimport { boxRequest, failure, type Result } from './client.ts'
export type DeleteNamedSnapshotInput = { name: string }
export type DeleteNamedSnapshotOutput = {
name: string
status: string
}
/**
* Remove a named snapshot and release its storage.
* Boxes already deployed from it are unaffected.
*/
export default async function deleteNamedSnapshot(
input: DeleteNamedSnapshotInput,
): Promise<Result<DeleteNamedSnapshotOutput>> {
if (!input?.name) {
return failure<DeleteNamedSnapshotOutput>({
code: 'invalid_snapshot_name',
message: 'name is required.',
status: 400,
})
}
return boxRequest<DeleteNamedSnapshotOutput>({
path: '/named-snapshots/' + encodeURIComponent(input.name),
method: 'DELETE',
})
}