export type DeleteApiV2CohortsCohortIdArgs = {cohortId: string}; export type DeleteApiV2CohortsCohortIdOptions = {baseUrl?: string | undefined, apiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete cohort * * DELETE /v2/cohorts/{cohortId} */ export const deleteApiV2CohortsCohortId = async (args: DeleteApiV2CohortsCohortIdArgs, options?: DeleteApiV2CohortsCohortIdOptions) => { const {baseUrl = "https://api.permutive.app", fetch: fetchFn = fetch, apiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKeyAuth !== undefined) query.set("k", apiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v2/cohorts/${encodeURIComponent(String(args.cohortId))}${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 };