@rtsdk/topia 0.9.2 → 0.11.0
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/dist/index.cjs +305 -3
- package/dist/index.d.ts +229 -0
- package/dist/index.js +305 -3
- package/package.json +1 -1
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.
|
|
@@ -40280,10 +40302,15 @@ class DroppedAsset extends Asset {
|
|
|
40280
40302
|
switch (periodType) {
|
|
40281
40303
|
case "week":
|
|
40282
40304
|
query = `&week=W${dateValue}`;
|
|
40305
|
+
break;
|
|
40283
40306
|
case "month":
|
|
40284
40307
|
query = `&month=${dateValue}`;
|
|
40308
|
+
break;
|
|
40285
40309
|
case "quarter":
|
|
40286
40310
|
query = `&quarter=Q${dateValue}`;
|
|
40311
|
+
break;
|
|
40312
|
+
default:
|
|
40313
|
+
"";
|
|
40287
40314
|
}
|
|
40288
40315
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
|
|
40289
40316
|
return response.data;
|
|
@@ -40618,7 +40645,6 @@ class World extends SDKController {
|
|
|
40618
40645
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40619
40646
|
try {
|
|
40620
40647
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets-with-unique-name/${uniqueName}?${isPartial ? `partial=${isPartial}&` : ""}${isReversed ? `reversed=${isReversed}` : ""}`, this.requestOptions);
|
|
40621
|
-
// create temp map and then update private property only once
|
|
40622
40648
|
const droppedAssets = [];
|
|
40623
40649
|
for (const asset of response.data.assets) {
|
|
40624
40650
|
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
@@ -40637,6 +40663,46 @@ class World extends SDKController {
|
|
|
40637
40663
|
}
|
|
40638
40664
|
});
|
|
40639
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
|
+
}
|
|
40640
40706
|
/**
|
|
40641
40707
|
* @summary
|
|
40642
40708
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
@@ -40834,6 +40900,53 @@ class World extends SDKController {
|
|
|
40834
40900
|
}
|
|
40835
40901
|
});
|
|
40836
40902
|
}
|
|
40903
|
+
/**
|
|
40904
|
+
* @summary
|
|
40905
|
+
* Get all particles available
|
|
40906
|
+
*
|
|
40907
|
+
* @usage
|
|
40908
|
+
* ```ts
|
|
40909
|
+
* await world.getAllParticles();
|
|
40910
|
+
* ```
|
|
40911
|
+
*/
|
|
40912
|
+
getAllParticles() {
|
|
40913
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40914
|
+
try {
|
|
40915
|
+
const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
|
|
40916
|
+
return result.data;
|
|
40917
|
+
}
|
|
40918
|
+
catch (error) {
|
|
40919
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "World.getAllParticles" });
|
|
40920
|
+
}
|
|
40921
|
+
});
|
|
40922
|
+
}
|
|
40923
|
+
/**
|
|
40924
|
+
* @summary
|
|
40925
|
+
* Trigger a particle effect at a position in the world
|
|
40926
|
+
*
|
|
40927
|
+
* @usage
|
|
40928
|
+
* ```ts
|
|
40929
|
+
* await world.triggerParticle({ name: "Flame" });
|
|
40930
|
+
* ```
|
|
40931
|
+
*/
|
|
40932
|
+
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
40933
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40934
|
+
if (!id && !name)
|
|
40935
|
+
throw "A particle name is required.";
|
|
40936
|
+
try {
|
|
40937
|
+
let particleId = id;
|
|
40938
|
+
if (name) {
|
|
40939
|
+
const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
|
|
40940
|
+
particleId = response.data[0].id;
|
|
40941
|
+
}
|
|
40942
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
|
|
40943
|
+
return result;
|
|
40944
|
+
}
|
|
40945
|
+
catch (error) {
|
|
40946
|
+
throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
|
|
40947
|
+
}
|
|
40948
|
+
});
|
|
40949
|
+
}
|
|
40837
40950
|
/**
|
|
40838
40951
|
* @summary
|
|
40839
40952
|
* Increments a specific value in the data object for a world by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -40998,6 +41111,128 @@ class User extends SDKController {
|
|
|
40998
41111
|
}
|
|
40999
41112
|
});
|
|
41000
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('dancePreviewImage', dancePreviewImage);
|
|
41215
|
+
* formData.append('emotePreviewImage', emotePreviewImage);
|
|
41216
|
+
* formData.append('previewImageFile', previewImageFile);
|
|
41217
|
+
* formData.append('sitPreviewImage', sitPreviewImage);
|
|
41218
|
+
* formData.append('standPreviewImage', standPreviewImage);
|
|
41219
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
41220
|
+
* formData.append('transportPreviewImage', transportPreviewImage);
|
|
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
|
+
}
|
|
41001
41236
|
/**
|
|
41002
41237
|
* @summary
|
|
41003
41238
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -41492,6 +41727,53 @@ class Visitor extends User {
|
|
|
41492
41727
|
}
|
|
41493
41728
|
});
|
|
41494
41729
|
}
|
|
41730
|
+
/**
|
|
41731
|
+
* @summary
|
|
41732
|
+
* Get all particles available
|
|
41733
|
+
*
|
|
41734
|
+
* @usage
|
|
41735
|
+
* ```ts
|
|
41736
|
+
* await visitor.getAllParticles();
|
|
41737
|
+
* ```
|
|
41738
|
+
*/
|
|
41739
|
+
getAllParticles() {
|
|
41740
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41741
|
+
try {
|
|
41742
|
+
const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
|
|
41743
|
+
return result.data;
|
|
41744
|
+
}
|
|
41745
|
+
catch (error) {
|
|
41746
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "Visitor.getAllParticles" });
|
|
41747
|
+
}
|
|
41748
|
+
});
|
|
41749
|
+
}
|
|
41750
|
+
/**
|
|
41751
|
+
* @summary
|
|
41752
|
+
* Trigger a particle effect on a visitor
|
|
41753
|
+
*
|
|
41754
|
+
* @usage
|
|
41755
|
+
* ```ts
|
|
41756
|
+
* await visitor.triggerParticle({ name: "Flame" });
|
|
41757
|
+
* ```
|
|
41758
|
+
*/
|
|
41759
|
+
triggerParticle({ id, name, duration = 10, }) {
|
|
41760
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41761
|
+
if (!id && !name)
|
|
41762
|
+
throw "A particle name is required.";
|
|
41763
|
+
try {
|
|
41764
|
+
let particleId = id;
|
|
41765
|
+
if (name) {
|
|
41766
|
+
const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
|
|
41767
|
+
particleId = response.data[0].id;
|
|
41768
|
+
}
|
|
41769
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
|
|
41770
|
+
return result;
|
|
41771
|
+
}
|
|
41772
|
+
catch (error) {
|
|
41773
|
+
throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
|
|
41774
|
+
}
|
|
41775
|
+
});
|
|
41776
|
+
}
|
|
41495
41777
|
/**
|
|
41496
41778
|
* @summary
|
|
41497
41779
|
* Retrieves the data object for a visitor.
|
|
@@ -41626,10 +41908,10 @@ class WorldActivity extends SDKController {
|
|
|
41626
41908
|
return __classPrivateFieldGet(this, _WorldActivity_visitorsMap, "f");
|
|
41627
41909
|
}
|
|
41628
41910
|
//////// visitors
|
|
41629
|
-
fetchVisitors() {
|
|
41911
|
+
fetchVisitors(droppedAssetId) {
|
|
41630
41912
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41631
41913
|
try {
|
|
41632
|
-
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);
|
|
41633
41915
|
// create temp map and then update private property only once
|
|
41634
41916
|
const tempVisitorsMap = {};
|
|
41635
41917
|
for (const id in response.data) {
|
|
@@ -41665,6 +41947,26 @@ class WorldActivity extends SDKController {
|
|
|
41665
41947
|
}
|
|
41666
41948
|
});
|
|
41667
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
|
+
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
|
+
}
|
|
41668
41970
|
/**
|
|
41669
41971
|
* @summary
|
|
41670
41972
|
* 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.
|
|
@@ -649,6 +726,31 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
649
726
|
* ```
|
|
650
727
|
*/
|
|
651
728
|
replaceScene(sceneId: string): Promise<void | ResponseType$1>;
|
|
729
|
+
/**
|
|
730
|
+
* @summary
|
|
731
|
+
* Get all particles available
|
|
732
|
+
*
|
|
733
|
+
* @usage
|
|
734
|
+
* ```ts
|
|
735
|
+
* await world.getAllParticles();
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
738
|
+
getAllParticles(): Promise<object | ResponseType$1>;
|
|
739
|
+
/**
|
|
740
|
+
* @summary
|
|
741
|
+
* Trigger a particle effect at a position in the world
|
|
742
|
+
*
|
|
743
|
+
* @usage
|
|
744
|
+
* ```ts
|
|
745
|
+
* await world.triggerParticle({ name: "Flame" });
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
triggerParticle({ id, name, duration, position, }: {
|
|
749
|
+
id?: string;
|
|
750
|
+
name?: string;
|
|
751
|
+
duration?: number;
|
|
752
|
+
position?: object;
|
|
753
|
+
}): Promise<object | ResponseType$1>;
|
|
652
754
|
/**
|
|
653
755
|
* @summary
|
|
654
756
|
* Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -794,6 +896,97 @@ declare class User extends SDKController implements UserInterface {
|
|
|
794
896
|
* ```
|
|
795
897
|
*/
|
|
796
898
|
checkInteractiveCredentials(): Promise<void | ResponseType$1>;
|
|
899
|
+
/**
|
|
900
|
+
* @summary
|
|
901
|
+
* Returns all avatars owned by User
|
|
902
|
+
*
|
|
903
|
+
* @usage
|
|
904
|
+
* ```ts
|
|
905
|
+
* const avatars = await user.fetchAvatars();
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
fetchAvatars(): Promise<void | ResponseType$1>;
|
|
909
|
+
/**
|
|
910
|
+
* @summary
|
|
911
|
+
* Add a new avatar
|
|
912
|
+
*
|
|
913
|
+
* @usage
|
|
914
|
+
* ```ts
|
|
915
|
+
* const { avatarId, spriteSheetId } = await user.addAvatar({
|
|
916
|
+
* name: "ExampleAvatar",
|
|
917
|
+
* animationMeta: {
|
|
918
|
+
* dance: {
|
|
919
|
+
* loop: true,
|
|
920
|
+
* x: 0,
|
|
921
|
+
* y: -20,
|
|
922
|
+
* hideLoop: true,
|
|
923
|
+
* },
|
|
924
|
+
* },
|
|
925
|
+
* animations: {
|
|
926
|
+
* "dance": [
|
|
927
|
+
* "dance/1.png",
|
|
928
|
+
* "dance/2.png",
|
|
929
|
+
* "dance/3.png",
|
|
930
|
+
* "dance/4.png",
|
|
931
|
+
* "dance/5.png",
|
|
932
|
+
* ],
|
|
933
|
+
* },
|
|
934
|
+
* frames: {
|
|
935
|
+
* "dance/1.png": {
|
|
936
|
+
* "frame": {
|
|
937
|
+
* "x": 1,
|
|
938
|
+
* "y": 1040,
|
|
939
|
+
* "w": 58,
|
|
940
|
+
* "h": 107
|
|
941
|
+
* },
|
|
942
|
+
* "rotated": true,
|
|
943
|
+
* "trimmed": true,
|
|
944
|
+
* "spriteSourceSize": {
|
|
945
|
+
* "x": 50,
|
|
946
|
+
* "y": 58,
|
|
947
|
+
* "w": 58,
|
|
948
|
+
* "h": 107
|
|
949
|
+
* },
|
|
950
|
+
* "sourceSize": {
|
|
951
|
+
* "w": 159,
|
|
952
|
+
* "h": 200
|
|
953
|
+
* }
|
|
954
|
+
* },
|
|
955
|
+
* },
|
|
956
|
+
* "spriteSheetType": "PLAYER_AVATAR",
|
|
957
|
+
* "spriteSheetTypeMeta": {
|
|
958
|
+
* "meta": {
|
|
959
|
+
* "image": "spriteSheets%2FTvHNjgoMkiErDNSrVqHU%2FspriteSheet.png?alt=media",
|
|
960
|
+
* "format": "RGBA8888",
|
|
961
|
+
* "size": {
|
|
962
|
+
* "w": 2006,
|
|
963
|
+
* "h": 1099,
|
|
964
|
+
* },
|
|
965
|
+
* "scale": "1",
|
|
966
|
+
* },
|
|
967
|
+
* });
|
|
968
|
+
* ```
|
|
969
|
+
*/
|
|
970
|
+
addAvatar({ animationMeta, animations, name, frames, meta, }: SpriteSheetJSONType): Promise<void | ResponseType$1>;
|
|
971
|
+
/**
|
|
972
|
+
* @summary
|
|
973
|
+
* Upload sprite sheet and avatar preview .png files to existing sprite sheet and avatar storage buckets
|
|
974
|
+
*
|
|
975
|
+
* @usage
|
|
976
|
+
* ```ts
|
|
977
|
+
* const formData = new FormData();
|
|
978
|
+
* formData.append('dancePreviewImage', dancePreviewImage);
|
|
979
|
+
* formData.append('emotePreviewImage', emotePreviewImage);
|
|
980
|
+
* formData.append('previewImageFile', previewImageFile);
|
|
981
|
+
* formData.append('sitPreviewImage', sitPreviewImage);
|
|
982
|
+
* formData.append('standPreviewImage', standPreviewImage);
|
|
983
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
984
|
+
* formData.append('transportPreviewImage', transportPreviewImage);
|
|
985
|
+
* formData.append('unityPackage', unityPackage);
|
|
986
|
+
* await user.uploadAvatarFiles("exampleAvatarId", formData);
|
|
987
|
+
* ```
|
|
988
|
+
*/
|
|
989
|
+
uploadAvatarFiles(avatarId: string, formData: FormData): Promise<void | ResponseType$1>;
|
|
797
990
|
/**
|
|
798
991
|
* @summary
|
|
799
992
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -1057,6 +1250,30 @@ declare class Visitor extends User implements VisitorInterface {
|
|
|
1057
1250
|
id?: string;
|
|
1058
1251
|
name?: string;
|
|
1059
1252
|
}): Promise<object | ResponseType$1>;
|
|
1253
|
+
/**
|
|
1254
|
+
* @summary
|
|
1255
|
+
* Get all particles available
|
|
1256
|
+
*
|
|
1257
|
+
* @usage
|
|
1258
|
+
* ```ts
|
|
1259
|
+
* await visitor.getAllParticles();
|
|
1260
|
+
* ```
|
|
1261
|
+
*/
|
|
1262
|
+
getAllParticles(): Promise<object | ResponseType$1>;
|
|
1263
|
+
/**
|
|
1264
|
+
* @summary
|
|
1265
|
+
* Trigger a particle effect on a visitor
|
|
1266
|
+
*
|
|
1267
|
+
* @usage
|
|
1268
|
+
* ```ts
|
|
1269
|
+
* await visitor.triggerParticle({ name: "Flame" });
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
triggerParticle({ id, name, duration, }: {
|
|
1273
|
+
id?: string;
|
|
1274
|
+
name?: string;
|
|
1275
|
+
duration?: number;
|
|
1276
|
+
}): Promise<object | ResponseType$1>;
|
|
1060
1277
|
/**
|
|
1061
1278
|
* @summary
|
|
1062
1279
|
* Retrieves the data object for a visitor.
|
|
@@ -1663,6 +1880,18 @@ declare class WorldActivity extends SDKController {
|
|
|
1663
1880
|
currentVisitors(): Promise<{
|
|
1664
1881
|
[key: string]: Visitor;
|
|
1665
1882
|
}>;
|
|
1883
|
+
/**
|
|
1884
|
+
* @summary
|
|
1885
|
+
* Retrieve all visitors currently in a Landmark Zone.
|
|
1886
|
+
*
|
|
1887
|
+
* @usage
|
|
1888
|
+
* ```ts
|
|
1889
|
+
* const visitors = await worldActivity.fetchVisitorsInZone("exampleDroppedAssetId");
|
|
1890
|
+
* ```
|
|
1891
|
+
*/
|
|
1892
|
+
fetchVisitorsInZone(droppedAssetId: string): Promise<{
|
|
1893
|
+
[key: string]: Visitor;
|
|
1894
|
+
}>;
|
|
1666
1895
|
/**
|
|
1667
1896
|
* @summary
|
|
1668
1897
|
* 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.
|
|
@@ -40278,10 +40300,15 @@ class DroppedAsset extends Asset {
|
|
|
40278
40300
|
switch (periodType) {
|
|
40279
40301
|
case "week":
|
|
40280
40302
|
query = `&week=W${dateValue}`;
|
|
40303
|
+
break;
|
|
40281
40304
|
case "month":
|
|
40282
40305
|
query = `&month=${dateValue}`;
|
|
40306
|
+
break;
|
|
40283
40307
|
case "quarter":
|
|
40284
40308
|
query = `&quarter=Q${dateValue}`;
|
|
40309
|
+
break;
|
|
40310
|
+
default:
|
|
40311
|
+
"";
|
|
40285
40312
|
}
|
|
40286
40313
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
|
|
40287
40314
|
return response.data;
|
|
@@ -40616,7 +40643,6 @@ class World extends SDKController {
|
|
|
40616
40643
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40617
40644
|
try {
|
|
40618
40645
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets-with-unique-name/${uniqueName}?${isPartial ? `partial=${isPartial}&` : ""}${isReversed ? `reversed=${isReversed}` : ""}`, this.requestOptions);
|
|
40619
|
-
// create temp map and then update private property only once
|
|
40620
40646
|
const droppedAssets = [];
|
|
40621
40647
|
for (const asset of response.data.assets) {
|
|
40622
40648
|
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
@@ -40635,6 +40661,46 @@ class World extends SDKController {
|
|
|
40635
40661
|
}
|
|
40636
40662
|
});
|
|
40637
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
|
+
}
|
|
40638
40704
|
/**
|
|
40639
40705
|
* @summary
|
|
40640
40706
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
@@ -40832,6 +40898,53 @@ class World extends SDKController {
|
|
|
40832
40898
|
}
|
|
40833
40899
|
});
|
|
40834
40900
|
}
|
|
40901
|
+
/**
|
|
40902
|
+
* @summary
|
|
40903
|
+
* Get all particles available
|
|
40904
|
+
*
|
|
40905
|
+
* @usage
|
|
40906
|
+
* ```ts
|
|
40907
|
+
* await world.getAllParticles();
|
|
40908
|
+
* ```
|
|
40909
|
+
*/
|
|
40910
|
+
getAllParticles() {
|
|
40911
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40912
|
+
try {
|
|
40913
|
+
const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
|
|
40914
|
+
return result.data;
|
|
40915
|
+
}
|
|
40916
|
+
catch (error) {
|
|
40917
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "World.getAllParticles" });
|
|
40918
|
+
}
|
|
40919
|
+
});
|
|
40920
|
+
}
|
|
40921
|
+
/**
|
|
40922
|
+
* @summary
|
|
40923
|
+
* Trigger a particle effect at a position in the world
|
|
40924
|
+
*
|
|
40925
|
+
* @usage
|
|
40926
|
+
* ```ts
|
|
40927
|
+
* await world.triggerParticle({ name: "Flame" });
|
|
40928
|
+
* ```
|
|
40929
|
+
*/
|
|
40930
|
+
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
40931
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40932
|
+
if (!id && !name)
|
|
40933
|
+
throw "A particle name is required.";
|
|
40934
|
+
try {
|
|
40935
|
+
let particleId = id;
|
|
40936
|
+
if (name) {
|
|
40937
|
+
const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
|
|
40938
|
+
particleId = response.data[0].id;
|
|
40939
|
+
}
|
|
40940
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
|
|
40941
|
+
return result;
|
|
40942
|
+
}
|
|
40943
|
+
catch (error) {
|
|
40944
|
+
throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
|
|
40945
|
+
}
|
|
40946
|
+
});
|
|
40947
|
+
}
|
|
40835
40948
|
/**
|
|
40836
40949
|
* @summary
|
|
40837
40950
|
* Increments a specific value in the data object for a world by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -40996,6 +41109,128 @@ class User extends SDKController {
|
|
|
40996
41109
|
}
|
|
40997
41110
|
});
|
|
40998
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('dancePreviewImage', dancePreviewImage);
|
|
41213
|
+
* formData.append('emotePreviewImage', emotePreviewImage);
|
|
41214
|
+
* formData.append('previewImageFile', previewImageFile);
|
|
41215
|
+
* formData.append('sitPreviewImage', sitPreviewImage);
|
|
41216
|
+
* formData.append('standPreviewImage', standPreviewImage);
|
|
41217
|
+
* formData.append('spriteSheet', spriteSheet);
|
|
41218
|
+
* formData.append('transportPreviewImage', transportPreviewImage);
|
|
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
|
+
}
|
|
40999
41234
|
/**
|
|
41000
41235
|
* @summary
|
|
41001
41236
|
* Returns all assets owned by User when an email address is provided.
|
|
@@ -41490,6 +41725,53 @@ class Visitor extends User {
|
|
|
41490
41725
|
}
|
|
41491
41726
|
});
|
|
41492
41727
|
}
|
|
41728
|
+
/**
|
|
41729
|
+
* @summary
|
|
41730
|
+
* Get all particles available
|
|
41731
|
+
*
|
|
41732
|
+
* @usage
|
|
41733
|
+
* ```ts
|
|
41734
|
+
* await visitor.getAllParticles();
|
|
41735
|
+
* ```
|
|
41736
|
+
*/
|
|
41737
|
+
getAllParticles() {
|
|
41738
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41739
|
+
try {
|
|
41740
|
+
const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
|
|
41741
|
+
return result.data;
|
|
41742
|
+
}
|
|
41743
|
+
catch (error) {
|
|
41744
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "Visitor.getAllParticles" });
|
|
41745
|
+
}
|
|
41746
|
+
});
|
|
41747
|
+
}
|
|
41748
|
+
/**
|
|
41749
|
+
* @summary
|
|
41750
|
+
* Trigger a particle effect on a visitor
|
|
41751
|
+
*
|
|
41752
|
+
* @usage
|
|
41753
|
+
* ```ts
|
|
41754
|
+
* await visitor.triggerParticle({ name: "Flame" });
|
|
41755
|
+
* ```
|
|
41756
|
+
*/
|
|
41757
|
+
triggerParticle({ id, name, duration = 10, }) {
|
|
41758
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41759
|
+
if (!id && !name)
|
|
41760
|
+
throw "A particle name is required.";
|
|
41761
|
+
try {
|
|
41762
|
+
let particleId = id;
|
|
41763
|
+
if (name) {
|
|
41764
|
+
const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
|
|
41765
|
+
particleId = response.data[0].id;
|
|
41766
|
+
}
|
|
41767
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
|
|
41768
|
+
return result;
|
|
41769
|
+
}
|
|
41770
|
+
catch (error) {
|
|
41771
|
+
throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
|
|
41772
|
+
}
|
|
41773
|
+
});
|
|
41774
|
+
}
|
|
41493
41775
|
/**
|
|
41494
41776
|
* @summary
|
|
41495
41777
|
* Retrieves the data object for a visitor.
|
|
@@ -41624,10 +41906,10 @@ class WorldActivity extends SDKController {
|
|
|
41624
41906
|
return __classPrivateFieldGet(this, _WorldActivity_visitorsMap, "f");
|
|
41625
41907
|
}
|
|
41626
41908
|
//////// visitors
|
|
41627
|
-
fetchVisitors() {
|
|
41909
|
+
fetchVisitors(droppedAssetId) {
|
|
41628
41910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41629
41911
|
try {
|
|
41630
|
-
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);
|
|
41631
41913
|
// create temp map and then update private property only once
|
|
41632
41914
|
const tempVisitorsMap = {};
|
|
41633
41915
|
for (const id in response.data) {
|
|
@@ -41663,6 +41945,26 @@ class WorldActivity extends SDKController {
|
|
|
41663
41945
|
}
|
|
41664
41946
|
});
|
|
41665
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
|
+
yield this.fetchVisitors(droppedAssetId);
|
|
41961
|
+
return this.visitors;
|
|
41962
|
+
}
|
|
41963
|
+
catch (error) {
|
|
41964
|
+
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "WorldActivity.fetchVisitorsInZone" });
|
|
41965
|
+
}
|
|
41966
|
+
});
|
|
41967
|
+
}
|
|
41666
41968
|
/**
|
|
41667
41969
|
* @summary
|
|
41668
41970
|
* Move all visitors currently in a world to a single set of coordinates.
|
package/package.json
CHANGED