export type CreateApiAccountsAccountIdContactsArgs = {account_id: number, body: Array<{id?: number | undefined, _dirty?: boolean | undefined, _deleted?: boolean | undefined}>}; export type CreateApiAccountsAccountIdContactsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an account's contacts * * POST /accounts/{account_id}/contacts */ export const createApiAccountsAccountIdContacts = async (args: CreateApiAccountsAccountIdContactsArgs, options?: CreateApiAccountsAccountIdContactsOptions) => { 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(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.account_id))}/contacts${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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() };