import fetchApi from "@moduletrace/twui/utils/fetch/fetchApi"; import type { APIResponseObject } from "@moduletrace/bunext/types"; type Params = { /** * Under `/api/admin/bots/`. */ path: | "list-sessions" | "new-session" | "reopen-session" | "session-messages" | "older-messages"; body: Record; }; /** * Posts to a conversation-session API route. */ export default async function postSessionApi({ path, body }: Params) { return await fetchApi, APIResponseObject>(`/api/admin/bots/${path}`, { method: "POST", body, }); }