hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { 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 | */ |
| 8 | export 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 | */ |
| 15 | export 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 | } |