(
sourceId: string,
chatId: string,
onProgress?: (p: ImportProgress) => void
)
| 115 | } |
| 116 | |
| 117 | async importPreparedChat( |
| 118 | sourceId: string, |
| 119 | chatId: string, |
| 120 | onProgress?: (p: ImportProgress) => void |
| 121 | ): Promise<ImportResult> { |
| 122 | const res = await fetchWithAuth(`${getBaseUrl()}/import-sources/${encodeURIComponent(sourceId)}/import`, { |
| 123 | method: 'POST', |
| 124 | headers: { 'Content-Type': 'application/json' }, |
| 125 | body: JSON.stringify({ chatId }), |
| 126 | }) |
| 127 | if (!res.ok) { |
| 128 | const text = await res.text() |
| 129 | return { success: false, error: `HTTP ${res.status}: ${text}` } |
| 130 | } |
| 131 | return consumeSseStream<ImportResult>(res, { success: false, error: 'Unknown error' }, onProgress) |
| 132 | } |
| 133 | |
| 134 | async releaseImportSource(sourceId: string): Promise<void> { |
| 135 | await fetchWithAuth(`${getBaseUrl()}/import-sources/${encodeURIComponent(sourceId)}`, { |
nothing calls this directly
no test coverage detected