export type PutApiFunnelsId = {name?: string | undefined, forward_url_params?: boolean | undefined, funnel_node_attributes: {content_page_id?: string | undefined, Integer?: string | undefined, form?: ('node_page' | 'node_link') | undefined, redirection_url?: string | undefined}}; export type UpdateApiApiFunnelsIdArgs = {id: number, body: PutApiFunnelsId}; export type UpdateApiApiFunnelsIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update funnel * * PUT /api/funnels/{id} */ export const updateApiApiFunnelsId = async (args: UpdateApiApiFunnelsIdArgs, options: UpdateApiApiFunnelsIdOptions) => { 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/funnels/${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 };