export type UserPreferences = {guidedTours?: boolean | undefined, onboardingBot?: boolean | undefined, productUpdates?: boolean | undefined, surveys?: boolean | undefined, trackUsage?: boolean | undefined}; export type UpdateApiV1UserPreferencesIdentifyIdArgs = {identifyId: string, body: UserPreferences}; export type UpdateApiV1UserPreferencesIdentifyIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update user preferences * * PUT /v1/user/preferences/{identifyId} */ export const updateApiV1UserPreferencesIdentifyId = async (args: UpdateApiV1UserPreferencesIdentifyIdArgs, options?: UpdateApiV1UserPreferencesIdentifyIdOptions) => { 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/${encodeURIComponent(String(args.identifyId))}${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 };