export type DeleteApiApiCdpSettingsV1AppAppIdAudienceIdArgs = {app_id: string, id: string}; export type DeleteApiApiCdpSettingsV1AppAppIdAudienceIdOptions = {baseUrl?: string | undefined, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete audience * * DELETE /api/cdp/settings/v1/app/{app_id}/audience/{id} */ export const deleteApiApiCdpSettingsV1AppAppIdAudienceId = async (args: DeleteApiApiCdpSettingsV1AppAppIdAudienceIdArgs, options?: DeleteApiApiCdpSettingsV1AppAppIdAudienceIdOptions) => { const {baseUrl = "https://example.piwik.pro", fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/cdp/settings/v1/app/${encodeURIComponent(String(args.app_id))}/audience/${encodeURIComponent(String(args.id))}${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 };