export type CreateApiEngageProfileDeleteArgs = {strict?: number | undefined, verbose?: number | undefined, callback?: string | undefined, body: Array<{$token: string, $distinct_id: string, $delete: string | null, $ignore_alias?: boolean | undefined}>}; export type CreateApiEngageProfileDeleteOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Profile * * POST /engage#profile-delete */ export const createApiEngageProfileDelete = async (args: CreateApiEngageProfileDeleteArgs, options?: CreateApiEngageProfileDeleteOptions) => { 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.strict != null) query.append("strict", String(args.strict)) if (args.verbose != null) query.append("verbose", String(args.verbose)) if (args.callback != null) query.append("callback", String(args.callback)) const url = `${baseUrl.replace(/\/+$/, '')}/engage#profile-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() };