forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

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

listPodcastJobs.ts22 lines, 1.1 KiBHistoryRawDownload
1import { client, pageQuery, type Page, type PageParams, type PodcastJobSummary } from "../client";
2
3/**
4 * A history call, optionally narrowed to one course note. `sourceId` is the
5 * note the studio panel is open on; leaving it out asks for the whole history,
6 * which is what the section's "All" scope does.
7 */
8export type PodcastJobListParams = PageParams & { sourceId?: string };
9
10/**
11 * The caller's own episodes, newest first — every job the backend ever minted
12 * for this user, whatever state it stopped in. A reading door: it answers from
13 * the rows alone, so it still lists the history with the service down.
14 */
15export function listPodcastJobs(params?: PodcastJobListParams, signal?: AbortSignal): Promise<Page<PodcastJobSummary>> {
16 const { sourceId, ...page } = params ?? {};
17 const query = pageQuery(page);
18 // Absent drops the key and asks for the whole history; an empty value never
19 // reaches the door, since the API 400s on a present-but-empty query param.
20 const scope = sourceId ? `${query ? "&" : "?"}source_id=${encodeURIComponent(sourceId)}` : "";
21 return client<Page<PodcastJobSummary>>(`/podcast/jobs${query}${scope}`, { signal });
22}