bulk episodic deletion

This commit is contained in:
Storme-bit
2026-04-17 19:43:18 -07:00
parent 930a6dbd13
commit 05f1fbb04e
4 changed files with 50 additions and 0 deletions

View File

@@ -133,6 +133,23 @@ async function getProject(id) {
return res.json();
}
async function getEpisodes({ limit = 50, offset = 0, sessionId, q } = {}) {
const url = new URL(`${BASE_URL}/episodes`);
url.searchParams.set('limit', limit);
url.searchParams.set('offset', offset);
if (sessionId) url.searchParams.set('sessionId', sessionId);
if (q) url.searchParams.set('q', q);
const res = await fetch(url.toString());
if (!res.ok) throw new Error(`Failed to fetch episodes: ${res.status}`);
return res.json();
}
async function deleteEpisode(id) {
const res = await fetch(`${BASE_URL}/episodes/${id}`, { method: 'DELETE' });
if (!res.ok) throw new Error(`Failed to delete episode: ${res.status}`);
}
module.exports = {
getSessionByExternalId,
createSession,
@@ -149,4 +166,6 @@ module.exports = {
deleteProject,
getProjectSessions,
getProject,
getEpisodes,
deleteEpisode,
}