/** * User operations for Managed Runtime. * * Handles user profile, API key, and email preferences management. * * @module operations/mrt/user */ import type { AuthStrategy } from '../../auth/types.js'; import type { components } from '../../clients/mrt.js'; /** * User profile type from API. */ export type MrtUserProfile = components['schemas']['APIUserProfile']; /** * User email preferences type from API. */ export type MrtEmailPreferences = components['schemas']['UserEmailPreferences']; /** * Patched email preferences type from API. */ export type PatchedMrtEmailPreferences = components['schemas']['PatchedUserEmailPreferences']; /** * Base options for user operations. */ export interface UserOperationOptions { /** * MRT API origin URL. * @default "https://cloud.mobify.com" */ origin?: string; } /** * Result of API key generation/reset. */ export interface ApiKeyResult { /** * The generated or reset API key. */ api_key: string; } /** * Options for updating email preferences. */ export interface UpdateEmailPreferencesOptions extends UserOperationOptions { /** * Whether to receive Node.js deprecation notifications. */ nodeDeprecationNotifications?: boolean; } /** * Gets the profile information for the authenticated user. * * @param options - Operation options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns User profile * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { getProfile } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const profile = await getProfile({}, auth); * console.log(`User: ${profile.first_name} ${profile.last_name}`); * ``` */ export declare function getProfile(options: UserOperationOptions, auth: AuthStrategy): Promise; /** * Generates or resets the API key for the authenticated user. * * Warning: This will invalidate your current API key. * * @param options - Operation options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns The new API key * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { resetApiKey } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const result = await resetApiKey({}, auth); * console.log(`New API key: ${result.api_key}`); * // Important: Update your stored API key! * ``` */ export declare function resetApiKey(options: UserOperationOptions, auth: AuthStrategy): Promise; /** * Gets email notification preferences for the authenticated user. * * @param options - Operation options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns Email preferences * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { getEmailPreferences } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const prefs = await getEmailPreferences({}, auth); * console.log(`Node deprecation notifications: ${prefs.node_deprecation_notifications}`); * ``` */ export declare function getEmailPreferences(options: UserOperationOptions, auth: AuthStrategy): Promise; /** * Updates email notification preferences for the authenticated user. * * @param options - Update options * @param auth - Authentication strategy (ApiKeyStrategy) * @returns Updated email preferences * @throws Error if request fails * * @example * ```typescript * import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth'; * import { updateEmailPreferences } from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const prefs = await updateEmailPreferences({ * nodeDeprecationNotifications: false * }, auth); * * console.log(`Updated: ${prefs.node_deprecation_notifications}`); * ``` */ export declare function updateEmailPreferences(options: UpdateEmailPreferencesOptions, auth: AuthStrategy): Promise;