export type Body10 = {linkContactIds?: Array | undefined, unlinkContactIds?: Array | undefined, linkCompanyIds?: Array | undefined, unlinkCompanyIds?: Array | undefined}; export type PatchApiCrmDealsLinkUnlinkIdArgs = {id: string, body: Body10}; export type PatchApiCrmDealsLinkUnlinkIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Link and Unlink a deal with contacts and companies * * PATCH /crm/deals/link-unlink/{id} * * Also accepts auth: partner-key */ export const patchApiCrmDealsLinkUnlinkId = async (args: PatchApiCrmDealsLinkUnlinkIdArgs, options?: PatchApiCrmDealsLinkUnlinkIdOptions) => { const {baseUrl = "https://api.brevo.com/v3", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/crm/deals/link-unlink/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 undefined };