Accounts

Methods

(async, inner) confirmEmailChange(token) → {Promise.<void>}

Source:
Parameters:
Name Type Description
token string The token sent to the user's email for verification.
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves when the email change is confirmed.
Type
Promise.<void>

(async, inner) deleteAccount(userId) → {Promise.<void>}

Source:
Parameters:
Name Type Description
userId number The ID of the user account to delete.
Returns:
- A promise that resolves with the anonymized user data or an HttpError if the request fails.
Type
Promise.<void>

(async, inner) numberOfActiveUsers() → {Promise.<number>}

Description:
  • Calls a public API endpoint to get the number of active users.
Source:
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves to the number of active users.
Type
Promise.<number>

(async, inner) requestEmailChange(email, password) → {Promise.<void>}

Source:
Parameters:
Name Type Description
email string The new email address to set for the user.
password string The current password of the user for verification.
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves when the email change request is made.
Type
Promise.<void>

(async, inner) resetPassword(params) → {Promise.<void>}

Source:
Properties:
Name Type Description
email string The email address for the account.
password string The new password for the account.
passwordConfirmation string The confirmation of the new password.
token string The token sent to the user's email for verification.
Parameters:
Name Type Description
params Object The parameters for resetting the password.
Throws:
- Throws an HttpError if the HTTP request fails.
Type
HttpError
Returns:
- A promise that resolves when the password reset is complete or an HttpError if the request fails.
Type
Promise.<void>

(async, inner) sendAccountSetupEmail(email) → {Promise.<void>}

Source:
Parameters:
Name Type Description
email string The email address to send the account setup email to.
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves when the email is sent or an HttpError if the request fails.
Type
Promise.<void>

(async, inner) sendPasswordResetEmail(email) → {Promise.<void>}

Source:
Parameters:
Name Type Description
email string The email address to send the password reset email to.
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves when the email change request is made.
Type
Promise.<void>

(async, inner) setupAccount(props) → {Promise.<AccountSetupResponse>}

Source:
Properties:
Name Type Attributes Description
email string The email address for the account.
password string The new password for the account.
passwordConfirmation string The confirmation of the new password.
token string <optional>
The token sent to the user's email for verification. Required for web requests
revenuecatAppUserId string <optional>
The RevenueCat App User ID for MA environments. Required for MA requests
deviceName string <optional>
The device name for MA environments. Required for MA requests
Parameters:
Name Type Description
props Object The parameters for setting up the account.
Throws:
  • - Throws an error if required parameters are missing based on the environment.
    Type
    Error
  • - Throws an HttpError if the HTTP request fails.
    Type
    HttpError
Returns:
- A promise that resolves when the account setup is complete or an HttpError if the request fails.
Type
Promise.<AccountSetupResponse>

(async, inner) status(email) → {Promise.<{requires_setup: boolean}>}

Source:
Parameters:
Name Type Description
email string The email address to check the account status for.
Throws:
- Throws HttpError if the request fails.
Type
HttpError
Returns:
- A promise that resolves to an object indicating whether account setup is required, or an HttpError if the request fails.
Type
Promise.<{requires_setup: boolean}>

(async, inner) toggleStudentView(useStudentView) → {Promise.<UserResource>}

Description:
  • Toggles the student view mode for admin users. When enabled, admins see the platform as a regular student would.
Source:
Parameters:
Name Type Description
useStudentView boolean Whether to enable student view mode (true) or admin view mode (false).
Throws:
- Throws HttpError if the request fails or user is not an admin.
Type
HttpError
Returns:
- A promise that resolves to the updated user resource.
Type
Promise.<UserResource>