← Public packages
@cameronpak/box
Full Box Public API v1 client: lifecycle, prompts, files, commands, snapshots, environments, webhooks, desktop, hosting, and account.
src/delete-environment.ts
25 lines · 841 B · TypeScriptimport { assertEnvironmentId, boxRequest, failure, type Result } from './client.ts'
import type { BoxEnvironment } from './types.ts'
export type DeleteEnvironmentInput = { environmentId: string }
export type DeleteEnvironmentOutput = {
success: boolean
environment?: BoxEnvironment | null
}
/**
* Soft-delete an environment. The default environment cannot be deleted,
* and at least one environment is always kept. Boxes pinned to its versions
* keep running.
*/
export default async function deleteEnvironment(
input: DeleteEnvironmentInput,
): Promise<Result<DeleteEnvironmentOutput>> {
const invalid = assertEnvironmentId(input?.environmentId)
if (invalid) return failure<DeleteEnvironmentOutput>(invalid)
return boxRequest<DeleteEnvironmentOutput>({
path: '/environments/' + input.environmentId,
method: 'DELETE',
})
}