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