import { parseWithAccount } from '../lib/api.ts' import { listWebhookEndpoints } from '../lib/webhooks.ts' /** * List the webhook endpoints this key can manage (`GET /v1/webhook-endpoints`): URL, events, * scopes, folder filter, enabled flag, creator. A personal key sees endpoints its owner created; * an Enterprise workspace admin sees all. Signing secrets are never returned (shown once at create). * * @param input.account - Account name (secret `granola-`). Required. @param input.secretName - Secret override. * @returns `{ account, count, webhookEndpoints: [{ id, url, events, scopes, folder_ids, enabled, created_by, created_at }] }` * * @example * import listWebhooks from 'kody:@charlesmatte/granola/webhooks/list' * * const { webhookEndpoints } = await listWebhooks({ account: 'work' }) */ export default async function listGranolaWebhooks(input: unknown) { const p = parseWithAccount>(input, {}, 'webhooks/list') const endpoints = await listWebhookEndpoints(p.acct) return { account: p.acct.account, count: endpoints.length, webhookEndpoints: endpoints } }