(path: string)
| 124 | |
| 125 | /** Fetch raw text (used for the docs markdown endpoint). Returns null on 404. */ |
| 126 | export async function apiGetText(path: string): Promise<string | null> { |
| 127 | const send = () => fetch(apiUrl(path), { headers: authHeaders() }); |
| 128 | let res = await send(); |
| 129 | if (res.status === 401 && (await tryRefresh())) { |
| 130 | res = await send(); |
| 131 | } |
| 132 | if (res.status === 404) return null; |
| 133 | if (!res.ok) throw new Error(`HTTP ${res.status}`); |
| 134 | return res.text(); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Stream a run's NDJSON events as an async generator (one RunEvent per line). |
no test coverage detected