Skip to content

Yurba.js / @yurbajs/rest / AccountResource

Class: AccountResource

Auth Core

activatePromo()

activatePromo(promo): Promise<BaseOkay>

Activate promo code

Parameters

promo

string

Promo code

Returns

Promise<BaseOkay>

Promo activation response

Since

1.0.0

Throws

If promo code is invalid

Example

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

confirm()

confirm(code, hCaptchaResponse): Promise<BaseOkay>

Confirm account registration

Parameters

code

string

Confirmation code

hCaptchaResponse

string

hCaptcha response

Returns

Promise<BaseOkay>

Confirmation response

Since

1.0.0

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

Since

1.0.0

Example

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

login()

login(email, password): Promise<Login>

Login to account

Parameters

email

string

User email

password

string

User password

Returns

Promise<Login>

Login response

Since

1.0.0

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

Since

1.0.0

Example

javascript
await rest.auth.logout();

register()

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

Register new account

Parameters

name

string

User name

email

string

User email

password

string

User password

surname

string = ''

User surname

Returns

Promise<BaseOkay>

Registration response

Since

1.0.0

Throws

If registration data is invalid

Example

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

resetPassword()

resetPassword(email): Promise<BaseOkay>

Reset password

Parameters

email

string

User email

Returns

Promise<BaseOkay>

Reset response

Since

1.0.0

Throws

If email is invalid

Example

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

Profile

update()

update(settings): Promise<BaseOkay>

Update profile settings

Parameters

settings

SettingsPayload

Profile settings to update

Returns

Promise<BaseOkay>

Update response

Since

1.0.0

Example

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