import { createCoreAPIClient } from "../../coreClient";
import { CHATBOT_API_ROUTES } from "../constants/api_constants";

const coreClient = createCoreAPIClient();

export async function listHistory(limit = 200, headers?: HeadersInit) {
  const params = new URLSearchParams({ limit: String(limit) });
  return coreClient<any>(`${CHATBOT_API_ROUTES.HISTORY}?${params.toString()}`, {
    method: "GET",
    headers,
    cache: "no-store",
  });
}
