import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration'; /** * Inspect an uploaded asset and existing links before a separate link decision. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param assetId - Media asset reserved for this account. * @param target - Shortcut target explicitly selected by the person. * @param signal - Caller-owned cancellation signal. * @returns Asset processing status and links; wait for upload verification before confirming a link. */ export async function reviewMediaBeforeLinking( client: Client, accountId: string, assetId: string, target: Parameters[1], signal: AbortSignal, ) { const options = { signal, timeoutMs: 15_000 }; const asset = await client.media.getAsset(accountId, assetId, options); const links = await client.media.listLinks(accountId, target, options); return { asset, links }; } /** * Create only the media link explicitly confirmed after asset review. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param input - Reviewed input for this operation. * @param signal - Caller-owned cancellation signal. * @returns The saved association; upload URLs and authority must remain private. */ export async function linkReviewedMedia( client: Client, accountId: string, input: Parameters[1], signal: AbortSignal, ) { return client.media.createLink(accountId, input, { signal, timeoutMs: 15_000 }); }