import { BaserowClient } from "./baserow-client"; /** * Operations for managing Baserow users. */ export declare class UserOperations { private client; constructor(client: BaserowClient); /** * Authenticates a user with email and password. * Returns JWT tokens and user information that can be used for subsequent API calls. * @param email - User's email * @param password - User's password * @returns Object containing user information, access_token and refresh_token * @throws {BaserowApiError} If authentication fails */ login(email: string, password: string): Promise<{ user: { first_name: string; username: string; language: string; }; access_token: string; refresh_token: string; }>; /** * Refreshes an expired JWT token using a refresh token. * @param refreshToken - The refresh token obtained during login * @returns Object containing a new access_token and user information * @throws {BaserowApiError} If the refresh token is invalid or expired */ refreshToken(refreshToken: string): Promise<{ user: { first_name: string; username: string; language: string; }; access_token: string; }>; /** * Verifies if a JWT token is valid and returns user information. * @param token - The JWT token to verify * @returns User information if token is valid * @throws {BaserowApiError} If the token is invalid */ verifyToken(token: string): Promise<{ user: { first_name: string; username: string; language: string; }; }>; /** * Logs out a user by blacklisting their refresh token. * @param refreshToken - The refresh token to blacklist * @throws {BaserowApiError} If the token blacklisting fails */ logout(refreshToken: string): Promise; /** * Creates a new user based on the provided values. * @param options - Object containing user registration fields: * - name: User's name * - email: User's email * - password: User's password * - language: Optional ISO 639 language code (default: "en") * - authenticate: Whether to generate authentication tokens (default: false) * - workspaceInvitationToken: Optional workspace invitation token * - templateId: Optional template ID to install after creating account * @returns Object containing user information and possibly tokens if authenticate is true * @throws {BaserowApiError} If user creation fails */ register(options: { name: string; email: string; password: string; language?: string; authenticate?: boolean; workspaceInvitationToken?: string; templateId?: number; }): Promise<{ user: { first_name: string; username: string; language: string; }; access_token?: string; refresh_token?: string; }>; /** * Updates the account information of the authenticated user. * @param options - Account fields to update * @returns Updated account information * @throws {BaserowApiError} If update fails */ updateAccount(options: { firstName?: string; language?: string; emailNotificationFrequency?: 'instant' | 'daily' | 'weekly' | 'never'; completedOnboarding?: boolean; completedGuidedTours?: string[]; }): Promise<{ first_name: string; language: string; email_notification_frequency: string; completed_onboarding: boolean; completed_guided_tours: string[]; }>; /** * Changes the password of an authenticated user. * @param oldPassword - Current password * @param newPassword - New password * @throws {BaserowApiError} If password change fails */ changePassword(oldPassword: string, newPassword: string): Promise; /** * Lists all the relevant user information that could be shown on a dashboard. * It will contain all the pending workspace invitations for that user. * @returns Dashboard information including workspace invitations * @throws {BaserowApiError} If request fails */ getDashboard(): Promise<{ workspace_invitations: Array<{ id: number; invited_by: string; workspace: string; email: string; message: string; created_on: string; email_exists: boolean; }>; }>; /** * Changes the password of a user if the reset token is valid. * @param token - Password reset token * @param password - New password * @throws {BaserowApiError} If password reset fails */ resetPassword(token: string, password: string): Promise; /** * Sends an email containing the password reset link to the user's email address. * @param email - User's email address * @param baseUrl - Base URL for the reset link * @throws {BaserowApiError} If sending email fails */ sendPasswordResetEmail(email: string, baseUrl: string): Promise; /** * Schedules the account deletion of the authenticated user. * @throws {BaserowApiError} If scheduling deletion fails */ scheduleAccountDeletion(): Promise; /** * Sends an email to the user with an email verification link. * @throws {BaserowApiError} If sending verification email fails */ sendVerifyEmail(): Promise; /** * Verifies a user's email address with a verification token. * @param token - Email verification token * @returns User information and tokens if unauthenticated * @throws {BaserowApiError} If email verification fails */ verifyEmail(token: string): Promise<{ user?: { first_name: string; username: string; language: string; }; access_token?: string; refresh_token?: string; }>; /** * Undoes the latest undoable action performed by the user. * @param clientSessionId - Client session ID header * @param scopes - Optional scopes to filter actions * @returns Result of the undo operation * @throws {BaserowApiError} If undo fails */ undo(clientSessionId: string, scopes?: { root?: boolean; workspace?: number; application?: number; table?: number; view?: number; teamsInWorkspace?: number; }): Promise<{ actions: Array<{ action_type: string | null; action_scope: string | null; }>; result_code: string; }>; /** * Redoes the latest redoable action performed by the user. * @param clientSessionId - Client session ID header * @param scopes - Optional scopes to filter actions * @returns Result of the redo operation * @throws {BaserowApiError} If redo fails */ redo(clientSessionId: string, scopes?: { root?: boolean; workspace?: number; application?: number; table?: number; view?: number; teamsInWorkspace?: number; }): Promise<{ actions: Array<{ action_type: string | null; action_scope: string | null; }>; result_code: string; }>; }