import { paths } from '../../schema'; import { ApiSecurity, ApiUrl, AppDetails } from '../../shared'; import { UserSettings } from '../../shared/types/userSettings'; import { ChangePasswordPayload, ChangePasswordPayloadNew, CheckChangeEmailExpirationResponse, FriendInvite, IncompleteCheckoutPayload, IncompleteCheckoutResponse, InitializeUserResponse, PreCreateUserResponse, Token, UpdateProfilePayload, UserPublicKeyResponse, UserPublicKeyWithCreationResponse, VerifyEmailChangeResponse } from './types'; export * as UserTypes from './types'; export declare class Users { private readonly client; private readonly appDetails; private readonly apiSecurity; static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Users; private constructor(); /** * Sends an invitation to the specified email * @param email */ sendInvitation(email: string): Promise; /** * Initialize basic state of user and returns data after registration process * @param email * @param mnemonic */ initialize(email: string, mnemonic: string): Promise; /** * Returns fresh data of the user */ refreshUser(): Promise; /** * Returns fresh data of the user */ refreshUserCredentials(): Promise; /** * Returns fresh avatar URL of the user */ refreshAvatarUser(): Promise<{ avatar: UserSettings['avatar']; }>; /** * @deprecated Use `refreshUser` instead. * * Retrieves the user data for a specific user identified by the uuid. * * @param {string} params.userUuid - The UUID of the user. * @return {Promise} A promise that resolves to an object containing the user data. * The object has the following properties: * - `newToken` (string): The new token of the user. * - `oldToken` (string): The old drive token of the user. * - `user` (UserSettings): The user data. */ getUserData({ userUuid }: { userUuid: string; }): Promise<{ newToken: string; oldToken: string; user: UserSettings; }>; /** * Updates the authentication credentials and invalidates previous tokens (Legacy backend (drive-server)) * @param payload * * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user. */ changePasswordLegacy(payload: ChangePasswordPayload): Promise<{ token: string; newToken: string; }>; /** * Updates the authentication credentials and invalidates previous tokens (New backend (drive-server-wip)) * @param payload * * @returns {Promise<{token: string, newToken: string}>} A promise that returns new tokens for this user. */ changePassword(payload: ChangePasswordPayloadNew): Promise<{ token: string; newToken: string; }>; /** * Pre registers an email * @param email * @returns {Promise} A promise that returns a public key for this user. */ preRegister(email: string): Promise; /** * @deprecated Use `updateUserProfile` instead. * Updates a user profile * @param payload */ updateProfile(payload: UpdateProfilePayload): Promise; /** * Updates a user profile * @param payload */ updateUserProfile(payload: UpdateProfilePayload, token?: Token): Promise; /** * @deprecated Use `updateUserAvatar` instead. * Updates a user avatar * @param payload */ updateAvatar(payload: { avatar: Blob; }): Promise<{ avatar: string; }>; /** * Updates a user avatar * @param payload */ updateUserAvatar(payload: { avatar: Blob; }, token?: Token): Promise<{ avatar: string; }>; /** * @deprecated Use `deleteUserAvatar` instead. * Delete current user avatar */ deleteAvatar(): Promise; /** * Delete current user avatar */ deleteUserAvatar(token?: Token): Promise; /** * Gets all friend invites created by this user */ getFriendInvites(): Promise; /** * Sends verification email */ sendVerificationEmail(token?: Token): Promise; /** * Verifies user email */ verifyEmail(payload: { verificationToken: string; }): Promise; /** * Change user email by new email * * @param {string} newEmail * * @returns {Promise} */ changeUserEmail(newEmail: string): Promise; /** * Verify user email change * * @param {string} encryptedAttemptChangeEmailId * * @returns {Promise} */ verifyEmailChange(encryptedAttemptChangeEmailId: string): Promise; /** * Check if user email change verification link is expired * * @param {string} encryptedAttemptChangeEmailId * * @returns {Promise} */ checkChangeEmailExpiration(encryptedAttemptChangeEmailId: string): Promise; /** * Get public key of given email */ getPublicKeyByEmail({ email }: { email: string; }): Promise; /** * Get public key of given email, if not exists it pre-create user with this email * and returns public key * @param email * @returns {Promise} A promise that returns the public keys of given user */ getPublicKeyWithPrecreation({ email }: { email: string; }): Promise; /** * Generate mnemonic */ generateMnemonic(): Promise<{ mnemonic: string; }>; /** * Tracks incomplete checkout event and sends notification email when user abandons checkout process * @param payload - The incomplete checkout data containing checkout URL, plan name and price * @returns A promise that resolves when the event is tracked successfully */ handleIncompleteCheckout(payload: IncompleteCheckoutPayload): Promise; private basicHeaders; private headers; private headersWithToken; }