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

12 lines · 592 B · TypeScript
import { assertWebhookId, boxRequest, failure, type Result } from './client.ts'
import type { Webhook } from './types.ts'

export type GetWebhookInput = { webhookId: string }
export type GetWebhookOutput = { webhook: Webhook }

/** Get one Box lifecycle webhook endpoint without its signing secret. */
export default async function getWebhook(input: GetWebhookInput): Promise<Result<GetWebhookOutput>> {
	const invalid = assertWebhookId(input?.webhookId)
	if (invalid) return failure<GetWebhookOutput>(invalid)
	return boxRequest<GetWebhookOutput>({ path: '/webhooks/' + input.webhookId })
}