export type DeleteApiCustomfieldsItemClassIdArgs = {itemClass: 'accounts' | 'contacts' | 'opportunities', id: number}; export type DeleteApiCustomfieldsItemClassIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a custom field * * DELETE /customfields/{itemClass}/{id} */ export const deleteApiCustomfieldsItemClassId = async (args: DeleteApiCustomfieldsItemClassIdArgs, options?: DeleteApiCustomfieldsItemClassIdOptions) => { const {baseUrl = "https://api.salesflare.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/customfields/${encodeURIComponent(String(args.itemClass))}/${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 res.blob() };