export type CreateApiDealsDealIdDuplicateArgs = {deal_id: number, body: {new_pipeline_id: number, new_stage_id: number, new_owner_id: number, duplicate_history: boolean, duplicate_note: boolean, duplicate_activity: boolean, duplicate_email: boolean, duplicate_file: boolean, duplicate_users_envolved?: boolean | undefined, duplicate_companies_envolved?: boolean | undefined, duplicate_custom_field: boolean, duplicate_call: boolean, duplicate_tag?: boolean | undefined, duplicate_origin?: boolean | undefined, duplicate_proposal?: boolean | undefined, duplicate_persons_envolved?: boolean | undefined, duplicate_data_list?: boolean | undefined, keep_owner_activity?: boolean | undefined, keep_note_user?: boolean | undefined, keep_call_user: boolean, keep_proposal_counter?: boolean | undefined, keep_proposal_involved_users?: boolean | undefined}}; export type CreateApiDealsDealIdDuplicateOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Duplicar oportunidade * * POST /deals/{deal_id}/duplicate */ export const createApiDealsDealIdDuplicate = async (args: CreateApiDealsDealIdDuplicateArgs, options?: CreateApiDealsDealIdDuplicateOptions) => { const {baseUrl = "https://api.pipe.run/v1", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (sec0 !== undefined) headers.set("token", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/deals/${encodeURIComponent(String(args.deal_id))}/duplicate${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 (await res.json()) as unknown };