export type GetApiCustomfieldsItemClassCustomFieldApiFieldOptionsArgs = {itemClass: 'accounts' | 'contacts' | 'opportunities', customFieldApiField: string, searchString?: string | undefined}; export type GetApiCustomfieldsItemClassCustomFieldApiFieldOptionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List a custom field's options * * GET /customfields/{itemClass}/{customFieldApiField}/options */ export const getApiCustomfieldsItemClassCustomFieldApiFieldOptions = async (args: GetApiCustomfieldsItemClassCustomFieldApiFieldOptionsArgs, options?: GetApiCustomfieldsItemClassCustomFieldApiFieldOptionsOptions) => { const {baseUrl = "https://api.salesflare.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.searchString != null) query.append("searchString", String(args.searchString)) const url = `${baseUrl.replace(/\/+$/, '')}/customfields/${encodeURIComponent(String(args.itemClass))}/${encodeURIComponent(String(args.customFieldApiField))}/options${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };