Skip to content

ESPRMUser

Defined in: src/ESPRMUser.ts:27

Represents an authenticated user session. Created by ESPRMAuth.login. Provides static helpers for token management and instance methods (via prototype augmentation) for user profile operations.

new ESPRMUser(tokens): ESPRMUser

Defined in: src/ESPRMUser.ts:37

UserTokensData

Access, ID, and refresh tokens from a successful login. Tokens are persisted separately via ESPRMUser.storeTokens.

ESPRMUser

static userId: string

Defined in: src/ESPRMUser.ts:28

deleteAccount(params?): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMUser/DeleteAccount.ts:22

Delete the currently authenticated user’s account.

DeleteAccountParams

Optional parameters for account deletion

Promise<ESPAPISuccessResponse>

Success response confirming the deletion


getUserInfo(): Promise<GetUserInfoResponse>

Defined in: src/methods/ESPRMUser/GetUserInfo.ts:20

Fetch the profile information of the currently authenticated user.

Promise<GetUserInfoResponse>

The user’s profile data


updateUserProfile(params): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMUser/UpdateUserProfile.ts:22

Update the profile of the currently authenticated user.

UpdateUserProfileRequest

Profile fields to update

Promise<ESPAPISuccessResponse>

Success response confirming the update


static clearAllTokens(): Promise<void>

Defined in: src/ESPRMUser.ts:125

Remove all stored session tokens (access, ID, and refresh). Resolves once storage has been updated.

Promise<void>


static extendSession(refreshToken): Promise<string>

Defined in: src/ESPRMUser.ts:98

Extend the current session using a refresh token. Stores the new access and ID tokens on success. Clears all tokens on failure.

string

The refresh token from the current session

Promise<string>

The new access token


static getAccessToken(): Promise<string>

Defined in: src/ESPRMUser.ts:60

Retrieve the current access token, refreshing it automatically if expired (or about to expire). Concurrent callers share a single refresh request.

Promise<string>

The valid access token string

ESPTokenError if tokens are missing or session cannot be extended


static storeTokens(tokens): Promise<void>

Defined in: src/ESPRMUser.ts:45

Persist a full token set to the configured storage adapter. Resolves once every token has been written.

UserTokensData

Promise<void>