export type UpdateApiApiV3DestinationsDestinationNameConnectionsIdArgs = {destination_name: string, id: number, body: {title?: string | undefined, connection_params?: Record | undefined}}; export type UpdateApiApiV3DestinationsDestinationNameConnectionsIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update connection parameters * * PUT /api/v3/destinations/{destination_name}/connections/{id} * * Also accepts auth: cookieAuth */ export const updateApiApiV3DestinationsDestinationNameConnectionsId = async (args: UpdateApiApiV3DestinationsDestinationNameConnectionsIdArgs, options?: UpdateApiApiV3DestinationsDestinationNameConnectionsIdOptions) => { 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/destinations/${encodeURIComponent(String(args.destination_name))}/connections/${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 };