user

Playtech.API. user

Methods

# (static) changePassword(options) → {Promise.<void>}

Change player's password. See ims docs.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
newPassword string
oldPassword string
Returns:
Type
Promise.<void>
Example
Playtech.API.user.changePassword({ newPassword, oldPassword });

# (static) fetchBalance() → {Promise.<{Object}>}

Retrieve player balances based on "Subscription balance types" and updates user's balance in store. See ims docs.
Returns:
{data: {balances: {balanceType: string, balance: {amount: string, currencyCode: string}}[]}}
Type
Promise.<{Object}>
Example
Playtech.API.user.fetchBalance().then((data) => { ... });

# (static) getGeoData() → {Promise.<{country: string, state: string, city: string, latitude: string, longitude: string, accuracyRadius: string}>}

Retrieve player's geo data.
Returns:
Type
Promise.<{country: string, state: string, city: string, latitude: string, longitude: string, accuracyRadius: string}>
Example
Playtech.API.user.getGeoData();

# (static) getPlayerBasicData() → {Object}

Gets player basic data.
Returns:
Type
Object
Example
Playtech.API.user.getPlayerBasicData();

# (static) getPlayerData(playerFieldsopt) → {Promise.<{data: Object}>}

Get player data. See ims docs.
Parameters:
Name Type Attributes Default Description
playerFields Array.<number> <optional>
[defaults...]
Returns:
Type
Promise.<{data: Object}>
Example
Playtech.API.user.getPlayerData([1]);

# (static) getPlayerTags(tagNameopt, isForceopt)

Retrieve all player tags or a specific one. See ims docs.
Parameters:
Name Type Attributes Description
tagName string <optional>
If set, retrieve only this tag.
isForce boolean <optional>
If set, try to retrieve tag before login.
Returns:
{Promise<{data: {tags: {name: string, type: string, value: string, expirationDate: Array}}>}
Example
Playtech.API.user.getPlayerTags('Playertag', true);

# (static) isLoggedIn() → {boolean}

Return whether the user is logged.
Returns:
Type
boolean
Example
Playtech.API.user.isLoggedIn();

# (static) setCountry(country)

Set country.
Parameters:
Name Type Description
country string
Example
Playtech.API.user.setCountry('UA');

# (static) setPlayerTags(tagsopt, isForceopt) → {Promise.<{data: {tags: Array.<{name: string, type: string, value: string, expirationDate: string}>}}>}

Set tags for a current player.
Parameters:
Name Type Attributes Default Description
tags Array.<tags> <optional>
[] List of tags.
Properties
Name Type Attributes Description
name string <optional>
value string <optional>
type string <optional>
expirationDate string <optional>
isForce boolean <optional>
If set, try to set tag before login.
Returns:
Type
Promise.<{data: {tags: Array.<{name: string, type: string, value: string, expirationDate: string}>}}>
Example
Playtech.API.user.setPlayerTags(
     [{
        name: 'tag1',
        value: 'value1',
        type: 'text',
        expirationDate: '2024-04-13'
     }],
     true
);

# (static) updatePlayerInfo(options) → {Promise.<{playerCode: number, actions: Object}>}

Update player's information. See ims docs.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
dataMap Object
addressDetails Object
contactAddress Object
customData Array.<Object>
Properties
Name Type Description
key string
value string
changeTimestamp string
Returns:
Type
Promise.<{playerCode: number, actions: Object}>
Example
Playtech.API.user.updatePlayerInfo({ dataMap, addressDetails, contactAddress, customData, changeTimestamp });

# (static) validatePassword(options) → {Promise.<void>}

Validate player's password. See ims docs.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
password string
Returns:
Type
Promise.<void>
Examples
Playtech.API.user.validatePassword({ password }).catch(({ response: { data: { errorMessage, errorCode } }, request, reason }) => { ... });
Playtech.API.user.validatePassword({ password }).then(({ response: {data: { correlationId } } }) => { ... });