@cognigy/rest-api-client
Version:
Cognigy REST-Client
93 lines • 8.13 kB
JavaScript
import { __rest } from "tslib";
import { GenericAPIFn } from "../GenericAPIFn";
import { GenericUploadFn } from "../GenericUploadFn";
import { stringifyQuery } from "../shared/helper/rest/query";
export function SimulationAPIGroup_2_0(instance) {
const self = instance;
return {
indexSimulations: (args, options) => GenericAPIFn(`/testing/simulations?${stringifyQuery(args)}`, "GET", self)(undefined, options),
createSimulation: (args, options) => GenericAPIFn("/testing/simulations", "POST", self)(args, options),
updateSimulation: (_a, options) => {
var { simulationReference, projectId } = _a, args = __rest(_a, ["simulationReference", "projectId"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}?${stringifyQuery({
projectId
})}`, "PATCH", self)(args, options);
},
deleteSimulation: ({ simulationReference, projectId }, options) => GenericAPIFn(`/testing/simulations/${simulationReference}?${stringifyQuery({
projectId
})}`, "DELETE", self)(undefined, options),
readSimulation: ({ simulationReference, projectId }, options) => GenericAPIFn(`/testing/simulations/${simulationReference}?${stringifyQuery({
projectId
})}`, "GET", self)(undefined, options),
scheduleSimulation: (_a, options) => {
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/schedule`, "POST", self)(args, options);
},
cloneSimulation: (_a, options) => {
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/clone`, "POST", self)(args, options);
},
indexSimulationRunBatches: (args, options) => GenericAPIFn(`/testing/simulations/batches?${stringifyQuery(args)}`, "GET", self)(undefined, options),
getAllSimulationRunBatches: (_a, options) => {
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/batches?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
readSimulationRunBatch: (_a, options) => {
var { simulationReference, simulationRunBatchReference } = _a, args = __rest(_a, ["simulationReference", "simulationRunBatchReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/batches/${simulationRunBatchReference}?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
stopSimulationRunBatch: (_a, options) => {
var { simulationReference, simulationRunBatchReference } = _a, args = __rest(_a, ["simulationReference", "simulationRunBatchReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/batches/${simulationRunBatchReference}/stop?${stringifyQuery(args)}`, "POST", self)(undefined, options);
},
indexSimulationRuns: (_a, options) => {
var { simulationReference, simulationRunBatchReference } = _a, args = __rest(_a, ["simulationReference", "simulationRunBatchReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/batches/${simulationRunBatchReference}/runs?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
readSimulationRun: (_a, options) => {
var { simulationReference, simulationRunBatchReference, simulationRunReference } = _a, args = __rest(_a, ["simulationReference", "simulationRunBatchReference", "simulationRunReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/batches/${simulationRunBatchReference}/runs/${simulationRunReference}?${stringifyQuery(args)}`, "GET", self)(undefined, options);
},
getPersonaOptions: (args, options) => GenericAPIFn("/testing/personas/options", "POST", self)(args, options),
generatePersona: (args, options) => GenericAPIFn("/testing/personas/generate", "POST", self)(args, options),
regeneratePersonaField: (args, options) => GenericAPIFn("/testing/personas/regenerate-field", "POST", self)(args, options),
generateBulkPersona: (args, options) => GenericAPIFn("/testing/personas/generate-bulk", "POST", self)(args, options),
generatePersonaFromTranscript: (args, options) => GenericAPIFn("/testing/personas/from-transcript", "POST", self)(args, options),
getSimulationOverviewMetrics: (args, options) => GenericAPIFn(`/testing/dashboard/overview?${stringifyQuery(args)}`, "GET", self)(args, options),
getSuccessRateTrend: (args, options) => GenericAPIFn(`/testing/dashboard/success-rate-trend?${stringifyQuery(args)}`, "GET", self)(args, options),
getUpcomingScheduledRuns: (args, options) => GenericAPIFn(`/testing/dashboard/upcoming-scheduled-runs?${stringifyQuery(args)}`, "GET", self)(undefined, options),
getScheduler: (_a, options) => {
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/schedules?${stringifyQuery(args)}`, "GET", self)(args, options);
},
createScheduler: (_a, options) => {
var { simulationReference } = _a, args = __rest(_a, ["simulationReference"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/schedules`, "POST", self)(args, options);
},
updateScheduler: (_a, options) => {
var { simulationReference, schedulerId, projectId } = _a, args = __rest(_a, ["simulationReference", "schedulerId", "projectId"]);
return GenericAPIFn(`/testing/simulations/${simulationReference}/schedules/${schedulerId}?${stringifyQuery({ projectId })}`, "PATCH", self)(args, options);
},
createTranscriptRequest: (args, options) => GenericAPIFn("/testing/v1/transcript-request", "POST", self)(args, options),
uploadTranscriptFile: (args, options) => GenericUploadFn("/testing/v1/transcript-upload", "POST", self)(args, options),
generateFromTranscript: (args, options) => GenericAPIFn("/testing/v1/generate-from-transcript", "POST", self)(args, options),
getSimulationTier: (_args, options) => GenericAPIFn("/testing/billing/simulation-tier", "GET", self)(undefined, options),
// --- Unified Batch API (flat `/testing/batches/*` paths) ---
validateBatch: (args, options) => GenericAPIFn("/testing/batches/validate", "POST", self)(args, options),
createBatch: (_a, options) => {
var { projectReference, organisationReference } = _a, body = __rest(_a, ["projectReference", "organisationReference"]);
return GenericAPIFn(`/testing/batches?${stringifyQuery({ projectId: projectReference })}`, "POST", self)(body, options);
},
readBatch: ({ batchId, projectId }, options) => GenericAPIFn(`/testing/batches/${batchId}?${stringifyQuery({ projectId })}`, "GET", self)(undefined, options),
indexBatchRuns: (_a, options) => {
var { batchId, projectId } = _a, args = __rest(_a, ["batchId", "projectId"]);
return GenericAPIFn(`/testing/batches/${batchId}/runs?${stringifyQuery(Object.assign({ projectId }, args))}`, "GET", self)(undefined, options);
},
readBatchRun: ({ batchId, runId, projectId }, options) => GenericAPIFn(`/testing/batches/${batchId}/runs/${runId}?${stringifyQuery({
projectId
})}`, "GET", self)(undefined, options),
stopBatch: ({ batchId, projectId, variantId }, options) => GenericAPIFn(`/testing/batches/${batchId}/stop?${stringifyQuery(Object.assign({ projectId }, (variantId ? { variantId } : {})))}`, "POST", self)(undefined, options),
deleteBatch: ({ batchId, projectId }, options) => GenericAPIFn(`/testing/batches/${batchId}?${stringifyQuery({ projectId })}`, "DELETE", self)(undefined, options)
};
}
//# sourceMappingURL=SimulationAPIGroup_2_0.js.map