* Fetches a single recording's metadata from the v2 recordings endpoint. * Returns null on 404 (recording deleted/inaccessible).
(accessToken: string, id: string)
| 282 | * Returns null on 404 (recording deleted/inaccessible). |
| 283 | */ |
| 284 | async function fetchRecording(accessToken: string, id: string): Promise<GrainRecording | null> { |
| 285 | const response = await fetchWithRetry(`${GRAIN_API_BASE}/recordings/${id}`, { |
| 286 | method: 'POST', |
| 287 | headers: grainHeaders(accessToken), |
| 288 | body: JSON.stringify({ include: RECORDING_INCLUDE }), |
| 289 | }) |
| 290 | |
| 291 | if (!response.ok) { |
| 292 | if (response.status === 404) return null |
| 293 | throw new Error(`Failed to fetch Grain recording: ${response.status}`) |
| 294 | } |
| 295 | |
| 296 | return (await response.json()) as GrainRecording |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * Fetches the speaker-attributed transcript segments for a recording. |
no test coverage detected