export type PostApiFunnelNodes = {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 CreateApiApiFunnelNodesArgs = {body: PostApiFunnelNodes}; export type CreateApiApiFunnelNodesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create funnel node * * POST /api/funnel_nodes */ export const createApiApiFunnelNodes = async (args: CreateApiApiFunnelNodesArgs, options: CreateApiApiFunnelNodesOptions) => { 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${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 undefined };