export type CreateApiGroupsGroupDeleteArgs = {verbose?: number | undefined, body: Array<{$token: string, $group_key: string, $group_id: string, $delete?: (string | null) | undefined}>}; export type CreateApiGroupsGroupDeleteOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Group * * POST /groups#group-delete */ export const createApiGroupsGroupDelete = async (args: CreateApiGroupsGroupDeleteArgs, options?: CreateApiGroupsGroupDeleteOptions) => { const {baseUrl = "https://mixpanel.com/api/query", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/plain") if (args.verbose != null) query.append("verbose", String(args.verbose)) const url = `${baseUrl.replace(/\/+$/, '')}/groups#group-delete${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };