export type NodeConfigUpdate = {config: {[key: string]: unknown}}; export type UpdateApiApiV1AutomationsAutomationIdNodesSlugConfigArgs = {automation_id: string, slug: string, body: NodeConfigUpdate}; export type UpdateApiApiV1AutomationsAutomationIdNodesSlugConfigOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update Node Config * * PUT /api/v1/automations/{automation_id}/nodes/{slug}/config */ export const updateApiApiV1AutomationsAutomationIdNodesSlugConfig = async (args: UpdateApiApiV1AutomationsAutomationIdNodesSlugConfigArgs, options: UpdateApiApiV1AutomationsAutomationIdNodesSlugConfigOptions) => { 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/v1/automations/${encodeURIComponent(String(args.automation_id))}/nodes/${encodeURIComponent(String(args.slug))}/config${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 };