Skip to content

Class: AccountResource

Auth Core

.activatePromo(promo): Promise<BaseOkay> Since1.0.0

GET /promo/{promo} API Docs
Activate promo code

Parameters

NameTypeDescription
promostringPromo code

Returns

Promise<BaseOkay>

Promo activation response

Throws

If promo code is invalid

Example

javascript
const result = await rest.auth.activatePromo('PROMO2024');

.confirm(code, hCaptchaResponse): Promise<BaseOkay> Since1.0.0

POST /confirm API Docs
Confirm account registration

Parameters

NameTypeDescription
codestringConfirmation code
hCaptchaResponsestringhCaptcha response

Returns

Promise<BaseOkay>

Confirmation response

Throws

If confirmation data is invalid

Example

javascript
const response = await rest.auth.confirm('123456', 'captcha_response');

getTokens()

getTokens(): Promise<Token[]>

Get user tokens

Returns

Promise<Token[]>

User tokens

Example

javascript
const tokens = await rest.auth.getTokens();

.login(email, password): Promise<Login> Since1.0.0

POST /login API Docs
Login to account

Parameters

NameTypeDescription
emailstringUser email
passwordstringUser password

Returns

Promise<Login>

Login response

Throws

If credentials are invalid

Example

javascript
const response = await rest.auth.login('user@example.com', 'password123');

logout()

logout(): Promise<BaseOkay>

Logout from account

Returns

Promise<BaseOkay>

Logout response

Example

javascript
await rest.auth.logout();

.register(name, email, password, surname): Promise<BaseOkay> Since1.0.0

POST /register API Docs
Register new account

Parameters

NameTypeDescription
namestringUser name
emailstringUser email
passwordstringUser password
surname?stringUser surname

Returns

Promise<BaseOkay>

Registration response

Throws

If registration data is invalid

Example

javascript
const response = await rest.auth.register('John', 'john@example.com', 'password123', 'Doe');

.resetPassword(email): Promise<BaseOkay> Since1.0.0

POST /reset API Docs
Reset password

Parameters

NameTypeDescription
emailstringUser email

Returns

Promise<BaseOkay>

Reset response

Throws

If email is invalid

Example

javascript
await rest.auth.resetPassword('user@example.com');

Profile

.update(settings): Promise<BaseOkay> Since1.0.0

PATCH /settings/profile API Docs
Update profile settings

Parameters

NameTypeDescription
settingsSettingsPayloadProfile settings to update

Returns

Promise<BaseOkay>

Update response

Example

javascript
await rest.account.update({ name: 'John', status: 'Online' });