forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

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

getBoardHistory.ts24 lines, 806 bytesHistoryRawDownload
1import {
2 appendPageParams,
3 client,
4 normalizePage,
5 type Page,
6} from "../client";
7import type { BoardHistoryParams, StrokeRow } from "./types";
8
9// The whole append-only log, oldest first, clear markers included. `epoch`
10// narrows to a single epoch (for session replay); omit for the whole life.
11export async function getBoardHistory(
12 id: string,
13 params?: BoardHistoryParams,
14 signal?: AbortSignal,
15): Promise<Page<StrokeRow>> {
16 const query = new URLSearchParams();
17 if (params?.epoch != null) query.set("epoch", String(params.epoch));
18 appendPageParams(query, params);
19 const suffix = query.toString() ? `?${query.toString()}` : "";
20 const data = await client<unknown>(`/boards/${encodeURIComponent(id)}/history${suffix}`, {
21 signal,
22 });
23 return normalizePage<StrokeRow>(data);
24}