@rtsdk/topia 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -28
- package/dist/index.cjs +212 -7
- package/dist/index.d.ts +183 -2
- package/dist/index.js +212 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,59 @@
|
|
|
1
|
+
<hr />
|
|
2
|
+
|
|
1
3
|
# Javascript RTSDK - Topia Client Library
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<hr/>
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
### Create integrated, interactive experiences with Topia’s SDK and API
|
|
10
|
+
|
|
11
|
+
Topia offers a robust SDK and API that allows anyone to build custom apps or integrate any 3rd-party content, application, game or learning experience. Dedicated deployments launch with dozens of SDK Applications, including mini-games and social apps made by the Topia team and our developer community
|
|
12
|
+
|
|
13
|
+
### Topia’s SDK/API can be used to:
|
|
14
|
+
|
|
15
|
+
- Turn existing applications and systems into multiplayer, cooperative experiences
|
|
16
|
+
- Integrate existing content into multiplayer learning journeys
|
|
17
|
+
- Create your own custom, dynamic social experiences and games
|
|
18
|
+
- Store and persist JSON data objects across sessions
|
|
19
|
+
- Add Social Connectivity Networking capabilities to your existing platforms
|
|
20
|
+
|
|
21
|
+
### Key Features:
|
|
22
|
+
|
|
23
|
+
- Built-in safety and security via an interactive credentialing system
|
|
24
|
+
- Control over the code and IP of your creations
|
|
25
|
+
- Integrated via i-frame, in-world assets, and server-based bi-directional data flow
|
|
26
|
+
- Every object, world, and visitor has a JSON database you use to build interactivity and data persistence
|
|
27
|
+
- Powerful SDK classes and methods enable control of every aspect of Topia
|
|
28
|
+
|
|
29
|
+
### Resources:
|
|
30
|
+
|
|
31
|
+
- [NPM Package](https://www.npmjs.com/package/@rtsdk/topia)
|
|
32
|
+
- [Demo World](https://topia.io/sdk-demos)
|
|
33
|
+
- [Typescript Boilerplate](https://github.com/metaversecloud-com/sdk-ts-boilerplate)
|
|
34
|
+
- [Javascript Boilerplate](https://github.com/metaversecloud-com/sdk-ts-boilerplate)
|
|
35
|
+
|
|
36
|
+
#### Need inspiration?! Check out the following applications which utilizes the SDK to create new and enhanced features inside [topia.io](https://topia.io/):
|
|
37
|
+
|
|
38
|
+
- **Bulletin Board:** A message board style application where users can submit messages and/or images for approval and an admin can approve the message so that it can be added to the world.
|
|
39
|
+
- [Github](https://github.com/metaversecloud-com/sdk-bulletin-board-app)
|
|
40
|
+
- [Demo](https://topia.io/bulletin-board-prod)
|
|
41
|
+
- **Jukebox:** A real-time interactive music player.
|
|
42
|
+
- [Github](https://github.com/metaversecloud-com/jukebox)
|
|
43
|
+
- [Demo](https://topia.io/jukebox-prod)
|
|
44
|
+
- **TicTacToe:** A turn based multiplayer game built completely on the canvas.
|
|
45
|
+
- [Github](https://github.com/metaversecloud-com/sdk-tictactoe)
|
|
46
|
+
- [Demo](https://topia.io/tictactoe-prod)
|
|
47
|
+
- **Quest:** A dynamic hide and seek game where an admin can drop multiple quest items within a world for users to find.
|
|
48
|
+
- [Github](https://github.com/metaversecloud-com/sdk-quest)
|
|
49
|
+
- [Demo](https://topia.io/quest-prod)
|
|
50
|
+
|
|
51
|
+
Questions, comments, or have something exciting to share with the Topia team? Reach out to [developers@topia.io](mailto:developers@topia.io)!
|
|
52
|
+
<br/>
|
|
4
53
|
|
|
5
54
|
## Authorization
|
|
6
55
|
|
|
7
|
-
|
|
56
|
+
Visitors of a [topia.io](https://topia.io/) world interact with each other and the interactively configured assets in your world without the need for an API Key. This is all made possible through Interactive Session credentials passed to the SDK with every request, when applicable. What does this mean for you? Not much, actually! All of the magic happens behind the scenes and all you have to do is make sure that new class constructors include an options object like this: `options: WorldOptionalInterface = { attributes: {}, credentials: {} }` and all calls to `this.topia.axios` include the inherited `this.requestOptions` parameter.
|
|
8
57
|
|
|
9
58
|
### Want to build interactive assets? This is how you can get started:
|
|
10
59
|
|
|
@@ -42,37 +91,24 @@ await DroppedAsset.get(assetId, urlSlug, {
|
|
|
42
91
|
});
|
|
43
92
|
```
|
|
44
93
|
|
|
45
|
-
|
|
94
|
+

|
|
46
95
|
|
|
47
|
-
###
|
|
96
|
+
### Want to enable want world owners / admins to use the app outside of Topia, but still have ability to modify things in worlds where they have the permission to do so? This is how you can create an API Key:
|
|
97
|
+
|
|
98
|
+
A Topia provided API Key can be included with every object initialization as a parameter named `apiKey`. This API Key is used to in authorization headers in all calls to the Public API. **Use it wisely and sparingly!** The API Key should only be used to authorize your app (and therefore all of it's users) to perform specific actions **when not currently in a Topia world**. In most case the ability to interact with an SDK application should be controlled per user using Interactive Credentials (see above).
|
|
48
99
|
|
|
49
100
|
- Navigate directly to your [integrations page](https://topia.io/t/dashboard/integrations) or follow the steps below from within a world.
|
|
50
101
|
- Click on your image (or circle) at the top left of the left hand navbar.
|
|
51
102
|
- Click Edit Profile. This will bring you to a separate dashboard.
|
|
52
|
-
- Click Integrations on the left nav
|
|
53
|
-
- Click Generate New API Key and copy the API Key to be used in your .env
|
|
54
|
-
|
|
55
|
-
Alternatively, visitors of a [topia.io](https://topia.io/) world interact with each other and the interactively configured assets in your world without the need for an API Key. This is all made possible through Interactive Session credentials passed to the SDK with every request, when applicable. What does this mean for you? Not much, actually! All of the magic happens behind the scenes and all you have to do is make sure that new class constructors include an options object like this: `options: WorldOptionalInterface = { attributes: {}, credentials: {} }` and all calls to `this.topia.axios` include the inherited `this.requestOptions` parameter.
|
|
56
|
-
|
|
57
|
-

|
|
103
|
+
- Click Integrations on the left nav.
|
|
104
|
+
- Click Generate New API Key and copy the API Key to be used in your .env file.
|
|
58
105
|
|
|
59
106
|
<br>
|
|
60
107
|
|
|
61
|
-
<hr/>
|
|
62
|
-
|
|
63
108
|
# Developers
|
|
64
109
|
|
|
65
110
|
<hr/>
|
|
66
111
|
|
|
67
|
-
Need inspiration?! Check out the following applications which utilizes the SDK to create new and enhanced features inside [topia.io](https://topia.io/):
|
|
68
|
-
|
|
69
|
-
- **TicTacToe:** A turn based multiplayer game built completely on the canvas.
|
|
70
|
-
- [Github](https://github.com/metaversecloud-com/sdk-tictactoe)
|
|
71
|
-
- [Demo](https://topia.io/tictactoe-prod)
|
|
72
|
-
- **Quest:** A dynamic hide and seek game where an admin can drop multiple quest items within a world for users to find.
|
|
73
|
-
- [Github](https://github.com/metaversecloud-com/sdk-quest)
|
|
74
|
-
- [Demo](https://topia.io/quest-prod)
|
|
75
|
-
|
|
76
112
|
<br>
|
|
77
113
|
|
|
78
114
|
## Get Started
|
|
@@ -133,6 +169,8 @@ export const getAssetAndDataObject = async (req) => {
|
|
|
133
169
|
};
|
|
134
170
|
```
|
|
135
171
|
|
|
172
|
+
<br/><br/>
|
|
173
|
+
|
|
136
174
|
## Data Objects
|
|
137
175
|
|
|
138
176
|
Data Objects can be used to store information such as game state, configurations, themes, and analytics.
|
|
@@ -167,9 +205,8 @@ There are three types of Data Objects:
|
|
|
167
205
|
```
|
|
168
206
|
- **User:** The User data object should be used to store information unique to a user that is NOT unique to a world or instance (dropped asset) of an app.
|
|
169
207
|
- **Example - Update totalMessagesSentCount by a user across all worlds:**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
```
|
|
208
|
+
`` js await world.incrementDataObjectValue([`totalMessagesSentCount`], 1); ``
|
|
209
|
+
<br/>
|
|
173
210
|
|
|
174
211
|
### Data Object Locking
|
|
175
212
|
|
|
@@ -216,10 +253,6 @@ Note: This does NOT impact the data objects themselves but rather allows you to
|
|
|
216
253
|
|
|
217
254
|
<br>
|
|
218
255
|
|
|
219
|
-
<hr/>
|
|
220
|
-
|
|
221
|
-
<br>
|
|
222
|
-
|
|
223
256
|
# Contributors
|
|
224
257
|
|
|
225
258
|
<hr/>
|
package/dist/index.cjs
CHANGED
|
@@ -40067,6 +40067,28 @@ class DroppedAsset extends Asset {
|
|
|
40067
40067
|
throw this.errorHandler({ error, params: { isMutezone }, sdkMethod: "DroppedAsset.updateMuteZone" });
|
|
40068
40068
|
}
|
|
40069
40069
|
}
|
|
40070
|
+
/**
|
|
40071
|
+
* @summary
|
|
40072
|
+
* Updates landmark zone options for a dropped asset.
|
|
40073
|
+
*
|
|
40074
|
+
* @usage
|
|
40075
|
+
* ```ts
|
|
40076
|
+
* await droppedAsset.updateLandmarkZone({
|
|
40077
|
+
* isLandmarkZoneEnabled: true,
|
|
40078
|
+
* landmarkZoneName: "Example",
|
|
40079
|
+
* landmarkZoneIsVisible: true,
|
|
40080
|
+
*});
|
|
40081
|
+
* ```
|
|
40082
|
+
*/
|
|
40083
|
+
updateLandmarkZone({ isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible, }) {
|
|
40084
|
+
const params = { isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible };
|
|
40085
|
+
try {
|
|
40086
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-landmark-zone");
|
|
40087
|
+
}
|
|
40088
|
+
catch (error) {
|
|
40089
|
+
throw this.errorHandler({ error, params, sdkMethod: "DroppedAsset.updateLandmarkZone" });
|
|
40090
|
+
}
|
|
40091
|
+
}
|
|
40070
40092
|
/**
|
|
40071
40093
|
* @summary
|
|
40072
40094
|
* Updates webhook zone options for a dropped asset.
|
|
@@ -40623,7 +40645,6 @@ class World extends SDKController {
|
|
|
40623
40645
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40624
40646
|
try {
|
|
40625
40647
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets-with-unique-name/${uniqueName}?${isPartial ? `partial=${isPartial}&` : ""}${isReversed ? `reversed=${isReversed}` : ""}`, this.requestOptions);
|
|
40626
|
-
// create temp map and then update private property only once
|
|
40627
40648
|
const droppedAssets = [];
|
|
40628
40649
|
for (const asset of response.data.assets) {
|
|
40629
40650
|
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
@@ -40642,6 +40663,46 @@ class World extends SDKController {
|
|
|
40642
40663
|
}
|
|
40643
40664
|
});
|
|
40644
40665
|
}
|
|
40666
|
+
/**
|
|
40667
|
+
* @summary
|
|
40668
|
+
* Retrieve all landmark zone assets dropped in a world.
|
|
40669
|
+
*
|
|
40670
|
+
* @usage
|
|
40671
|
+
* ```ts
|
|
40672
|
+
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
40673
|
+
* ```
|
|
40674
|
+
*/
|
|
40675
|
+
fetchLandmarkZones(landmarkZoneName, sceneDropId) {
|
|
40676
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40677
|
+
try {
|
|
40678
|
+
let queryParams = "";
|
|
40679
|
+
if (landmarkZoneName) {
|
|
40680
|
+
queryParams = `?landmarkZoneName=${landmarkZoneName}`;
|
|
40681
|
+
if (sceneDropId)
|
|
40682
|
+
queryParams += `&sceneDropId=${sceneDropId}`;
|
|
40683
|
+
}
|
|
40684
|
+
else if (sceneDropId) {
|
|
40685
|
+
queryParams = `?sceneDropId=${sceneDropId}`;
|
|
40686
|
+
}
|
|
40687
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/landmark-zones${queryParams}`, this.requestOptions);
|
|
40688
|
+
const droppedAssets = [];
|
|
40689
|
+
for (const asset of response.data.assets) {
|
|
40690
|
+
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
40691
|
+
attributes: asset,
|
|
40692
|
+
credentials: this.credentials,
|
|
40693
|
+
}));
|
|
40694
|
+
}
|
|
40695
|
+
return droppedAssets;
|
|
40696
|
+
}
|
|
40697
|
+
catch (error) {
|
|
40698
|
+
throw this.errorHandler({
|
|
40699
|
+
error,
|
|
40700
|
+
params: { landmarkZoneName, sceneDropId },
|
|
40701
|
+
sdkMethod: "World.fetchLandmarkZones",
|
|
40702
|
+
});
|
|
40703
|
+
}
|
|
40704
|
+
});
|
|
40705
|
+
}
|
|
40645
40706
|
/**
|
|
40646
40707
|
* @summary
|
|
40647
40708
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
@@ -40800,9 +40861,9 @@ class World extends SDKController {
|
|
|
40800
40861
|
* { sceneDropId: sceneId-timestamp, success: true }
|
|
40801
40862
|
* ```
|
|
40802
40863
|
*/
|
|
40803
|
-
dropScene({ assetSuffix, position, sceneId, }) {
|
|
40864
|
+
dropScene({ assetSuffix, position, sceneDropId, sceneId, }) {
|
|
40804
40865
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40805
|
-
const params = { assetSuffix, position, sceneId };
|
|
40866
|
+
const params = { assetSuffix, position, sceneDropId, sceneId };
|
|
40806
40867
|
try {
|
|
40807
40868
|
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
|
|
40808
40869
|
return result;
|
|
@@ -40871,7 +40932,7 @@ class World extends SDKController {
|
|
|
40871
40932
|
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
40872
40933
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40873
40934
|
if (!id && !name)
|
|
40874
|
-
throw "
|
|
40935
|
+
throw "A particle name is required.";
|
|
40875
40936
|
try {
|
|
40876
40937
|
let particleId = id;
|
|
40877
40938
|
if (name) {
|
|
@@ -41050,6 +41111,128 @@ class User extends SDKController {
|
|
|
41050
41111
|
}
|
|
41051
41112
|
});
|
|
41052
41113
|
}
|
|
41114
|
+
/**
|
|
41115
|
+
* @summary
|
|
41116
|
+
* Returns all avatars owned by User
|
|
41117
|
+
*
|
|
41118
|
+
* @usage
|
|
41119
|
+
* ```ts
|
|
41120
|
+
* const avatars = await user.fetchAvatars();
|
|
41121
|
+
* ```
|
|
41122
|
+
*/
|
|
41123
|
+
fetchAvatars() {
|
|
41124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41125
|
+
try {
|
|
41126
|
+
const response = yield this.topiaPublicApi().get(`/avatars`, this.requestOptions);
|
|
41127
|
+
return response.data;
|
|
41128
|
+
}
|
|
41129
|
+
catch (error) {
|
|
41130
|
+
throw this.errorHandler({ error, sdkMethod: "User.fetchAvatars" });
|
|
41131
|
+
}
|
|
41132
|
+
});
|
|
41133
|
+
}
|
|
41134
|
+
/**
|
|
41135
|
+
* @summary
|
|
41136
|
+
* Add a new avatar
|
|
41137
|
+
*
|
|
41138
|
+
* @usage
|
|
41139
|
+
* ```ts
|
|
41140
|
+
* const { avatarId, spriteSheetId } = await user.addAvatar({
|
|
41141
|
+
* name: "ExampleAvatar",
|
|
41142
|
+
* animationMeta: {
|
|
41143
|
+
* dance: {
|
|
41144
|
+
* loop: true,
|
|
41145
|
+
* x: 0,
|
|
41146
|
+
* y: -20,
|
|
41147
|
+
* hideLoop: true,
|
|
41148
|
+
* },
|
|
41149
|
+
* },
|
|
41150
|
+
* animations: {
|
|
41151
|
+
* "dance": [
|
|
41152
|
+
* "dance/1.png",
|
|
41153
|
+
* "dance/2.png",
|
|
41154
|
+
* "dance/3.png",
|
|
41155
|
+
* "dance/4.png",
|
|
41156
|
+
* "dance/5.png",
|
|
41157
|
+
* ],
|
|
41158
|
+
* },
|
|
41159
|
+
* frames: {
|
|
41160
|
+
* "dance/1.png": {
|
|
41161
|
+
* "frame": {
|
|
41162
|
+
* "x": 1,
|
|
41163
|
+
* "y": 1040,
|
|
41164
|
+
* "w": 58,
|
|
41165
|
+
* "h": 107
|
|
41166
|
+
* },
|
|
41167
|
+
* "rotated": true,
|
|
41168
|
+
* "trimmed": true,
|
|
41169
|
+
* "spriteSourceSize": {
|
|
41170
|
+
* "x": 50,
|
|
41171
|
+
* "y": 58,
|
|
41172
|
+
* "w": 58,
|
|
41173
|
+
* "h": 107
|
|
41174
|
+
* },
|
|
41175
|
+
* "sourceSize": {
|
|
41176
|
+
* "w": 159,
|
|
41177
|
+
* "h": 200
|
|
41178
|
+
* }
|
|
41179
|
+
* },
|
|
41180
|
+
* },
|
|
41181
|
+
* "spriteSheetType": "PLAYER_AVATAR",
|
|
41182
|
+
* "spriteSheetTypeMeta": {
|
|
41183
|
+
* "meta": {
|
|
41184
|
+
* "image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
|
|
41185
|
+
* "format": "RGBA8888",
|
|
41186
|
+
* "size": {
|
|
41187
|
+
* "w": 2006,
|
|
41188
|
+
* "h": 1099,
|
|
41189
|
+
* },
|
|
41190
|
+
* "scale": "1",
|
|
41191
|
+
* },
|
|
41192
|
+
* });
|
|
41193
|
+
* ```
|
|
41194
|
+
*/
|
|
41195
|
+
addAvatar({ animationMeta, animations, name, frames, meta, }) {
|
|
41196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41197
|
+
const params = { animationMeta, animations, name, frames, meta };
|
|
41198
|
+
try {
|
|
41199
|
+
const response = yield this.topiaPublicApi().post(`/avatars`, params, this.requestOptions);
|
|
41200
|
+
return response.data;
|
|
41201
|
+
}
|
|
41202
|
+
catch (error) {
|
|
41203
|
+
throw this.errorHandler({ error, params, sdkMethod: "User.addAvatar" });
|
|
41204
|
+
}
|
|
41205
|
+
});
|
|
41206
|
+
}
|
|
41207
|
+
/**
|
|
41208
|
+
* @summary
|
|
41209
|
+
* Upload sprite sheet and avatar preview .png files to existing sprite sheet and avatar storage buckets
|
|
41210
|
+
*
|
|
41211
|
+
* @usage
|
|
41212
|
+
* ```ts
|
|
41213
|
+
* const formData = new FormData();
|
|
41214
|
+
* formData.append('expression_dance', expression_dance);
|
|
41215
|
+
* formData.append('expression_emote', expression_emote);
|
|
41216
|
+
* formData.append('expression_sit', expression_sit);
|
|
41217
|
+
* formData.append('expression_stand', expression_stand);
|
|
41218
|
+
* formData.append('expression_transport', expression_transport);
|
|
41219
|
+
* formData.append('preview', preview);
|
|
41220
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
41221
|
+
* formData.append('unityPackage', unityPackage);
|
|
41222
|
+
* await user.uploadAvatarFiles("exampleAvatarId", formData);
|
|
41223
|
+
* ```
|
|
41224
|
+
*/
|
|
41225
|
+
uploadAvatarFiles(avatarId, formData) {
|
|
41226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41227
|
+
try {
|
|
41228
|
+
const response = yield this.topiaPublicApi().post(`/avatars/${avatarId}/upload-files`, formData, this.requestOptions);
|
|
41229
|
+
return response.data;
|
|
41230
|
+
}
|
|
41231
|
+
catch (error) {
|
|
41232
|
+
throw this.errorHandler({ error, sdkMethod: "User.uploadAvatarFiles" });
|
|
41233
|
+
}
|
|
41234
|
+
});
|
|
41235
|
+
}
|
|
41053
41236
|
/**
|
|
41054
41237
|
* @summary
|
|
41055
41238
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -41576,7 +41759,7 @@ class Visitor extends User {
|
|
|
41576
41759
|
triggerParticle({ id, name, duration = 10, }) {
|
|
41577
41760
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41578
41761
|
if (!id && !name)
|
|
41579
|
-
throw "
|
|
41762
|
+
throw "A particle name is required.";
|
|
41580
41763
|
try {
|
|
41581
41764
|
let particleId = id;
|
|
41582
41765
|
if (name) {
|
|
@@ -41725,10 +41908,10 @@ class WorldActivity extends SDKController {
|
|
|
41725
41908
|
return __classPrivateFieldGet(this, _WorldActivity_visitorsMap, "f");
|
|
41726
41909
|
}
|
|
41727
41910
|
//////// visitors
|
|
41728
|
-
fetchVisitors() {
|
|
41911
|
+
fetchVisitors(droppedAssetId) {
|
|
41729
41912
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41730
41913
|
try {
|
|
41731
|
-
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors`, this.requestOptions);
|
|
41914
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors${droppedAssetId ? `?droppedAssetId=${droppedAssetId}` : ""}`, this.requestOptions);
|
|
41732
41915
|
// create temp map and then update private property only once
|
|
41733
41916
|
const tempVisitorsMap = {};
|
|
41734
41917
|
for (const id in response.data) {
|
|
@@ -41764,6 +41947,28 @@ class WorldActivity extends SDKController {
|
|
|
41764
41947
|
}
|
|
41765
41948
|
});
|
|
41766
41949
|
}
|
|
41950
|
+
/**
|
|
41951
|
+
* @summary
|
|
41952
|
+
* Retrieve all visitors currently in a Landmark Zone.
|
|
41953
|
+
*
|
|
41954
|
+
* @usage
|
|
41955
|
+
* ```ts
|
|
41956
|
+
* const visitors = await worldActivity.fetchVisitorsInZone("exampleDroppedAssetId");
|
|
41957
|
+
* ```
|
|
41958
|
+
*/
|
|
41959
|
+
fetchVisitorsInZone(droppedAssetId) {
|
|
41960
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41961
|
+
try {
|
|
41962
|
+
if (!droppedAssetId)
|
|
41963
|
+
throw "A landmark zone id (droppedAssetId) is required.";
|
|
41964
|
+
yield this.fetchVisitors(droppedAssetId);
|
|
41965
|
+
return this.visitors;
|
|
41966
|
+
}
|
|
41967
|
+
catch (error) {
|
|
41968
|
+
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "WorldActivity.fetchVisitorsInZone" });
|
|
41969
|
+
}
|
|
41970
|
+
});
|
|
41971
|
+
}
|
|
41767
41972
|
/**
|
|
41768
41973
|
* @summary
|
|
41769
41974
|
* Move all visitors currently in a world to a single set of coordinates.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,55 @@ import * as axios from 'axios';
|
|
|
2
2
|
import { AxiosResponse, AxiosInstance, AxiosError } from 'axios';
|
|
3
3
|
import jwt from 'jsonwebtoken';
|
|
4
4
|
|
|
5
|
+
type AnimationMetaType = {
|
|
6
|
+
loop: boolean;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
hideLoop: boolean;
|
|
10
|
+
};
|
|
11
|
+
type FrameType = {
|
|
12
|
+
frame: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
w: number;
|
|
16
|
+
h: number;
|
|
17
|
+
};
|
|
18
|
+
rotated: boolean;
|
|
19
|
+
trimmed: boolean;
|
|
20
|
+
spriteSourceSize: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
w: number;
|
|
24
|
+
h: number;
|
|
25
|
+
};
|
|
26
|
+
sourceSize: {
|
|
27
|
+
w: number;
|
|
28
|
+
h: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
type SpriteSheetJSONType = {
|
|
32
|
+
name: string;
|
|
33
|
+
animations: {
|
|
34
|
+
[key: string]: string[];
|
|
35
|
+
};
|
|
36
|
+
animationMeta: {
|
|
37
|
+
[key: string]: AnimationMetaType;
|
|
38
|
+
};
|
|
39
|
+
frames: {
|
|
40
|
+
[key: string]: FrameType;
|
|
41
|
+
};
|
|
42
|
+
meta: {
|
|
43
|
+
image: string;
|
|
44
|
+
format: string;
|
|
45
|
+
size: {
|
|
46
|
+
w: number;
|
|
47
|
+
h: number;
|
|
48
|
+
};
|
|
49
|
+
scale: string;
|
|
50
|
+
};
|
|
51
|
+
spriteSheetType: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
5
54
|
declare enum DroppedAssetClickType {
|
|
6
55
|
NONE = "none",
|
|
7
56
|
LINK = "link",
|
|
@@ -275,6 +324,24 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
|
275
324
|
* ```
|
|
276
325
|
*/
|
|
277
326
|
updateMuteZone(isMutezone: boolean): Promise<void | ResponseType$1>;
|
|
327
|
+
/**
|
|
328
|
+
* @summary
|
|
329
|
+
* Updates landmark zone options for a dropped asset.
|
|
330
|
+
*
|
|
331
|
+
* @usage
|
|
332
|
+
* ```ts
|
|
333
|
+
* await droppedAsset.updateLandmarkZone({
|
|
334
|
+
* isLandmarkZoneEnabled: true,
|
|
335
|
+
* landmarkZoneName: "Example",
|
|
336
|
+
* landmarkZoneIsVisible: true,
|
|
337
|
+
*});
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
updateLandmarkZone({ isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible, }: {
|
|
341
|
+
isLandmarkZoneEnabled: boolean;
|
|
342
|
+
landmarkZoneName?: string;
|
|
343
|
+
landmarkZoneIsVisible?: boolean;
|
|
344
|
+
}): Promise<void | ResponseType$1>;
|
|
278
345
|
/**
|
|
279
346
|
* @summary
|
|
280
347
|
* Updates webhook zone options for a dropped asset.
|
|
@@ -521,6 +588,16 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
521
588
|
isPartial?: boolean;
|
|
522
589
|
isReversed?: boolean;
|
|
523
590
|
}): Promise<DroppedAsset[]>;
|
|
591
|
+
/**
|
|
592
|
+
* @summary
|
|
593
|
+
* Retrieve all landmark zone assets dropped in a world.
|
|
594
|
+
*
|
|
595
|
+
* @usage
|
|
596
|
+
* ```ts
|
|
597
|
+
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
598
|
+
* ```
|
|
599
|
+
*/
|
|
600
|
+
fetchLandmarkZones(landmarkZoneName?: string, sceneDropId?: string): Promise<DroppedAsset[]>;
|
|
524
601
|
/**
|
|
525
602
|
* @summary
|
|
526
603
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
@@ -626,9 +703,10 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
626
703
|
* { sceneDropId: sceneId-timestamp, success: true }
|
|
627
704
|
* ```
|
|
628
705
|
*/
|
|
629
|
-
dropScene({ assetSuffix, position, sceneId, }: {
|
|
630
|
-
assetSuffix
|
|
706
|
+
dropScene({ assetSuffix, position, sceneDropId, sceneId, }: {
|
|
707
|
+
assetSuffix?: string;
|
|
631
708
|
position: object;
|
|
709
|
+
sceneDropId?: string;
|
|
632
710
|
sceneId: string;
|
|
633
711
|
}): Promise<object | ResponseType$1>;
|
|
634
712
|
/**
|
|
@@ -819,6 +897,97 @@ declare class User extends SDKController implements UserInterface {
|
|
|
819
897
|
* ```
|
|
820
898
|
*/
|
|
821
899
|
checkInteractiveCredentials(): Promise<void | ResponseType$1>;
|
|
900
|
+
/**
|
|
901
|
+
* @summary
|
|
902
|
+
* Returns all avatars owned by User
|
|
903
|
+
*
|
|
904
|
+
* @usage
|
|
905
|
+
* ```ts
|
|
906
|
+
* const avatars = await user.fetchAvatars();
|
|
907
|
+
* ```
|
|
908
|
+
*/
|
|
909
|
+
fetchAvatars(): Promise<void | ResponseType$1>;
|
|
910
|
+
/**
|
|
911
|
+
* @summary
|
|
912
|
+
* Add a new avatar
|
|
913
|
+
*
|
|
914
|
+
* @usage
|
|
915
|
+
* ```ts
|
|
916
|
+
* const { avatarId, spriteSheetId } = await user.addAvatar({
|
|
917
|
+
* name: "ExampleAvatar",
|
|
918
|
+
* animationMeta: {
|
|
919
|
+
* dance: {
|
|
920
|
+
* loop: true,
|
|
921
|
+
* x: 0,
|
|
922
|
+
* y: -20,
|
|
923
|
+
* hideLoop: true,
|
|
924
|
+
* },
|
|
925
|
+
* },
|
|
926
|
+
* animations: {
|
|
927
|
+
* "dance": [
|
|
928
|
+
* "dance/1.png",
|
|
929
|
+
* "dance/2.png",
|
|
930
|
+
* "dance/3.png",
|
|
931
|
+
* "dance/4.png",
|
|
932
|
+
* "dance/5.png",
|
|
933
|
+
* ],
|
|
934
|
+
* },
|
|
935
|
+
* frames: {
|
|
936
|
+
* "dance/1.png": {
|
|
937
|
+
* "frame": {
|
|
938
|
+
* "x": 1,
|
|
939
|
+
* "y": 1040,
|
|
940
|
+
* "w": 58,
|
|
941
|
+
* "h": 107
|
|
942
|
+
* },
|
|
943
|
+
* "rotated": true,
|
|
944
|
+
* "trimmed": true,
|
|
945
|
+
* "spriteSourceSize": {
|
|
946
|
+
* "x": 50,
|
|
947
|
+
* "y": 58,
|
|
948
|
+
* "w": 58,
|
|
949
|
+
* "h": 107
|
|
950
|
+
* },
|
|
951
|
+
* "sourceSize": {
|
|
952
|
+
* "w": 159,
|
|
953
|
+
* "h": 200
|
|
954
|
+
* }
|
|
955
|
+
* },
|
|
956
|
+
* },
|
|
957
|
+
* "spriteSheetType": "PLAYER_AVATAR",
|
|
958
|
+
* "spriteSheetTypeMeta": {
|
|
959
|
+
* "meta": {
|
|
960
|
+
* "image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
|
|
961
|
+
* "format": "RGBA8888",
|
|
962
|
+
* "size": {
|
|
963
|
+
* "w": 2006,
|
|
964
|
+
* "h": 1099,
|
|
965
|
+
* },
|
|
966
|
+
* "scale": "1",
|
|
967
|
+
* },
|
|
968
|
+
* });
|
|
969
|
+
* ```
|
|
970
|
+
*/
|
|
971
|
+
addAvatar({ animationMeta, animations, name, frames, meta, }: SpriteSheetJSONType): Promise<void | ResponseType$1>;
|
|
972
|
+
/**
|
|
973
|
+
* @summary
|
|
974
|
+
* Upload sprite sheet and avatar preview .png files to existing sprite sheet and avatar storage buckets
|
|
975
|
+
*
|
|
976
|
+
* @usage
|
|
977
|
+
* ```ts
|
|
978
|
+
* const formData = new FormData();
|
|
979
|
+
* formData.append('expression_dance', expression_dance);
|
|
980
|
+
* formData.append('expression_emote', expression_emote);
|
|
981
|
+
* formData.append('expression_sit', expression_sit);
|
|
982
|
+
* formData.append('expression_stand', expression_stand);
|
|
983
|
+
* formData.append('expression_transport', expression_transport);
|
|
984
|
+
* formData.append('preview', preview);
|
|
985
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
986
|
+
* formData.append('unityPackage', unityPackage);
|
|
987
|
+
* await user.uploadAvatarFiles("exampleAvatarId", formData);
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
uploadAvatarFiles(avatarId: string, formData: FormData): Promise<void | ResponseType$1>;
|
|
822
991
|
/**
|
|
823
992
|
* @summary
|
|
824
993
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -1712,6 +1881,18 @@ declare class WorldActivity extends SDKController {
|
|
|
1712
1881
|
currentVisitors(): Promise<{
|
|
1713
1882
|
[key: string]: Visitor;
|
|
1714
1883
|
}>;
|
|
1884
|
+
/**
|
|
1885
|
+
* @summary
|
|
1886
|
+
* Retrieve all visitors currently in a Landmark Zone.
|
|
1887
|
+
*
|
|
1888
|
+
* @usage
|
|
1889
|
+
* ```ts
|
|
1890
|
+
* const visitors = await worldActivity.fetchVisitorsInZone("exampleDroppedAssetId");
|
|
1891
|
+
* ```
|
|
1892
|
+
*/
|
|
1893
|
+
fetchVisitorsInZone(droppedAssetId: string): Promise<{
|
|
1894
|
+
[key: string]: Visitor;
|
|
1895
|
+
}>;
|
|
1715
1896
|
/**
|
|
1716
1897
|
* @summary
|
|
1717
1898
|
* Move all visitors currently in a world to a single set of coordinates.
|
package/dist/index.js
CHANGED
|
@@ -40065,6 +40065,28 @@ class DroppedAsset extends Asset {
|
|
|
40065
40065
|
throw this.errorHandler({ error, params: { isMutezone }, sdkMethod: "DroppedAsset.updateMuteZone" });
|
|
40066
40066
|
}
|
|
40067
40067
|
}
|
|
40068
|
+
/**
|
|
40069
|
+
* @summary
|
|
40070
|
+
* Updates landmark zone options for a dropped asset.
|
|
40071
|
+
*
|
|
40072
|
+
* @usage
|
|
40073
|
+
* ```ts
|
|
40074
|
+
* await droppedAsset.updateLandmarkZone({
|
|
40075
|
+
* isLandmarkZoneEnabled: true,
|
|
40076
|
+
* landmarkZoneName: "Example",
|
|
40077
|
+
* landmarkZoneIsVisible: true,
|
|
40078
|
+
*});
|
|
40079
|
+
* ```
|
|
40080
|
+
*/
|
|
40081
|
+
updateLandmarkZone({ isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible, }) {
|
|
40082
|
+
const params = { isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible };
|
|
40083
|
+
try {
|
|
40084
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-landmark-zone");
|
|
40085
|
+
}
|
|
40086
|
+
catch (error) {
|
|
40087
|
+
throw this.errorHandler({ error, params, sdkMethod: "DroppedAsset.updateLandmarkZone" });
|
|
40088
|
+
}
|
|
40089
|
+
}
|
|
40068
40090
|
/**
|
|
40069
40091
|
* @summary
|
|
40070
40092
|
* Updates webhook zone options for a dropped asset.
|
|
@@ -40621,7 +40643,6 @@ class World extends SDKController {
|
|
|
40621
40643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40622
40644
|
try {
|
|
40623
40645
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets-with-unique-name/${uniqueName}?${isPartial ? `partial=${isPartial}&` : ""}${isReversed ? `reversed=${isReversed}` : ""}`, this.requestOptions);
|
|
40624
|
-
// create temp map and then update private property only once
|
|
40625
40646
|
const droppedAssets = [];
|
|
40626
40647
|
for (const asset of response.data.assets) {
|
|
40627
40648
|
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
@@ -40640,6 +40661,46 @@ class World extends SDKController {
|
|
|
40640
40661
|
}
|
|
40641
40662
|
});
|
|
40642
40663
|
}
|
|
40664
|
+
/**
|
|
40665
|
+
* @summary
|
|
40666
|
+
* Retrieve all landmark zone assets dropped in a world.
|
|
40667
|
+
*
|
|
40668
|
+
* @usage
|
|
40669
|
+
* ```ts
|
|
40670
|
+
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
40671
|
+
* ```
|
|
40672
|
+
*/
|
|
40673
|
+
fetchLandmarkZones(landmarkZoneName, sceneDropId) {
|
|
40674
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40675
|
+
try {
|
|
40676
|
+
let queryParams = "";
|
|
40677
|
+
if (landmarkZoneName) {
|
|
40678
|
+
queryParams = `?landmarkZoneName=${landmarkZoneName}`;
|
|
40679
|
+
if (sceneDropId)
|
|
40680
|
+
queryParams += `&sceneDropId=${sceneDropId}`;
|
|
40681
|
+
}
|
|
40682
|
+
else if (sceneDropId) {
|
|
40683
|
+
queryParams = `?sceneDropId=${sceneDropId}`;
|
|
40684
|
+
}
|
|
40685
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/landmark-zones${queryParams}`, this.requestOptions);
|
|
40686
|
+
const droppedAssets = [];
|
|
40687
|
+
for (const asset of response.data.assets) {
|
|
40688
|
+
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
40689
|
+
attributes: asset,
|
|
40690
|
+
credentials: this.credentials,
|
|
40691
|
+
}));
|
|
40692
|
+
}
|
|
40693
|
+
return droppedAssets;
|
|
40694
|
+
}
|
|
40695
|
+
catch (error) {
|
|
40696
|
+
throw this.errorHandler({
|
|
40697
|
+
error,
|
|
40698
|
+
params: { landmarkZoneName, sceneDropId },
|
|
40699
|
+
sdkMethod: "World.fetchLandmarkZones",
|
|
40700
|
+
});
|
|
40701
|
+
}
|
|
40702
|
+
});
|
|
40703
|
+
}
|
|
40643
40704
|
/**
|
|
40644
40705
|
* @summary
|
|
40645
40706
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
@@ -40798,9 +40859,9 @@ class World extends SDKController {
|
|
|
40798
40859
|
* { sceneDropId: sceneId-timestamp, success: true }
|
|
40799
40860
|
* ```
|
|
40800
40861
|
*/
|
|
40801
|
-
dropScene({ assetSuffix, position, sceneId, }) {
|
|
40862
|
+
dropScene({ assetSuffix, position, sceneDropId, sceneId, }) {
|
|
40802
40863
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40803
|
-
const params = { assetSuffix, position, sceneId };
|
|
40864
|
+
const params = { assetSuffix, position, sceneDropId, sceneId };
|
|
40804
40865
|
try {
|
|
40805
40866
|
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
|
|
40806
40867
|
return result;
|
|
@@ -40869,7 +40930,7 @@ class World extends SDKController {
|
|
|
40869
40930
|
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
40870
40931
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40871
40932
|
if (!id && !name)
|
|
40872
|
-
throw "
|
|
40933
|
+
throw "A particle name is required.";
|
|
40873
40934
|
try {
|
|
40874
40935
|
let particleId = id;
|
|
40875
40936
|
if (name) {
|
|
@@ -41048,6 +41109,128 @@ class User extends SDKController {
|
|
|
41048
41109
|
}
|
|
41049
41110
|
});
|
|
41050
41111
|
}
|
|
41112
|
+
/**
|
|
41113
|
+
* @summary
|
|
41114
|
+
* Returns all avatars owned by User
|
|
41115
|
+
*
|
|
41116
|
+
* @usage
|
|
41117
|
+
* ```ts
|
|
41118
|
+
* const avatars = await user.fetchAvatars();
|
|
41119
|
+
* ```
|
|
41120
|
+
*/
|
|
41121
|
+
fetchAvatars() {
|
|
41122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41123
|
+
try {
|
|
41124
|
+
const response = yield this.topiaPublicApi().get(`/avatars`, this.requestOptions);
|
|
41125
|
+
return response.data;
|
|
41126
|
+
}
|
|
41127
|
+
catch (error) {
|
|
41128
|
+
throw this.errorHandler({ error, sdkMethod: "User.fetchAvatars" });
|
|
41129
|
+
}
|
|
41130
|
+
});
|
|
41131
|
+
}
|
|
41132
|
+
/**
|
|
41133
|
+
* @summary
|
|
41134
|
+
* Add a new avatar
|
|
41135
|
+
*
|
|
41136
|
+
* @usage
|
|
41137
|
+
* ```ts
|
|
41138
|
+
* const { avatarId, spriteSheetId } = await user.addAvatar({
|
|
41139
|
+
* name: "ExampleAvatar",
|
|
41140
|
+
* animationMeta: {
|
|
41141
|
+
* dance: {
|
|
41142
|
+
* loop: true,
|
|
41143
|
+
* x: 0,
|
|
41144
|
+
* y: -20,
|
|
41145
|
+
* hideLoop: true,
|
|
41146
|
+
* },
|
|
41147
|
+
* },
|
|
41148
|
+
* animations: {
|
|
41149
|
+
* "dance": [
|
|
41150
|
+
* "dance/1.png",
|
|
41151
|
+
* "dance/2.png",
|
|
41152
|
+
* "dance/3.png",
|
|
41153
|
+
* "dance/4.png",
|
|
41154
|
+
* "dance/5.png",
|
|
41155
|
+
* ],
|
|
41156
|
+
* },
|
|
41157
|
+
* frames: {
|
|
41158
|
+
* "dance/1.png": {
|
|
41159
|
+
* "frame": {
|
|
41160
|
+
* "x": 1,
|
|
41161
|
+
* "y": 1040,
|
|
41162
|
+
* "w": 58,
|
|
41163
|
+
* "h": 107
|
|
41164
|
+
* },
|
|
41165
|
+
* "rotated": true,
|
|
41166
|
+
* "trimmed": true,
|
|
41167
|
+
* "spriteSourceSize": {
|
|
41168
|
+
* "x": 50,
|
|
41169
|
+
* "y": 58,
|
|
41170
|
+
* "w": 58,
|
|
41171
|
+
* "h": 107
|
|
41172
|
+
* },
|
|
41173
|
+
* "sourceSize": {
|
|
41174
|
+
* "w": 159,
|
|
41175
|
+
* "h": 200
|
|
41176
|
+
* }
|
|
41177
|
+
* },
|
|
41178
|
+
* },
|
|
41179
|
+
* "spriteSheetType": "PLAYER_AVATAR",
|
|
41180
|
+
* "spriteSheetTypeMeta": {
|
|
41181
|
+
* "meta": {
|
|
41182
|
+
* "image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
|
|
41183
|
+
* "format": "RGBA8888",
|
|
41184
|
+
* "size": {
|
|
41185
|
+
* "w": 2006,
|
|
41186
|
+
* "h": 1099,
|
|
41187
|
+
* },
|
|
41188
|
+
* "scale": "1",
|
|
41189
|
+
* },
|
|
41190
|
+
* });
|
|
41191
|
+
* ```
|
|
41192
|
+
*/
|
|
41193
|
+
addAvatar({ animationMeta, animations, name, frames, meta, }) {
|
|
41194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41195
|
+
const params = { animationMeta, animations, name, frames, meta };
|
|
41196
|
+
try {
|
|
41197
|
+
const response = yield this.topiaPublicApi().post(`/avatars`, params, this.requestOptions);
|
|
41198
|
+
return response.data;
|
|
41199
|
+
}
|
|
41200
|
+
catch (error) {
|
|
41201
|
+
throw this.errorHandler({ error, params, sdkMethod: "User.addAvatar" });
|
|
41202
|
+
}
|
|
41203
|
+
});
|
|
41204
|
+
}
|
|
41205
|
+
/**
|
|
41206
|
+
* @summary
|
|
41207
|
+
* Upload sprite sheet and avatar preview .png files to existing sprite sheet and avatar storage buckets
|
|
41208
|
+
*
|
|
41209
|
+
* @usage
|
|
41210
|
+
* ```ts
|
|
41211
|
+
* const formData = new FormData();
|
|
41212
|
+
* formData.append('expression_dance', expression_dance);
|
|
41213
|
+
* formData.append('expression_emote', expression_emote);
|
|
41214
|
+
* formData.append('expression_sit', expression_sit);
|
|
41215
|
+
* formData.append('expression_stand', expression_stand);
|
|
41216
|
+
* formData.append('expression_transport', expression_transport);
|
|
41217
|
+
* formData.append('preview', preview);
|
|
41218
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
41219
|
+
* formData.append('unityPackage', unityPackage);
|
|
41220
|
+
* await user.uploadAvatarFiles("exampleAvatarId", formData);
|
|
41221
|
+
* ```
|
|
41222
|
+
*/
|
|
41223
|
+
uploadAvatarFiles(avatarId, formData) {
|
|
41224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41225
|
+
try {
|
|
41226
|
+
const response = yield this.topiaPublicApi().post(`/avatars/${avatarId}/upload-files`, formData, this.requestOptions);
|
|
41227
|
+
return response.data;
|
|
41228
|
+
}
|
|
41229
|
+
catch (error) {
|
|
41230
|
+
throw this.errorHandler({ error, sdkMethod: "User.uploadAvatarFiles" });
|
|
41231
|
+
}
|
|
41232
|
+
});
|
|
41233
|
+
}
|
|
41051
41234
|
/**
|
|
41052
41235
|
* @summary
|
|
41053
41236
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -41574,7 +41757,7 @@ class Visitor extends User {
|
|
|
41574
41757
|
triggerParticle({ id, name, duration = 10, }) {
|
|
41575
41758
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41576
41759
|
if (!id && !name)
|
|
41577
|
-
throw "
|
|
41760
|
+
throw "A particle name is required.";
|
|
41578
41761
|
try {
|
|
41579
41762
|
let particleId = id;
|
|
41580
41763
|
if (name) {
|
|
@@ -41723,10 +41906,10 @@ class WorldActivity extends SDKController {
|
|
|
41723
41906
|
return __classPrivateFieldGet(this, _WorldActivity_visitorsMap, "f");
|
|
41724
41907
|
}
|
|
41725
41908
|
//////// visitors
|
|
41726
|
-
fetchVisitors() {
|
|
41909
|
+
fetchVisitors(droppedAssetId) {
|
|
41727
41910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41728
41911
|
try {
|
|
41729
|
-
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors`, this.requestOptions);
|
|
41912
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors${droppedAssetId ? `?droppedAssetId=${droppedAssetId}` : ""}`, this.requestOptions);
|
|
41730
41913
|
// create temp map and then update private property only once
|
|
41731
41914
|
const tempVisitorsMap = {};
|
|
41732
41915
|
for (const id in response.data) {
|
|
@@ -41762,6 +41945,28 @@ class WorldActivity extends SDKController {
|
|
|
41762
41945
|
}
|
|
41763
41946
|
});
|
|
41764
41947
|
}
|
|
41948
|
+
/**
|
|
41949
|
+
* @summary
|
|
41950
|
+
* Retrieve all visitors currently in a Landmark Zone.
|
|
41951
|
+
*
|
|
41952
|
+
* @usage
|
|
41953
|
+
* ```ts
|
|
41954
|
+
* const visitors = await worldActivity.fetchVisitorsInZone("exampleDroppedAssetId");
|
|
41955
|
+
* ```
|
|
41956
|
+
*/
|
|
41957
|
+
fetchVisitorsInZone(droppedAssetId) {
|
|
41958
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41959
|
+
try {
|
|
41960
|
+
if (!droppedAssetId)
|
|
41961
|
+
throw "A landmark zone id (droppedAssetId) is required.";
|
|
41962
|
+
yield this.fetchVisitors(droppedAssetId);
|
|
41963
|
+
return this.visitors;
|
|
41964
|
+
}
|
|
41965
|
+
catch (error) {
|
|
41966
|
+
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "WorldActivity.fetchVisitorsInZone" });
|
|
41967
|
+
}
|
|
41968
|
+
});
|
|
41969
|
+
}
|
|
41765
41970
|
/**
|
|
41766
41971
|
* @summary
|
|
41767
41972
|
* Move all visitors currently in a world to a single set of coordinates.
|
package/package.json
CHANGED