hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { client } from "../client"; |
| 2 | |
| 3 | /** The receipt for an accepted recompute. Nothing is computed yet. */ |
| 4 | export type AcceptedInsightRun = { |
| 5 | message_id: string; |
| 6 | status: "pending"; |
| 7 | }; |
| 8 | |
| 9 | export type PostInsightsRefreshBody = { |
| 10 | /** |
| 11 | * Student user ids to recompute; omit for the service's own configured list |
| 12 | * — the backend does not enumerate a school roster for it. |
| 13 | */ |
| 14 | user_ids?: string[]; |
| 15 | /** Recompute even where the service considers its cached result valid. */ |
| 16 | force?: boolean; |
| 17 | }; |
| 18 | |
| 19 | /** |
| 20 | * 202 — a school-wide batch, queued. The sweep's own record is the run ledger, |
| 21 | * so poll `getInsightRuns` to watch a run move from `running` to its verdict. |
| 22 | * Manager+ only, and 503 when no service offers `insight.refresh`. |
| 23 | */ |
| 24 | export function postInsightsRefresh(body: PostInsightsRefreshBody = {}): Promise<AcceptedInsightRun> { |
| 25 | return client<AcceptedInsightRun>("/insights/refresh", { method: "POST", body }); |
| 26 | } |