export type UpdateApiV1LeadsMarkProcessedPersonIdArgs = {personId: number, mergeIntoPersonId?: number | undefined}; export type UpdateApiV1LeadsMarkProcessedPersonIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Marks a lead as processed. If mergeIntoPersonId is provided, the lead is treated as having * been merged into that existing person record instead of becoming a new one. * * PUT /v1/Leads/MarkProcessed/{personId} */ export const updateApiV1LeadsMarkProcessedPersonId = async (args: UpdateApiV1LeadsMarkProcessedPersonIdArgs, options: UpdateApiV1LeadsMarkProcessedPersonIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.mergeIntoPersonId != null) query.append("mergeIntoPersonId", String(args.mergeIntoPersonId)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Leads/MarkProcessed/${encodeURIComponent(String(args.personId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };