@gentrace/core
Version:
Core Gentrace Node.JS library
63 lines (62 loc) • 3.38 kB
TypeScript
import { CreateMultipleTestCases, CreateSingleTestCase, TestCase, UpdateTestCase } from "../models";
/**
* Retrieves test cases for a given pipeline from the Gentrace API.
* @async
* @param {string} pipelineSlug - The slug of the pipeline to filter test cases by.
* @returns {Promise<Array<TestCase>>} - A promise that resolves to an array of test cases.
* @throws {Error} - Throws an error if the Gentrace API key is not initialized or if the pipeline is not found.
* @remarks The golden dataset for the specified pipeline will be used.
*/
export declare const getTestCases: (pipelineSlug: string) => Promise<TestCase[]>;
/**
* Retrieves test cases for a specific dataset from the Gentrace API.
* @async
* @param {string} datasetId - The ID of the dataset to retrieve test cases for.
* @returns {Promise<Array<TestCase>>} - A promise that resolves to an array of test cases.
* @throws {Error} - Throws an error if the Gentrace API key is not initialized.
*/
export declare const getTestCasesForDataset: (datasetId: string) => Promise<TestCase[]>;
export declare const getTestCase: (id: string) => Promise<import("../models").TestCaseV2>;
/**
* Creates a single test case for a given pipeline ID from the Gentrace API
*
* @async
* @param {CreateSingleTestCase} payload - New test case payload
* @throws {Error} Throws an error if the SDK is not initialized. Call init() first.
* @returns {Promise<string>} A Promise that resolves to the created case ID
* @remarks If a pipeline slug is specified, the golden dataset will be used.
* If a datasetId is provided, it will be used instead.
*/
export declare const createTestCase: (payload: CreateSingleTestCase) => Promise<string>;
/**
* Creates multiple test cases for a given pipeline ID from the Gentrace API
*
* @async
* @param {CreateMultipleTestCases} payload - New test case payloads
* @throws {Error} Throws an error if the SDK is not initialized. Call init() first.
* @returns {Promise<string>} A Promise that resolves to the number of test cases successfully created
* @remarks If a pipeline slug is specified, the golden dataset will be used.
* If a datasetId is provided, it will be used instead.
*/
export declare const createTestCases: (payload: CreateMultipleTestCases) => Promise<number>;
/**
* Updates a single test case in the Gentrace API
*
* @async
* @param {UpdateTestCase} payload - The payload containing the test case update information
* @throws {Error} Throws an error if the SDK is not initialized or if the test case ID is invalid
* @returns {Promise<string>} A Promise that resolves to the updated case ID
* @remarks This function updates an existing test case with the provided information.
* The payload should include the test case ID and any fields to be updated.
*/
export declare const updateTestCase: (payload: UpdateTestCase) => Promise<string>;
/**
* Deletes a single test case from the Gentrace API
*
* @async
* @param {string} id - The ID of the test case to delete
* @throws {Error} Throws an error if the SDK is not initialized or if the test case ID is invalid
* @returns {Promise<boolean>} A Promise that resolves to true if the test case was successfully deleted
* @remarks This function deletes an existing test case with the provided ID.
*/
export declare const deleteTestCase: (id: string) => Promise<boolean>;