import {
  makeRequest
} from "./chunk-CAY57CKF.js";

// src/langwatch-api-datasets.ts
async function listDatasets(params) {
  const query = new URLSearchParams();
  if (params?.page != null) query.set("page", String(params.page));
  if (params?.limit != null) query.set("limit", String(params.limit));
  const qs = query.toString();
  const path = qs ? `/api/dataset?${qs}` : "/api/dataset";
  return makeRequest("GET", path);
}
async function getDataset(slugOrId) {
  return makeRequest(
    "GET",
    `/api/dataset/${encodeURIComponent(slugOrId)}`
  );
}
async function createDataset(data) {
  return makeRequest(
    "POST",
    "/api/dataset",
    data
  );
}
async function updateDataset(params) {
  const { slugOrId, ...data } = params;
  return makeRequest(
    "PATCH",
    `/api/dataset/${encodeURIComponent(slugOrId)}`,
    data
  );
}
async function deleteDataset(slugOrId) {
  return makeRequest(
    "DELETE",
    `/api/dataset/${encodeURIComponent(slugOrId)}`
  );
}
async function createDatasetRecords(params) {
  const { slugOrId, entries } = params;
  return makeRequest(
    "POST",
    `/api/dataset/${encodeURIComponent(slugOrId)}/records`,
    { entries }
  );
}
async function updateDatasetRecord(params) {
  const { slugOrId, recordId, entry } = params;
  return makeRequest(
    "PATCH",
    `/api/dataset/${encodeURIComponent(slugOrId)}/records/${encodeURIComponent(recordId)}`,
    { entry }
  );
}
async function deleteDatasetRecords(params) {
  const { slugOrId, recordIds } = params;
  return makeRequest(
    "DELETE",
    `/api/dataset/${encodeURIComponent(slugOrId)}/records`,
    { recordIds }
  );
}
async function listDatasetRecords(params) {
  const { slugOrId } = params;
  const query = new URLSearchParams();
  if (params.page != null) query.set("page", String(params.page));
  if (params.limit != null) query.set("limit", String(params.limit));
  const qs = query.toString();
  const path = `/api/dataset/${encodeURIComponent(slugOrId)}/records${qs ? `?${qs}` : ""}`;
  return makeRequest("GET", path);
}

export {
  listDatasets,
  getDataset,
  createDataset,
  updateDataset,
  deleteDataset,
  createDatasetRecords,
  updateDatasetRecord,
  deleteDatasetRecords,
  listDatasetRecords
};
//# sourceMappingURL=chunk-ITN2QGHF.js.map