export type DeleteApiSimulationsSimulationReferenceArgs = {projectId: string, simulationReference: string}; export type DeleteApiSimulationsSimulationReferenceOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete scenario * * DELETE /simulations/{simulationReference} * * Also accepts auth: apiKeyAuth */ export const deleteApiSimulationsSimulationReference = async (args: DeleteApiSimulationsSimulationReferenceArgs, options?: DeleteApiSimulationsSimulationReferenceOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.projectId != null) query.append("projectId", String(args.projectId)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/simulations/${encodeURIComponent(String(args.simulationReference))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };