export type PutApiFunnelNodesId = {parent_id?: number | undefined, direction?: ('yes' | 'no') | undefined, content_page_id?: string | undefined, Integer?: string | undefined, form?: ('node_page' | 'node_link') | undefined, redirection_url?: string | undefined}; export type UpdateApiApiFunnelNodesIdArgs = {id: number, body: PutApiFunnelNodesId}; export type UpdateApiApiFunnelNodesIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update funnel node * * PUT /api/funnel_nodes/{id} */ export const updateApiApiFunnelNodesId = async (args: UpdateApiApiFunnelNodesIdArgs, options: UpdateApiApiFunnelNodesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/funnel_nodes/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };