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-webhook.ts

16 lines · 579 B · TypeScript
import { assertWebhookId, boxRequest, failure, type Result } from './client.ts'

export type DeleteWebhookInput = { webhookId: string }
export type DeleteWebhookOutput = { id: string }

/** Delete a webhook endpoint and its queued deliveries. */
export default async function deleteWebhook(
	input: DeleteWebhookInput,
): Promise<Result<DeleteWebhookOutput>> {
	const invalid = assertWebhookId(input?.webhookId)
	if (invalid) return failure<DeleteWebhookOutput>(invalid)
	return boxRequest<DeleteWebhookOutput>({
		path: '/webhooks/' + input.webhookId,
		method: 'DELETE',
	})
}