Profiles
1.1.0

We highly recommend to read the documentation profiles page.

More details and API reference: Profiles

Reference

KeyTypeDescription
customIdstring
unique
Unique identifier from your services (1-64 characters)

Methods

.create

.create(customId, rpName, rpNumber)

Create a profile to your iPear server data.

More details and API reference: Create player

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)
rpNamestring
required
RolePlay name of the profile (1-64 characters)
rpNumberstring
unique
required
Phone number of the profile (1-64 characters)

Returns

Promise<{ customId: string, qrcode: string }>

Examples

Promise use

app.profiles.create("1234", "John Doe", "555-5126").then((player) => {
    console.log(player);
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    const player = await app.profiles.create("1234", "John Doe", "555-5126");
    console.log(player);
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

{
  "customId": "1234",
  "qrcode": "https://link_to_qrcode.com/4586632.png"
}

.getQrCode

.getQrCode(customId)

Retrieve a new QR Code for a profile.

Important

You need to create (/create) a profile before trying to get a new QR Code.

More details and API reference: Retrieve QR Code

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)

Returns

Promise<{ customId: string, qrcode: string }>

Examples

Promise use

app.profiles.getQrCode("1234").then((data) => {
    console.log(data);
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    const data = await app.profiles.getQrCode("1234");
    console.log(data);
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

{
  "customId": "1234",
  "qrcode": "https://link_to_qrcode.com/544548.png"
}

.getSecretCode

.getSecretCode(customId)

DEPRECATED since 1.1.0

This feature is now deprecated, and you should use [Profiles] Delete instead.

Retrieve a new secret code for a profile. A secret allows the user to avoid scanning the QR Code. (useful in case that their camera doesn't work)

One code is available for 5 minutes.

Important

You need to create (/create) a profile before trying to get a new secret code.

More details and API reference: Retrieve secret code

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)

Returns

Promise<{ customId: string, code: string, expiresAt: number, expiresAt_date: Date }>

Examples

Promise use

app.profiles.getSecretCode("1234").then((data) => {
    console.log(data);
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    const data = await app.profiles.getSecretCode("1234");
    console.log(data);
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

{
  "customId": "1234",
  "code": "486327",
  "expiresAt": 1682619471476,
  "expiresAt_date": Date(1682619471476)
}

.delete

.delete(customId)

Delete a profile from your iPear server data.

More details and API reference: Delete player

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)

Returns

Promise<boolean>

Examples

Promise use

app.profiles.delete("1234").then((deleted) => {
    console.log(deleted);
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    const deleted = await app.profiles.delete("1234");
    console.log(deleted);
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

true

.enable

.enable(customId)

Enable a player profile (in case you disabled it).

More details and API reference: Enable profile

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)

Returns

Promise<void>

Examples

Promise use

app.profiles.enable("1234").then(() => {
    console.log("event sent");
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    await app.profiles.enable("1234");
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

No result

.disable

.disable(customId)

Disable a player profile to avoid the player to use his iPear profile (for example: your player doesn't have mobile phone prop in his inventory).

More details and API reference: Disable profile

Parameters

KeyTypeDescription
customIdstring
unique
required
Unique identifier from your services (1-64 characters)

Returns

Promise<void>

Examples

Promise use

app.profiles.disable("1234").then(() => {
    console.log("event sent");
}).catch((error) => {
    console.log('An error has been occurred!', error);
})

Async use

try {
    await app.profiles.disable("1234");
} catch (error) {
    console.log('An error has been occurred!', error);
}

Result

No result

Powered by Doctave