export type DeleteApiAppProjectsProjectKpisKpiArgs = {project: number, kpi: number}; export type DeleteApiAppProjectsProjectKpisKpiOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a conversion-type KPI * * DELETE /app/projects/{project}/kpis/{kpi} */ export const deleteApiAppProjectsProjectKpisKpi = async (args: DeleteApiAppProjectsProjectKpisKpiArgs, options: DeleteApiAppProjectsProjectKpisKpiOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/app/projects/${encodeURIComponent(String(args.project))}/kpis/${encodeURIComponent(String(args.kpi))}${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 };