updated orchestion to handle updating and deleting sessions
This commit is contained in:
@@ -63,6 +63,23 @@ async function getSessions(limit = EPISODIC.DEFAULT_SESSIONS_LIMIT, offset = EPI
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function updateSession(externalId, { name }) {
|
||||
const res = await fetch(`${BASE_URL}/sessions/by-external/${externalId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ name }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to update session: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function deleteSession(externalId) {
|
||||
const res = await fetch(`${BASE_URL}/sessions/by-external/${externalId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
if (!res.ok) throw new Error(`Failed to delete session: ${res.status}`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSessionByExternalId,
|
||||
createSession,
|
||||
@@ -70,5 +87,7 @@ module.exports = {
|
||||
createEpisode,
|
||||
getEpisodeById,
|
||||
getSessionHistory,
|
||||
getSessions
|
||||
getSessions,
|
||||
updateSession,
|
||||
deleteSession,
|
||||
}
|
||||
Reference in New Issue
Block a user