export type UpdateUserPreferences = {guidedTours?: boolean | undefined, identifyId: string, onboardingBot?: boolean | undefined, productUpdates?: boolean | undefined, surveys?: boolean | undefined, trackUsage?: boolean | undefined}; export type UpdateApiV1UserPreferencesArgs = {body: UpdateUserPreferences}; export type UpdateApiV1UserPreferencesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user preferences (identifyId passed via request body) * * PUT /v1/user/preferences */ export const updateApiV1UserPreferences = async (args: UpdateApiV1UserPreferencesArgs, options?: UpdateApiV1UserPreferencesOptions) => { const {baseUrl = "https://app.aptrinsic.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/user/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 };