@rtsdk/topia 0.17.0 → 0.17.2
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 +55 -13
- package/dist/index.cjs +567 -363
- package/dist/index.d.ts +516 -330
- package/dist/index.js +568 -364
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39614,10 +39614,9 @@ const {
|
|
|
39614
39614
|
|
|
39615
39615
|
// utils
|
|
39616
39616
|
/**
|
|
39617
|
-
* @summary
|
|
39618
39617
|
* Create an instance of SDKController class with credentials.
|
|
39619
39618
|
*
|
|
39620
|
-
* @
|
|
39619
|
+
* @example
|
|
39621
39620
|
* ```ts
|
|
39622
39621
|
* const credentials = {
|
|
39623
39622
|
* assetId: "exampleAsset",
|
|
@@ -39712,12 +39711,11 @@ class SDKController {
|
|
|
39712
39711
|
}
|
|
39713
39712
|
|
|
39714
39713
|
/**
|
|
39715
|
-
* @summary
|
|
39716
39714
|
* Create an instance of Asset class with a given asset id and optional attributes and session credentials.
|
|
39717
39715
|
*
|
|
39718
|
-
* @
|
|
39716
|
+
* @example
|
|
39719
39717
|
* ```ts
|
|
39720
|
-
* await new Asset(topia, "id", {
|
|
39718
|
+
* const asset = await new Asset(topia, "id", {
|
|
39721
39719
|
* attributes: { assetName: "My Asset", isPublic: false },
|
|
39722
39720
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39723
39721
|
* });
|
|
@@ -39731,14 +39729,15 @@ class Asset extends SDKController {
|
|
|
39731
39729
|
Object.assign(this, options.attributes);
|
|
39732
39730
|
}
|
|
39733
39731
|
/**
|
|
39734
|
-
*
|
|
39735
|
-
* Retrieves platform asset details.
|
|
39732
|
+
* Retrieves platform asset details and assigns response data to the instance.
|
|
39736
39733
|
*
|
|
39737
|
-
* @
|
|
39734
|
+
* @example
|
|
39738
39735
|
* ```ts
|
|
39739
39736
|
* await asset.fetchAssetById();
|
|
39740
39737
|
* const { assetName } = asset;
|
|
39741
39738
|
* ```
|
|
39739
|
+
*
|
|
39740
|
+
* @returns {Promise<object | ResponseType>} Returns the asset details or an error response.
|
|
39742
39741
|
*/
|
|
39743
39742
|
fetchAssetById() {
|
|
39744
39743
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -39753,10 +39752,9 @@ class Asset extends SDKController {
|
|
|
39753
39752
|
});
|
|
39754
39753
|
}
|
|
39755
39754
|
/**
|
|
39756
|
-
* @summary
|
|
39757
39755
|
* Updates platform asset details.
|
|
39758
39756
|
*
|
|
39759
|
-
* @
|
|
39757
|
+
* @example
|
|
39760
39758
|
* ```ts
|
|
39761
39759
|
* await asset.updateAsset({
|
|
39762
39760
|
* assetName: "exampleAsset",
|
|
@@ -39804,7 +39802,14 @@ exports.DroppedAssetMediaType = void 0;
|
|
|
39804
39802
|
(function (DroppedAssetMediaType) {
|
|
39805
39803
|
DroppedAssetMediaType["NONE"] = "none";
|
|
39806
39804
|
DroppedAssetMediaType["LINK"] = "link";
|
|
39807
|
-
})(exports.DroppedAssetMediaType || (exports.DroppedAssetMediaType = {}));
|
|
39805
|
+
})(exports.DroppedAssetMediaType || (exports.DroppedAssetMediaType = {}));
|
|
39806
|
+
exports.DroppedAssetMediaVolumeRadius = void 0;
|
|
39807
|
+
(function (DroppedAssetMediaVolumeRadius) {
|
|
39808
|
+
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["CLOSE"] = 0] = "CLOSE";
|
|
39809
|
+
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["MEDIUM"] = 1] = "MEDIUM";
|
|
39810
|
+
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["FAR"] = 2] = "FAR";
|
|
39811
|
+
DroppedAssetMediaVolumeRadius[DroppedAssetMediaVolumeRadius["EVERYWHERE"] = 3] = "EVERYWHERE";
|
|
39812
|
+
})(exports.DroppedAssetMediaVolumeRadius || (exports.DroppedAssetMediaVolumeRadius = {}));
|
|
39808
39813
|
|
|
39809
39814
|
exports.WorldActivityType = void 0;
|
|
39810
39815
|
(function (WorldActivityType) {
|
|
@@ -39842,12 +39847,11 @@ const scatterVisitors = (original, scatterBy) => {
|
|
|
39842
39847
|
|
|
39843
39848
|
var _DroppedAsset_updateDroppedAsset;
|
|
39844
39849
|
/**
|
|
39845
|
-
* @summary
|
|
39846
39850
|
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
39847
39851
|
*
|
|
39848
|
-
* @
|
|
39852
|
+
* @example
|
|
39849
39853
|
* ```ts
|
|
39850
|
-
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39854
|
+
* const droppedAsset = await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39851
39855
|
* attributes: { text: "My Dropped Asset" },
|
|
39852
39856
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39853
39857
|
* });
|
|
@@ -39860,7 +39864,9 @@ class DroppedAsset extends Asset {
|
|
|
39860
39864
|
// private methods
|
|
39861
39865
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39862
39866
|
try {
|
|
39863
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/${updateType}`, Object.assign({}, payload), this.requestOptions);
|
|
39867
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/${updateType}`, Object.assign({}, payload), this.requestOptions);
|
|
39868
|
+
Object.assign(this, response.data);
|
|
39869
|
+
return response.data;
|
|
39864
39870
|
}
|
|
39865
39871
|
catch (error) {
|
|
39866
39872
|
throw this.errorHandler({ error, params: { payload, updateType }, sdkMethod: "DroppedAsset.updateDroppedAsset" });
|
|
@@ -39873,10 +39879,9 @@ class DroppedAsset extends Asset {
|
|
|
39873
39879
|
this.position = ((_b = options.attributes) === null || _b === void 0 ? void 0 : _b.position) || { x: 0, y: 0 };
|
|
39874
39880
|
}
|
|
39875
39881
|
/**
|
|
39876
|
-
*
|
|
39877
|
-
* Retrieves dropped asset details.
|
|
39882
|
+
* Retrieves dropped asset details and assigns response data to the instance.
|
|
39878
39883
|
*
|
|
39879
|
-
* @
|
|
39884
|
+
* @example
|
|
39880
39885
|
* ```ts
|
|
39881
39886
|
* await droppedAsset.fetchDroppedAssetById();
|
|
39882
39887
|
* const { assetName } = droppedAsset;
|
|
@@ -39896,10 +39901,9 @@ class DroppedAsset extends Asset {
|
|
|
39896
39901
|
});
|
|
39897
39902
|
}
|
|
39898
39903
|
/**
|
|
39899
|
-
*
|
|
39900
|
-
* Updates dropped asset details.
|
|
39904
|
+
* Updates dropped asset details and assigns the response data to the instance. Requires Public Key to have the `canUpdateDroppedAssets` permission.
|
|
39901
39905
|
*
|
|
39902
|
-
* @
|
|
39906
|
+
* @example
|
|
39903
39907
|
* ```ts
|
|
39904
39908
|
* const payload = {
|
|
39905
39909
|
* assetScale: 1,
|
|
@@ -39926,10 +39930,12 @@ class DroppedAsset extends Asset {
|
|
|
39926
39930
|
* const { assetName } = droppedAsset;
|
|
39927
39931
|
* ```
|
|
39928
39932
|
*/
|
|
39929
|
-
updateDroppedAsset({ assetScale, clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, flipped, isInteractive, isTextTopLayer, interactivePublicKey, layer0, layer1, position, specialType, text, textColor, textSize, textWeight, textWidth, uniqueName, yOrderAdjust, }) {
|
|
39933
|
+
updateDroppedAsset({ assetScale, audioRadius, audioSliderVolume, clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, flipped, isInteractive, isTextTopLayer, isVideo, interactivePublicKey, layer0, layer1, mediaLink, mediaName, mediaType, portalName, position, specialType, syncUserMedia, text, textColor, textSize, textWeight, textWidth, uniqueName, yOrderAdjust, }) {
|
|
39930
39934
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39931
39935
|
const params = {
|
|
39932
39936
|
assetScale,
|
|
39937
|
+
audioRadius,
|
|
39938
|
+
audioSliderVolume,
|
|
39933
39939
|
clickType,
|
|
39934
39940
|
clickableLink,
|
|
39935
39941
|
clickableLinkTitle,
|
|
@@ -39938,11 +39944,17 @@ class DroppedAsset extends Asset {
|
|
|
39938
39944
|
flipped,
|
|
39939
39945
|
isInteractive,
|
|
39940
39946
|
isTextTopLayer,
|
|
39947
|
+
isVideo,
|
|
39941
39948
|
interactivePublicKey,
|
|
39942
39949
|
layer0,
|
|
39943
39950
|
layer1,
|
|
39951
|
+
mediaLink,
|
|
39952
|
+
mediaName,
|
|
39953
|
+
mediaType,
|
|
39954
|
+
portalName,
|
|
39944
39955
|
position,
|
|
39945
39956
|
specialType,
|
|
39957
|
+
syncUserMedia,
|
|
39946
39958
|
text,
|
|
39947
39959
|
textColor,
|
|
39948
39960
|
textSize,
|
|
@@ -39963,10 +39975,9 @@ class DroppedAsset extends Asset {
|
|
|
39963
39975
|
});
|
|
39964
39976
|
}
|
|
39965
39977
|
/**
|
|
39966
|
-
*
|
|
39967
|
-
* Delete dropped asset.
|
|
39978
|
+
* Deletes the dropped asset (removes it from the world).
|
|
39968
39979
|
*
|
|
39969
|
-
* @
|
|
39980
|
+
* @example
|
|
39970
39981
|
* ```ts
|
|
39971
39982
|
* await droppedAsset.deleteDroppedAsset();
|
|
39972
39983
|
* ```
|
|
@@ -39982,13 +39993,16 @@ class DroppedAsset extends Asset {
|
|
|
39982
39993
|
});
|
|
39983
39994
|
}
|
|
39984
39995
|
/**
|
|
39985
|
-
* @summary
|
|
39986
39996
|
* Retrieves the data object for a dropped asset.
|
|
39987
39997
|
*
|
|
39988
|
-
* @
|
|
39998
|
+
* @category Data Objects
|
|
39999
|
+
*
|
|
40000
|
+
* @example
|
|
39989
40001
|
* ```ts
|
|
39990
40002
|
* const dataObject = await droppedAsset.fetchDataObject();
|
|
39991
40003
|
* ```
|
|
40004
|
+
*
|
|
40005
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
39992
40006
|
*/
|
|
39993
40007
|
fetchDataObject(appPublicKey, appJWT) {
|
|
39994
40008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40006,16 +40020,24 @@ class DroppedAsset extends Asset {
|
|
|
40006
40020
|
});
|
|
40007
40021
|
}
|
|
40008
40022
|
/**
|
|
40009
|
-
*
|
|
40010
|
-
* Sets the data object for a dropped asset.
|
|
40023
|
+
* Sets the data object for a dropped asset and assigns the response data to the instance.
|
|
40011
40024
|
*
|
|
40025
|
+
* @remarks
|
|
40012
40026
|
* 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
|
|
40013
40027
|
*
|
|
40014
|
-
* @
|
|
40028
|
+
* @category Data Objects
|
|
40029
|
+
*
|
|
40030
|
+
* @example
|
|
40015
40031
|
* ```ts
|
|
40016
|
-
* await droppedAsset.setDataObject(
|
|
40017
|
-
*
|
|
40018
|
-
*
|
|
40032
|
+
* await droppedAsset.setDataObject(
|
|
40033
|
+
* { resetCount: 0 },
|
|
40034
|
+
* {
|
|
40035
|
+
* analytics: [{ analyticName: "resets"} ],
|
|
40036
|
+
* lock: { lockId: `${assetId}-${resetCount}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
|
|
40037
|
+
* },
|
|
40038
|
+
* );
|
|
40039
|
+
*
|
|
40040
|
+
* const { resetCount } = droppedAsset.dataObject;
|
|
40019
40041
|
* ```
|
|
40020
40042
|
*/
|
|
40021
40043
|
setDataObject(dataObject, options = {}) {
|
|
@@ -40030,16 +40052,21 @@ class DroppedAsset extends Asset {
|
|
|
40030
40052
|
});
|
|
40031
40053
|
}
|
|
40032
40054
|
/**
|
|
40033
|
-
*
|
|
40034
|
-
* Updates the data object for a dropped asset.
|
|
40055
|
+
* Updates the data object for a dropped asset and assigns the response data to the instance.
|
|
40035
40056
|
*
|
|
40057
|
+
* @remarks
|
|
40036
40058
|
* 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
|
|
40037
40059
|
*
|
|
40038
|
-
* @
|
|
40060
|
+
* @category Data Objects
|
|
40061
|
+
*
|
|
40062
|
+
* @example
|
|
40039
40063
|
* ```ts
|
|
40040
40064
|
* await droppedAsset.updateDataObject({
|
|
40041
|
-
*
|
|
40065
|
+
* [`profiles.${profileId}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
40066
|
+
* [`profileMapper.${profileId}`]: username,
|
|
40042
40067
|
* });
|
|
40068
|
+
*
|
|
40069
|
+
* const { profiles } = droppedAsset.dataObject;
|
|
40043
40070
|
* ```
|
|
40044
40071
|
*/
|
|
40045
40072
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -40054,12 +40081,14 @@ class DroppedAsset extends Asset {
|
|
|
40054
40081
|
});
|
|
40055
40082
|
}
|
|
40056
40083
|
/**
|
|
40057
|
-
* @summary
|
|
40058
40084
|
* Increments a specific value in the data object for a dropped asset by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
40059
40085
|
*
|
|
40086
|
+
* @remarks
|
|
40060
40087
|
* 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
|
|
40061
40088
|
*
|
|
40062
|
-
* @
|
|
40089
|
+
* @category Data Objects
|
|
40090
|
+
*
|
|
40091
|
+
* @example
|
|
40063
40092
|
* ```ts
|
|
40064
40093
|
* await droppedAsset.incrementDataObjectValue("key", 1);
|
|
40065
40094
|
* ```
|
|
@@ -40078,12 +40107,10 @@ class DroppedAsset extends Asset {
|
|
|
40078
40107
|
}
|
|
40079
40108
|
});
|
|
40080
40109
|
}
|
|
40081
|
-
// update dropped assets
|
|
40082
40110
|
/**
|
|
40083
|
-
* @summary
|
|
40084
40111
|
* Updates broadcast options for a dropped asset.
|
|
40085
40112
|
*
|
|
40086
|
-
* @
|
|
40113
|
+
* @example
|
|
40087
40114
|
* ```ts
|
|
40088
40115
|
* await droppedAsset.updateBroadcast({
|
|
40089
40116
|
* assetBroadcast: true,
|
|
@@ -40091,6 +40118,8 @@ class DroppedAsset extends Asset {
|
|
|
40091
40118
|
* broadcasterEmail: "example@email.com"
|
|
40092
40119
|
* });
|
|
40093
40120
|
* ```
|
|
40121
|
+
*
|
|
40122
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40094
40123
|
*/
|
|
40095
40124
|
updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }) {
|
|
40096
40125
|
const params = { assetBroadcast, assetBroadcastAll, broadcasterEmail };
|
|
@@ -40102,10 +40131,9 @@ class DroppedAsset extends Asset {
|
|
|
40102
40131
|
}
|
|
40103
40132
|
}
|
|
40104
40133
|
/**
|
|
40105
|
-
* @summary
|
|
40106
40134
|
* Updates click options for a dropped asset.
|
|
40107
40135
|
*
|
|
40108
|
-
* @
|
|
40136
|
+
* @example
|
|
40109
40137
|
* ```ts
|
|
40110
40138
|
* await droppedAsset.updateClickType({
|
|
40111
40139
|
* "clickType": "portal",
|
|
@@ -40120,6 +40148,8 @@ class DroppedAsset extends Asset {
|
|
|
40120
40148
|
* "portalName": "community"
|
|
40121
40149
|
* });
|
|
40122
40150
|
* ```
|
|
40151
|
+
*
|
|
40152
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40123
40153
|
*/
|
|
40124
40154
|
updateClickType({ clickType = exports.DroppedAssetClickType.LINK, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40125
40155
|
const params = {
|
|
@@ -40141,10 +40171,9 @@ class DroppedAsset extends Asset {
|
|
|
40141
40171
|
}
|
|
40142
40172
|
}
|
|
40143
40173
|
/**
|
|
40144
|
-
* @summary
|
|
40145
40174
|
* Adds an array of links to an asset. Maximum is 20 links.
|
|
40146
40175
|
*
|
|
40147
|
-
* @
|
|
40176
|
+
* @example
|
|
40148
40177
|
* ```ts
|
|
40149
40178
|
* await droppedAsset.setClickableLinkMulti({
|
|
40150
40179
|
* clickableLinks: [
|
|
@@ -40163,6 +40192,8 @@ class DroppedAsset extends Asset {
|
|
|
40163
40192
|
* ],
|
|
40164
40193
|
* });
|
|
40165
40194
|
* ```
|
|
40195
|
+
*
|
|
40196
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40166
40197
|
*/
|
|
40167
40198
|
setClickableLinkMulti({ clickableLinks }) {
|
|
40168
40199
|
const params = {
|
|
@@ -40177,11 +40208,12 @@ class DroppedAsset extends Asset {
|
|
|
40177
40208
|
}
|
|
40178
40209
|
}
|
|
40179
40210
|
/**
|
|
40180
|
-
* @summary
|
|
40181
40211
|
* Updates multiple clickable links for a dropped asset.
|
|
40212
|
+
*
|
|
40213
|
+
* @remarks
|
|
40182
40214
|
* Pass in an 'existingLinkId' to edit an existing link.
|
|
40183
40215
|
*
|
|
40184
|
-
* @
|
|
40216
|
+
* @example
|
|
40185
40217
|
* ```ts
|
|
40186
40218
|
* await droppedAsset.updateClickableLinkMulti({
|
|
40187
40219
|
* clickableLink: "https://example.com",
|
|
@@ -40191,6 +40223,8 @@ class DroppedAsset extends Asset {
|
|
|
40191
40223
|
* existingLinkId: "abcd"
|
|
40192
40224
|
* });
|
|
40193
40225
|
* ```
|
|
40226
|
+
*
|
|
40227
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40194
40228
|
*/
|
|
40195
40229
|
updateClickableLinkMulti({ clickableLink, clickableLinkTitle, isForceLinkInIframe, isOpenLinkInDrawer, existingLinkId, linkSamlQueryParams, }) {
|
|
40196
40230
|
const params = {
|
|
@@ -40210,13 +40244,14 @@ class DroppedAsset extends Asset {
|
|
|
40210
40244
|
}
|
|
40211
40245
|
}
|
|
40212
40246
|
/**
|
|
40213
|
-
* @summary
|
|
40214
40247
|
* Removes a clickable link from a dropped asset.
|
|
40215
40248
|
*
|
|
40216
|
-
* @
|
|
40249
|
+
* @example
|
|
40217
40250
|
* ```ts
|
|
40218
40251
|
* await droppedAsset.removeClickableLink({ linkId: "link-id" });
|
|
40219
40252
|
* ```
|
|
40253
|
+
*
|
|
40254
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40220
40255
|
*/
|
|
40221
40256
|
removeClickableLink({ linkId }) {
|
|
40222
40257
|
const params = {
|
|
@@ -40230,10 +40265,9 @@ class DroppedAsset extends Asset {
|
|
|
40230
40265
|
}
|
|
40231
40266
|
}
|
|
40232
40267
|
/**
|
|
40233
|
-
* @summary
|
|
40234
40268
|
* Updates text and style of a dropped asset.
|
|
40235
40269
|
*
|
|
40236
|
-
* @
|
|
40270
|
+
* @example
|
|
40237
40271
|
* ```ts
|
|
40238
40272
|
* const style = {
|
|
40239
40273
|
* "textColor": "#abc123",
|
|
@@ -40244,6 +40278,8 @@ class DroppedAsset extends Asset {
|
|
|
40244
40278
|
* };
|
|
40245
40279
|
* await droppedAsset.updateCustomTextAsset(style, "hello world");
|
|
40246
40280
|
* ```
|
|
40281
|
+
*
|
|
40282
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40247
40283
|
*/
|
|
40248
40284
|
updateCustomTextAsset(style, text) {
|
|
40249
40285
|
const params = { style, text };
|
|
@@ -40255,10 +40291,9 @@ class DroppedAsset extends Asset {
|
|
|
40255
40291
|
}
|
|
40256
40292
|
}
|
|
40257
40293
|
/**
|
|
40258
|
-
* @summary
|
|
40259
40294
|
* Updates media options for a dropped asset.
|
|
40260
40295
|
*
|
|
40261
|
-
* @
|
|
40296
|
+
* @example
|
|
40262
40297
|
* ```ts
|
|
40263
40298
|
* await droppedAsset.updateMediaType({
|
|
40264
40299
|
* "mediaType": "link",
|
|
@@ -40271,6 +40306,8 @@ class DroppedAsset extends Asset {
|
|
|
40271
40306
|
* "mediaName": "string"
|
|
40272
40307
|
* });
|
|
40273
40308
|
* ```
|
|
40309
|
+
*
|
|
40310
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40274
40311
|
*/
|
|
40275
40312
|
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }) {
|
|
40276
40313
|
const params = {
|
|
@@ -40291,13 +40328,14 @@ class DroppedAsset extends Asset {
|
|
|
40291
40328
|
}
|
|
40292
40329
|
}
|
|
40293
40330
|
/**
|
|
40294
|
-
* @summary
|
|
40295
40331
|
* Updates mute zone options for a dropped asset.
|
|
40296
40332
|
*
|
|
40297
|
-
* @
|
|
40333
|
+
* @example
|
|
40298
40334
|
* ```ts
|
|
40299
40335
|
* await droppedAsset.updateMuteZone(true);
|
|
40300
40336
|
* ```
|
|
40337
|
+
*
|
|
40338
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40301
40339
|
*/
|
|
40302
40340
|
updateMuteZone(isMutezone) {
|
|
40303
40341
|
try {
|
|
@@ -40308,10 +40346,9 @@ class DroppedAsset extends Asset {
|
|
|
40308
40346
|
}
|
|
40309
40347
|
}
|
|
40310
40348
|
/**
|
|
40311
|
-
* @summary
|
|
40312
40349
|
* Updates landmark zone options for a dropped asset.
|
|
40313
40350
|
*
|
|
40314
|
-
* @
|
|
40351
|
+
* @example
|
|
40315
40352
|
* ```ts
|
|
40316
40353
|
* await droppedAsset.updateLandmarkZone({
|
|
40317
40354
|
* isLandmarkZoneEnabled: true,
|
|
@@ -40319,6 +40356,8 @@ class DroppedAsset extends Asset {
|
|
|
40319
40356
|
* landmarkZoneIsVisible: true,
|
|
40320
40357
|
*});
|
|
40321
40358
|
* ```
|
|
40359
|
+
*
|
|
40360
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40322
40361
|
*/
|
|
40323
40362
|
updateLandmarkZone({ isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible, }) {
|
|
40324
40363
|
const params = { isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible };
|
|
@@ -40330,13 +40369,14 @@ class DroppedAsset extends Asset {
|
|
|
40330
40369
|
}
|
|
40331
40370
|
}
|
|
40332
40371
|
/**
|
|
40333
|
-
* @summary
|
|
40334
40372
|
* Updates webhook zone options for a dropped asset.
|
|
40335
40373
|
*
|
|
40336
|
-
* @
|
|
40374
|
+
* @example
|
|
40337
40375
|
* ```ts
|
|
40338
40376
|
* await droppedAsset.updateWebhookZone(true);
|
|
40339
40377
|
* ```
|
|
40378
|
+
*
|
|
40379
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40340
40380
|
*/
|
|
40341
40381
|
updateWebhookZone(isWebhookZoneEnabled) {
|
|
40342
40382
|
try {
|
|
@@ -40347,13 +40387,14 @@ class DroppedAsset extends Asset {
|
|
|
40347
40387
|
}
|
|
40348
40388
|
}
|
|
40349
40389
|
/**
|
|
40350
|
-
* @summary
|
|
40351
40390
|
* Moves a dropped asset to specified coordinates.
|
|
40352
40391
|
*
|
|
40353
|
-
* @
|
|
40392
|
+
* @example
|
|
40354
40393
|
* ```ts
|
|
40355
|
-
* await droppedAsset.updatePosition(100,200);
|
|
40394
|
+
* await droppedAsset.updatePosition(100, 200, 100);
|
|
40356
40395
|
* ```
|
|
40396
|
+
*
|
|
40397
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40357
40398
|
*/
|
|
40358
40399
|
updatePosition(x, y, yOrderAdjust) {
|
|
40359
40400
|
const params = { x, y, yOrderAdjust };
|
|
@@ -40365,10 +40406,9 @@ class DroppedAsset extends Asset {
|
|
|
40365
40406
|
}
|
|
40366
40407
|
}
|
|
40367
40408
|
/**
|
|
40368
|
-
* @summary
|
|
40369
40409
|
* Updates private zone options for a dropped asset.
|
|
40370
40410
|
*
|
|
40371
|
-
* @
|
|
40411
|
+
* @example
|
|
40372
40412
|
* ```ts
|
|
40373
40413
|
* await droppedAsset.updatePrivateZone({
|
|
40374
40414
|
* "isPrivateZone": false,
|
|
@@ -40376,6 +40416,8 @@ class DroppedAsset extends Asset {
|
|
|
40376
40416
|
* "privateZoneUserCap": 10
|
|
40377
40417
|
* });
|
|
40378
40418
|
* ```
|
|
40419
|
+
*
|
|
40420
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40379
40421
|
*/
|
|
40380
40422
|
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }) {
|
|
40381
40423
|
const params = { isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap };
|
|
@@ -40387,13 +40429,14 @@ class DroppedAsset extends Asset {
|
|
|
40387
40429
|
}
|
|
40388
40430
|
}
|
|
40389
40431
|
/**
|
|
40390
|
-
* @summary
|
|
40391
40432
|
* Updates the size of a dropped asset.
|
|
40392
40433
|
*
|
|
40393
|
-
* @
|
|
40434
|
+
* @example
|
|
40394
40435
|
* ```ts
|
|
40395
40436
|
* await droppedAsset.assetScale(.5);
|
|
40396
40437
|
* ```
|
|
40438
|
+
*
|
|
40439
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40397
40440
|
*/
|
|
40398
40441
|
updateScale(assetScale) {
|
|
40399
40442
|
try {
|
|
@@ -40404,13 +40447,14 @@ class DroppedAsset extends Asset {
|
|
|
40404
40447
|
}
|
|
40405
40448
|
}
|
|
40406
40449
|
/**
|
|
40407
|
-
* @summary
|
|
40408
40450
|
* Flip an dropped asset.
|
|
40409
40451
|
*
|
|
40410
|
-
* @
|
|
40452
|
+
* @example
|
|
40411
40453
|
* ```ts
|
|
40412
40454
|
* await droppedAsset.flip(.5);
|
|
40413
40455
|
* ```
|
|
40456
|
+
*
|
|
40457
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40414
40458
|
*/
|
|
40415
40459
|
flip() {
|
|
40416
40460
|
try {
|
|
@@ -40421,13 +40465,14 @@ class DroppedAsset extends Asset {
|
|
|
40421
40465
|
}
|
|
40422
40466
|
}
|
|
40423
40467
|
/**
|
|
40424
|
-
* @summary
|
|
40425
40468
|
* Change or remove media embedded in a dropped asset.
|
|
40426
40469
|
*
|
|
40427
|
-
* @
|
|
40470
|
+
* @example
|
|
40428
40471
|
* ```ts
|
|
40429
40472
|
* await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
|
|
40430
40473
|
* ```
|
|
40474
|
+
*
|
|
40475
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40431
40476
|
*/
|
|
40432
40477
|
updateUploadedMediaSelected(mediaId) {
|
|
40433
40478
|
try {
|
|
@@ -40438,13 +40483,14 @@ class DroppedAsset extends Asset {
|
|
|
40438
40483
|
}
|
|
40439
40484
|
}
|
|
40440
40485
|
/**
|
|
40441
|
-
* @summary
|
|
40442
40486
|
* Change or remove top and bottom layers of a dropped asset.
|
|
40443
40487
|
*
|
|
40444
|
-
* @
|
|
40488
|
+
* @example
|
|
40445
40489
|
* ```ts
|
|
40446
40490
|
* await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");
|
|
40447
40491
|
* ```
|
|
40492
|
+
*
|
|
40493
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40448
40494
|
*/
|
|
40449
40495
|
updateWebImageLayers(bottom, top) {
|
|
40450
40496
|
const params = { bottom, top };
|
|
@@ -40456,10 +40502,9 @@ class DroppedAsset extends Asset {
|
|
|
40456
40502
|
}
|
|
40457
40503
|
}
|
|
40458
40504
|
/**
|
|
40459
|
-
* @summary
|
|
40460
40505
|
* Add a webhook to a dropped asset
|
|
40461
40506
|
*
|
|
40462
|
-
* @
|
|
40507
|
+
* @example
|
|
40463
40508
|
* ```ts
|
|
40464
40509
|
* await droppedAsset.addWebhook({
|
|
40465
40510
|
* dataObject: {},
|
|
@@ -40471,6 +40516,8 @@ class DroppedAsset extends Asset {
|
|
|
40471
40516
|
* url: "https://url.com",
|
|
40472
40517
|
* });
|
|
40473
40518
|
* ```
|
|
40519
|
+
*
|
|
40520
|
+
* @returns {Promise<void | ResponseType>} Returns the new `webhookId` or an error.
|
|
40474
40521
|
*/
|
|
40475
40522
|
addWebhook({ dataObject, description, isUniqueOnly, shouldSetClickType, shouldSetIsInteractive, title, type, url, }) {
|
|
40476
40523
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40494,10 +40541,9 @@ class DroppedAsset extends Asset {
|
|
|
40494
40541
|
});
|
|
40495
40542
|
}
|
|
40496
40543
|
/**
|
|
40497
|
-
* @summary
|
|
40498
40544
|
* Set the interactive settings on a dropped asset
|
|
40499
40545
|
*
|
|
40500
|
-
* @
|
|
40546
|
+
* @example
|
|
40501
40547
|
* ```ts
|
|
40502
40548
|
* await droppedAsset.setInteractiveSettings({
|
|
40503
40549
|
* isInteractive: true,
|
|
@@ -40521,12 +40567,10 @@ class DroppedAsset extends Asset {
|
|
|
40521
40567
|
}
|
|
40522
40568
|
});
|
|
40523
40569
|
}
|
|
40524
|
-
////////// analytics
|
|
40525
40570
|
/**
|
|
40526
|
-
* @summary
|
|
40527
40571
|
* Retrieve analytics for a dropped asset by day, week, month, quarter, or year
|
|
40528
40572
|
*
|
|
40529
|
-
* @
|
|
40573
|
+
* @example
|
|
40530
40574
|
* ```ts
|
|
40531
40575
|
* const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
|
|
40532
40576
|
* periodType: "quarter",
|
|
@@ -40534,6 +40578,8 @@ class DroppedAsset extends Asset {
|
|
|
40534
40578
|
* year: 2023,
|
|
40535
40579
|
* });
|
|
40536
40580
|
* ```
|
|
40581
|
+
*
|
|
40582
|
+
* @returns {Promise<void | ResponseType>} Returns the analytics data or an error.
|
|
40537
40583
|
*/
|
|
40538
40584
|
fetchDroppedAssetAnalytics({ periodType, dateValue, year, }) {
|
|
40539
40585
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40568,12 +40614,11 @@ class DroppedAsset extends Asset {
|
|
|
40568
40614
|
_DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
40569
40615
|
|
|
40570
40616
|
/**
|
|
40571
|
-
* @summary
|
|
40572
40617
|
* Create an instance of Ecosystem class with optional session credentials
|
|
40573
40618
|
*
|
|
40574
|
-
* @
|
|
40619
|
+
* @example
|
|
40575
40620
|
* ```ts
|
|
40576
|
-
* await new Ecosystem(topia, {
|
|
40621
|
+
* const ecosystem =await new Ecosystem(topia, {
|
|
40577
40622
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40578
40623
|
* });
|
|
40579
40624
|
* ```
|
|
@@ -40584,13 +40629,16 @@ class Ecosystem extends SDKController {
|
|
|
40584
40629
|
this.dataObject = {};
|
|
40585
40630
|
}
|
|
40586
40631
|
/**
|
|
40587
|
-
* @summary
|
|
40588
40632
|
* Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
|
|
40589
40633
|
*
|
|
40590
|
-
* @
|
|
40634
|
+
* @category Data Objects
|
|
40635
|
+
*
|
|
40636
|
+
* @example
|
|
40591
40637
|
* ```ts
|
|
40592
40638
|
* const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
|
|
40593
40639
|
* ```
|
|
40640
|
+
*
|
|
40641
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
40594
40642
|
*/
|
|
40595
40643
|
fetchDataObject(appPublicKey, appJWT) {
|
|
40596
40644
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40608,17 +40656,22 @@ class Ecosystem extends SDKController {
|
|
|
40608
40656
|
});
|
|
40609
40657
|
}
|
|
40610
40658
|
/**
|
|
40611
|
-
* @summary
|
|
40612
40659
|
* Sets the data object for a Topia ecosystem.
|
|
40613
40660
|
*
|
|
40661
|
+
* @remarks
|
|
40662
|
+
* This method also allows you to set a data object on behalf of another Public Key. It requires `canUpdateEcosystemDataObjects` permission to be set to true for the Public Key.
|
|
40663
|
+
*
|
|
40614
40664
|
* 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
|
|
40615
40665
|
*
|
|
40616
|
-
* @
|
|
40666
|
+
* @category Data Objects
|
|
40667
|
+
*
|
|
40668
|
+
* @example
|
|
40617
40669
|
* ```ts
|
|
40618
40670
|
* await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
|
|
40619
40671
|
* sharedAppPublicKey: "exampleAppPublicKey",
|
|
40620
40672
|
* sharedAppJWT: "exampleAppPublicKeyJWT",}
|
|
40621
40673
|
* });
|
|
40674
|
+
* const { exampleKey } = ecosystem.dataObject;
|
|
40622
40675
|
* ```
|
|
40623
40676
|
*/
|
|
40624
40677
|
setDataObject(dataObject, options = {}) {
|
|
@@ -40633,17 +40686,28 @@ class Ecosystem extends SDKController {
|
|
|
40633
40686
|
});
|
|
40634
40687
|
}
|
|
40635
40688
|
/**
|
|
40636
|
-
* @summary
|
|
40637
40689
|
* Updates the data object for a Topia ecosystem.
|
|
40638
40690
|
*
|
|
40691
|
+
* @remarks
|
|
40692
|
+
* This method also allows you to update a data object on behalf of another Public Key. It requires `canUpdateEcosystemDataObjects` permission to be set to true for the Public Key.
|
|
40693
|
+
*
|
|
40639
40694
|
* 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
|
|
40640
40695
|
*
|
|
40641
|
-
* @
|
|
40696
|
+
* @category Data Objects
|
|
40697
|
+
*
|
|
40698
|
+
* @example
|
|
40642
40699
|
* ```ts
|
|
40643
|
-
* await ecosystem.updateDataObject({
|
|
40644
|
-
*
|
|
40645
|
-
*
|
|
40700
|
+
* await ecosystem.updateDataObject({
|
|
40701
|
+
* [`profiles.${profileId}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
40702
|
+
* [`profileMapper.${profileId}`]: username,
|
|
40703
|
+
* }, {
|
|
40704
|
+
* sharedAppPublicKey: "exampleAppPublicKey",
|
|
40705
|
+
* sharedAppJWT: "exampleAppPublicKeyJWT",
|
|
40706
|
+
* analytics: [{ analyticName: "itemCollected", profileId, uniqueKey: profileId, urlSlug } ],
|
|
40707
|
+
* lock: { lockId: `${assetId}-${resetCount}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
|
|
40708
|
+
* }
|
|
40646
40709
|
* });
|
|
40710
|
+
* const { exampleKey } = ecosystem.dataObject;
|
|
40647
40711
|
* ```
|
|
40648
40712
|
*/
|
|
40649
40713
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -40658,12 +40722,16 @@ class Ecosystem extends SDKController {
|
|
|
40658
40722
|
});
|
|
40659
40723
|
}
|
|
40660
40724
|
/**
|
|
40661
|
-
* @summary
|
|
40662
40725
|
* Increments a specific value in the data object for a Topia ecosystem by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
40663
40726
|
*
|
|
40727
|
+
* @remarks
|
|
40728
|
+
* This method also allows you to increment a data object value on behalf of another Public Key. It requires `canUpdateEcosystemDataObjects` permission to be set to true for the Public Key.
|
|
40729
|
+
*
|
|
40664
40730
|
* 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
|
|
40665
40731
|
*
|
|
40666
|
-
* @
|
|
40732
|
+
* @category Data Objects
|
|
40733
|
+
*
|
|
40734
|
+
* @example
|
|
40667
40735
|
* ```ts
|
|
40668
40736
|
* await ecosystem.incrementDataObjectValue("key", 1, {
|
|
40669
40737
|
* sharedAppPublicKey: "exampleAppPublicKey",
|
|
@@ -40688,12 +40756,11 @@ class Ecosystem extends SDKController {
|
|
|
40688
40756
|
}
|
|
40689
40757
|
|
|
40690
40758
|
/**
|
|
40691
|
-
* @summary
|
|
40692
40759
|
* Create an instance of Scene class with a given scene id and optional attributes and session credentials.
|
|
40693
40760
|
*
|
|
40694
|
-
* @
|
|
40761
|
+
* @example
|
|
40695
40762
|
* ```ts
|
|
40696
|
-
* await new Scene(topia, "sceneId", {
|
|
40763
|
+
* const scene = await new Scene(topia, "sceneId", {
|
|
40697
40764
|
* attributes: { name: "My Scene" },
|
|
40698
40765
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40699
40766
|
* });
|
|
@@ -40706,10 +40773,9 @@ class Scene extends SDKController {
|
|
|
40706
40773
|
Object.assign(this, options.attributes);
|
|
40707
40774
|
}
|
|
40708
40775
|
/**
|
|
40709
|
-
*
|
|
40710
|
-
* Retrieves scene details.
|
|
40776
|
+
* Retrieves scene details and assigns response data to the instance.
|
|
40711
40777
|
*
|
|
40712
|
-
* @
|
|
40778
|
+
* @example
|
|
40713
40779
|
* ```ts
|
|
40714
40780
|
* await scene.fetchSceneById();
|
|
40715
40781
|
* const { name } = scene;
|
|
@@ -40729,10 +40795,9 @@ class Scene extends SDKController {
|
|
|
40729
40795
|
}
|
|
40730
40796
|
|
|
40731
40797
|
/**
|
|
40732
|
-
* @summary
|
|
40733
40798
|
* Create a single instance of Topia axios used for all calls to the public API in all classes
|
|
40734
40799
|
*
|
|
40735
|
-
* @
|
|
40800
|
+
* @example
|
|
40736
40801
|
* ```ts
|
|
40737
40802
|
* const topia = await new Topia({
|
|
40738
40803
|
* apiDomain: "api.topia.io",
|
|
@@ -40768,12 +40833,11 @@ class Topia {
|
|
|
40768
40833
|
|
|
40769
40834
|
var _World_droppedAssetsMap;
|
|
40770
40835
|
/**
|
|
40771
|
-
* @summary
|
|
40772
40836
|
* Create an instance of World class with a given url slug and optional attributes and session credentials.
|
|
40773
40837
|
*
|
|
40774
|
-
* @
|
|
40838
|
+
* @example
|
|
40775
40839
|
* ```ts
|
|
40776
|
-
* await new World(topia, "exampleWorld", {
|
|
40840
|
+
* const world = await new World(topia, "exampleWorld", {
|
|
40777
40841
|
* attributes: { name: "Example World" },
|
|
40778
40842
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40779
40843
|
* });
|
|
@@ -40786,10 +40850,11 @@ class World extends SDKController {
|
|
|
40786
40850
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40787
40851
|
////////// data objects
|
|
40788
40852
|
/**
|
|
40789
|
-
* @summary
|
|
40790
40853
|
* Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
40791
40854
|
*
|
|
40792
|
-
* @
|
|
40855
|
+
* @category Data Objects
|
|
40856
|
+
*
|
|
40857
|
+
* @example
|
|
40793
40858
|
* ```ts
|
|
40794
40859
|
* await world.fetchDataObject();
|
|
40795
40860
|
* const { dataObject } = world;
|
|
@@ -40809,17 +40874,23 @@ class World extends SDKController {
|
|
|
40809
40874
|
}
|
|
40810
40875
|
});
|
|
40811
40876
|
/**
|
|
40812
|
-
* @summary
|
|
40813
40877
|
* Sets the data object for a user. Must have valid interactive credentials from a visitor in the world.
|
|
40814
40878
|
*
|
|
40879
|
+
* @remarks
|
|
40815
40880
|
* 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
|
|
40816
40881
|
*
|
|
40817
|
-
* @
|
|
40882
|
+
* @category Data Objects
|
|
40883
|
+
*
|
|
40884
|
+
* @example
|
|
40818
40885
|
* ```ts
|
|
40819
|
-
|
|
40820
|
-
|
|
40821
|
-
|
|
40822
|
-
|
|
40886
|
+
await world.setDataObject(
|
|
40887
|
+
{
|
|
40888
|
+
...defaultGameData,
|
|
40889
|
+
keyAssetId: droppedAsset.id,
|
|
40890
|
+
},
|
|
40891
|
+
{ lock: { lock: { lockId: `${keyAssetId}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` }, releaseLock: true } },
|
|
40892
|
+
);
|
|
40893
|
+
* const { profileMapper } = world.dataObject;
|
|
40823
40894
|
* ```
|
|
40824
40895
|
*/
|
|
40825
40896
|
this.setDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40832,17 +40903,20 @@ class World extends SDKController {
|
|
|
40832
40903
|
}
|
|
40833
40904
|
});
|
|
40834
40905
|
/**
|
|
40835
|
-
* @summary
|
|
40836
40906
|
* Updates the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
40837
40907
|
*
|
|
40908
|
+
* @remarks
|
|
40838
40909
|
* 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
|
|
40839
40910
|
*
|
|
40840
|
-
* @
|
|
40911
|
+
* @category Data Objects
|
|
40912
|
+
*
|
|
40913
|
+
* @example
|
|
40841
40914
|
* ```ts
|
|
40842
40915
|
* await world.updateDataObject({
|
|
40843
|
-
*
|
|
40916
|
+
* [`keyAssets.${keyAssetId}.itemsCollectedByUser.${profileId}`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
40917
|
+
* [`profileMapper.${profileId}`]: username,
|
|
40844
40918
|
* });
|
|
40845
|
-
* const {
|
|
40919
|
+
* const { profileMapper } = world.dataObject;
|
|
40846
40920
|
* ```
|
|
40847
40921
|
*/
|
|
40848
40922
|
this.updateDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40863,10 +40937,9 @@ class World extends SDKController {
|
|
|
40863
40937
|
}
|
|
40864
40938
|
//////// world details
|
|
40865
40939
|
/**
|
|
40866
|
-
* @summary
|
|
40867
40940
|
* Retrieves details of a world.
|
|
40868
40941
|
*
|
|
40869
|
-
* @
|
|
40942
|
+
* @example
|
|
40870
40943
|
* ```ts
|
|
40871
40944
|
* await world.fetchDetails();
|
|
40872
40945
|
* const { name } = world;
|
|
@@ -40884,10 +40957,9 @@ class World extends SDKController {
|
|
|
40884
40957
|
});
|
|
40885
40958
|
}
|
|
40886
40959
|
/**
|
|
40887
|
-
* @summary
|
|
40888
40960
|
* Update details of a world.
|
|
40889
40961
|
*
|
|
40890
|
-
* @
|
|
40962
|
+
* @example
|
|
40891
40963
|
* ```ts
|
|
40892
40964
|
* await world.updateDetails({
|
|
40893
40965
|
* controls: {
|
|
@@ -40903,6 +40975,8 @@ class World extends SDKController {
|
|
|
40903
40975
|
* spawnPosition: { x: 100, y: 100 },
|
|
40904
40976
|
* width: 2000
|
|
40905
40977
|
* });
|
|
40978
|
+
*
|
|
40979
|
+
* const { name, description } = world;
|
|
40906
40980
|
* ```
|
|
40907
40981
|
*/
|
|
40908
40982
|
updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }) {
|
|
@@ -40927,10 +41001,9 @@ class World extends SDKController {
|
|
|
40927
41001
|
});
|
|
40928
41002
|
}
|
|
40929
41003
|
/**
|
|
40930
|
-
* @summary
|
|
40931
41004
|
* Set close world settings
|
|
40932
41005
|
*
|
|
40933
|
-
* @
|
|
41006
|
+
* @example
|
|
40934
41007
|
* ```ts
|
|
40935
41008
|
* await world.updateCloseWorldSettings({
|
|
40936
41009
|
* controls: {
|
|
@@ -40947,6 +41020,8 @@ class World extends SDKController {
|
|
|
40947
41020
|
* width: 2000
|
|
40948
41021
|
* });
|
|
40949
41022
|
* ```
|
|
41023
|
+
*
|
|
41024
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
40950
41025
|
*/
|
|
40951
41026
|
updateCloseWorldSettings({ closeWorldDescription, isWorldClosed, }) {
|
|
40952
41027
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40955,7 +41030,8 @@ class World extends SDKController {
|
|
|
40955
41030
|
isWorldClosed,
|
|
40956
41031
|
};
|
|
40957
41032
|
try {
|
|
40958
|
-
|
|
41033
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/set-close-world-settings`, params, this.requestOptions);
|
|
41034
|
+
return response.data;
|
|
40959
41035
|
}
|
|
40960
41036
|
catch (error) {
|
|
40961
41037
|
throw this.errorHandler({ error, params, sdkMethod: "World.updateCloseWorldSettings" });
|
|
@@ -40964,10 +41040,11 @@ class World extends SDKController {
|
|
|
40964
41040
|
}
|
|
40965
41041
|
////////// dropped assets
|
|
40966
41042
|
/**
|
|
40967
|
-
* @summary
|
|
40968
41043
|
* Retrieve all assets dropped in a world.
|
|
40969
41044
|
*
|
|
40970
|
-
* @
|
|
41045
|
+
* @category Dropped Assets
|
|
41046
|
+
*
|
|
41047
|
+
* @example
|
|
40971
41048
|
* ```ts
|
|
40972
41049
|
* await world.fetchDroppedAssets();
|
|
40973
41050
|
* const assets = world.droppedAssets;
|
|
@@ -40993,13 +41070,16 @@ class World extends SDKController {
|
|
|
40993
41070
|
});
|
|
40994
41071
|
}
|
|
40995
41072
|
/**
|
|
40996
|
-
* @summary
|
|
40997
41073
|
* Retrieve all assets dropped in a world matching uniqueName.
|
|
40998
41074
|
*
|
|
40999
|
-
* @
|
|
41075
|
+
* @category Dropped Assets
|
|
41076
|
+
*
|
|
41077
|
+
* @example
|
|
41000
41078
|
* ```ts
|
|
41001
|
-
* const droppedAssets = await world.fetchDroppedAssetsWithUniqueName({
|
|
41079
|
+
* const droppedAssets = await world.fetchDroppedAssetsWithUniqueName({ uniqueName: "exampleUniqueName", isPartial: true });
|
|
41002
41080
|
* ```
|
|
41081
|
+
*
|
|
41082
|
+
* @returns {Promise<DroppedAsset[]>} Returns an array of DroppedAsset instances.
|
|
41003
41083
|
*/
|
|
41004
41084
|
fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial = false, isReversed = false, }) {
|
|
41005
41085
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41024,57 +41104,19 @@ class World extends SDKController {
|
|
|
41024
41104
|
});
|
|
41025
41105
|
}
|
|
41026
41106
|
/**
|
|
41027
|
-
* @summary
|
|
41028
|
-
* Retrieve all landmark zone assets dropped in a world.
|
|
41029
|
-
*
|
|
41030
|
-
* @usage
|
|
41031
|
-
* ```ts
|
|
41032
|
-
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
41033
|
-
* ```
|
|
41034
|
-
*/
|
|
41035
|
-
fetchLandmarkZones(landmarkZoneName, sceneDropId) {
|
|
41036
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41037
|
-
try {
|
|
41038
|
-
let queryParams = "";
|
|
41039
|
-
if (landmarkZoneName) {
|
|
41040
|
-
queryParams = `?landmarkZoneName=${landmarkZoneName}`;
|
|
41041
|
-
if (sceneDropId)
|
|
41042
|
-
queryParams += `&sceneDropId=${sceneDropId}`;
|
|
41043
|
-
}
|
|
41044
|
-
else if (sceneDropId) {
|
|
41045
|
-
queryParams = `?sceneDropId=${sceneDropId}`;
|
|
41046
|
-
}
|
|
41047
|
-
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/landmark-zones${queryParams}`, this.requestOptions);
|
|
41048
|
-
const droppedAssets = [];
|
|
41049
|
-
for (const asset of response.data.assets) {
|
|
41050
|
-
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
41051
|
-
attributes: asset,
|
|
41052
|
-
credentials: this.credentials,
|
|
41053
|
-
}));
|
|
41054
|
-
}
|
|
41055
|
-
return droppedAssets;
|
|
41056
|
-
}
|
|
41057
|
-
catch (error) {
|
|
41058
|
-
throw this.errorHandler({
|
|
41059
|
-
error,
|
|
41060
|
-
params: { landmarkZoneName, sceneDropId },
|
|
41061
|
-
sdkMethod: "World.fetchLandmarkZones",
|
|
41062
|
-
});
|
|
41063
|
-
}
|
|
41064
|
-
});
|
|
41065
|
-
}
|
|
41066
|
-
/**
|
|
41067
|
-
* @summary
|
|
41068
41107
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
41069
41108
|
*
|
|
41070
|
-
* @
|
|
41109
|
+
* @category Dropped Assets
|
|
41110
|
+
*
|
|
41111
|
+
* @example
|
|
41071
41112
|
* ```ts
|
|
41072
|
-
* await world.fetchDroppedAssetsBySceneDropId({
|
|
41113
|
+
* const droppedAssets = await world.fetchDroppedAssetsBySceneDropId({
|
|
41073
41114
|
* sceneDropId: "sceneDropIdExample",
|
|
41074
41115
|
* uniqueName: "optionalUniqueNameExample",
|
|
41075
41116
|
* });
|
|
41076
|
-
* const assets = world.droppedAssets;
|
|
41077
41117
|
* ```
|
|
41118
|
+
*
|
|
41119
|
+
* @returns {Promise<DroppedAsset[]>} Returns an array of DroppedAsset instances.
|
|
41078
41120
|
*/
|
|
41079
41121
|
fetchDroppedAssetsBySceneDropId({ sceneDropId, uniqueName, }) {
|
|
41080
41122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41102,10 +41144,11 @@ class World extends SDKController {
|
|
|
41102
41144
|
});
|
|
41103
41145
|
}
|
|
41104
41146
|
/**
|
|
41105
|
-
* @summary
|
|
41106
41147
|
* Update multiple custom text dropped assets with a single style while preserving text for specified dropped assets only.
|
|
41107
41148
|
*
|
|
41108
|
-
* @
|
|
41149
|
+
* @category Dropped Assets
|
|
41150
|
+
*
|
|
41151
|
+
* @example
|
|
41109
41152
|
* ```ts
|
|
41110
41153
|
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]];
|
|
41111
41154
|
* const style = {
|
|
@@ -41118,7 +41161,7 @@ class World extends SDKController {
|
|
|
41118
41161
|
* await world.updateCustomText(droppedAssetsToUpdate, style);
|
|
41119
41162
|
* ```
|
|
41120
41163
|
*
|
|
41121
|
-
* @
|
|
41164
|
+
* @returns
|
|
41122
41165
|
* Updates each DroppedAsset instance and world.droppedAssets map.
|
|
41123
41166
|
*/
|
|
41124
41167
|
updateCustomTextDroppedAssets(droppedAssetsToUpdate, style) {
|
|
@@ -41131,19 +41174,61 @@ class World extends SDKController {
|
|
|
41131
41174
|
return outcomes;
|
|
41132
41175
|
});
|
|
41133
41176
|
}
|
|
41177
|
+
/**
|
|
41178
|
+
* Retrieve all landmark zone assets dropped in a world.
|
|
41179
|
+
*
|
|
41180
|
+
* @category Dropped Assets
|
|
41181
|
+
*
|
|
41182
|
+
* @example
|
|
41183
|
+
* ```ts
|
|
41184
|
+
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
41185
|
+
* ```
|
|
41186
|
+
*
|
|
41187
|
+
* @returns {Promise<DroppedAsset[]>} Returns an array of DroppedAsset instances.
|
|
41188
|
+
*/
|
|
41189
|
+
fetchLandmarkZones(landmarkZoneName, sceneDropId) {
|
|
41190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41191
|
+
try {
|
|
41192
|
+
let queryParams = "";
|
|
41193
|
+
if (landmarkZoneName) {
|
|
41194
|
+
queryParams = `?landmarkZoneName=${landmarkZoneName}`;
|
|
41195
|
+
if (sceneDropId)
|
|
41196
|
+
queryParams += `&sceneDropId=${sceneDropId}`;
|
|
41197
|
+
}
|
|
41198
|
+
else if (sceneDropId) {
|
|
41199
|
+
queryParams = `?sceneDropId=${sceneDropId}`;
|
|
41200
|
+
}
|
|
41201
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/landmark-zones${queryParams}`, this.requestOptions);
|
|
41202
|
+
const droppedAssets = [];
|
|
41203
|
+
for (const asset of response.data.assets) {
|
|
41204
|
+
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
41205
|
+
attributes: asset,
|
|
41206
|
+
credentials: this.credentials,
|
|
41207
|
+
}));
|
|
41208
|
+
}
|
|
41209
|
+
return droppedAssets;
|
|
41210
|
+
}
|
|
41211
|
+
catch (error) {
|
|
41212
|
+
throw this.errorHandler({
|
|
41213
|
+
error,
|
|
41214
|
+
params: { landmarkZoneName, sceneDropId },
|
|
41215
|
+
sdkMethod: "World.fetchLandmarkZones",
|
|
41216
|
+
});
|
|
41217
|
+
}
|
|
41218
|
+
});
|
|
41219
|
+
}
|
|
41134
41220
|
// scenes
|
|
41135
41221
|
/**
|
|
41136
41222
|
* @deprecated Use {@link fetchScenes} instead.
|
|
41137
41223
|
*
|
|
41138
|
-
* @summary
|
|
41139
41224
|
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
41140
41225
|
*
|
|
41141
|
-
* @
|
|
41226
|
+
* @example
|
|
41142
41227
|
* ```ts
|
|
41143
41228
|
* await world.fetchSceneDropIds();
|
|
41144
41229
|
* ```
|
|
41145
41230
|
*
|
|
41146
|
-
* @
|
|
41231
|
+
* @returns
|
|
41147
41232
|
* ```ts
|
|
41148
41233
|
* { sceneDropIds: [] }
|
|
41149
41234
|
* ```
|
|
@@ -41161,15 +41246,16 @@ class World extends SDKController {
|
|
|
41161
41246
|
});
|
|
41162
41247
|
}
|
|
41163
41248
|
/**
|
|
41164
|
-
* @summary
|
|
41165
41249
|
* Fetch a list of all scene drop ids and dropped assets in a world
|
|
41166
41250
|
*
|
|
41167
|
-
* @
|
|
41251
|
+
* @category Scenes
|
|
41252
|
+
*
|
|
41253
|
+
* @example
|
|
41168
41254
|
* ```ts
|
|
41169
41255
|
* await world.fetchScenes();
|
|
41170
41256
|
* ```
|
|
41171
41257
|
*
|
|
41172
|
-
* @
|
|
41258
|
+
* @returns
|
|
41173
41259
|
* ```ts
|
|
41174
41260
|
* { "scenes": {
|
|
41175
41261
|
* "sceneDropId_1": {
|
|
@@ -41201,10 +41287,11 @@ class World extends SDKController {
|
|
|
41201
41287
|
});
|
|
41202
41288
|
}
|
|
41203
41289
|
/**
|
|
41204
|
-
* @summary
|
|
41205
41290
|
* Drops a scene in a world and returns sceneDropId.
|
|
41206
41291
|
*
|
|
41207
|
-
* @
|
|
41292
|
+
* @category Scenes
|
|
41293
|
+
*
|
|
41294
|
+
* @example
|
|
41208
41295
|
* ```ts
|
|
41209
41296
|
* await world.dropScene({
|
|
41210
41297
|
* "sceneId": "string",
|
|
@@ -41216,7 +41303,7 @@ class World extends SDKController {
|
|
|
41216
41303
|
* });
|
|
41217
41304
|
* ```
|
|
41218
41305
|
*
|
|
41219
|
-
* @
|
|
41306
|
+
* @returns
|
|
41220
41307
|
* ```ts
|
|
41221
41308
|
* { sceneDropId: sceneId-timestamp, success: true }
|
|
41222
41309
|
* ```
|
|
@@ -41234,10 +41321,11 @@ class World extends SDKController {
|
|
|
41234
41321
|
});
|
|
41235
41322
|
}
|
|
41236
41323
|
/**
|
|
41237
|
-
* @summary
|
|
41238
41324
|
* Replace the current scene of a world.
|
|
41239
41325
|
*
|
|
41240
|
-
* @
|
|
41326
|
+
* @category Scenes
|
|
41327
|
+
*
|
|
41328
|
+
* @example
|
|
41241
41329
|
* ```ts
|
|
41242
41330
|
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]]
|
|
41243
41331
|
* const style = {
|
|
@@ -41249,6 +41337,8 @@ class World extends SDKController {
|
|
|
41249
41337
|
* }
|
|
41250
41338
|
* await world.replaceScene(SCENE_ID);
|
|
41251
41339
|
* ```
|
|
41340
|
+
*
|
|
41341
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41252
41342
|
*/
|
|
41253
41343
|
replaceScene(sceneId) {
|
|
41254
41344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41261,12 +41351,15 @@ class World extends SDKController {
|
|
|
41261
41351
|
});
|
|
41262
41352
|
}
|
|
41263
41353
|
/**
|
|
41264
|
-
* @summary
|
|
41265
41354
|
* Get all particles available
|
|
41266
41355
|
*
|
|
41267
|
-
* @
|
|
41356
|
+
* @category Particles
|
|
41357
|
+
*
|
|
41358
|
+
* @example
|
|
41268
41359
|
* ```ts
|
|
41269
41360
|
* await world.getAllParticles();
|
|
41361
|
+
*
|
|
41362
|
+
* @returns {Promise<ResponseType>} Returns an array of particles or an error response.
|
|
41270
41363
|
* ```
|
|
41271
41364
|
*/
|
|
41272
41365
|
getAllParticles() {
|
|
@@ -41281,13 +41374,16 @@ class World extends SDKController {
|
|
|
41281
41374
|
});
|
|
41282
41375
|
}
|
|
41283
41376
|
/**
|
|
41284
|
-
* @summary
|
|
41285
41377
|
* Trigger a particle effect at a position in the world
|
|
41286
41378
|
*
|
|
41287
|
-
* @
|
|
41379
|
+
* @category Particles
|
|
41380
|
+
*
|
|
41381
|
+
* @example
|
|
41288
41382
|
* ```ts
|
|
41289
41383
|
* await world.triggerParticle({ name: "Flame" });
|
|
41290
41384
|
* ```
|
|
41385
|
+
*
|
|
41386
|
+
* @returns {Promise<ResponseType | string>} Returns `{ success: true }` or a message if no particleId is found.
|
|
41291
41387
|
*/
|
|
41292
41388
|
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
41293
41389
|
var _a;
|
|
@@ -41311,14 +41407,15 @@ class World extends SDKController {
|
|
|
41311
41407
|
});
|
|
41312
41408
|
}
|
|
41313
41409
|
/**
|
|
41314
|
-
* @summary
|
|
41315
41410
|
* Add an activity to a world
|
|
41316
41411
|
* excludeFromNotification is an array of visitorIds to exclude from the notification
|
|
41317
41412
|
*
|
|
41318
|
-
* @
|
|
41413
|
+
* @example
|
|
41319
41414
|
* ```ts
|
|
41320
41415
|
* await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
|
|
41321
41416
|
* ```
|
|
41417
|
+
*
|
|
41418
|
+
* @returns {Promise<ResponseType | string>} Returns the `activityId` or an error response.
|
|
41322
41419
|
*/
|
|
41323
41420
|
triggerActivity({ type, assetId, excludeFromNotification, }) {
|
|
41324
41421
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41333,10 +41430,9 @@ class World extends SDKController {
|
|
|
41333
41430
|
});
|
|
41334
41431
|
}
|
|
41335
41432
|
/**
|
|
41336
|
-
* @summary
|
|
41337
41433
|
* Display a message via a toast to all visitors currently in a world.
|
|
41338
41434
|
*
|
|
41339
|
-
* @
|
|
41435
|
+
* @example
|
|
41340
41436
|
* ```ts
|
|
41341
41437
|
* await world.fireToast({
|
|
41342
41438
|
* groupId: "custom-message",
|
|
@@ -41344,6 +41440,8 @@ class World extends SDKController {
|
|
|
41344
41440
|
* text: "Thank you for participating!",
|
|
41345
41441
|
* });
|
|
41346
41442
|
* ```
|
|
41443
|
+
*
|
|
41444
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41347
41445
|
*/
|
|
41348
41446
|
fireToast({ groupId, title, text }) {
|
|
41349
41447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41353,7 +41451,8 @@ class World extends SDKController {
|
|
|
41353
41451
|
text,
|
|
41354
41452
|
};
|
|
41355
41453
|
try {
|
|
41356
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/fire-toast`, params, this.requestOptions);
|
|
41454
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/fire-toast`, params, this.requestOptions);
|
|
41455
|
+
return response.data;
|
|
41357
41456
|
}
|
|
41358
41457
|
catch (error) {
|
|
41359
41458
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
@@ -41361,14 +41460,16 @@ class World extends SDKController {
|
|
|
41361
41460
|
});
|
|
41362
41461
|
}
|
|
41363
41462
|
/**
|
|
41364
|
-
* @summary
|
|
41365
41463
|
* 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.
|
|
41366
41464
|
*
|
|
41465
|
+
* @remarks
|
|
41367
41466
|
* 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
|
|
41368
41467
|
*
|
|
41369
|
-
* @
|
|
41468
|
+
* @category Data Objects
|
|
41469
|
+
*
|
|
41470
|
+
* @example
|
|
41370
41471
|
* ```ts
|
|
41371
|
-
* await world.incrementDataObjectValue(
|
|
41472
|
+
* await world.incrementDataObjectValue([`keyAssets.${keyAssetId}.totalItemsCollected.count`], 1);
|
|
41372
41473
|
* ```
|
|
41373
41474
|
*/
|
|
41374
41475
|
incrementDataObjectValue(path, amount, options = {}) {
|
|
@@ -41387,10 +41488,11 @@ class World extends SDKController {
|
|
|
41387
41488
|
}
|
|
41388
41489
|
////////// webhooks
|
|
41389
41490
|
/**
|
|
41390
|
-
* @summary
|
|
41391
41491
|
* Retrieve all webhooks in a world.
|
|
41392
41492
|
*
|
|
41393
|
-
* @
|
|
41493
|
+
* @category Webhooks
|
|
41494
|
+
*
|
|
41495
|
+
* @example
|
|
41394
41496
|
* ```ts
|
|
41395
41497
|
* await world.fetchWebhooks();
|
|
41396
41498
|
* const webhooks = world.webhooks;
|
|
@@ -41409,10 +41511,11 @@ class World extends SDKController {
|
|
|
41409
41511
|
}
|
|
41410
41512
|
////////// analytics
|
|
41411
41513
|
/**
|
|
41412
|
-
* @summary
|
|
41413
41514
|
* Retrieve world analytics by day, week, month, quarter, or year
|
|
41414
41515
|
*
|
|
41415
|
-
* @
|
|
41516
|
+
* @category Analytics
|
|
41517
|
+
*
|
|
41518
|
+
* @example
|
|
41416
41519
|
* ```ts
|
|
41417
41520
|
* const analytics = await world.fetchWorldAnalytics({
|
|
41418
41521
|
* periodType: "week",
|
|
@@ -41455,12 +41558,11 @@ _World_droppedAssetsMap = new WeakMap();
|
|
|
41455
41558
|
|
|
41456
41559
|
var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
41457
41560
|
/**
|
|
41458
|
-
* @summary
|
|
41459
41561
|
* Create an instance of User class with optional session credentials.
|
|
41460
41562
|
*
|
|
41461
|
-
* @
|
|
41563
|
+
* @example
|
|
41462
41564
|
* ```ts
|
|
41463
|
-
* await new User(topia, {
|
|
41565
|
+
* const user = await new User(topia, {
|
|
41464
41566
|
* profileId: 1,
|
|
41465
41567
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
41466
41568
|
* });
|
|
@@ -41493,14 +41595,15 @@ class User extends SDKController {
|
|
|
41493
41595
|
get worlds() {
|
|
41494
41596
|
return __classPrivateFieldGet(this, _User_worldsMap, "f");
|
|
41495
41597
|
}
|
|
41496
|
-
|
|
41497
|
-
* @summary
|
|
41598
|
+
/*
|
|
41498
41599
|
* Verify user has valid interactive credentials
|
|
41499
41600
|
*
|
|
41500
|
-
* @
|
|
41601
|
+
* @example
|
|
41501
41602
|
* ```ts
|
|
41502
41603
|
* await user.checkInteractiveCredentials();
|
|
41503
41604
|
* ```
|
|
41605
|
+
*
|
|
41606
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41504
41607
|
*/
|
|
41505
41608
|
checkInteractiveCredentials() {
|
|
41506
41609
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41514,13 +41617,16 @@ class User extends SDKController {
|
|
|
41514
41617
|
});
|
|
41515
41618
|
}
|
|
41516
41619
|
/**
|
|
41517
|
-
* @summary
|
|
41518
41620
|
* Returns all avatars owned by User
|
|
41519
41621
|
*
|
|
41520
|
-
* @
|
|
41622
|
+
* @category Avatars
|
|
41623
|
+
*
|
|
41624
|
+
* @example
|
|
41521
41625
|
* ```ts
|
|
41522
41626
|
* const avatars = await user.fetchAvatars();
|
|
41523
41627
|
* ```
|
|
41628
|
+
*
|
|
41629
|
+
* @returns {Promise<void | ResponseType>} Returns the avatars or an error.
|
|
41524
41630
|
*/
|
|
41525
41631
|
fetchAvatars() {
|
|
41526
41632
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41534,10 +41640,11 @@ class User extends SDKController {
|
|
|
41534
41640
|
});
|
|
41535
41641
|
}
|
|
41536
41642
|
/**
|
|
41537
|
-
* @summary
|
|
41538
41643
|
* Add a new avatar
|
|
41539
41644
|
*
|
|
41540
|
-
* @
|
|
41645
|
+
* @category Avatars
|
|
41646
|
+
*
|
|
41647
|
+
* @example
|
|
41541
41648
|
* ```ts
|
|
41542
41649
|
* const animationMeta = {
|
|
41543
41650
|
* "emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
|
|
@@ -41615,10 +41722,11 @@ class User extends SDKController {
|
|
|
41615
41722
|
});
|
|
41616
41723
|
}
|
|
41617
41724
|
/**
|
|
41618
|
-
* @summary
|
|
41619
41725
|
* Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
|
|
41620
41726
|
*
|
|
41621
|
-
* @
|
|
41727
|
+
* @category Avatars
|
|
41728
|
+
*
|
|
41729
|
+
* @example
|
|
41622
41730
|
* ```ts
|
|
41623
41731
|
* const animationMeta = {
|
|
41624
41732
|
* "emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
|
|
@@ -41696,10 +41804,11 @@ class User extends SDKController {
|
|
|
41696
41804
|
});
|
|
41697
41805
|
}
|
|
41698
41806
|
/**
|
|
41699
|
-
* @summary
|
|
41700
41807
|
* Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
|
|
41701
41808
|
*
|
|
41702
|
-
* @
|
|
41809
|
+
* @category Avatars
|
|
41810
|
+
*
|
|
41811
|
+
* @example
|
|
41703
41812
|
* ```ts
|
|
41704
41813
|
* await user.deleteAvatar("exampleAvatarId");
|
|
41705
41814
|
* ```
|
|
@@ -41716,10 +41825,11 @@ class User extends SDKController {
|
|
|
41716
41825
|
});
|
|
41717
41826
|
}
|
|
41718
41827
|
/**
|
|
41719
|
-
* @summary
|
|
41720
41828
|
* Returns all assets owned by User when an email address is provided.
|
|
41721
41829
|
*
|
|
41722
|
-
* @
|
|
41830
|
+
* @category Assets
|
|
41831
|
+
*
|
|
41832
|
+
* @example
|
|
41723
41833
|
* ```ts
|
|
41724
41834
|
* await user.fetchAssets();
|
|
41725
41835
|
* const userAssets = user.assets;
|
|
@@ -41745,13 +41855,16 @@ class User extends SDKController {
|
|
|
41745
41855
|
});
|
|
41746
41856
|
}
|
|
41747
41857
|
/**
|
|
41748
|
-
* @summary
|
|
41749
41858
|
* Returns all platform assets.
|
|
41750
41859
|
*
|
|
41751
|
-
* @
|
|
41860
|
+
* @category Assets
|
|
41861
|
+
*
|
|
41862
|
+
* @example
|
|
41752
41863
|
* ```ts
|
|
41753
41864
|
* const assets = await user.fetchPlatformAssets();
|
|
41754
41865
|
* ```
|
|
41866
|
+
*
|
|
41867
|
+
* @returns {Promise<object | ResponseType>} Returns the platform assets or an error response.
|
|
41755
41868
|
*/
|
|
41756
41869
|
fetchPlatformAssets() {
|
|
41757
41870
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41765,10 +41878,11 @@ class User extends SDKController {
|
|
|
41765
41878
|
});
|
|
41766
41879
|
}
|
|
41767
41880
|
/**
|
|
41768
|
-
* @summary
|
|
41769
41881
|
* Returns all scenes owned by User.
|
|
41770
41882
|
*
|
|
41771
|
-
* @
|
|
41883
|
+
* @category Scenes
|
|
41884
|
+
*
|
|
41885
|
+
* @example
|
|
41772
41886
|
* ```ts
|
|
41773
41887
|
* await user.fetchScenes();
|
|
41774
41888
|
* const userScenes = user.scenes;
|
|
@@ -41794,18 +41908,17 @@ class User extends SDKController {
|
|
|
41794
41908
|
});
|
|
41795
41909
|
}
|
|
41796
41910
|
/**
|
|
41797
|
-
*
|
|
41798
|
-
*
|
|
41799
|
-
*
|
|
41800
|
-
* and creates new map of Worlds accessible via user.worlds.
|
|
41911
|
+
* 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.
|
|
41912
|
+
*
|
|
41913
|
+
* @category Worlds
|
|
41801
41914
|
*
|
|
41802
|
-
* @
|
|
41915
|
+
* @example
|
|
41803
41916
|
* ```ts
|
|
41804
41917
|
* await user.fetchWorldsByKey();
|
|
41805
41918
|
* const userWorlds = user.worlds;
|
|
41806
41919
|
* ```
|
|
41807
41920
|
*
|
|
41808
|
-
* @
|
|
41921
|
+
* @returns
|
|
41809
41922
|
* ```ts
|
|
41810
41923
|
* { urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
|
|
41811
41924
|
* ```
|
|
@@ -41830,12 +41943,11 @@ class User extends SDKController {
|
|
|
41830
41943
|
});
|
|
41831
41944
|
}
|
|
41832
41945
|
/**
|
|
41833
|
-
*
|
|
41834
|
-
* Retrieves all worlds a user with matching API Key is an admin in,
|
|
41835
|
-
* creates a new World object for each,
|
|
41836
|
-
* and creates new map of Worlds accessible via user.adminWorlds.
|
|
41946
|
+
* Retrieves 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.
|
|
41837
41947
|
*
|
|
41838
|
-
* @
|
|
41948
|
+
* @category Worlds
|
|
41949
|
+
*
|
|
41950
|
+
* @example
|
|
41839
41951
|
* ```ts
|
|
41840
41952
|
* await user.fetchAdminWorldsByKey();
|
|
41841
41953
|
* const adminWorlds = user.adminWorlds;
|
|
@@ -41860,14 +41972,17 @@ class User extends SDKController {
|
|
|
41860
41972
|
});
|
|
41861
41973
|
}
|
|
41862
41974
|
/**
|
|
41863
|
-
* @summary
|
|
41864
41975
|
* Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
|
|
41865
41976
|
*
|
|
41866
|
-
* @
|
|
41977
|
+
* @category Dropped Assets
|
|
41978
|
+
*
|
|
41979
|
+
* @example
|
|
41867
41980
|
* ```ts
|
|
41868
41981
|
* await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
|
|
41869
41982
|
* const interactiveWorlds = user.interactiveWorlds;
|
|
41870
41983
|
* ```
|
|
41984
|
+
*
|
|
41985
|
+
* @returns {Promise<object | ResponseType>} Returns the `urlSlugs` of worlds where the Public Key is found or an error response.
|
|
41871
41986
|
*/
|
|
41872
41987
|
fetchInteractiveWorldsByKey(interactivePublicKey) {
|
|
41873
41988
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41881,14 +41996,15 @@ class User extends SDKController {
|
|
|
41881
41996
|
});
|
|
41882
41997
|
}
|
|
41883
41998
|
/**
|
|
41884
|
-
* @summary
|
|
41885
41999
|
* Send an email
|
|
41886
42000
|
*
|
|
41887
|
-
* @
|
|
42001
|
+
* @example
|
|
41888
42002
|
* ```ts
|
|
41889
42003
|
* const html = `<p><b>Hello World!</b></p><p>This email is being sent from via SDK.</p>`
|
|
41890
42004
|
* await user.sendEmail({ html, subject: "Example", to: "example@email.io" });
|
|
41891
42005
|
* ```
|
|
42006
|
+
*
|
|
42007
|
+
* @returns {Promise<object | ResponseType>} Returns `{ success: true }` if the email is sent successfully or an error response.
|
|
41892
42008
|
*/
|
|
41893
42009
|
sendEmail({ html, subject, to, }) {
|
|
41894
42010
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41903,13 +42019,16 @@ class User extends SDKController {
|
|
|
41903
42019
|
});
|
|
41904
42020
|
}
|
|
41905
42021
|
/**
|
|
41906
|
-
* @summary
|
|
41907
42022
|
* Get expressions
|
|
41908
42023
|
*
|
|
41909
|
-
* @
|
|
42024
|
+
* @category Expressions
|
|
42025
|
+
*
|
|
42026
|
+
* @example
|
|
41910
42027
|
* ```ts
|
|
41911
42028
|
* await user.getExpressions({ getUnlockablesOnly: true, });
|
|
41912
42029
|
* ```
|
|
42030
|
+
*
|
|
42031
|
+
* @returns {Promise<ResponseType>} Returns an array of expressions or an error response.
|
|
41913
42032
|
*/
|
|
41914
42033
|
getExpressions({ name, getUnlockablesOnly, }) {
|
|
41915
42034
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41926,13 +42045,16 @@ class User extends SDKController {
|
|
|
41926
42045
|
});
|
|
41927
42046
|
}
|
|
41928
42047
|
/**
|
|
41929
|
-
* @summary
|
|
41930
42048
|
* Retrieves the data object for a user.
|
|
41931
42049
|
*
|
|
41932
|
-
* @
|
|
42050
|
+
* @category Data Objects
|
|
42051
|
+
*
|
|
42052
|
+
* @example
|
|
41933
42053
|
* ```ts
|
|
41934
42054
|
* const dataObject = await user.fetchDataObject();
|
|
41935
42055
|
* ```
|
|
42056
|
+
*
|
|
42057
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
41936
42058
|
*/
|
|
41937
42059
|
fetchDataObject(appPublicKey, appJWT) {
|
|
41938
42060
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41952,16 +42074,24 @@ class User extends SDKController {
|
|
|
41952
42074
|
});
|
|
41953
42075
|
}
|
|
41954
42076
|
/**
|
|
41955
|
-
* @summary
|
|
41956
42077
|
* Sets the data object for a user.
|
|
41957
42078
|
*
|
|
42079
|
+
* @remarks
|
|
41958
42080
|
* 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
|
|
41959
42081
|
*
|
|
41960
|
-
* @
|
|
42082
|
+
* @category Data Objects
|
|
42083
|
+
*
|
|
42084
|
+
* @example
|
|
41961
42085
|
* ```ts
|
|
41962
|
-
* await user.setDataObject(
|
|
41963
|
-
*
|
|
41964
|
-
*
|
|
42086
|
+
* await user.setDataObject(
|
|
42087
|
+
* { itemsCollected: 0 },
|
|
42088
|
+
* {
|
|
42089
|
+
* analytics: [{ analyticName: "resets"} ],
|
|
42090
|
+
* lock: { lockId: `${assetId}-${itemsCollected}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
|
|
42091
|
+
* },
|
|
42092
|
+
* );
|
|
42093
|
+
*
|
|
42094
|
+
* const { itemsCollected } = user.dataObject;
|
|
41965
42095
|
* ```
|
|
41966
42096
|
*/
|
|
41967
42097
|
setDataObject(dataObject, options = {}) {
|
|
@@ -41978,16 +42108,22 @@ class User extends SDKController {
|
|
|
41978
42108
|
});
|
|
41979
42109
|
}
|
|
41980
42110
|
/**
|
|
41981
|
-
* @summary
|
|
41982
42111
|
* Updates the data object for a user.
|
|
41983
42112
|
*
|
|
42113
|
+
* @remarks
|
|
41984
42114
|
* 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
|
|
41985
42115
|
*
|
|
41986
|
-
* @
|
|
42116
|
+
* @category Data Objects
|
|
42117
|
+
*
|
|
42118
|
+
* @example
|
|
41987
42119
|
* ```ts
|
|
42120
|
+
* const theme = "exampleTheme";
|
|
42121
|
+
*
|
|
41988
42122
|
* await user.updateDataObject({
|
|
41989
|
-
*
|
|
42123
|
+
* [`${theme}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
41990
42124
|
* });
|
|
42125
|
+
*
|
|
42126
|
+
* const { exampleTheme } = user.dataObject;
|
|
41991
42127
|
* ```
|
|
41992
42128
|
*/
|
|
41993
42129
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -42004,12 +42140,14 @@ class User extends SDKController {
|
|
|
42004
42140
|
});
|
|
42005
42141
|
}
|
|
42006
42142
|
/**
|
|
42007
|
-
* @summary
|
|
42008
42143
|
* 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.
|
|
42009
42144
|
*
|
|
42145
|
+
* @remarks
|
|
42010
42146
|
* 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
|
|
42011
42147
|
*
|
|
42012
|
-
* @
|
|
42148
|
+
* @category Data Objects
|
|
42149
|
+
*
|
|
42150
|
+
* @example
|
|
42013
42151
|
* ```ts
|
|
42014
42152
|
* await user.incrementDataObjectValue("key", 1);
|
|
42015
42153
|
* ```
|
|
@@ -42028,12 +42166,11 @@ class User extends SDKController {
|
|
|
42028
42166
|
_User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
42029
42167
|
|
|
42030
42168
|
/**
|
|
42031
|
-
* @summary
|
|
42032
42169
|
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
42033
42170
|
*
|
|
42034
|
-
* @
|
|
42171
|
+
* @example
|
|
42035
42172
|
* ```ts
|
|
42036
|
-
* await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
|
|
42173
|
+
* const visitor = await new Visitor(topia, id, urlSlug, { attributes: { moveTo: { x: 0, y: 0 } }, credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" } });
|
|
42037
42174
|
* ```
|
|
42038
42175
|
*/
|
|
42039
42176
|
class Visitor extends User {
|
|
@@ -42044,15 +42181,14 @@ class Visitor extends User {
|
|
|
42044
42181
|
this.urlSlug = urlSlug;
|
|
42045
42182
|
}
|
|
42046
42183
|
/**
|
|
42047
|
-
* @summary
|
|
42048
42184
|
* Get a single visitor from a world
|
|
42049
42185
|
*
|
|
42050
|
-
* @
|
|
42186
|
+
* @example
|
|
42051
42187
|
* ```ts
|
|
42052
42188
|
* await visitor.fetchVisitor();
|
|
42053
42189
|
* ```
|
|
42054
42190
|
*
|
|
42055
|
-
* @
|
|
42191
|
+
* @returns
|
|
42056
42192
|
* Returns details for a visitor in a world by id and urlSlug
|
|
42057
42193
|
*/
|
|
42058
42194
|
fetchVisitor() {
|
|
@@ -42078,10 +42214,9 @@ class Visitor extends User {
|
|
|
42078
42214
|
});
|
|
42079
42215
|
}
|
|
42080
42216
|
/**
|
|
42081
|
-
* @summary
|
|
42082
42217
|
* Teleport or walk a visitor currently in a world to a single set of coordinates.
|
|
42083
42218
|
*
|
|
42084
|
-
* @
|
|
42219
|
+
* @example
|
|
42085
42220
|
* ```ts
|
|
42086
42221
|
* await visitor.moveVisitor({
|
|
42087
42222
|
* shouldTeleportVisitor: true,
|
|
@@ -42090,19 +42225,20 @@ class Visitor extends User {
|
|
|
42090
42225
|
* });
|
|
42091
42226
|
* ```
|
|
42092
42227
|
*
|
|
42093
|
-
* @
|
|
42094
|
-
*
|
|
42228
|
+
* @returns
|
|
42229
|
+
* Returns `{ success: true }` if the visitor was moved successfully.
|
|
42095
42230
|
*/
|
|
42096
42231
|
moveVisitor({ shouldTeleportVisitor, x, y }) {
|
|
42097
42232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42098
42233
|
try {
|
|
42099
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/move`, {
|
|
42234
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/move`, {
|
|
42100
42235
|
moveTo: {
|
|
42101
42236
|
x,
|
|
42102
42237
|
y,
|
|
42103
42238
|
},
|
|
42104
42239
|
teleport: shouldTeleportVisitor,
|
|
42105
42240
|
}, this.requestOptions);
|
|
42241
|
+
return response.data;
|
|
42106
42242
|
}
|
|
42107
42243
|
catch (error) {
|
|
42108
42244
|
throw this.errorHandler({ error, params: { shouldTeleportVisitor, x, y }, sdkMethod: "Visitor.moveVisitor" });
|
|
@@ -42110,10 +42246,9 @@ class Visitor extends User {
|
|
|
42110
42246
|
});
|
|
42111
42247
|
}
|
|
42112
42248
|
/**
|
|
42113
|
-
* @summary
|
|
42114
42249
|
* Display a message via a toast to a visitor currently in a world.
|
|
42115
42250
|
*
|
|
42116
|
-
* @
|
|
42251
|
+
* @example
|
|
42117
42252
|
* ```ts
|
|
42118
42253
|
* await visitor.fireToast({
|
|
42119
42254
|
* groupId: "custom-message",
|
|
@@ -42121,6 +42256,8 @@ class Visitor extends User {
|
|
|
42121
42256
|
* text: "Thank you for participating!",
|
|
42122
42257
|
* });
|
|
42123
42258
|
* ```
|
|
42259
|
+
*
|
|
42260
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42124
42261
|
*/
|
|
42125
42262
|
fireToast({ groupId, title, text }) {
|
|
42126
42263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42130,7 +42267,8 @@ class Visitor extends User {
|
|
|
42130
42267
|
text,
|
|
42131
42268
|
};
|
|
42132
42269
|
try {
|
|
42133
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, params, this.requestOptions);
|
|
42270
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, params, this.requestOptions);
|
|
42271
|
+
return response.data;
|
|
42134
42272
|
}
|
|
42135
42273
|
catch (error) {
|
|
42136
42274
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
@@ -42138,10 +42276,11 @@ class Visitor extends User {
|
|
|
42138
42276
|
});
|
|
42139
42277
|
}
|
|
42140
42278
|
/**
|
|
42141
|
-
* @summary
|
|
42142
42279
|
* Open an iframe in a drawer or modal for a visitor currently in a world.
|
|
42143
42280
|
*
|
|
42144
|
-
* @
|
|
42281
|
+
* @category iframes
|
|
42282
|
+
*
|
|
42283
|
+
* @example
|
|
42145
42284
|
* ```ts
|
|
42146
42285
|
* await visitor.openIframe({
|
|
42147
42286
|
* droppedAssetId: "droppedAssetId",
|
|
@@ -42150,6 +42289,8 @@ class Visitor extends User {
|
|
|
42150
42289
|
* title: "Hello World",
|
|
42151
42290
|
* });
|
|
42152
42291
|
* ```
|
|
42292
|
+
*
|
|
42293
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42153
42294
|
*/
|
|
42154
42295
|
openIframe({ droppedAssetId, link, shouldOpenInDrawer, title, }) {
|
|
42155
42296
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42160,7 +42301,8 @@ class Visitor extends User {
|
|
|
42160
42301
|
title,
|
|
42161
42302
|
};
|
|
42162
42303
|
try {
|
|
42163
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, params, this.requestOptions);
|
|
42304
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, params, this.requestOptions);
|
|
42305
|
+
return response.data;
|
|
42164
42306
|
}
|
|
42165
42307
|
catch (error) {
|
|
42166
42308
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.openIframe" });
|
|
@@ -42168,18 +42310,22 @@ class Visitor extends User {
|
|
|
42168
42310
|
});
|
|
42169
42311
|
}
|
|
42170
42312
|
/**
|
|
42171
|
-
* @summary
|
|
42172
42313
|
* Reload an iframe for a visitor currently in a world.
|
|
42173
42314
|
*
|
|
42174
|
-
* @
|
|
42315
|
+
* @category iframes
|
|
42316
|
+
*
|
|
42317
|
+
* @example
|
|
42175
42318
|
* ```ts
|
|
42176
42319
|
* await visitor.reloadIframe("droppedAssetId");
|
|
42177
42320
|
* ```
|
|
42321
|
+
*
|
|
42322
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42178
42323
|
*/
|
|
42179
42324
|
reloadIframe(droppedAssetId) {
|
|
42180
42325
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42181
42326
|
try {
|
|
42182
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/reload-iframe`, { droppedAssetId }, this.requestOptions);
|
|
42327
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/reload-iframe`, { droppedAssetId }, this.requestOptions);
|
|
42328
|
+
return response.data;
|
|
42183
42329
|
}
|
|
42184
42330
|
catch (error) {
|
|
42185
42331
|
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "Visitor.reloadIframe" });
|
|
@@ -42187,18 +42333,22 @@ class Visitor extends User {
|
|
|
42187
42333
|
});
|
|
42188
42334
|
}
|
|
42189
42335
|
/**
|
|
42190
|
-
* @summary
|
|
42191
42336
|
* Close an iframe for a visitor currently in a world.
|
|
42192
42337
|
*
|
|
42193
|
-
* @
|
|
42338
|
+
* @category iframes
|
|
42339
|
+
*
|
|
42340
|
+
* @example
|
|
42194
42341
|
* ```ts
|
|
42195
42342
|
* await visitor.closeIframe("droppedAssetId");
|
|
42196
42343
|
* ```
|
|
42344
|
+
*
|
|
42345
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42197
42346
|
*/
|
|
42198
42347
|
closeIframe(droppedAssetId) {
|
|
42199
42348
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42200
42349
|
try {
|
|
42201
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/close-iframe`, { droppedAssetId }, this.requestOptions);
|
|
42350
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/close-iframe`, { droppedAssetId }, this.requestOptions);
|
|
42351
|
+
return response.data;
|
|
42202
42352
|
}
|
|
42203
42353
|
catch (error) {
|
|
42204
42354
|
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "Visitor.closeIframe" });
|
|
@@ -42206,18 +42356,20 @@ class Visitor extends User {
|
|
|
42206
42356
|
});
|
|
42207
42357
|
}
|
|
42208
42358
|
/**
|
|
42209
|
-
* @summary
|
|
42210
42359
|
* Mute and turn video off for a visitor currently in a world.
|
|
42211
42360
|
*
|
|
42212
|
-
* @
|
|
42361
|
+
* @example
|
|
42213
42362
|
* ```ts
|
|
42214
42363
|
* await visitor.turnAVOff();
|
|
42215
42364
|
* ```
|
|
42365
|
+
*
|
|
42366
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42216
42367
|
*/
|
|
42217
42368
|
turnAVOff() {
|
|
42218
42369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42219
42370
|
try {
|
|
42220
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/turn-av-off`, {}, this.requestOptions);
|
|
42371
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/turn-av-off`, {}, this.requestOptions);
|
|
42372
|
+
return response.data;
|
|
42221
42373
|
}
|
|
42222
42374
|
catch (error) {
|
|
42223
42375
|
throw this.errorHandler({ error, sdkMethod: "Visitor.turnAVOff" });
|
|
@@ -42225,13 +42377,15 @@ class Visitor extends User {
|
|
|
42225
42377
|
});
|
|
42226
42378
|
}
|
|
42227
42379
|
/**
|
|
42228
|
-
* @summary
|
|
42229
42380
|
* Get expressions
|
|
42230
42381
|
*
|
|
42231
|
-
* @
|
|
42382
|
+
* @category Expressions
|
|
42383
|
+
*
|
|
42384
|
+
* @example
|
|
42232
42385
|
* ```ts
|
|
42233
42386
|
* await visitor.getExpressions({ getUnlockablesOnly: true, });
|
|
42234
42387
|
* ```
|
|
42388
|
+
* @returns {Promise<ResponseType>} Returns an array of expressions or an error response.
|
|
42235
42389
|
*/
|
|
42236
42390
|
getExpressions({ name, getUnlockablesOnly, }) {
|
|
42237
42391
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42248,14 +42402,17 @@ class Visitor extends User {
|
|
|
42248
42402
|
});
|
|
42249
42403
|
}
|
|
42250
42404
|
/**
|
|
42251
|
-
* @summary
|
|
42252
42405
|
* Grant expression to a visitor by id or name.
|
|
42253
42406
|
*
|
|
42254
|
-
* @
|
|
42407
|
+
* @category Expressions
|
|
42408
|
+
*
|
|
42409
|
+
* @example
|
|
42255
42410
|
* ```ts
|
|
42256
42411
|
* await visitor.grantExpression({ id: "exampleExpressionId" });
|
|
42257
42412
|
* await visitor.grantExpression({ name: "exampleExpressionName" });
|
|
42258
42413
|
* ```
|
|
42414
|
+
*
|
|
42415
|
+
* @returns {Promise<ResponseType>} Returns `{ success: true }` if the expression was granted successfully or an error response.
|
|
42259
42416
|
*/
|
|
42260
42417
|
grantExpression({ id, name }) {
|
|
42261
42418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42276,13 +42433,16 @@ class Visitor extends User {
|
|
|
42276
42433
|
});
|
|
42277
42434
|
}
|
|
42278
42435
|
/**
|
|
42279
|
-
* @summary
|
|
42280
42436
|
* Get all particles available
|
|
42281
42437
|
*
|
|
42282
|
-
* @
|
|
42438
|
+
* @category Particle Effects
|
|
42439
|
+
*
|
|
42440
|
+
* @example
|
|
42283
42441
|
* ```ts
|
|
42284
42442
|
* await visitor.getAllParticles();
|
|
42285
42443
|
* ```
|
|
42444
|
+
*
|
|
42445
|
+
* @returns {Promise<ResponseType>} Returns an array of particles or an error response.
|
|
42286
42446
|
*/
|
|
42287
42447
|
getAllParticles() {
|
|
42288
42448
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42296,13 +42456,16 @@ class Visitor extends User {
|
|
|
42296
42456
|
});
|
|
42297
42457
|
}
|
|
42298
42458
|
/**
|
|
42299
|
-
* @summary
|
|
42300
42459
|
* Trigger a particle effect on a visitor
|
|
42301
42460
|
*
|
|
42302
|
-
* @
|
|
42461
|
+
* @category Particle Effects
|
|
42462
|
+
*
|
|
42463
|
+
* @example
|
|
42303
42464
|
* ```ts
|
|
42304
42465
|
* await visitor.triggerParticle({ name: "Flame" });
|
|
42305
42466
|
* ```
|
|
42467
|
+
*
|
|
42468
|
+
* @returns {Promise<ResponseType | string>} Returns `{ success: true }` or a message if no particleId is found.
|
|
42306
42469
|
*/
|
|
42307
42470
|
triggerParticle({ id, name, duration = 10, }) {
|
|
42308
42471
|
var _a;
|
|
@@ -42326,13 +42489,16 @@ class Visitor extends User {
|
|
|
42326
42489
|
});
|
|
42327
42490
|
}
|
|
42328
42491
|
/**
|
|
42329
|
-
* @summary
|
|
42330
42492
|
* Retrieves the data object for a visitor.
|
|
42331
42493
|
*
|
|
42332
|
-
* @
|
|
42494
|
+
* @category Data Objects
|
|
42495
|
+
*
|
|
42496
|
+
* @example
|
|
42333
42497
|
* ```ts
|
|
42334
42498
|
* const dataObject = await visitor.fetchDataObject();
|
|
42335
42499
|
* ```
|
|
42500
|
+
*
|
|
42501
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
42336
42502
|
*/
|
|
42337
42503
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42338
42504
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42350,16 +42516,24 @@ class Visitor extends User {
|
|
|
42350
42516
|
});
|
|
42351
42517
|
}
|
|
42352
42518
|
/**
|
|
42353
|
-
* @summary
|
|
42354
42519
|
* Sets the data object for a visitor.
|
|
42355
42520
|
*
|
|
42521
|
+
* @remarks
|
|
42356
42522
|
* 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
|
|
42357
42523
|
*
|
|
42358
|
-
* @
|
|
42524
|
+
* @category Data Objects
|
|
42525
|
+
*
|
|
42526
|
+
* @example
|
|
42359
42527
|
* ```ts
|
|
42360
|
-
* await visitor.setDataObject(
|
|
42361
|
-
*
|
|
42362
|
-
*
|
|
42528
|
+
* await visitor.setDataObject(
|
|
42529
|
+
* { itemsCollected: 0 },
|
|
42530
|
+
* {
|
|
42531
|
+
* analytics: [{ analyticName: "resets"} ],
|
|
42532
|
+
* lock: { lockId: `${assetId}-${itemsCollected}-${new Date(Math.round(new Date().getTime() / 10000) * 10000)}` },
|
|
42533
|
+
* },
|
|
42534
|
+
* );
|
|
42535
|
+
*
|
|
42536
|
+
* const { itemsCollected } = visitor.dataObject;
|
|
42363
42537
|
* ```
|
|
42364
42538
|
*/
|
|
42365
42539
|
setDataObject(dataObject, options = {}) {
|
|
@@ -42374,16 +42548,22 @@ class Visitor extends User {
|
|
|
42374
42548
|
});
|
|
42375
42549
|
}
|
|
42376
42550
|
/**
|
|
42377
|
-
* @summary
|
|
42378
42551
|
* Updates the data object for a visitor.
|
|
42379
42552
|
*
|
|
42553
|
+
* @remarks
|
|
42380
42554
|
* 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
|
|
42381
42555
|
*
|
|
42382
|
-
* @
|
|
42556
|
+
* @category Data Objects
|
|
42557
|
+
*
|
|
42558
|
+
* @example
|
|
42383
42559
|
* ```ts
|
|
42560
|
+
* const theme = "exampleTheme";
|
|
42561
|
+
*
|
|
42384
42562
|
* await visitor.updateDataObject({
|
|
42385
|
-
*
|
|
42563
|
+
* [`${theme}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
42386
42564
|
* });
|
|
42565
|
+
*
|
|
42566
|
+
* const { exampleTheme } = visitor.dataObject;
|
|
42387
42567
|
* ```
|
|
42388
42568
|
*/
|
|
42389
42569
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -42398,12 +42578,14 @@ class Visitor extends User {
|
|
|
42398
42578
|
});
|
|
42399
42579
|
}
|
|
42400
42580
|
/**
|
|
42401
|
-
* @summary
|
|
42402
42581
|
* Increments a specific value in the data object for a visitor by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
42403
42582
|
*
|
|
42583
|
+
* @remarks
|
|
42404
42584
|
* 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
|
|
42405
42585
|
*
|
|
42406
|
-
* @
|
|
42586
|
+
* @category Data Objects
|
|
42587
|
+
*
|
|
42588
|
+
* @example
|
|
42407
42589
|
* ```ts
|
|
42408
42590
|
* await visitor.incrementDataObjectValue("key", 1);
|
|
42409
42591
|
* ```
|
|
@@ -42423,10 +42605,9 @@ class Visitor extends User {
|
|
|
42423
42605
|
});
|
|
42424
42606
|
}
|
|
42425
42607
|
/**
|
|
42426
|
-
* @summary
|
|
42427
42608
|
* Update analytics for a given public key. Must have valid interactive credentials from a visitor in the world.
|
|
42428
42609
|
*
|
|
42429
|
-
* @
|
|
42610
|
+
* @example
|
|
42430
42611
|
* ```ts
|
|
42431
42612
|
* await visitor.updatePublicKeyAnalytics([{ analyticName: "joins", profileId, uniqueKey: profileId, urlSlug }]);
|
|
42432
42613
|
* ```
|
|
@@ -42446,10 +42627,9 @@ class Visitor extends User {
|
|
|
42446
42627
|
});
|
|
42447
42628
|
}
|
|
42448
42629
|
/**
|
|
42449
|
-
* @summary
|
|
42450
42630
|
* Setup signal to visitor
|
|
42451
42631
|
*
|
|
42452
|
-
* @
|
|
42632
|
+
* @example
|
|
42453
42633
|
* ```ts
|
|
42454
42634
|
* await visitor.sendSignalToVisitor(iceServers);
|
|
42455
42635
|
* ```
|
|
@@ -42472,12 +42652,11 @@ class Visitor extends User {
|
|
|
42472
42652
|
}
|
|
42473
42653
|
|
|
42474
42654
|
/**
|
|
42475
|
-
* @summary
|
|
42476
42655
|
* Create an instance of WebRTCConnector class with optional session credentials.
|
|
42477
42656
|
*
|
|
42478
|
-
* @
|
|
42657
|
+
* @example
|
|
42479
42658
|
* ```ts
|
|
42480
|
-
* await new WebRTCConnector(topia, {
|
|
42659
|
+
* const webRTC = await new WebRTCConnector(topia, {
|
|
42481
42660
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42482
42661
|
* });
|
|
42483
42662
|
* ```
|
|
@@ -42490,10 +42669,9 @@ class WebRTCConnector extends SDKController {
|
|
|
42490
42669
|
this.urlSlug = urlSlug;
|
|
42491
42670
|
}
|
|
42492
42671
|
/**
|
|
42493
|
-
* @summary
|
|
42494
42672
|
* Get twilio
|
|
42495
42673
|
*
|
|
42496
|
-
* @
|
|
42674
|
+
* @example
|
|
42497
42675
|
* ```ts
|
|
42498
42676
|
* await webRTCConnector.getTwilioConfig();
|
|
42499
42677
|
* ```
|
|
@@ -42514,14 +42692,14 @@ class WebRTCConnector extends SDKController {
|
|
|
42514
42692
|
|
|
42515
42693
|
var _WorldActivity_visitorsMap;
|
|
42516
42694
|
/**
|
|
42517
|
-
* @summary
|
|
42518
42695
|
* Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
|
|
42519
42696
|
*
|
|
42697
|
+
* @remarks
|
|
42520
42698
|
* This class is responsible for all activity of a specified world including editing dropped assets, moving current visitors, etc.
|
|
42521
42699
|
*
|
|
42522
|
-
* @
|
|
42700
|
+
* @example
|
|
42523
42701
|
* ```ts
|
|
42524
|
-
* await new WorldActivity(topia, "exampleWorld", {
|
|
42702
|
+
* const activity = await new WorldActivity(topia, "exampleWorld", {
|
|
42525
42703
|
* attributes: { name: "Example World" },
|
|
42526
42704
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42527
42705
|
* });
|
|
@@ -42568,13 +42746,16 @@ class WorldActivity extends SDKController {
|
|
|
42568
42746
|
});
|
|
42569
42747
|
}
|
|
42570
42748
|
/**
|
|
42571
|
-
* @summary
|
|
42572
42749
|
* Retrieve all visitors currently in a world.
|
|
42573
42750
|
*
|
|
42574
|
-
* @
|
|
42751
|
+
* @category Visitors
|
|
42752
|
+
*
|
|
42753
|
+
* @example
|
|
42575
42754
|
* ```ts
|
|
42576
42755
|
* const visitors = await worldActivity.currentVisitors("exampleLandmarkZoneId", true);
|
|
42577
42756
|
* ```
|
|
42757
|
+
*
|
|
42758
|
+
* @returns {Promise<void | ResponseType>} Returns the an object containing current visitors keyed by visitorId or an error.
|
|
42578
42759
|
*/
|
|
42579
42760
|
currentVisitors(shouldIncludeAdminPermissions) {
|
|
42580
42761
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42588,13 +42769,16 @@ class WorldActivity extends SDKController {
|
|
|
42588
42769
|
});
|
|
42589
42770
|
}
|
|
42590
42771
|
/**
|
|
42591
|
-
* @summary
|
|
42592
42772
|
* Retrieve all visitors currently in a Landmark Zone.
|
|
42593
42773
|
*
|
|
42594
|
-
* @
|
|
42774
|
+
* @category Visitors
|
|
42775
|
+
*
|
|
42776
|
+
* @example
|
|
42595
42777
|
* ```ts
|
|
42596
42778
|
* const visitors = await worldActivity.fetchVisitorsInZone({ droppedAssetId: "exampleDroppedAssetId" });
|
|
42597
42779
|
* ```
|
|
42780
|
+
*
|
|
42781
|
+
* @returns {Promise<void | ResponseType>} Returns the an object containing current visitors keyed by visitorId or an error.
|
|
42598
42782
|
*/
|
|
42599
42783
|
fetchVisitorsInZone({ droppedAssetId, shouldIncludeAdminPermissions, }) {
|
|
42600
42784
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42610,12 +42794,15 @@ class WorldActivity extends SDKController {
|
|
|
42610
42794
|
});
|
|
42611
42795
|
}
|
|
42612
42796
|
/**
|
|
42613
|
-
* @summary
|
|
42614
42797
|
* Move all visitors currently in a world to a single set of coordinates.
|
|
42798
|
+
*
|
|
42799
|
+
* @remarks
|
|
42615
42800
|
* Optionally refetch visitors, teleport or walk visitors to new location,
|
|
42616
42801
|
* and scatter visitors by any number so that they don't all move to the exact same location.
|
|
42617
42802
|
*
|
|
42618
|
-
* @
|
|
42803
|
+
* @category Visitors
|
|
42804
|
+
*
|
|
42805
|
+
* @example
|
|
42619
42806
|
* ```ts
|
|
42620
42807
|
* await worldActivity.moveAllVisitors({
|
|
42621
42808
|
* shouldFetchVisitors: true,
|
|
@@ -42626,7 +42813,7 @@ class WorldActivity extends SDKController {
|
|
|
42626
42813
|
* });
|
|
42627
42814
|
* ```
|
|
42628
42815
|
*
|
|
42629
|
-
* @
|
|
42816
|
+
* @returns
|
|
42630
42817
|
* Updates each Visitor instance and worldActivity.visitors map.
|
|
42631
42818
|
*/
|
|
42632
42819
|
moveAllVisitors({ shouldFetchVisitors = true, shouldTeleportVisitors = true, scatterVisitorsBy = 0, x, y, }) {
|
|
@@ -42647,10 +42834,11 @@ class WorldActivity extends SDKController {
|
|
|
42647
42834
|
});
|
|
42648
42835
|
}
|
|
42649
42836
|
/**
|
|
42650
|
-
* @summary
|
|
42651
42837
|
* Teleport or walk a list of visitors currently in a world to various coordinates.
|
|
42652
42838
|
*
|
|
42653
|
-
* @
|
|
42839
|
+
* @category Visitors
|
|
42840
|
+
*
|
|
42841
|
+
* @example
|
|
42654
42842
|
* ```ts
|
|
42655
42843
|
* const visitorsToMove = [
|
|
42656
42844
|
* {
|
|
@@ -42668,7 +42856,7 @@ class WorldActivity extends SDKController {
|
|
|
42668
42856
|
* await worldActivity.moveVisitors(visitorsToMove);
|
|
42669
42857
|
* ```
|
|
42670
42858
|
*
|
|
42671
|
-
* @
|
|
42859
|
+
* @returns
|
|
42672
42860
|
* Updates each Visitor instance and worldActivity.visitors map.
|
|
42673
42861
|
*/
|
|
42674
42862
|
moveVisitors(visitorsToMove) {
|
|
@@ -42685,7 +42873,7 @@ class WorldActivity extends SDKController {
|
|
|
42685
42873
|
_WorldActivity_visitorsMap = new WeakMap();
|
|
42686
42874
|
|
|
42687
42875
|
/**
|
|
42688
|
-
* @
|
|
42876
|
+
* @example
|
|
42689
42877
|
* ```ts
|
|
42690
42878
|
* const Asset = new AssetFactory(myTopiaInstance);
|
|
42691
42879
|
* ```
|
|
@@ -42695,22 +42883,22 @@ class AssetFactory extends SDKController {
|
|
|
42695
42883
|
super(topia);
|
|
42696
42884
|
}
|
|
42697
42885
|
/**
|
|
42698
|
-
* @summary
|
|
42699
42886
|
* Instantiate a new instance of Asset class.
|
|
42700
42887
|
*
|
|
42701
|
-
* @
|
|
42888
|
+
* @example
|
|
42702
42889
|
* ```
|
|
42703
42890
|
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42704
42891
|
* ```
|
|
42892
|
+
*
|
|
42893
|
+
* @returns {Asset} Returns a new Asset object with the asset id.
|
|
42705
42894
|
*/
|
|
42706
42895
|
create(id, options) {
|
|
42707
42896
|
return new Asset(this.topia, id, options);
|
|
42708
42897
|
}
|
|
42709
42898
|
/**
|
|
42710
|
-
* @summary
|
|
42711
42899
|
* Upload a new Asset and return a new instance of Asset class.
|
|
42712
42900
|
*
|
|
42713
|
-
* @
|
|
42901
|
+
* @example
|
|
42714
42902
|
* ```
|
|
42715
42903
|
* const assetPayload = {
|
|
42716
42904
|
* assetName: "exampleAssetName"
|
|
@@ -42722,6 +42910,8 @@ class AssetFactory extends SDKController {
|
|
|
42722
42910
|
* }
|
|
42723
42911
|
* const asset = await Asset.upload(assetPayload, apiKey);
|
|
42724
42912
|
* ```
|
|
42913
|
+
*
|
|
42914
|
+
* @returns {AssetType} Returns a new Asset object with the asset details.
|
|
42725
42915
|
*/
|
|
42726
42916
|
upload(assetPayload, apiKey) {
|
|
42727
42917
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42741,7 +42931,7 @@ class AssetFactory extends SDKController {
|
|
|
42741
42931
|
}
|
|
42742
42932
|
|
|
42743
42933
|
/**
|
|
42744
|
-
* @
|
|
42934
|
+
* @example
|
|
42745
42935
|
* ```ts
|
|
42746
42936
|
* const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
|
|
42747
42937
|
* ```
|
|
@@ -42751,25 +42941,27 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42751
42941
|
super(topia);
|
|
42752
42942
|
}
|
|
42753
42943
|
/**
|
|
42754
|
-
* @summary
|
|
42755
42944
|
* Instantiate a new instance of DroppedAsset class.
|
|
42756
42945
|
*
|
|
42757
|
-
* @
|
|
42946
|
+
* @example
|
|
42758
42947
|
* ```
|
|
42759
42948
|
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42760
42949
|
* ```
|
|
42950
|
+
*
|
|
42951
|
+
* @returns {DroppedAsset} Returns a new DroppedAsset object.
|
|
42761
42952
|
*/
|
|
42762
42953
|
create(id, urlSlug, options) {
|
|
42763
42954
|
return new DroppedAsset(this.topia, id, urlSlug, options);
|
|
42764
42955
|
}
|
|
42765
42956
|
/**
|
|
42766
|
-
* @summary
|
|
42767
42957
|
* Instantiate a new instance of DroppedAsset class and retrieve all properties.
|
|
42768
42958
|
*
|
|
42769
|
-
* @
|
|
42959
|
+
* @example
|
|
42770
42960
|
* ```
|
|
42771
42961
|
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42772
42962
|
* ```
|
|
42963
|
+
*
|
|
42964
|
+
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
|
|
42773
42965
|
*/
|
|
42774
42966
|
get(id, urlSlug, options) {
|
|
42775
42967
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42779,16 +42971,17 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42779
42971
|
});
|
|
42780
42972
|
}
|
|
42781
42973
|
/**
|
|
42782
|
-
* @summary
|
|
42783
42974
|
* Searches dropped assets within a world by a provide `uniqueName`. If a single match is found, a new instance of DroppedAsset class is returned all properties.
|
|
42784
42975
|
*
|
|
42785
|
-
* @
|
|
42976
|
+
* @remarks
|
|
42977
|
+
* This method leverages the handleGetDroppedAssetByUniqueName endpoint in the Public API and assumes there is exactly one dropped asset with matching uniqueName for the given urlSlug.
|
|
42978
|
+
*
|
|
42979
|
+
* @example
|
|
42786
42980
|
* ```
|
|
42787
42981
|
* const droppedAssetInstance = await DroppedAsset.getWithUniqueName("exampleUniqueName", urlSlug, interactiveSecret, credentials);
|
|
42788
42982
|
* ```
|
|
42789
42983
|
*
|
|
42790
|
-
* @
|
|
42791
|
-
* This method leverages the handleGetDroppedAssetByUniqueName endpoint in the Public API and assumes there is exactly one dropped asset with matching uniqueName for the given urlSlug.
|
|
42984
|
+
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
|
|
42792
42985
|
*/
|
|
42793
42986
|
getWithUniqueName(uniqueName, urlSlug, interactiveSecret, credentials) {
|
|
42794
42987
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42813,10 +43006,9 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42813
43006
|
});
|
|
42814
43007
|
}
|
|
42815
43008
|
/**
|
|
42816
|
-
* @summary
|
|
42817
43009
|
* Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
|
|
42818
43010
|
*
|
|
42819
|
-
* @
|
|
43011
|
+
* @example
|
|
42820
43012
|
* ```
|
|
42821
43013
|
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42822
43014
|
* const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
|
|
@@ -42831,6 +43023,8 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42831
43023
|
urlSlug,
|
|
42832
43024
|
});
|
|
42833
43025
|
* ```
|
|
43026
|
+
*
|
|
43027
|
+
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
|
|
42834
43028
|
*/
|
|
42835
43029
|
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textFontFamily, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
42836
43030
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42885,7 +43079,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42885
43079
|
}
|
|
42886
43080
|
|
|
42887
43081
|
/**
|
|
42888
|
-
* @
|
|
43082
|
+
* @example
|
|
42889
43083
|
* ```ts
|
|
42890
43084
|
* const Ecosystem = new EcosystemFactory(myTopiaInstance);
|
|
42891
43085
|
* ```
|
|
@@ -42895,13 +43089,14 @@ class EcosystemFactory {
|
|
|
42895
43089
|
this.topia = topia;
|
|
42896
43090
|
}
|
|
42897
43091
|
/**
|
|
42898
|
-
* @summary
|
|
42899
43092
|
* Instantiate a new instance of Ecosystem class.
|
|
42900
43093
|
*
|
|
42901
|
-
* @
|
|
43094
|
+
* @example
|
|
42902
43095
|
* ```
|
|
42903
43096
|
* const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
|
|
42904
43097
|
* ```
|
|
43098
|
+
*
|
|
43099
|
+
* @returns {Ecosystem} Returns a new Ecosystem object.
|
|
42905
43100
|
*/
|
|
42906
43101
|
create(options) {
|
|
42907
43102
|
return new Ecosystem(this.topia, options);
|
|
@@ -42909,7 +43104,7 @@ class EcosystemFactory {
|
|
|
42909
43104
|
}
|
|
42910
43105
|
|
|
42911
43106
|
/**
|
|
42912
|
-
* @
|
|
43107
|
+
* @example
|
|
42913
43108
|
* ```ts
|
|
42914
43109
|
* const Scene = new SceneFactory(myTopiaInstance);
|
|
42915
43110
|
* ```
|
|
@@ -42920,25 +43115,27 @@ class SceneFactory {
|
|
|
42920
43115
|
this.create;
|
|
42921
43116
|
}
|
|
42922
43117
|
/**
|
|
42923
|
-
* @summary
|
|
42924
43118
|
* Instantiate a new instance of Scene class.
|
|
42925
43119
|
*
|
|
42926
|
-
* @
|
|
43120
|
+
* @example
|
|
42927
43121
|
* ```
|
|
42928
43122
|
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42929
43123
|
* ```
|
|
43124
|
+
*
|
|
43125
|
+
* @returns {Scene} Returns a new Scene object.
|
|
42930
43126
|
*/
|
|
42931
43127
|
create(id, options) {
|
|
42932
43128
|
return new Scene(this.topia, id, options);
|
|
42933
43129
|
}
|
|
42934
43130
|
/**
|
|
42935
|
-
* @summary
|
|
42936
43131
|
* Instantiate a new instance of Scene class and retrieve all properties.
|
|
42937
43132
|
*
|
|
42938
|
-
* @
|
|
43133
|
+
* @example
|
|
42939
43134
|
* ```
|
|
42940
43135
|
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42941
43136
|
* ```
|
|
43137
|
+
*
|
|
43138
|
+
* @returns {Promise<Scene>} Returns a new Scene object with all properties.
|
|
42942
43139
|
*/
|
|
42943
43140
|
get(id, options) {
|
|
42944
43141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42950,7 +43147,7 @@ class SceneFactory {
|
|
|
42950
43147
|
}
|
|
42951
43148
|
|
|
42952
43149
|
/**
|
|
42953
|
-
* @
|
|
43150
|
+
* @example
|
|
42954
43151
|
* ```ts
|
|
42955
43152
|
* const User = new UserFactory(myTopiaInstance);
|
|
42956
43153
|
* ```
|
|
@@ -42960,13 +43157,14 @@ class UserFactory {
|
|
|
42960
43157
|
this.topia = topia;
|
|
42961
43158
|
}
|
|
42962
43159
|
/**
|
|
42963
|
-
* @summary
|
|
42964
43160
|
* Instantiate a new instance of User class.
|
|
42965
43161
|
*
|
|
42966
|
-
* @
|
|
43162
|
+
* @example
|
|
42967
43163
|
* ```
|
|
42968
43164
|
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42969
43165
|
* ```
|
|
43166
|
+
*
|
|
43167
|
+
* @returns {User} Returns a new User object.
|
|
42970
43168
|
*/
|
|
42971
43169
|
create(options) {
|
|
42972
43170
|
return new User(this.topia, options);
|
|
@@ -42974,7 +43172,7 @@ class UserFactory {
|
|
|
42974
43172
|
}
|
|
42975
43173
|
|
|
42976
43174
|
/**
|
|
42977
|
-
* @
|
|
43175
|
+
* @example
|
|
42978
43176
|
* ```ts
|
|
42979
43177
|
* const Visitor = new VisitorFactory(myTopiaInstance);
|
|
42980
43178
|
* ```
|
|
@@ -42984,25 +43182,27 @@ class VisitorFactory {
|
|
|
42984
43182
|
this.topia = topia;
|
|
42985
43183
|
}
|
|
42986
43184
|
/**
|
|
42987
|
-
* @summary
|
|
42988
43185
|
* Instantiate a new instance of Visitor class.
|
|
42989
43186
|
*
|
|
42990
|
-
* @
|
|
43187
|
+
* @example
|
|
42991
43188
|
* ```
|
|
42992
43189
|
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42993
43190
|
* ```
|
|
43191
|
+
*
|
|
43192
|
+
* @returns {Visitor} Returns a new Visitor object.
|
|
42994
43193
|
*/
|
|
42995
43194
|
create(id, urlSlug, options) {
|
|
42996
43195
|
return new Visitor(this.topia, id, urlSlug, options);
|
|
42997
43196
|
}
|
|
42998
43197
|
/**
|
|
42999
|
-
* @summary
|
|
43000
43198
|
* Instantiate a new instance of Visitor class and retrieve all properties.
|
|
43001
43199
|
*
|
|
43002
|
-
* @
|
|
43200
|
+
* @example
|
|
43003
43201
|
* ```
|
|
43004
43202
|
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43005
43203
|
* ```
|
|
43204
|
+
*
|
|
43205
|
+
* @returns {Promise<Visitor>} Returns a new Visitor object with all properties.
|
|
43006
43206
|
*/
|
|
43007
43207
|
get(id, urlSlug, options) {
|
|
43008
43208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -43014,7 +43214,7 @@ class VisitorFactory {
|
|
|
43014
43214
|
}
|
|
43015
43215
|
|
|
43016
43216
|
/**
|
|
43017
|
-
* @
|
|
43217
|
+
* @example
|
|
43018
43218
|
* ```ts
|
|
43019
43219
|
* const WebRTCConnector = new WebRTCConnectorFactory(myTopiaInstance);
|
|
43020
43220
|
* ```
|
|
@@ -43024,13 +43224,14 @@ class WebRTCConnectorFactory {
|
|
|
43024
43224
|
this.topia = topia;
|
|
43025
43225
|
}
|
|
43026
43226
|
/**
|
|
43027
|
-
* @summary
|
|
43028
43227
|
* Instantiate a new instance of WebRTCConnector class.
|
|
43029
43228
|
*
|
|
43030
|
-
* @
|
|
43229
|
+
* @example
|
|
43031
43230
|
* ```
|
|
43032
43231
|
* const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
|
|
43033
43232
|
* ```
|
|
43233
|
+
*
|
|
43234
|
+
* @returns {WebRTCConnector} Returns a new WebRTCConnector object.
|
|
43034
43235
|
*/
|
|
43035
43236
|
create(urlSlug, options) {
|
|
43036
43237
|
return new WebRTCConnector(this.topia, urlSlug, options);
|
|
@@ -43038,7 +43239,7 @@ class WebRTCConnectorFactory {
|
|
|
43038
43239
|
}
|
|
43039
43240
|
|
|
43040
43241
|
/**
|
|
43041
|
-
* @
|
|
43242
|
+
* @example
|
|
43042
43243
|
* ```ts
|
|
43043
43244
|
* const WorldActivity = new WorldActivityFactory(myTopiaInstance);
|
|
43044
43245
|
* ```
|
|
@@ -43048,13 +43249,14 @@ class WorldActivityFactory {
|
|
|
43048
43249
|
this.topia = topia;
|
|
43049
43250
|
}
|
|
43050
43251
|
/**
|
|
43051
|
-
* @summary
|
|
43052
43252
|
* Instantiate a new instance of WorldActivity class.
|
|
43053
43253
|
*
|
|
43054
|
-
* @
|
|
43254
|
+
* @example
|
|
43055
43255
|
* ```
|
|
43056
43256
|
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43057
43257
|
* ```
|
|
43258
|
+
*
|
|
43259
|
+
* @returns {WorldActivity} Returns a new WorldActivity object.
|
|
43058
43260
|
*/
|
|
43059
43261
|
create(urlSlug, options) {
|
|
43060
43262
|
return new WorldActivity(this.topia, urlSlug, options);
|
|
@@ -43062,7 +43264,7 @@ class WorldActivityFactory {
|
|
|
43062
43264
|
}
|
|
43063
43265
|
|
|
43064
43266
|
/**
|
|
43065
|
-
* @
|
|
43267
|
+
* @example
|
|
43066
43268
|
* ```ts
|
|
43067
43269
|
* const World = new WorldFactory(myTopiaInstance);
|
|
43068
43270
|
* ```
|
|
@@ -43072,25 +43274,27 @@ class WorldFactory extends SDKController {
|
|
|
43072
43274
|
super(topia);
|
|
43073
43275
|
}
|
|
43074
43276
|
/**
|
|
43075
|
-
* @summary
|
|
43076
43277
|
* Instantiate a new instance of World class.
|
|
43077
43278
|
*
|
|
43078
|
-
* @
|
|
43279
|
+
* @example
|
|
43079
43280
|
* ```
|
|
43080
43281
|
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43081
43282
|
* ```
|
|
43283
|
+
*
|
|
43284
|
+
* @returns {World} Returns a new World object.
|
|
43082
43285
|
*/
|
|
43083
43286
|
create(urlSlug, options) {
|
|
43084
43287
|
return new World(this.topia, urlSlug, options);
|
|
43085
43288
|
}
|
|
43086
43289
|
/**
|
|
43087
|
-
* @summary
|
|
43088
43290
|
* Deletes an array of Dropped Assets from within a world and returns success: true
|
|
43089
43291
|
*
|
|
43090
|
-
* @
|
|
43292
|
+
* @example
|
|
43091
43293
|
* ```
|
|
43092
43294
|
* await World.deleteDroppedAssets(urlSlug, ["exampleDroppedAssetId1", "exampleDroppedAssetId2"], interactiveSecret, credentials);
|
|
43093
43295
|
* ```
|
|
43296
|
+
*
|
|
43297
|
+
* @returns {Promise<{ success: boolean }>} Returns `{ success: true }` or an error.
|
|
43094
43298
|
*/
|
|
43095
43299
|
deleteDroppedAssets(urlSlug, droppedAssetIds, interactiveSecret, credentials) {
|
|
43096
43300
|
return __awaiter(this, void 0, void 0, function* () {
|