export type AutomatedRecipeConnectionAccount = {id: number, account_id?: string | undefined}; export type AutomatedRecipeConnection = {connection_id: number, connection_data_source: string, accounts: Array}; export type AutomatedRecipeUpdateRequest = {data_sources: Array, connections: Array, sync_from_date?: string | undefined}; export type UpdateApiApiV3AutomatedRecipesRecipeIdArgs = {recipe_id: string, body: AutomatedRecipeUpdateRequest}; export type UpdateApiApiV3AutomatedRecipesRecipeIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * DEPRECATED Update automated recipe configuration * * PUT /api/v3/automated-recipes/{recipe_id}/ * * Also accepts auth: cookieAuth */ export const updateApiApiV3AutomatedRecipesRecipeId = async (args: UpdateApiApiV3AutomatedRecipesRecipeIdArgs, options?: UpdateApiApiV3AutomatedRecipesRecipeIdOptions) => { const {baseUrl = "https://embedded.improvado.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/automated-recipes/${encodeURIComponent(String(args.recipe_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 };