@watzon/baserow
    Preparing search index...

    Class UserOperations

    Operations for managing Baserow users.

    Index

    Constructors

    Methods

    • Changes the password of an authenticated user.

      Parameters

      • oldPassword: string

        Current password

      • newPassword: string

        New password

      Returns Promise<void>

      If password change fails

    • 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 Promise<
          {
              workspace_invitations: {
                  created_on: string;
                  email: string;
                  email_exists: boolean;
                  id: number;
                  invited_by: string;
                  message: string;
                  workspace: string;
              }[];
          },
      >

      Dashboard information including workspace invitations

      If request fails

    • Authenticates a user with email and password. Returns JWT tokens and user information that can be used for subsequent API calls.

      Parameters

      • email: string

        User's email

      • password: string

        User's password

      Returns Promise<
          {
              access_token: string;
              refresh_token: string;
              user: { first_name: string; language: string; username: string };
          },
      >

      Object containing user information, access_token and refresh_token

      If authentication fails

    • Logs out a user by blacklisting their refresh token.

      Parameters

      • refreshToken: string

        The refresh token to blacklist

      Returns Promise<void>

      If the token blacklisting fails

    • Redoes the latest redoable action performed by the user.

      Parameters

      • clientSessionId: string

        Client session ID header

      • Optionalscopes: {
            application?: number;
            root?: boolean;
            table?: number;
            teamsInWorkspace?: number;
            view?: number;
            workspace?: number;
        }

        Optional scopes to filter actions

      Returns Promise<
          {
              actions: { action_scope: null
              | string; action_type: null | string }[];
              result_code: string;
          },
      >

      Result of the redo operation

      If redo fails

    • Refreshes an expired JWT token using a refresh token.

      Parameters

      • refreshToken: string

        The refresh token obtained during login

      Returns Promise<
          {
              access_token: string;
              user: { first_name: string; language: string; username: string };
          },
      >

      Object containing a new access_token and user information

      If the refresh token is invalid or expired

    • Creates a new user based on the provided values.

      Parameters

      • options: {
            authenticate?: boolean;
            email: string;
            language?: string;
            name: string;
            password: string;
            templateId?: number;
            workspaceInvitationToken?: string;
        }

        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 Promise<
          {
              access_token?: string;
              refresh_token?: string;
              user: { first_name: string; language: string; username: string };
          },
      >

      Object containing user information and possibly tokens if authenticate is true

      If user creation fails

    • Changes the password of a user if the reset token is valid.

      Parameters

      • token: string

        Password reset token

      • password: string

        New password

      Returns Promise<void>

      If password reset fails

    • Schedules the account deletion of the authenticated user.

      Returns Promise<void>

      If scheduling deletion fails

    • Sends an email containing the password reset link to the user's email address.

      Parameters

      • email: string

        User's email address

      • baseUrl: string

        Base URL for the reset link

      Returns Promise<void>

      If sending email fails

    • Sends an email to the user with an email verification link.

      Returns Promise<void>

      If sending verification email fails

    • Undoes the latest undoable action performed by the user.

      Parameters

      • clientSessionId: string

        Client session ID header

      • Optionalscopes: {
            application?: number;
            root?: boolean;
            table?: number;
            teamsInWorkspace?: number;
            view?: number;
            workspace?: number;
        }

        Optional scopes to filter actions

      Returns Promise<
          {
              actions: { action_scope: null
              | string; action_type: null | string }[];
              result_code: string;
          },
      >

      Result of the undo operation

      If undo fails

    • Updates the account information of the authenticated user.

      Parameters

      • options: {
            completedGuidedTours?: string[];
            completedOnboarding?: boolean;
            emailNotificationFrequency?: "instant" | "daily" | "weekly" | "never";
            firstName?: string;
            language?: string;
        }

        Account fields to update

      Returns Promise<
          {
              completed_guided_tours: string[];
              completed_onboarding: boolean;
              email_notification_frequency: string;
              first_name: string;
              language: string;
          },
      >

      Updated account information

      If update fails

    • Verifies a user's email address with a verification token.

      Parameters

      • token: string

        Email verification token

      Returns Promise<
          {
              access_token?: string;
              refresh_token?: string;
              user?: { first_name: string; language: string; username: string };
          },
      >

      User information and tokens if unauthenticated

      If email verification fails

    • Verifies if a JWT token is valid and returns user information.

      Parameters

      • token: string

        The JWT token to verify

      Returns Promise<{ user: { first_name: string; language: string; username: string } }>

      User information if token is valid

      If the token is invalid