Skip to content
← Public packages

@charlesmatte/granola

Search and read Granola meeting notes, summaries and transcripts from any agent; manage webhooks and legal holds safely.

src/legal-holds/get.ts

20 lines · 1.0 KB · TypeScript
Raw
import { parseWithAccount } from '../lib/api.ts'
import { getHold } from '../lib/holds.ts'
import { HOLD_ID_PATTERN } from '../lib/validate.ts'

/**
 * Get one legal hold (`GET /v1/legal-holds/{hold_id}`). Needs a Legal hold API key (Enterprise).
 *
 * @param input.account - Account whose secret holds a Legal hold API key. Required. @param input.secretName - Secret override.
 * @param input.holdId - `lgh_…` id. Required.
 * @returns `{ account, legalHold: { id, name, description, covers_entire_workspace, custodian_count, created_at, released_at } }`
 *
 * @example
 * import getHold from 'kody:@charlesmatte/granola/legal-holds/get'
 *
 * const { legalHold } = await getHold({ account: 'work-legal', holdId: 'lgh_Abc123XyZ456Dq' })
 */
export default async function getGranolaLegalHold(input: unknown) {
	const p = parseWithAccount<{ holdId: string }>(input, { holdId: { type: 'string', required: true, pattern: HOLD_ID_PATTERN } }, 'legal-holds/get')
	return { account: p.acct.account, legalHold: await getHold(p.acct, p.holdId) }
}