export type UpdateApiCustomfieldsItemClassIdArgs = {itemClass: 'accounts' | 'contacts' | 'opportunities', id: number, body: {id: number, type?: number | undefined, name?: string | undefined, enabled?: boolean | undefined, archived?: boolean | undefined, required?: boolean | undefined, pipeline?: number | undefined, pipelineName?: string | undefined, order?: number | undefined, predefined_customfield?: number | undefined, users_can_add_options?: boolean | undefined, options?: (Array<{id?: number | undefined, order?: number | undefined, archived?: boolean | undefined, name: string}>) | undefined, order_alphabetically?: boolean | undefined, min_number?: number | undefined, max_number?: number | undefined, min_date?: string | undefined, max_date?: string | undefined}}; export type UpdateApiCustomfieldsItemClassIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a custom field * * PUT /customfields/{itemClass}/{id} */ export const updateApiCustomfieldsItemClassId = async (args: UpdateApiCustomfieldsItemClassIdArgs, options?: UpdateApiCustomfieldsItemClassIdOptions) => { const {baseUrl = "https://api.salesflare.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") 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: "PUT", 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.blob() };