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/delete-environment-secret-file.ts

20 lines · 762 B · TypeScript
import { assertEnvironmentId, boxRequest, failure, type Result } from './client.ts'
import type { EnvironmentMutationOutput } from './set-environment-var.ts'

export type DeleteEnvironmentSecretFileInput = {
	environmentId: string
	path: string
}

/** Remove the secret file at path. Mints a new immutable version. */
export default async function deleteEnvironmentSecretFile(
	input: DeleteEnvironmentSecretFileInput,
): Promise<Result<EnvironmentMutationOutput>> {
	const invalid = assertEnvironmentId(input?.environmentId)
	if (invalid) return failure<EnvironmentMutationOutput>(invalid)
	return boxRequest<EnvironmentMutationOutput>({
		path: '/environments/' + input.environmentId + '/secret-files',
		method: 'DELETE',
		query: { path: input.path },
	})
}