export type DeleteApiEmRulesIdArgs = {id: string}; export type DeleteApiEmRulesIdOptions = {baseUrl?: string | undefined, authToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a rule * * DELETE /em-rules/{id} */ export const deleteApiEmRulesId = async (args: DeleteApiEmRulesIdArgs, options?: DeleteApiEmRulesIdOptions) => { const {baseUrl = "https://commerce_studio_id.experiencemanager.lucidworks.com", fetch: fetchFn = fetch, authToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (authToken !== undefined) headers.set('authorization', `Bearer ${authToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/em-rules/${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 };