Optional
dataOptional
jwtOptional
profileOptional
profileAdd a new avatar
const animationMeta = {
"emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
}
const spriteSheetJSON = {
"animations": {
"emote": [
"emote/1.png"
]
},
"frames": {
"emote/1.png": {
"frame": {
"x": 1911,
"y": 778,
"w": 58,
"h": 91
},
"rotated": true,
"trimmed": true,
"spriteSourceSize": {
"x": 50,
"y": 33,
"w": 58,
"h": 91
},
"sourceSize": {
"w": 159,
"h": 159
}
}
},
"spriteSheetTypeMeta": {
"nameplate": {
"x": 0,
"y": -70
}
},
"meta": {
"image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
"format": "RGBA8888",
"size": {
"w": 2006,
"h": 1099
},
"scale": "1"
}
}
const formData = new FormData();
formData.append('animationMeta', animationMeta);
formData.append('name', "ExampleAvatarName");
formData.append('spriteSheetJSON', spriteSheetJSON);
formData.append('expression_dance', expression_dance);
formData.append('expression_emote', expression_emote);
formData.append('expression_sit', expression_sit);
formData.append('expression_stand', expression_stand);
formData.append('expression_transport', expression_transport);
formData.append('preview', preview);
formData.append('spriteSheet', spriteSheet);
formData.append('unityPackage', unityPackage);
await user.uploadAvatarFiles("exampleAvatarId", formData);
Verify user has valid interactive credentials
await user.checkInteractiveCredentials();
Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
await user.deleteAvatar("exampleAvatarId");
Optional
error?: unknownOptional
message?: stringOptional
params?: objectOptional
sdkRetrieves all worlds a user with matching API Key is an admin in, creates a new World object for each, and creates new map of Worlds accessible via user.adminWorlds.
await user.fetchAdminWorldsByKey();
const adminWorlds = user.adminWorlds;
Returns all assets owned by User when an email address is provided.
await user.fetchAssets();
const userAssets = user.assets;
Returns all avatars owned by User
const avatars = await user.fetchAvatars();
Retrieves the data object for a user.
const dataObject = await user.fetchDataObject();
Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
const interactiveWorlds = user.interactiveWorlds;
Returns all platform assets.
const assets = await user.fetchPlatformAssets();
Returns all scenes owned by User.
await user.fetchScenes();
const userScenes = user.scenes;
Retrieves all worlds owned by user with matching API Key, creates a new World object for each, and creates new map of Worlds accessible via user.worlds.
await user.fetchWorldsByKey();
const userWorlds = user.worlds;
{ urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
Increments a specific value in the data object for a user by the amount specified. Must have valid interactive credentials from a visitor in the world.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await user.incrementDataObjectValue("key", 1);
Optional
analytics?: AnalyticType[]Optional
lock?: { Optional
releaseSend an email
const html = `<p><b>Hello World!</b></p><p>This email is being sent from via SDK.</p>`
await user.sendEmail({ html, subject: "Example", to: "example@email.io" });
Sets the data object for a user.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await user.setDataObject({
"exampleKey": "exampleValue",
});
Optional
analytics?: AnalyticType[]Optional
lock?: { Optional
releaseUpdate avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
const animationMeta = {
"emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
}
const spriteSheetJSON = {
"animations": {
"emote": [
"emote/1.png"
]
},
"frames": {
"emote/1.png": {
"frame": {
"x": 1911,
"y": 778,
"w": 58,
"h": 91
},
"rotated": true,
"trimmed": true,
"spriteSourceSize": {
"x": 50,
"y": 33,
"w": 58,
"h": 91
},
"sourceSize": {
"w": 159,
"h": 159
}
}
},
"spriteSheetTypeMeta": {
"nameplate": {
"x": 0,
"y": -70
}
},
"meta": {
"image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
"format": "RGBA8888",
"size": {
"w": 2006,
"h": 1099
},
"scale": "1"
}
}
const formData = new FormData();
formData.append('animationMeta', animationMeta);
formData.append('name', "ExampleAvatarName");
formData.append('spriteSheetJSON', spriteSheetJSON);
formData.append('expression_dance', expression_dance);
formData.append('expression_emote', expression_emote);
formData.append('expression_sit', expression_sit);
formData.append('expression_stand', expression_stand);
formData.append('expression_transport', expression_transport);
formData.append('preview', preview);
formData.append('spriteSheet', spriteSheet);
formData.append('unityPackage', unityPackage);
await user.uploadAvatarFiles("exampleAvatarId", formData);
Updates the data object for a user.
Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
await user.updateDataObject({
"exampleKey": "exampleValue",
});
Optional
analytics?: AnalyticType[]Optional
lock?: { Optional
release
Summary
Create an instance of User class with optional session credentials.
Usage