export type ProviderAccountPreferences = {isDataExtractsEnabled?: boolean | undefined, linkedProviderAccountId?: number | undefined, isAutoRefreshEnabled?: boolean | undefined}; export type ProviderAccountPreferencesRequest = {preferences?: ProviderAccountPreferences | undefined}; export type UpdateApiProviderAccountsProviderAccountIdPreferencesArgs = {providerAccountId: number, body: ProviderAccountPreferencesRequest}; export type UpdateApiProviderAccountsProviderAccountIdPreferencesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update Preferences * * PUT /providerAccounts/{providerAccountId}/preferences */ export const updateApiProviderAccountsProviderAccountIdPreferences = async (args: UpdateApiProviderAccountsProviderAccountIdPreferencesArgs, options: UpdateApiProviderAccountsProviderAccountIdPreferencesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/providerAccounts/${encodeURIComponent(String(args.providerAccountId))}/preferences${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 };