forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

postInsightComputeByUserId.ts25 lines, 903 bytesHistoryRawDownload
1import { client } from "../client";
2import type { AcceptedInsightRun } from "./postInsightsRefresh";
3
4export type PostInsightComputeBody = {
5 /** Compute only these sections; omit for all of them. */
6 sections?: string[];
7 /** ISO-8601 date to compute from; omit for the dönem's beginning. */
8 since?: string;
9};
10
11/**
12 * 202 — queued, not computed. The service works through the student's data on
13 * its own; poll `getInsightByUserId` and watch `summary.computed_at` move.
14 * 503 when no service offers `insight.student`, and then nothing was queued.
15 * Authorization is `getInsightByUserId`'s gate for gate, so a refusal is a 404.
16 */
17export function postInsightComputeByUserId(
18 userId: string,
19 body: PostInsightComputeBody = {},
20): Promise<AcceptedInsightRun> {
21 return client<AcceptedInsightRun>(`/insights/students/${encodeURIComponent(userId)}`, {
22 method: "POST",
23 body,
24 });
25}