UNPKG

@arizeai/phoenix-client

Version:

A client for the Phoenix API

29 lines 1.22 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.listDatasets = listDatasets; const client_1 = require("../client"); const tiny_invariant_1 = __importDefault(require("tiny-invariant")); /** * List the information about all datasets available to the client. * * @example * ```ts * import { listDatasets } from "@arizeai/phoenix-client/datasets"; * * const datasets = await listDatasets({}); * console.log(datasets); * ``` * * @throws {Error} If the datasets cannot be listed or the response is invalid. */ async function listDatasets({ client: _client, }) { var _a; const client = _client || (0, client_1.createClient)(); const response = await client.GET("/v1/datasets"); (0, tiny_invariant_1.default)((_a = response.data) === null || _a === void 0 ? void 0 : _a.data, "Failed to list datasets"); return response.data.data.map((dataset) => (Object.assign(Object.assign({}, dataset), { startDate: new Date(dataset.created_at), endDate: new Date(dataset.updated_at) }))); } //# sourceMappingURL=listDatasets.js.map