@rtsdk/topia 0.17.1 → 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 +549 -359
- package/dist/index.d.ts +496 -324
- package/dist/index.js +549 -359
- 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",
|
|
@@ -39847,12 +39845,11 @@ const scatterVisitors = (original, scatterBy) => {
|
|
|
39847
39845
|
|
|
39848
39846
|
var _DroppedAsset_updateDroppedAsset;
|
|
39849
39847
|
/**
|
|
39850
|
-
* @summary
|
|
39851
39848
|
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
39852
39849
|
*
|
|
39853
|
-
* @
|
|
39850
|
+
* @example
|
|
39854
39851
|
* ```ts
|
|
39855
|
-
* await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39852
|
+
* const droppedAsset = await new DroppedAsset(topia, "1giFZb0sQ3X27L7uGyQX", "example", {
|
|
39856
39853
|
* attributes: { text: "My Dropped Asset" },
|
|
39857
39854
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
39858
39855
|
* });
|
|
@@ -39865,7 +39862,9 @@ class DroppedAsset extends Asset {
|
|
|
39865
39862
|
// private methods
|
|
39866
39863
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39867
39864
|
try {
|
|
39868
|
-
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;
|
|
39869
39868
|
}
|
|
39870
39869
|
catch (error) {
|
|
39871
39870
|
throw this.errorHandler({ error, params: { payload, updateType }, sdkMethod: "DroppedAsset.updateDroppedAsset" });
|
|
@@ -39878,10 +39877,9 @@ class DroppedAsset extends Asset {
|
|
|
39878
39877
|
this.position = ((_b = options.attributes) === null || _b === void 0 ? void 0 : _b.position) || { x: 0, y: 0 };
|
|
39879
39878
|
}
|
|
39880
39879
|
/**
|
|
39881
|
-
*
|
|
39882
|
-
* Retrieves dropped asset details.
|
|
39880
|
+
* Retrieves dropped asset details and assigns response data to the instance.
|
|
39883
39881
|
*
|
|
39884
|
-
* @
|
|
39882
|
+
* @example
|
|
39885
39883
|
* ```ts
|
|
39886
39884
|
* await droppedAsset.fetchDroppedAssetById();
|
|
39887
39885
|
* const { assetName } = droppedAsset;
|
|
@@ -39901,10 +39899,9 @@ class DroppedAsset extends Asset {
|
|
|
39901
39899
|
});
|
|
39902
39900
|
}
|
|
39903
39901
|
/**
|
|
39904
|
-
*
|
|
39905
|
-
* 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.
|
|
39906
39903
|
*
|
|
39907
|
-
* @
|
|
39904
|
+
* @example
|
|
39908
39905
|
* ```ts
|
|
39909
39906
|
* const payload = {
|
|
39910
39907
|
* assetScale: 1,
|
|
@@ -39976,10 +39973,9 @@ class DroppedAsset extends Asset {
|
|
|
39976
39973
|
});
|
|
39977
39974
|
}
|
|
39978
39975
|
/**
|
|
39979
|
-
*
|
|
39980
|
-
* Delete dropped asset.
|
|
39976
|
+
* Deletes the dropped asset (removes it from the world).
|
|
39981
39977
|
*
|
|
39982
|
-
* @
|
|
39978
|
+
* @example
|
|
39983
39979
|
* ```ts
|
|
39984
39980
|
* await droppedAsset.deleteDroppedAsset();
|
|
39985
39981
|
* ```
|
|
@@ -39995,13 +39991,16 @@ class DroppedAsset extends Asset {
|
|
|
39995
39991
|
});
|
|
39996
39992
|
}
|
|
39997
39993
|
/**
|
|
39998
|
-
* @summary
|
|
39999
39994
|
* Retrieves the data object for a dropped asset.
|
|
40000
39995
|
*
|
|
40001
|
-
* @
|
|
39996
|
+
* @category Data Objects
|
|
39997
|
+
*
|
|
39998
|
+
* @example
|
|
40002
39999
|
* ```ts
|
|
40003
40000
|
* const dataObject = await droppedAsset.fetchDataObject();
|
|
40004
40001
|
* ```
|
|
40002
|
+
*
|
|
40003
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
40005
40004
|
*/
|
|
40006
40005
|
fetchDataObject(appPublicKey, appJWT) {
|
|
40007
40006
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40019,16 +40018,24 @@ class DroppedAsset extends Asset {
|
|
|
40019
40018
|
});
|
|
40020
40019
|
}
|
|
40021
40020
|
/**
|
|
40022
|
-
*
|
|
40023
|
-
* 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.
|
|
40024
40022
|
*
|
|
40023
|
+
* @remarks
|
|
40025
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
|
|
40026
40025
|
*
|
|
40027
|
-
* @
|
|
40026
|
+
* @category Data Objects
|
|
40027
|
+
*
|
|
40028
|
+
* @example
|
|
40028
40029
|
* ```ts
|
|
40029
|
-
* await droppedAsset.setDataObject(
|
|
40030
|
-
*
|
|
40031
|
-
*
|
|
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;
|
|
40032
40039
|
* ```
|
|
40033
40040
|
*/
|
|
40034
40041
|
setDataObject(dataObject, options = {}) {
|
|
@@ -40043,16 +40050,21 @@ class DroppedAsset extends Asset {
|
|
|
40043
40050
|
});
|
|
40044
40051
|
}
|
|
40045
40052
|
/**
|
|
40046
|
-
*
|
|
40047
|
-
* 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.
|
|
40048
40054
|
*
|
|
40055
|
+
* @remarks
|
|
40049
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
|
|
40050
40057
|
*
|
|
40051
|
-
* @
|
|
40058
|
+
* @category Data Objects
|
|
40059
|
+
*
|
|
40060
|
+
* @example
|
|
40052
40061
|
* ```ts
|
|
40053
40062
|
* await droppedAsset.updateDataObject({
|
|
40054
|
-
*
|
|
40063
|
+
* [`profiles.${profileId}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
40064
|
+
* [`profileMapper.${profileId}`]: username,
|
|
40055
40065
|
* });
|
|
40066
|
+
*
|
|
40067
|
+
* const { profiles } = droppedAsset.dataObject;
|
|
40056
40068
|
* ```
|
|
40057
40069
|
*/
|
|
40058
40070
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -40067,12 +40079,14 @@ class DroppedAsset extends Asset {
|
|
|
40067
40079
|
});
|
|
40068
40080
|
}
|
|
40069
40081
|
/**
|
|
40070
|
-
* @summary
|
|
40071
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.
|
|
40072
40083
|
*
|
|
40084
|
+
* @remarks
|
|
40073
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
|
|
40074
40086
|
*
|
|
40075
|
-
* @
|
|
40087
|
+
* @category Data Objects
|
|
40088
|
+
*
|
|
40089
|
+
* @example
|
|
40076
40090
|
* ```ts
|
|
40077
40091
|
* await droppedAsset.incrementDataObjectValue("key", 1);
|
|
40078
40092
|
* ```
|
|
@@ -40091,12 +40105,10 @@ class DroppedAsset extends Asset {
|
|
|
40091
40105
|
}
|
|
40092
40106
|
});
|
|
40093
40107
|
}
|
|
40094
|
-
// update dropped assets
|
|
40095
40108
|
/**
|
|
40096
|
-
* @summary
|
|
40097
40109
|
* Updates broadcast options for a dropped asset.
|
|
40098
40110
|
*
|
|
40099
|
-
* @
|
|
40111
|
+
* @example
|
|
40100
40112
|
* ```ts
|
|
40101
40113
|
* await droppedAsset.updateBroadcast({
|
|
40102
40114
|
* assetBroadcast: true,
|
|
@@ -40104,6 +40116,8 @@ class DroppedAsset extends Asset {
|
|
|
40104
40116
|
* broadcasterEmail: "example@email.com"
|
|
40105
40117
|
* });
|
|
40106
40118
|
* ```
|
|
40119
|
+
*
|
|
40120
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40107
40121
|
*/
|
|
40108
40122
|
updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }) {
|
|
40109
40123
|
const params = { assetBroadcast, assetBroadcastAll, broadcasterEmail };
|
|
@@ -40115,10 +40129,9 @@ class DroppedAsset extends Asset {
|
|
|
40115
40129
|
}
|
|
40116
40130
|
}
|
|
40117
40131
|
/**
|
|
40118
|
-
* @summary
|
|
40119
40132
|
* Updates click options for a dropped asset.
|
|
40120
40133
|
*
|
|
40121
|
-
* @
|
|
40134
|
+
* @example
|
|
40122
40135
|
* ```ts
|
|
40123
40136
|
* await droppedAsset.updateClickType({
|
|
40124
40137
|
* "clickType": "portal",
|
|
@@ -40133,6 +40146,8 @@ class DroppedAsset extends Asset {
|
|
|
40133
40146
|
* "portalName": "community"
|
|
40134
40147
|
* });
|
|
40135
40148
|
* ```
|
|
40149
|
+
*
|
|
40150
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40136
40151
|
*/
|
|
40137
40152
|
updateClickType({ clickType = DroppedAssetClickType.LINK, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40138
40153
|
const params = {
|
|
@@ -40154,10 +40169,9 @@ class DroppedAsset extends Asset {
|
|
|
40154
40169
|
}
|
|
40155
40170
|
}
|
|
40156
40171
|
/**
|
|
40157
|
-
* @summary
|
|
40158
40172
|
* Adds an array of links to an asset. Maximum is 20 links.
|
|
40159
40173
|
*
|
|
40160
|
-
* @
|
|
40174
|
+
* @example
|
|
40161
40175
|
* ```ts
|
|
40162
40176
|
* await droppedAsset.setClickableLinkMulti({
|
|
40163
40177
|
* clickableLinks: [
|
|
@@ -40176,6 +40190,8 @@ class DroppedAsset extends Asset {
|
|
|
40176
40190
|
* ],
|
|
40177
40191
|
* });
|
|
40178
40192
|
* ```
|
|
40193
|
+
*
|
|
40194
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40179
40195
|
*/
|
|
40180
40196
|
setClickableLinkMulti({ clickableLinks }) {
|
|
40181
40197
|
const params = {
|
|
@@ -40190,11 +40206,12 @@ class DroppedAsset extends Asset {
|
|
|
40190
40206
|
}
|
|
40191
40207
|
}
|
|
40192
40208
|
/**
|
|
40193
|
-
* @summary
|
|
40194
40209
|
* Updates multiple clickable links for a dropped asset.
|
|
40210
|
+
*
|
|
40211
|
+
* @remarks
|
|
40195
40212
|
* Pass in an 'existingLinkId' to edit an existing link.
|
|
40196
40213
|
*
|
|
40197
|
-
* @
|
|
40214
|
+
* @example
|
|
40198
40215
|
* ```ts
|
|
40199
40216
|
* await droppedAsset.updateClickableLinkMulti({
|
|
40200
40217
|
* clickableLink: "https://example.com",
|
|
@@ -40204,6 +40221,8 @@ class DroppedAsset extends Asset {
|
|
|
40204
40221
|
* existingLinkId: "abcd"
|
|
40205
40222
|
* });
|
|
40206
40223
|
* ```
|
|
40224
|
+
*
|
|
40225
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40207
40226
|
*/
|
|
40208
40227
|
updateClickableLinkMulti({ clickableLink, clickableLinkTitle, isForceLinkInIframe, isOpenLinkInDrawer, existingLinkId, linkSamlQueryParams, }) {
|
|
40209
40228
|
const params = {
|
|
@@ -40223,13 +40242,14 @@ class DroppedAsset extends Asset {
|
|
|
40223
40242
|
}
|
|
40224
40243
|
}
|
|
40225
40244
|
/**
|
|
40226
|
-
* @summary
|
|
40227
40245
|
* Removes a clickable link from a dropped asset.
|
|
40228
40246
|
*
|
|
40229
|
-
* @
|
|
40247
|
+
* @example
|
|
40230
40248
|
* ```ts
|
|
40231
40249
|
* await droppedAsset.removeClickableLink({ linkId: "link-id" });
|
|
40232
40250
|
* ```
|
|
40251
|
+
*
|
|
40252
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40233
40253
|
*/
|
|
40234
40254
|
removeClickableLink({ linkId }) {
|
|
40235
40255
|
const params = {
|
|
@@ -40243,10 +40263,9 @@ class DroppedAsset extends Asset {
|
|
|
40243
40263
|
}
|
|
40244
40264
|
}
|
|
40245
40265
|
/**
|
|
40246
|
-
* @summary
|
|
40247
40266
|
* Updates text and style of a dropped asset.
|
|
40248
40267
|
*
|
|
40249
|
-
* @
|
|
40268
|
+
* @example
|
|
40250
40269
|
* ```ts
|
|
40251
40270
|
* const style = {
|
|
40252
40271
|
* "textColor": "#abc123",
|
|
@@ -40257,6 +40276,8 @@ class DroppedAsset extends Asset {
|
|
|
40257
40276
|
* };
|
|
40258
40277
|
* await droppedAsset.updateCustomTextAsset(style, "hello world");
|
|
40259
40278
|
* ```
|
|
40279
|
+
*
|
|
40280
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40260
40281
|
*/
|
|
40261
40282
|
updateCustomTextAsset(style, text) {
|
|
40262
40283
|
const params = { style, text };
|
|
@@ -40268,10 +40289,9 @@ class DroppedAsset extends Asset {
|
|
|
40268
40289
|
}
|
|
40269
40290
|
}
|
|
40270
40291
|
/**
|
|
40271
|
-
* @summary
|
|
40272
40292
|
* Updates media options for a dropped asset.
|
|
40273
40293
|
*
|
|
40274
|
-
* @
|
|
40294
|
+
* @example
|
|
40275
40295
|
* ```ts
|
|
40276
40296
|
* await droppedAsset.updateMediaType({
|
|
40277
40297
|
* "mediaType": "link",
|
|
@@ -40284,6 +40304,8 @@ class DroppedAsset extends Asset {
|
|
|
40284
40304
|
* "mediaName": "string"
|
|
40285
40305
|
* });
|
|
40286
40306
|
* ```
|
|
40307
|
+
*
|
|
40308
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40287
40309
|
*/
|
|
40288
40310
|
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }) {
|
|
40289
40311
|
const params = {
|
|
@@ -40304,13 +40326,14 @@ class DroppedAsset extends Asset {
|
|
|
40304
40326
|
}
|
|
40305
40327
|
}
|
|
40306
40328
|
/**
|
|
40307
|
-
* @summary
|
|
40308
40329
|
* Updates mute zone options for a dropped asset.
|
|
40309
40330
|
*
|
|
40310
|
-
* @
|
|
40331
|
+
* @example
|
|
40311
40332
|
* ```ts
|
|
40312
40333
|
* await droppedAsset.updateMuteZone(true);
|
|
40313
40334
|
* ```
|
|
40335
|
+
*
|
|
40336
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40314
40337
|
*/
|
|
40315
40338
|
updateMuteZone(isMutezone) {
|
|
40316
40339
|
try {
|
|
@@ -40321,10 +40344,9 @@ class DroppedAsset extends Asset {
|
|
|
40321
40344
|
}
|
|
40322
40345
|
}
|
|
40323
40346
|
/**
|
|
40324
|
-
* @summary
|
|
40325
40347
|
* Updates landmark zone options for a dropped asset.
|
|
40326
40348
|
*
|
|
40327
|
-
* @
|
|
40349
|
+
* @example
|
|
40328
40350
|
* ```ts
|
|
40329
40351
|
* await droppedAsset.updateLandmarkZone({
|
|
40330
40352
|
* isLandmarkZoneEnabled: true,
|
|
@@ -40332,6 +40354,8 @@ class DroppedAsset extends Asset {
|
|
|
40332
40354
|
* landmarkZoneIsVisible: true,
|
|
40333
40355
|
*});
|
|
40334
40356
|
* ```
|
|
40357
|
+
*
|
|
40358
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40335
40359
|
*/
|
|
40336
40360
|
updateLandmarkZone({ isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible, }) {
|
|
40337
40361
|
const params = { isLandmarkZoneEnabled, landmarkZoneName, landmarkZoneIsVisible };
|
|
@@ -40343,13 +40367,14 @@ class DroppedAsset extends Asset {
|
|
|
40343
40367
|
}
|
|
40344
40368
|
}
|
|
40345
40369
|
/**
|
|
40346
|
-
* @summary
|
|
40347
40370
|
* Updates webhook zone options for a dropped asset.
|
|
40348
40371
|
*
|
|
40349
|
-
* @
|
|
40372
|
+
* @example
|
|
40350
40373
|
* ```ts
|
|
40351
40374
|
* await droppedAsset.updateWebhookZone(true);
|
|
40352
40375
|
* ```
|
|
40376
|
+
*
|
|
40377
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40353
40378
|
*/
|
|
40354
40379
|
updateWebhookZone(isWebhookZoneEnabled) {
|
|
40355
40380
|
try {
|
|
@@ -40360,13 +40385,14 @@ class DroppedAsset extends Asset {
|
|
|
40360
40385
|
}
|
|
40361
40386
|
}
|
|
40362
40387
|
/**
|
|
40363
|
-
* @summary
|
|
40364
40388
|
* Moves a dropped asset to specified coordinates.
|
|
40365
40389
|
*
|
|
40366
|
-
* @
|
|
40390
|
+
* @example
|
|
40367
40391
|
* ```ts
|
|
40368
|
-
* await droppedAsset.updatePosition(100,200);
|
|
40392
|
+
* await droppedAsset.updatePosition(100, 200, 100);
|
|
40369
40393
|
* ```
|
|
40394
|
+
*
|
|
40395
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40370
40396
|
*/
|
|
40371
40397
|
updatePosition(x, y, yOrderAdjust) {
|
|
40372
40398
|
const params = { x, y, yOrderAdjust };
|
|
@@ -40378,10 +40404,9 @@ class DroppedAsset extends Asset {
|
|
|
40378
40404
|
}
|
|
40379
40405
|
}
|
|
40380
40406
|
/**
|
|
40381
|
-
* @summary
|
|
40382
40407
|
* Updates private zone options for a dropped asset.
|
|
40383
40408
|
*
|
|
40384
|
-
* @
|
|
40409
|
+
* @example
|
|
40385
40410
|
* ```ts
|
|
40386
40411
|
* await droppedAsset.updatePrivateZone({
|
|
40387
40412
|
* "isPrivateZone": false,
|
|
@@ -40389,6 +40414,8 @@ class DroppedAsset extends Asset {
|
|
|
40389
40414
|
* "privateZoneUserCap": 10
|
|
40390
40415
|
* });
|
|
40391
40416
|
* ```
|
|
40417
|
+
*
|
|
40418
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40392
40419
|
*/
|
|
40393
40420
|
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }) {
|
|
40394
40421
|
const params = { isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap };
|
|
@@ -40400,13 +40427,14 @@ class DroppedAsset extends Asset {
|
|
|
40400
40427
|
}
|
|
40401
40428
|
}
|
|
40402
40429
|
/**
|
|
40403
|
-
* @summary
|
|
40404
40430
|
* Updates the size of a dropped asset.
|
|
40405
40431
|
*
|
|
40406
|
-
* @
|
|
40432
|
+
* @example
|
|
40407
40433
|
* ```ts
|
|
40408
40434
|
* await droppedAsset.assetScale(.5);
|
|
40409
40435
|
* ```
|
|
40436
|
+
*
|
|
40437
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40410
40438
|
*/
|
|
40411
40439
|
updateScale(assetScale) {
|
|
40412
40440
|
try {
|
|
@@ -40417,13 +40445,14 @@ class DroppedAsset extends Asset {
|
|
|
40417
40445
|
}
|
|
40418
40446
|
}
|
|
40419
40447
|
/**
|
|
40420
|
-
* @summary
|
|
40421
40448
|
* Flip an dropped asset.
|
|
40422
40449
|
*
|
|
40423
|
-
* @
|
|
40450
|
+
* @example
|
|
40424
40451
|
* ```ts
|
|
40425
40452
|
* await droppedAsset.flip(.5);
|
|
40426
40453
|
* ```
|
|
40454
|
+
*
|
|
40455
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40427
40456
|
*/
|
|
40428
40457
|
flip() {
|
|
40429
40458
|
try {
|
|
@@ -40434,13 +40463,14 @@ class DroppedAsset extends Asset {
|
|
|
40434
40463
|
}
|
|
40435
40464
|
}
|
|
40436
40465
|
/**
|
|
40437
|
-
* @summary
|
|
40438
40466
|
* Change or remove media embedded in a dropped asset.
|
|
40439
40467
|
*
|
|
40440
|
-
* @
|
|
40468
|
+
* @example
|
|
40441
40469
|
* ```ts
|
|
40442
40470
|
* await droppedAsset.updateUploadedMediaSelected("LVWyxwNxI96eLjnXWwYO");
|
|
40443
40471
|
* ```
|
|
40472
|
+
*
|
|
40473
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40444
40474
|
*/
|
|
40445
40475
|
updateUploadedMediaSelected(mediaId) {
|
|
40446
40476
|
try {
|
|
@@ -40451,13 +40481,14 @@ class DroppedAsset extends Asset {
|
|
|
40451
40481
|
}
|
|
40452
40482
|
}
|
|
40453
40483
|
/**
|
|
40454
|
-
* @summary
|
|
40455
40484
|
* Change or remove top and bottom layers of a dropped asset.
|
|
40456
40485
|
*
|
|
40457
|
-
* @
|
|
40486
|
+
* @example
|
|
40458
40487
|
* ```ts
|
|
40459
40488
|
* await droppedAsset.updateWebImageLayers("","https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg");
|
|
40460
40489
|
* ```
|
|
40490
|
+
*
|
|
40491
|
+
* @returns {Promise<void | ResponseType>} Returns the updated dropped asset or an error.
|
|
40461
40492
|
*/
|
|
40462
40493
|
updateWebImageLayers(bottom, top) {
|
|
40463
40494
|
const params = { bottom, top };
|
|
@@ -40469,10 +40500,9 @@ class DroppedAsset extends Asset {
|
|
|
40469
40500
|
}
|
|
40470
40501
|
}
|
|
40471
40502
|
/**
|
|
40472
|
-
* @summary
|
|
40473
40503
|
* Add a webhook to a dropped asset
|
|
40474
40504
|
*
|
|
40475
|
-
* @
|
|
40505
|
+
* @example
|
|
40476
40506
|
* ```ts
|
|
40477
40507
|
* await droppedAsset.addWebhook({
|
|
40478
40508
|
* dataObject: {},
|
|
@@ -40484,6 +40514,8 @@ class DroppedAsset extends Asset {
|
|
|
40484
40514
|
* url: "https://url.com",
|
|
40485
40515
|
* });
|
|
40486
40516
|
* ```
|
|
40517
|
+
*
|
|
40518
|
+
* @returns {Promise<void | ResponseType>} Returns the new `webhookId` or an error.
|
|
40487
40519
|
*/
|
|
40488
40520
|
addWebhook({ dataObject, description, isUniqueOnly, shouldSetClickType, shouldSetIsInteractive, title, type, url, }) {
|
|
40489
40521
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40507,10 +40539,9 @@ class DroppedAsset extends Asset {
|
|
|
40507
40539
|
});
|
|
40508
40540
|
}
|
|
40509
40541
|
/**
|
|
40510
|
-
* @summary
|
|
40511
40542
|
* Set the interactive settings on a dropped asset
|
|
40512
40543
|
*
|
|
40513
|
-
* @
|
|
40544
|
+
* @example
|
|
40514
40545
|
* ```ts
|
|
40515
40546
|
* await droppedAsset.setInteractiveSettings({
|
|
40516
40547
|
* isInteractive: true,
|
|
@@ -40534,12 +40565,10 @@ class DroppedAsset extends Asset {
|
|
|
40534
40565
|
}
|
|
40535
40566
|
});
|
|
40536
40567
|
}
|
|
40537
|
-
////////// analytics
|
|
40538
40568
|
/**
|
|
40539
|
-
* @summary
|
|
40540
40569
|
* Retrieve analytics for a dropped asset by day, week, month, quarter, or year
|
|
40541
40570
|
*
|
|
40542
|
-
* @
|
|
40571
|
+
* @example
|
|
40543
40572
|
* ```ts
|
|
40544
40573
|
* const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
|
|
40545
40574
|
* periodType: "quarter",
|
|
@@ -40547,6 +40576,8 @@ class DroppedAsset extends Asset {
|
|
|
40547
40576
|
* year: 2023,
|
|
40548
40577
|
* });
|
|
40549
40578
|
* ```
|
|
40579
|
+
*
|
|
40580
|
+
* @returns {Promise<void | ResponseType>} Returns the analytics data or an error.
|
|
40550
40581
|
*/
|
|
40551
40582
|
fetchDroppedAssetAnalytics({ periodType, dateValue, year, }) {
|
|
40552
40583
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40581,12 +40612,11 @@ class DroppedAsset extends Asset {
|
|
|
40581
40612
|
_DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
40582
40613
|
|
|
40583
40614
|
/**
|
|
40584
|
-
* @summary
|
|
40585
40615
|
* Create an instance of Ecosystem class with optional session credentials
|
|
40586
40616
|
*
|
|
40587
|
-
* @
|
|
40617
|
+
* @example
|
|
40588
40618
|
* ```ts
|
|
40589
|
-
* await new Ecosystem(topia, {
|
|
40619
|
+
* const ecosystem =await new Ecosystem(topia, {
|
|
40590
40620
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40591
40621
|
* });
|
|
40592
40622
|
* ```
|
|
@@ -40597,13 +40627,16 @@ class Ecosystem extends SDKController {
|
|
|
40597
40627
|
this.dataObject = {};
|
|
40598
40628
|
}
|
|
40599
40629
|
/**
|
|
40600
|
-
* @summary
|
|
40601
40630
|
* Retrieves the data object for a Topia ecosystem. Requires canUpdateEcosystemDataObjects permission to be set to true for the public key.
|
|
40602
40631
|
*
|
|
40603
|
-
* @
|
|
40632
|
+
* @category Data Objects
|
|
40633
|
+
*
|
|
40634
|
+
* @example
|
|
40604
40635
|
* ```ts
|
|
40605
40636
|
* const dataObject = await ecosystem.fetchDataObject("exampleAppPublicKey", "exampleAppPublicKeyJWT");
|
|
40606
40637
|
* ```
|
|
40638
|
+
*
|
|
40639
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
40607
40640
|
*/
|
|
40608
40641
|
fetchDataObject(appPublicKey, appJWT) {
|
|
40609
40642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40621,17 +40654,22 @@ class Ecosystem extends SDKController {
|
|
|
40621
40654
|
});
|
|
40622
40655
|
}
|
|
40623
40656
|
/**
|
|
40624
|
-
* @summary
|
|
40625
40657
|
* Sets the data object for a Topia ecosystem.
|
|
40626
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
|
+
*
|
|
40627
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
|
|
40628
40663
|
*
|
|
40629
|
-
* @
|
|
40664
|
+
* @category Data Objects
|
|
40665
|
+
*
|
|
40666
|
+
* @example
|
|
40630
40667
|
* ```ts
|
|
40631
40668
|
* await ecosystem.setDataObject({ "exampleKey": "exampleValue" }, {
|
|
40632
40669
|
* sharedAppPublicKey: "exampleAppPublicKey",
|
|
40633
40670
|
* sharedAppJWT: "exampleAppPublicKeyJWT",}
|
|
40634
40671
|
* });
|
|
40672
|
+
* const { exampleKey } = ecosystem.dataObject;
|
|
40635
40673
|
* ```
|
|
40636
40674
|
*/
|
|
40637
40675
|
setDataObject(dataObject, options = {}) {
|
|
@@ -40646,17 +40684,28 @@ class Ecosystem extends SDKController {
|
|
|
40646
40684
|
});
|
|
40647
40685
|
}
|
|
40648
40686
|
/**
|
|
40649
|
-
* @summary
|
|
40650
40687
|
* Updates the data object for a Topia ecosystem.
|
|
40651
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
|
+
*
|
|
40652
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
|
|
40653
40693
|
*
|
|
40654
|
-
* @
|
|
40694
|
+
* @category Data Objects
|
|
40695
|
+
*
|
|
40696
|
+
* @example
|
|
40655
40697
|
* ```ts
|
|
40656
|
-
* await ecosystem.updateDataObject({
|
|
40657
|
-
*
|
|
40658
|
-
*
|
|
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
|
+
* }
|
|
40659
40707
|
* });
|
|
40708
|
+
* const { exampleKey } = ecosystem.dataObject;
|
|
40660
40709
|
* ```
|
|
40661
40710
|
*/
|
|
40662
40711
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -40671,12 +40720,16 @@ class Ecosystem extends SDKController {
|
|
|
40671
40720
|
});
|
|
40672
40721
|
}
|
|
40673
40722
|
/**
|
|
40674
|
-
* @summary
|
|
40675
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.
|
|
40676
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
|
+
*
|
|
40677
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
|
|
40678
40729
|
*
|
|
40679
|
-
* @
|
|
40730
|
+
* @category Data Objects
|
|
40731
|
+
*
|
|
40732
|
+
* @example
|
|
40680
40733
|
* ```ts
|
|
40681
40734
|
* await ecosystem.incrementDataObjectValue("key", 1, {
|
|
40682
40735
|
* sharedAppPublicKey: "exampleAppPublicKey",
|
|
@@ -40701,12 +40754,11 @@ class Ecosystem extends SDKController {
|
|
|
40701
40754
|
}
|
|
40702
40755
|
|
|
40703
40756
|
/**
|
|
40704
|
-
* @summary
|
|
40705
40757
|
* Create an instance of Scene class with a given scene id and optional attributes and session credentials.
|
|
40706
40758
|
*
|
|
40707
|
-
* @
|
|
40759
|
+
* @example
|
|
40708
40760
|
* ```ts
|
|
40709
|
-
* await new Scene(topia, "sceneId", {
|
|
40761
|
+
* const scene = await new Scene(topia, "sceneId", {
|
|
40710
40762
|
* attributes: { name: "My Scene" },
|
|
40711
40763
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40712
40764
|
* });
|
|
@@ -40719,10 +40771,9 @@ class Scene extends SDKController {
|
|
|
40719
40771
|
Object.assign(this, options.attributes);
|
|
40720
40772
|
}
|
|
40721
40773
|
/**
|
|
40722
|
-
*
|
|
40723
|
-
* Retrieves scene details.
|
|
40774
|
+
* Retrieves scene details and assigns response data to the instance.
|
|
40724
40775
|
*
|
|
40725
|
-
* @
|
|
40776
|
+
* @example
|
|
40726
40777
|
* ```ts
|
|
40727
40778
|
* await scene.fetchSceneById();
|
|
40728
40779
|
* const { name } = scene;
|
|
@@ -40742,10 +40793,9 @@ class Scene extends SDKController {
|
|
|
40742
40793
|
}
|
|
40743
40794
|
|
|
40744
40795
|
/**
|
|
40745
|
-
* @summary
|
|
40746
40796
|
* Create a single instance of Topia axios used for all calls to the public API in all classes
|
|
40747
40797
|
*
|
|
40748
|
-
* @
|
|
40798
|
+
* @example
|
|
40749
40799
|
* ```ts
|
|
40750
40800
|
* const topia = await new Topia({
|
|
40751
40801
|
* apiDomain: "api.topia.io",
|
|
@@ -40781,12 +40831,11 @@ class Topia {
|
|
|
40781
40831
|
|
|
40782
40832
|
var _World_droppedAssetsMap;
|
|
40783
40833
|
/**
|
|
40784
|
-
* @summary
|
|
40785
40834
|
* Create an instance of World class with a given url slug and optional attributes and session credentials.
|
|
40786
40835
|
*
|
|
40787
|
-
* @
|
|
40836
|
+
* @example
|
|
40788
40837
|
* ```ts
|
|
40789
|
-
* await new World(topia, "exampleWorld", {
|
|
40838
|
+
* const world = await new World(topia, "exampleWorld", {
|
|
40790
40839
|
* attributes: { name: "Example World" },
|
|
40791
40840
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
40792
40841
|
* });
|
|
@@ -40799,10 +40848,11 @@ class World extends SDKController {
|
|
|
40799
40848
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40800
40849
|
////////// data objects
|
|
40801
40850
|
/**
|
|
40802
|
-
* @summary
|
|
40803
40851
|
* Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
40804
40852
|
*
|
|
40805
|
-
* @
|
|
40853
|
+
* @category Data Objects
|
|
40854
|
+
*
|
|
40855
|
+
* @example
|
|
40806
40856
|
* ```ts
|
|
40807
40857
|
* await world.fetchDataObject();
|
|
40808
40858
|
* const { dataObject } = world;
|
|
@@ -40822,17 +40872,23 @@ class World extends SDKController {
|
|
|
40822
40872
|
}
|
|
40823
40873
|
});
|
|
40824
40874
|
/**
|
|
40825
|
-
* @summary
|
|
40826
40875
|
* Sets the data object for a user. Must have valid interactive credentials from a visitor in the world.
|
|
40827
40876
|
*
|
|
40877
|
+
* @remarks
|
|
40828
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
|
|
40829
40879
|
*
|
|
40830
|
-
* @
|
|
40880
|
+
* @category Data Objects
|
|
40881
|
+
*
|
|
40882
|
+
* @example
|
|
40831
40883
|
* ```ts
|
|
40832
|
-
|
|
40833
|
-
|
|
40834
|
-
|
|
40835
|
-
|
|
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;
|
|
40836
40892
|
* ```
|
|
40837
40893
|
*/
|
|
40838
40894
|
this.setDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40845,17 +40901,20 @@ class World extends SDKController {
|
|
|
40845
40901
|
}
|
|
40846
40902
|
});
|
|
40847
40903
|
/**
|
|
40848
|
-
* @summary
|
|
40849
40904
|
* Updates the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
40850
40905
|
*
|
|
40906
|
+
* @remarks
|
|
40851
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
|
|
40852
40908
|
*
|
|
40853
|
-
* @
|
|
40909
|
+
* @category Data Objects
|
|
40910
|
+
*
|
|
40911
|
+
* @example
|
|
40854
40912
|
* ```ts
|
|
40855
40913
|
* await world.updateDataObject({
|
|
40856
|
-
*
|
|
40914
|
+
* [`keyAssets.${keyAssetId}.itemsCollectedByUser.${profileId}`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
40915
|
+
* [`profileMapper.${profileId}`]: username,
|
|
40857
40916
|
* });
|
|
40858
|
-
* const {
|
|
40917
|
+
* const { profileMapper } = world.dataObject;
|
|
40859
40918
|
* ```
|
|
40860
40919
|
*/
|
|
40861
40920
|
this.updateDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40876,10 +40935,9 @@ class World extends SDKController {
|
|
|
40876
40935
|
}
|
|
40877
40936
|
//////// world details
|
|
40878
40937
|
/**
|
|
40879
|
-
* @summary
|
|
40880
40938
|
* Retrieves details of a world.
|
|
40881
40939
|
*
|
|
40882
|
-
* @
|
|
40940
|
+
* @example
|
|
40883
40941
|
* ```ts
|
|
40884
40942
|
* await world.fetchDetails();
|
|
40885
40943
|
* const { name } = world;
|
|
@@ -40897,10 +40955,9 @@ class World extends SDKController {
|
|
|
40897
40955
|
});
|
|
40898
40956
|
}
|
|
40899
40957
|
/**
|
|
40900
|
-
* @summary
|
|
40901
40958
|
* Update details of a world.
|
|
40902
40959
|
*
|
|
40903
|
-
* @
|
|
40960
|
+
* @example
|
|
40904
40961
|
* ```ts
|
|
40905
40962
|
* await world.updateDetails({
|
|
40906
40963
|
* controls: {
|
|
@@ -40916,6 +40973,8 @@ class World extends SDKController {
|
|
|
40916
40973
|
* spawnPosition: { x: 100, y: 100 },
|
|
40917
40974
|
* width: 2000
|
|
40918
40975
|
* });
|
|
40976
|
+
*
|
|
40977
|
+
* const { name, description } = world;
|
|
40919
40978
|
* ```
|
|
40920
40979
|
*/
|
|
40921
40980
|
updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }) {
|
|
@@ -40940,10 +40999,9 @@ class World extends SDKController {
|
|
|
40940
40999
|
});
|
|
40941
41000
|
}
|
|
40942
41001
|
/**
|
|
40943
|
-
* @summary
|
|
40944
41002
|
* Set close world settings
|
|
40945
41003
|
*
|
|
40946
|
-
* @
|
|
41004
|
+
* @example
|
|
40947
41005
|
* ```ts
|
|
40948
41006
|
* await world.updateCloseWorldSettings({
|
|
40949
41007
|
* controls: {
|
|
@@ -40960,6 +41018,8 @@ class World extends SDKController {
|
|
|
40960
41018
|
* width: 2000
|
|
40961
41019
|
* });
|
|
40962
41020
|
* ```
|
|
41021
|
+
*
|
|
41022
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
40963
41023
|
*/
|
|
40964
41024
|
updateCloseWorldSettings({ closeWorldDescription, isWorldClosed, }) {
|
|
40965
41025
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40968,7 +41028,8 @@ class World extends SDKController {
|
|
|
40968
41028
|
isWorldClosed,
|
|
40969
41029
|
};
|
|
40970
41030
|
try {
|
|
40971
|
-
|
|
41031
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/set-close-world-settings`, params, this.requestOptions);
|
|
41032
|
+
return response.data;
|
|
40972
41033
|
}
|
|
40973
41034
|
catch (error) {
|
|
40974
41035
|
throw this.errorHandler({ error, params, sdkMethod: "World.updateCloseWorldSettings" });
|
|
@@ -40977,10 +41038,11 @@ class World extends SDKController {
|
|
|
40977
41038
|
}
|
|
40978
41039
|
////////// dropped assets
|
|
40979
41040
|
/**
|
|
40980
|
-
* @summary
|
|
40981
41041
|
* Retrieve all assets dropped in a world.
|
|
40982
41042
|
*
|
|
40983
|
-
* @
|
|
41043
|
+
* @category Dropped Assets
|
|
41044
|
+
*
|
|
41045
|
+
* @example
|
|
40984
41046
|
* ```ts
|
|
40985
41047
|
* await world.fetchDroppedAssets();
|
|
40986
41048
|
* const assets = world.droppedAssets;
|
|
@@ -41006,13 +41068,16 @@ class World extends SDKController {
|
|
|
41006
41068
|
});
|
|
41007
41069
|
}
|
|
41008
41070
|
/**
|
|
41009
|
-
* @summary
|
|
41010
41071
|
* Retrieve all assets dropped in a world matching uniqueName.
|
|
41011
41072
|
*
|
|
41012
|
-
* @
|
|
41073
|
+
* @category Dropped Assets
|
|
41074
|
+
*
|
|
41075
|
+
* @example
|
|
41013
41076
|
* ```ts
|
|
41014
|
-
* const droppedAssets = await world.fetchDroppedAssetsWithUniqueName({
|
|
41077
|
+
* const droppedAssets = await world.fetchDroppedAssetsWithUniqueName({ uniqueName: "exampleUniqueName", isPartial: true });
|
|
41015
41078
|
* ```
|
|
41079
|
+
*
|
|
41080
|
+
* @returns {Promise<DroppedAsset[]>} Returns an array of DroppedAsset instances.
|
|
41016
41081
|
*/
|
|
41017
41082
|
fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial = false, isReversed = false, }) {
|
|
41018
41083
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41037,56 +41102,19 @@ class World extends SDKController {
|
|
|
41037
41102
|
});
|
|
41038
41103
|
}
|
|
41039
41104
|
/**
|
|
41040
|
-
* @summary
|
|
41041
|
-
* Retrieve all landmark zone assets dropped in a world.
|
|
41042
|
-
*
|
|
41043
|
-
* @usage
|
|
41044
|
-
* ```ts
|
|
41045
|
-
* const zones = await world.fetchLandmarkZones("optionalLandmarkZoneName", "optionalSceneDropIdExample");
|
|
41046
|
-
* ```
|
|
41047
|
-
*/
|
|
41048
|
-
fetchLandmarkZones(landmarkZoneName, sceneDropId) {
|
|
41049
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41050
|
-
try {
|
|
41051
|
-
let queryParams = "";
|
|
41052
|
-
if (landmarkZoneName) {
|
|
41053
|
-
queryParams = `?landmarkZoneName=${landmarkZoneName}`;
|
|
41054
|
-
if (sceneDropId)
|
|
41055
|
-
queryParams += `&sceneDropId=${sceneDropId}`;
|
|
41056
|
-
}
|
|
41057
|
-
else if (sceneDropId) {
|
|
41058
|
-
queryParams = `?sceneDropId=${sceneDropId}`;
|
|
41059
|
-
}
|
|
41060
|
-
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/landmark-zones${queryParams}`, this.requestOptions);
|
|
41061
|
-
const droppedAssets = [];
|
|
41062
|
-
for (const asset of response.data.assets) {
|
|
41063
|
-
droppedAssets.push(new DroppedAsset(this.topia, asset.id, this.urlSlug, {
|
|
41064
|
-
attributes: asset,
|
|
41065
|
-
credentials: this.credentials,
|
|
41066
|
-
}));
|
|
41067
|
-
}
|
|
41068
|
-
return droppedAssets;
|
|
41069
|
-
}
|
|
41070
|
-
catch (error) {
|
|
41071
|
-
throw this.errorHandler({
|
|
41072
|
-
error,
|
|
41073
|
-
params: { landmarkZoneName, sceneDropId },
|
|
41074
|
-
sdkMethod: "World.fetchLandmarkZones",
|
|
41075
|
-
});
|
|
41076
|
-
}
|
|
41077
|
-
});
|
|
41078
|
-
}
|
|
41079
|
-
/**
|
|
41080
|
-
* @summary
|
|
41081
41105
|
* Retrieve all assets dropped in a world matching sceneDropId.
|
|
41082
41106
|
*
|
|
41083
|
-
* @
|
|
41107
|
+
* @category Dropped Assets
|
|
41108
|
+
*
|
|
41109
|
+
* @example
|
|
41084
41110
|
* ```ts
|
|
41085
41111
|
* const droppedAssets = await world.fetchDroppedAssetsBySceneDropId({
|
|
41086
41112
|
* sceneDropId: "sceneDropIdExample",
|
|
41087
41113
|
* uniqueName: "optionalUniqueNameExample",
|
|
41088
41114
|
* });
|
|
41089
41115
|
* ```
|
|
41116
|
+
*
|
|
41117
|
+
* @returns {Promise<DroppedAsset[]>} Returns an array of DroppedAsset instances.
|
|
41090
41118
|
*/
|
|
41091
41119
|
fetchDroppedAssetsBySceneDropId({ sceneDropId, uniqueName, }) {
|
|
41092
41120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41114,10 +41142,11 @@ class World extends SDKController {
|
|
|
41114
41142
|
});
|
|
41115
41143
|
}
|
|
41116
41144
|
/**
|
|
41117
|
-
* @summary
|
|
41118
41145
|
* Update multiple custom text dropped assets with a single style while preserving text for specified dropped assets only.
|
|
41119
41146
|
*
|
|
41120
|
-
* @
|
|
41147
|
+
* @category Dropped Assets
|
|
41148
|
+
*
|
|
41149
|
+
* @example
|
|
41121
41150
|
* ```ts
|
|
41122
41151
|
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]];
|
|
41123
41152
|
* const style = {
|
|
@@ -41130,7 +41159,7 @@ class World extends SDKController {
|
|
|
41130
41159
|
* await world.updateCustomText(droppedAssetsToUpdate, style);
|
|
41131
41160
|
* ```
|
|
41132
41161
|
*
|
|
41133
|
-
* @
|
|
41162
|
+
* @returns
|
|
41134
41163
|
* Updates each DroppedAsset instance and world.droppedAssets map.
|
|
41135
41164
|
*/
|
|
41136
41165
|
updateCustomTextDroppedAssets(droppedAssetsToUpdate, style) {
|
|
@@ -41143,19 +41172,61 @@ class World extends SDKController {
|
|
|
41143
41172
|
return outcomes;
|
|
41144
41173
|
});
|
|
41145
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
|
+
}
|
|
41146
41218
|
// scenes
|
|
41147
41219
|
/**
|
|
41148
41220
|
* @deprecated Use {@link fetchScenes} instead.
|
|
41149
41221
|
*
|
|
41150
|
-
* @summary
|
|
41151
41222
|
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
41152
41223
|
*
|
|
41153
|
-
* @
|
|
41224
|
+
* @example
|
|
41154
41225
|
* ```ts
|
|
41155
41226
|
* await world.fetchSceneDropIds();
|
|
41156
41227
|
* ```
|
|
41157
41228
|
*
|
|
41158
|
-
* @
|
|
41229
|
+
* @returns
|
|
41159
41230
|
* ```ts
|
|
41160
41231
|
* { sceneDropIds: [] }
|
|
41161
41232
|
* ```
|
|
@@ -41173,15 +41244,16 @@ class World extends SDKController {
|
|
|
41173
41244
|
});
|
|
41174
41245
|
}
|
|
41175
41246
|
/**
|
|
41176
|
-
* @summary
|
|
41177
41247
|
* Fetch a list of all scene drop ids and dropped assets in a world
|
|
41178
41248
|
*
|
|
41179
|
-
* @
|
|
41249
|
+
* @category Scenes
|
|
41250
|
+
*
|
|
41251
|
+
* @example
|
|
41180
41252
|
* ```ts
|
|
41181
41253
|
* await world.fetchScenes();
|
|
41182
41254
|
* ```
|
|
41183
41255
|
*
|
|
41184
|
-
* @
|
|
41256
|
+
* @returns
|
|
41185
41257
|
* ```ts
|
|
41186
41258
|
* { "scenes": {
|
|
41187
41259
|
* "sceneDropId_1": {
|
|
@@ -41213,10 +41285,11 @@ class World extends SDKController {
|
|
|
41213
41285
|
});
|
|
41214
41286
|
}
|
|
41215
41287
|
/**
|
|
41216
|
-
* @summary
|
|
41217
41288
|
* Drops a scene in a world and returns sceneDropId.
|
|
41218
41289
|
*
|
|
41219
|
-
* @
|
|
41290
|
+
* @category Scenes
|
|
41291
|
+
*
|
|
41292
|
+
* @example
|
|
41220
41293
|
* ```ts
|
|
41221
41294
|
* await world.dropScene({
|
|
41222
41295
|
* "sceneId": "string",
|
|
@@ -41228,7 +41301,7 @@ class World extends SDKController {
|
|
|
41228
41301
|
* });
|
|
41229
41302
|
* ```
|
|
41230
41303
|
*
|
|
41231
|
-
* @
|
|
41304
|
+
* @returns
|
|
41232
41305
|
* ```ts
|
|
41233
41306
|
* { sceneDropId: sceneId-timestamp, success: true }
|
|
41234
41307
|
* ```
|
|
@@ -41246,10 +41319,11 @@ class World extends SDKController {
|
|
|
41246
41319
|
});
|
|
41247
41320
|
}
|
|
41248
41321
|
/**
|
|
41249
|
-
* @summary
|
|
41250
41322
|
* Replace the current scene of a world.
|
|
41251
41323
|
*
|
|
41252
|
-
* @
|
|
41324
|
+
* @category Scenes
|
|
41325
|
+
*
|
|
41326
|
+
* @example
|
|
41253
41327
|
* ```ts
|
|
41254
41328
|
* const droppedAssetsToUpdate = [world.droppedAssets["6"], world.droppedAssets["12"]]
|
|
41255
41329
|
* const style = {
|
|
@@ -41261,6 +41335,8 @@ class World extends SDKController {
|
|
|
41261
41335
|
* }
|
|
41262
41336
|
* await world.replaceScene(SCENE_ID);
|
|
41263
41337
|
* ```
|
|
41338
|
+
*
|
|
41339
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41264
41340
|
*/
|
|
41265
41341
|
replaceScene(sceneId) {
|
|
41266
41342
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41273,12 +41349,15 @@ class World extends SDKController {
|
|
|
41273
41349
|
});
|
|
41274
41350
|
}
|
|
41275
41351
|
/**
|
|
41276
|
-
* @summary
|
|
41277
41352
|
* Get all particles available
|
|
41278
41353
|
*
|
|
41279
|
-
* @
|
|
41354
|
+
* @category Particles
|
|
41355
|
+
*
|
|
41356
|
+
* @example
|
|
41280
41357
|
* ```ts
|
|
41281
41358
|
* await world.getAllParticles();
|
|
41359
|
+
*
|
|
41360
|
+
* @returns {Promise<ResponseType>} Returns an array of particles or an error response.
|
|
41282
41361
|
* ```
|
|
41283
41362
|
*/
|
|
41284
41363
|
getAllParticles() {
|
|
@@ -41293,13 +41372,16 @@ class World extends SDKController {
|
|
|
41293
41372
|
});
|
|
41294
41373
|
}
|
|
41295
41374
|
/**
|
|
41296
|
-
* @summary
|
|
41297
41375
|
* Trigger a particle effect at a position in the world
|
|
41298
41376
|
*
|
|
41299
|
-
* @
|
|
41377
|
+
* @category Particles
|
|
41378
|
+
*
|
|
41379
|
+
* @example
|
|
41300
41380
|
* ```ts
|
|
41301
41381
|
* await world.triggerParticle({ name: "Flame" });
|
|
41302
41382
|
* ```
|
|
41383
|
+
*
|
|
41384
|
+
* @returns {Promise<ResponseType | string>} Returns `{ success: true }` or a message if no particleId is found.
|
|
41303
41385
|
*/
|
|
41304
41386
|
triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
|
|
41305
41387
|
var _a;
|
|
@@ -41323,14 +41405,15 @@ class World extends SDKController {
|
|
|
41323
41405
|
});
|
|
41324
41406
|
}
|
|
41325
41407
|
/**
|
|
41326
|
-
* @summary
|
|
41327
41408
|
* Add an activity to a world
|
|
41328
41409
|
* excludeFromNotification is an array of visitorIds to exclude from the notification
|
|
41329
41410
|
*
|
|
41330
|
-
* @
|
|
41411
|
+
* @example
|
|
41331
41412
|
* ```ts
|
|
41332
41413
|
* await world.triggerActivity({ type: "GAME_ON", assetId: "abc123" });
|
|
41333
41414
|
* ```
|
|
41415
|
+
*
|
|
41416
|
+
* @returns {Promise<ResponseType | string>} Returns the `activityId` or an error response.
|
|
41334
41417
|
*/
|
|
41335
41418
|
triggerActivity({ type, assetId, excludeFromNotification, }) {
|
|
41336
41419
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41345,10 +41428,9 @@ class World extends SDKController {
|
|
|
41345
41428
|
});
|
|
41346
41429
|
}
|
|
41347
41430
|
/**
|
|
41348
|
-
* @summary
|
|
41349
41431
|
* Display a message via a toast to all visitors currently in a world.
|
|
41350
41432
|
*
|
|
41351
|
-
* @
|
|
41433
|
+
* @example
|
|
41352
41434
|
* ```ts
|
|
41353
41435
|
* await world.fireToast({
|
|
41354
41436
|
* groupId: "custom-message",
|
|
@@ -41356,6 +41438,8 @@ class World extends SDKController {
|
|
|
41356
41438
|
* text: "Thank you for participating!",
|
|
41357
41439
|
* });
|
|
41358
41440
|
* ```
|
|
41441
|
+
*
|
|
41442
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41359
41443
|
*/
|
|
41360
41444
|
fireToast({ groupId, title, text }) {
|
|
41361
41445
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41365,7 +41449,8 @@ class World extends SDKController {
|
|
|
41365
41449
|
text,
|
|
41366
41450
|
};
|
|
41367
41451
|
try {
|
|
41368
|
-
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;
|
|
41369
41454
|
}
|
|
41370
41455
|
catch (error) {
|
|
41371
41456
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
@@ -41373,14 +41458,16 @@ class World extends SDKController {
|
|
|
41373
41458
|
});
|
|
41374
41459
|
}
|
|
41375
41460
|
/**
|
|
41376
|
-
* @summary
|
|
41377
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.
|
|
41378
41462
|
*
|
|
41463
|
+
* @remarks
|
|
41379
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
|
|
41380
41465
|
*
|
|
41381
|
-
* @
|
|
41466
|
+
* @category Data Objects
|
|
41467
|
+
*
|
|
41468
|
+
* @example
|
|
41382
41469
|
* ```ts
|
|
41383
|
-
* await world.incrementDataObjectValue(
|
|
41470
|
+
* await world.incrementDataObjectValue([`keyAssets.${keyAssetId}.totalItemsCollected.count`], 1);
|
|
41384
41471
|
* ```
|
|
41385
41472
|
*/
|
|
41386
41473
|
incrementDataObjectValue(path, amount, options = {}) {
|
|
@@ -41399,10 +41486,11 @@ class World extends SDKController {
|
|
|
41399
41486
|
}
|
|
41400
41487
|
////////// webhooks
|
|
41401
41488
|
/**
|
|
41402
|
-
* @summary
|
|
41403
41489
|
* Retrieve all webhooks in a world.
|
|
41404
41490
|
*
|
|
41405
|
-
* @
|
|
41491
|
+
* @category Webhooks
|
|
41492
|
+
*
|
|
41493
|
+
* @example
|
|
41406
41494
|
* ```ts
|
|
41407
41495
|
* await world.fetchWebhooks();
|
|
41408
41496
|
* const webhooks = world.webhooks;
|
|
@@ -41421,10 +41509,11 @@ class World extends SDKController {
|
|
|
41421
41509
|
}
|
|
41422
41510
|
////////// analytics
|
|
41423
41511
|
/**
|
|
41424
|
-
* @summary
|
|
41425
41512
|
* Retrieve world analytics by day, week, month, quarter, or year
|
|
41426
41513
|
*
|
|
41427
|
-
* @
|
|
41514
|
+
* @category Analytics
|
|
41515
|
+
*
|
|
41516
|
+
* @example
|
|
41428
41517
|
* ```ts
|
|
41429
41518
|
* const analytics = await world.fetchWorldAnalytics({
|
|
41430
41519
|
* periodType: "week",
|
|
@@ -41467,12 +41556,11 @@ _World_droppedAssetsMap = new WeakMap();
|
|
|
41467
41556
|
|
|
41468
41557
|
var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
41469
41558
|
/**
|
|
41470
|
-
* @summary
|
|
41471
41559
|
* Create an instance of User class with optional session credentials.
|
|
41472
41560
|
*
|
|
41473
|
-
* @
|
|
41561
|
+
* @example
|
|
41474
41562
|
* ```ts
|
|
41475
|
-
* await new User(topia, {
|
|
41563
|
+
* const user = await new User(topia, {
|
|
41476
41564
|
* profileId: 1,
|
|
41477
41565
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
41478
41566
|
* });
|
|
@@ -41505,14 +41593,15 @@ class User extends SDKController {
|
|
|
41505
41593
|
get worlds() {
|
|
41506
41594
|
return __classPrivateFieldGet(this, _User_worldsMap, "f");
|
|
41507
41595
|
}
|
|
41508
|
-
|
|
41509
|
-
* @summary
|
|
41596
|
+
/*
|
|
41510
41597
|
* Verify user has valid interactive credentials
|
|
41511
41598
|
*
|
|
41512
|
-
* @
|
|
41599
|
+
* @example
|
|
41513
41600
|
* ```ts
|
|
41514
41601
|
* await user.checkInteractiveCredentials();
|
|
41515
41602
|
* ```
|
|
41603
|
+
*
|
|
41604
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
41516
41605
|
*/
|
|
41517
41606
|
checkInteractiveCredentials() {
|
|
41518
41607
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41526,13 +41615,16 @@ class User extends SDKController {
|
|
|
41526
41615
|
});
|
|
41527
41616
|
}
|
|
41528
41617
|
/**
|
|
41529
|
-
* @summary
|
|
41530
41618
|
* Returns all avatars owned by User
|
|
41531
41619
|
*
|
|
41532
|
-
* @
|
|
41620
|
+
* @category Avatars
|
|
41621
|
+
*
|
|
41622
|
+
* @example
|
|
41533
41623
|
* ```ts
|
|
41534
41624
|
* const avatars = await user.fetchAvatars();
|
|
41535
41625
|
* ```
|
|
41626
|
+
*
|
|
41627
|
+
* @returns {Promise<void | ResponseType>} Returns the avatars or an error.
|
|
41536
41628
|
*/
|
|
41537
41629
|
fetchAvatars() {
|
|
41538
41630
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41546,10 +41638,11 @@ class User extends SDKController {
|
|
|
41546
41638
|
});
|
|
41547
41639
|
}
|
|
41548
41640
|
/**
|
|
41549
|
-
* @summary
|
|
41550
41641
|
* Add a new avatar
|
|
41551
41642
|
*
|
|
41552
|
-
* @
|
|
41643
|
+
* @category Avatars
|
|
41644
|
+
*
|
|
41645
|
+
* @example
|
|
41553
41646
|
* ```ts
|
|
41554
41647
|
* const animationMeta = {
|
|
41555
41648
|
* "emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
|
|
@@ -41627,10 +41720,11 @@ class User extends SDKController {
|
|
|
41627
41720
|
});
|
|
41628
41721
|
}
|
|
41629
41722
|
/**
|
|
41630
|
-
* @summary
|
|
41631
41723
|
* Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
|
|
41632
41724
|
*
|
|
41633
|
-
* @
|
|
41725
|
+
* @category Avatars
|
|
41726
|
+
*
|
|
41727
|
+
* @example
|
|
41634
41728
|
* ```ts
|
|
41635
41729
|
* const animationMeta = {
|
|
41636
41730
|
* "emote": { "loop": false, "x": 0, "y": 0, "hideLoop": true }
|
|
@@ -41708,10 +41802,11 @@ class User extends SDKController {
|
|
|
41708
41802
|
});
|
|
41709
41803
|
}
|
|
41710
41804
|
/**
|
|
41711
|
-
* @summary
|
|
41712
41805
|
* Update avatar and sprite sheet records and upload files to existing sprite sheet and avatar storage buckets
|
|
41713
41806
|
*
|
|
41714
|
-
* @
|
|
41807
|
+
* @category Avatars
|
|
41808
|
+
*
|
|
41809
|
+
* @example
|
|
41715
41810
|
* ```ts
|
|
41716
41811
|
* await user.deleteAvatar("exampleAvatarId");
|
|
41717
41812
|
* ```
|
|
@@ -41728,10 +41823,11 @@ class User extends SDKController {
|
|
|
41728
41823
|
});
|
|
41729
41824
|
}
|
|
41730
41825
|
/**
|
|
41731
|
-
* @summary
|
|
41732
41826
|
* Returns all assets owned by User when an email address is provided.
|
|
41733
41827
|
*
|
|
41734
|
-
* @
|
|
41828
|
+
* @category Assets
|
|
41829
|
+
*
|
|
41830
|
+
* @example
|
|
41735
41831
|
* ```ts
|
|
41736
41832
|
* await user.fetchAssets();
|
|
41737
41833
|
* const userAssets = user.assets;
|
|
@@ -41757,13 +41853,16 @@ class User extends SDKController {
|
|
|
41757
41853
|
});
|
|
41758
41854
|
}
|
|
41759
41855
|
/**
|
|
41760
|
-
* @summary
|
|
41761
41856
|
* Returns all platform assets.
|
|
41762
41857
|
*
|
|
41763
|
-
* @
|
|
41858
|
+
* @category Assets
|
|
41859
|
+
*
|
|
41860
|
+
* @example
|
|
41764
41861
|
* ```ts
|
|
41765
41862
|
* const assets = await user.fetchPlatformAssets();
|
|
41766
41863
|
* ```
|
|
41864
|
+
*
|
|
41865
|
+
* @returns {Promise<object | ResponseType>} Returns the platform assets or an error response.
|
|
41767
41866
|
*/
|
|
41768
41867
|
fetchPlatformAssets() {
|
|
41769
41868
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41777,10 +41876,11 @@ class User extends SDKController {
|
|
|
41777
41876
|
});
|
|
41778
41877
|
}
|
|
41779
41878
|
/**
|
|
41780
|
-
* @summary
|
|
41781
41879
|
* Returns all scenes owned by User.
|
|
41782
41880
|
*
|
|
41783
|
-
* @
|
|
41881
|
+
* @category Scenes
|
|
41882
|
+
*
|
|
41883
|
+
* @example
|
|
41784
41884
|
* ```ts
|
|
41785
41885
|
* await user.fetchScenes();
|
|
41786
41886
|
* const userScenes = user.scenes;
|
|
@@ -41806,18 +41906,17 @@ class User extends SDKController {
|
|
|
41806
41906
|
});
|
|
41807
41907
|
}
|
|
41808
41908
|
/**
|
|
41809
|
-
*
|
|
41810
|
-
*
|
|
41811
|
-
*
|
|
41812
|
-
* 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
|
|
41813
41912
|
*
|
|
41814
|
-
* @
|
|
41913
|
+
* @example
|
|
41815
41914
|
* ```ts
|
|
41816
41915
|
* await user.fetchWorldsByKey();
|
|
41817
41916
|
* const userWorlds = user.worlds;
|
|
41818
41917
|
* ```
|
|
41819
41918
|
*
|
|
41820
|
-
* @
|
|
41919
|
+
* @returns
|
|
41821
41920
|
* ```ts
|
|
41822
41921
|
* { urlSlug: new World({ apiKey, worldArgs, urlSlug }) }
|
|
41823
41922
|
* ```
|
|
@@ -41842,12 +41941,11 @@ class User extends SDKController {
|
|
|
41842
41941
|
});
|
|
41843
41942
|
}
|
|
41844
41943
|
/**
|
|
41845
|
-
*
|
|
41846
|
-
*
|
|
41847
|
-
*
|
|
41848
|
-
* 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.
|
|
41945
|
+
*
|
|
41946
|
+
* @category Worlds
|
|
41849
41947
|
*
|
|
41850
|
-
* @
|
|
41948
|
+
* @example
|
|
41851
41949
|
* ```ts
|
|
41852
41950
|
* await user.fetchAdminWorldsByKey();
|
|
41853
41951
|
* const adminWorlds = user.adminWorlds;
|
|
@@ -41872,14 +41970,17 @@ class User extends SDKController {
|
|
|
41872
41970
|
});
|
|
41873
41971
|
}
|
|
41874
41972
|
/**
|
|
41875
|
-
* @summary
|
|
41876
41973
|
* Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
|
|
41877
41974
|
*
|
|
41878
|
-
* @
|
|
41975
|
+
* @category Dropped Assets
|
|
41976
|
+
*
|
|
41977
|
+
* @example
|
|
41879
41978
|
* ```ts
|
|
41880
41979
|
* await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
|
|
41881
41980
|
* const interactiveWorlds = user.interactiveWorlds;
|
|
41882
41981
|
* ```
|
|
41982
|
+
*
|
|
41983
|
+
* @returns {Promise<object | ResponseType>} Returns the `urlSlugs` of worlds where the Public Key is found or an error response.
|
|
41883
41984
|
*/
|
|
41884
41985
|
fetchInteractiveWorldsByKey(interactivePublicKey) {
|
|
41885
41986
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41893,14 +41994,15 @@ class User extends SDKController {
|
|
|
41893
41994
|
});
|
|
41894
41995
|
}
|
|
41895
41996
|
/**
|
|
41896
|
-
* @summary
|
|
41897
41997
|
* Send an email
|
|
41898
41998
|
*
|
|
41899
|
-
* @
|
|
41999
|
+
* @example
|
|
41900
42000
|
* ```ts
|
|
41901
42001
|
* const html = `<p><b>Hello World!</b></p><p>This email is being sent from via SDK.</p>`
|
|
41902
42002
|
* await user.sendEmail({ html, subject: "Example", to: "example@email.io" });
|
|
41903
42003
|
* ```
|
|
42004
|
+
*
|
|
42005
|
+
* @returns {Promise<object | ResponseType>} Returns `{ success: true }` if the email is sent successfully or an error response.
|
|
41904
42006
|
*/
|
|
41905
42007
|
sendEmail({ html, subject, to, }) {
|
|
41906
42008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41915,13 +42017,16 @@ class User extends SDKController {
|
|
|
41915
42017
|
});
|
|
41916
42018
|
}
|
|
41917
42019
|
/**
|
|
41918
|
-
* @summary
|
|
41919
42020
|
* Get expressions
|
|
41920
42021
|
*
|
|
41921
|
-
* @
|
|
42022
|
+
* @category Expressions
|
|
42023
|
+
*
|
|
42024
|
+
* @example
|
|
41922
42025
|
* ```ts
|
|
41923
42026
|
* await user.getExpressions({ getUnlockablesOnly: true, });
|
|
41924
42027
|
* ```
|
|
42028
|
+
*
|
|
42029
|
+
* @returns {Promise<ResponseType>} Returns an array of expressions or an error response.
|
|
41925
42030
|
*/
|
|
41926
42031
|
getExpressions({ name, getUnlockablesOnly, }) {
|
|
41927
42032
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41938,13 +42043,16 @@ class User extends SDKController {
|
|
|
41938
42043
|
});
|
|
41939
42044
|
}
|
|
41940
42045
|
/**
|
|
41941
|
-
* @summary
|
|
41942
42046
|
* Retrieves the data object for a user.
|
|
41943
42047
|
*
|
|
41944
|
-
* @
|
|
42048
|
+
* @category Data Objects
|
|
42049
|
+
*
|
|
42050
|
+
* @example
|
|
41945
42051
|
* ```ts
|
|
41946
42052
|
* const dataObject = await user.fetchDataObject();
|
|
41947
42053
|
* ```
|
|
42054
|
+
*
|
|
42055
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
41948
42056
|
*/
|
|
41949
42057
|
fetchDataObject(appPublicKey, appJWT) {
|
|
41950
42058
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41964,16 +42072,24 @@ class User extends SDKController {
|
|
|
41964
42072
|
});
|
|
41965
42073
|
}
|
|
41966
42074
|
/**
|
|
41967
|
-
* @summary
|
|
41968
42075
|
* Sets the data object for a user.
|
|
41969
42076
|
*
|
|
42077
|
+
* @remarks
|
|
41970
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
|
|
41971
42079
|
*
|
|
41972
|
-
* @
|
|
42080
|
+
* @category Data Objects
|
|
42081
|
+
*
|
|
42082
|
+
* @example
|
|
41973
42083
|
* ```ts
|
|
41974
|
-
* await user.setDataObject(
|
|
41975
|
-
*
|
|
41976
|
-
*
|
|
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;
|
|
41977
42093
|
* ```
|
|
41978
42094
|
*/
|
|
41979
42095
|
setDataObject(dataObject, options = {}) {
|
|
@@ -41990,16 +42106,22 @@ class User extends SDKController {
|
|
|
41990
42106
|
});
|
|
41991
42107
|
}
|
|
41992
42108
|
/**
|
|
41993
|
-
* @summary
|
|
41994
42109
|
* Updates the data object for a user.
|
|
41995
42110
|
*
|
|
42111
|
+
* @remarks
|
|
41996
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
|
|
41997
42113
|
*
|
|
41998
|
-
* @
|
|
42114
|
+
* @category Data Objects
|
|
42115
|
+
*
|
|
42116
|
+
* @example
|
|
41999
42117
|
* ```ts
|
|
42118
|
+
* const theme = "exampleTheme";
|
|
42119
|
+
*
|
|
42000
42120
|
* await user.updateDataObject({
|
|
42001
|
-
*
|
|
42121
|
+
* [`${theme}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
42002
42122
|
* });
|
|
42123
|
+
*
|
|
42124
|
+
* const { exampleTheme } = user.dataObject;
|
|
42003
42125
|
* ```
|
|
42004
42126
|
*/
|
|
42005
42127
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -42016,12 +42138,14 @@ class User extends SDKController {
|
|
|
42016
42138
|
});
|
|
42017
42139
|
}
|
|
42018
42140
|
/**
|
|
42019
|
-
* @summary
|
|
42020
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.
|
|
42021
42142
|
*
|
|
42143
|
+
* @remarks
|
|
42022
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
|
|
42023
42145
|
*
|
|
42024
|
-
* @
|
|
42146
|
+
* @category Data Objects
|
|
42147
|
+
*
|
|
42148
|
+
* @example
|
|
42025
42149
|
* ```ts
|
|
42026
42150
|
* await user.incrementDataObjectValue("key", 1);
|
|
42027
42151
|
* ```
|
|
@@ -42040,12 +42164,11 @@ class User extends SDKController {
|
|
|
42040
42164
|
_User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
42041
42165
|
|
|
42042
42166
|
/**
|
|
42043
|
-
* @summary
|
|
42044
42167
|
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
42045
42168
|
*
|
|
42046
|
-
* @
|
|
42169
|
+
* @example
|
|
42047
42170
|
* ```ts
|
|
42048
|
-
* 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" } });
|
|
42049
42172
|
* ```
|
|
42050
42173
|
*/
|
|
42051
42174
|
class Visitor extends User {
|
|
@@ -42056,15 +42179,14 @@ class Visitor extends User {
|
|
|
42056
42179
|
this.urlSlug = urlSlug;
|
|
42057
42180
|
}
|
|
42058
42181
|
/**
|
|
42059
|
-
* @summary
|
|
42060
42182
|
* Get a single visitor from a world
|
|
42061
42183
|
*
|
|
42062
|
-
* @
|
|
42184
|
+
* @example
|
|
42063
42185
|
* ```ts
|
|
42064
42186
|
* await visitor.fetchVisitor();
|
|
42065
42187
|
* ```
|
|
42066
42188
|
*
|
|
42067
|
-
* @
|
|
42189
|
+
* @returns
|
|
42068
42190
|
* Returns details for a visitor in a world by id and urlSlug
|
|
42069
42191
|
*/
|
|
42070
42192
|
fetchVisitor() {
|
|
@@ -42090,10 +42212,9 @@ class Visitor extends User {
|
|
|
42090
42212
|
});
|
|
42091
42213
|
}
|
|
42092
42214
|
/**
|
|
42093
|
-
* @summary
|
|
42094
42215
|
* Teleport or walk a visitor currently in a world to a single set of coordinates.
|
|
42095
42216
|
*
|
|
42096
|
-
* @
|
|
42217
|
+
* @example
|
|
42097
42218
|
* ```ts
|
|
42098
42219
|
* await visitor.moveVisitor({
|
|
42099
42220
|
* shouldTeleportVisitor: true,
|
|
@@ -42102,19 +42223,20 @@ class Visitor extends User {
|
|
|
42102
42223
|
* });
|
|
42103
42224
|
* ```
|
|
42104
42225
|
*
|
|
42105
|
-
* @
|
|
42106
|
-
*
|
|
42226
|
+
* @returns
|
|
42227
|
+
* Returns `{ success: true }` if the visitor was moved successfully.
|
|
42107
42228
|
*/
|
|
42108
42229
|
moveVisitor({ shouldTeleportVisitor, x, y }) {
|
|
42109
42230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42110
42231
|
try {
|
|
42111
|
-
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`, {
|
|
42112
42233
|
moveTo: {
|
|
42113
42234
|
x,
|
|
42114
42235
|
y,
|
|
42115
42236
|
},
|
|
42116
42237
|
teleport: shouldTeleportVisitor,
|
|
42117
42238
|
}, this.requestOptions);
|
|
42239
|
+
return response.data;
|
|
42118
42240
|
}
|
|
42119
42241
|
catch (error) {
|
|
42120
42242
|
throw this.errorHandler({ error, params: { shouldTeleportVisitor, x, y }, sdkMethod: "Visitor.moveVisitor" });
|
|
@@ -42122,10 +42244,9 @@ class Visitor extends User {
|
|
|
42122
42244
|
});
|
|
42123
42245
|
}
|
|
42124
42246
|
/**
|
|
42125
|
-
* @summary
|
|
42126
42247
|
* Display a message via a toast to a visitor currently in a world.
|
|
42127
42248
|
*
|
|
42128
|
-
* @
|
|
42249
|
+
* @example
|
|
42129
42250
|
* ```ts
|
|
42130
42251
|
* await visitor.fireToast({
|
|
42131
42252
|
* groupId: "custom-message",
|
|
@@ -42133,6 +42254,8 @@ class Visitor extends User {
|
|
|
42133
42254
|
* text: "Thank you for participating!",
|
|
42134
42255
|
* });
|
|
42135
42256
|
* ```
|
|
42257
|
+
*
|
|
42258
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42136
42259
|
*/
|
|
42137
42260
|
fireToast({ groupId, title, text }) {
|
|
42138
42261
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42142,7 +42265,8 @@ class Visitor extends User {
|
|
|
42142
42265
|
text,
|
|
42143
42266
|
};
|
|
42144
42267
|
try {
|
|
42145
|
-
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;
|
|
42146
42270
|
}
|
|
42147
42271
|
catch (error) {
|
|
42148
42272
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
@@ -42150,10 +42274,11 @@ class Visitor extends User {
|
|
|
42150
42274
|
});
|
|
42151
42275
|
}
|
|
42152
42276
|
/**
|
|
42153
|
-
* @summary
|
|
42154
42277
|
* Open an iframe in a drawer or modal for a visitor currently in a world.
|
|
42155
42278
|
*
|
|
42156
|
-
* @
|
|
42279
|
+
* @category iframes
|
|
42280
|
+
*
|
|
42281
|
+
* @example
|
|
42157
42282
|
* ```ts
|
|
42158
42283
|
* await visitor.openIframe({
|
|
42159
42284
|
* droppedAssetId: "droppedAssetId",
|
|
@@ -42162,6 +42287,8 @@ class Visitor extends User {
|
|
|
42162
42287
|
* title: "Hello World",
|
|
42163
42288
|
* });
|
|
42164
42289
|
* ```
|
|
42290
|
+
*
|
|
42291
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42165
42292
|
*/
|
|
42166
42293
|
openIframe({ droppedAssetId, link, shouldOpenInDrawer, title, }) {
|
|
42167
42294
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42172,7 +42299,8 @@ class Visitor extends User {
|
|
|
42172
42299
|
title,
|
|
42173
42300
|
};
|
|
42174
42301
|
try {
|
|
42175
|
-
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;
|
|
42176
42304
|
}
|
|
42177
42305
|
catch (error) {
|
|
42178
42306
|
throw this.errorHandler({ error, params, sdkMethod: "Visitor.openIframe" });
|
|
@@ -42180,18 +42308,22 @@ class Visitor extends User {
|
|
|
42180
42308
|
});
|
|
42181
42309
|
}
|
|
42182
42310
|
/**
|
|
42183
|
-
* @summary
|
|
42184
42311
|
* Reload an iframe for a visitor currently in a world.
|
|
42185
42312
|
*
|
|
42186
|
-
* @
|
|
42313
|
+
* @category iframes
|
|
42314
|
+
*
|
|
42315
|
+
* @example
|
|
42187
42316
|
* ```ts
|
|
42188
42317
|
* await visitor.reloadIframe("droppedAssetId");
|
|
42189
42318
|
* ```
|
|
42319
|
+
*
|
|
42320
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42190
42321
|
*/
|
|
42191
42322
|
reloadIframe(droppedAssetId) {
|
|
42192
42323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42193
42324
|
try {
|
|
42194
|
-
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;
|
|
42195
42327
|
}
|
|
42196
42328
|
catch (error) {
|
|
42197
42329
|
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "Visitor.reloadIframe" });
|
|
@@ -42199,18 +42331,22 @@ class Visitor extends User {
|
|
|
42199
42331
|
});
|
|
42200
42332
|
}
|
|
42201
42333
|
/**
|
|
42202
|
-
* @summary
|
|
42203
42334
|
* Close an iframe for a visitor currently in a world.
|
|
42204
42335
|
*
|
|
42205
|
-
* @
|
|
42336
|
+
* @category iframes
|
|
42337
|
+
*
|
|
42338
|
+
* @example
|
|
42206
42339
|
* ```ts
|
|
42207
42340
|
* await visitor.closeIframe("droppedAssetId");
|
|
42208
42341
|
* ```
|
|
42342
|
+
*
|
|
42343
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42209
42344
|
*/
|
|
42210
42345
|
closeIframe(droppedAssetId) {
|
|
42211
42346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42212
42347
|
try {
|
|
42213
|
-
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;
|
|
42214
42350
|
}
|
|
42215
42351
|
catch (error) {
|
|
42216
42352
|
throw this.errorHandler({ error, params: { droppedAssetId }, sdkMethod: "Visitor.closeIframe" });
|
|
@@ -42218,18 +42354,20 @@ class Visitor extends User {
|
|
|
42218
42354
|
});
|
|
42219
42355
|
}
|
|
42220
42356
|
/**
|
|
42221
|
-
* @summary
|
|
42222
42357
|
* Mute and turn video off for a visitor currently in a world.
|
|
42223
42358
|
*
|
|
42224
|
-
* @
|
|
42359
|
+
* @example
|
|
42225
42360
|
* ```ts
|
|
42226
42361
|
* await visitor.turnAVOff();
|
|
42227
42362
|
* ```
|
|
42363
|
+
*
|
|
42364
|
+
* @returns {Promise<void | ResponseType>} Returns `{ success: true }` or an error.
|
|
42228
42365
|
*/
|
|
42229
42366
|
turnAVOff() {
|
|
42230
42367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42231
42368
|
try {
|
|
42232
|
-
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;
|
|
42233
42371
|
}
|
|
42234
42372
|
catch (error) {
|
|
42235
42373
|
throw this.errorHandler({ error, sdkMethod: "Visitor.turnAVOff" });
|
|
@@ -42237,13 +42375,15 @@ class Visitor extends User {
|
|
|
42237
42375
|
});
|
|
42238
42376
|
}
|
|
42239
42377
|
/**
|
|
42240
|
-
* @summary
|
|
42241
42378
|
* Get expressions
|
|
42242
42379
|
*
|
|
42243
|
-
* @
|
|
42380
|
+
* @category Expressions
|
|
42381
|
+
*
|
|
42382
|
+
* @example
|
|
42244
42383
|
* ```ts
|
|
42245
42384
|
* await visitor.getExpressions({ getUnlockablesOnly: true, });
|
|
42246
42385
|
* ```
|
|
42386
|
+
* @returns {Promise<ResponseType>} Returns an array of expressions or an error response.
|
|
42247
42387
|
*/
|
|
42248
42388
|
getExpressions({ name, getUnlockablesOnly, }) {
|
|
42249
42389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42260,14 +42400,17 @@ class Visitor extends User {
|
|
|
42260
42400
|
});
|
|
42261
42401
|
}
|
|
42262
42402
|
/**
|
|
42263
|
-
* @summary
|
|
42264
42403
|
* Grant expression to a visitor by id or name.
|
|
42265
42404
|
*
|
|
42266
|
-
* @
|
|
42405
|
+
* @category Expressions
|
|
42406
|
+
*
|
|
42407
|
+
* @example
|
|
42267
42408
|
* ```ts
|
|
42268
42409
|
* await visitor.grantExpression({ id: "exampleExpressionId" });
|
|
42269
42410
|
* await visitor.grantExpression({ name: "exampleExpressionName" });
|
|
42270
42411
|
* ```
|
|
42412
|
+
*
|
|
42413
|
+
* @returns {Promise<ResponseType>} Returns `{ success: true }` if the expression was granted successfully or an error response.
|
|
42271
42414
|
*/
|
|
42272
42415
|
grantExpression({ id, name }) {
|
|
42273
42416
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42288,13 +42431,16 @@ class Visitor extends User {
|
|
|
42288
42431
|
});
|
|
42289
42432
|
}
|
|
42290
42433
|
/**
|
|
42291
|
-
* @summary
|
|
42292
42434
|
* Get all particles available
|
|
42293
42435
|
*
|
|
42294
|
-
* @
|
|
42436
|
+
* @category Particle Effects
|
|
42437
|
+
*
|
|
42438
|
+
* @example
|
|
42295
42439
|
* ```ts
|
|
42296
42440
|
* await visitor.getAllParticles();
|
|
42297
42441
|
* ```
|
|
42442
|
+
*
|
|
42443
|
+
* @returns {Promise<ResponseType>} Returns an array of particles or an error response.
|
|
42298
42444
|
*/
|
|
42299
42445
|
getAllParticles() {
|
|
42300
42446
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42308,13 +42454,16 @@ class Visitor extends User {
|
|
|
42308
42454
|
});
|
|
42309
42455
|
}
|
|
42310
42456
|
/**
|
|
42311
|
-
* @summary
|
|
42312
42457
|
* Trigger a particle effect on a visitor
|
|
42313
42458
|
*
|
|
42314
|
-
* @
|
|
42459
|
+
* @category Particle Effects
|
|
42460
|
+
*
|
|
42461
|
+
* @example
|
|
42315
42462
|
* ```ts
|
|
42316
42463
|
* await visitor.triggerParticle({ name: "Flame" });
|
|
42317
42464
|
* ```
|
|
42465
|
+
*
|
|
42466
|
+
* @returns {Promise<ResponseType | string>} Returns `{ success: true }` or a message if no particleId is found.
|
|
42318
42467
|
*/
|
|
42319
42468
|
triggerParticle({ id, name, duration = 10, }) {
|
|
42320
42469
|
var _a;
|
|
@@ -42338,13 +42487,16 @@ class Visitor extends User {
|
|
|
42338
42487
|
});
|
|
42339
42488
|
}
|
|
42340
42489
|
/**
|
|
42341
|
-
* @summary
|
|
42342
42490
|
* Retrieves the data object for a visitor.
|
|
42343
42491
|
*
|
|
42344
|
-
* @
|
|
42492
|
+
* @category Data Objects
|
|
42493
|
+
*
|
|
42494
|
+
* @example
|
|
42345
42495
|
* ```ts
|
|
42346
42496
|
* const dataObject = await visitor.fetchDataObject();
|
|
42347
42497
|
* ```
|
|
42498
|
+
*
|
|
42499
|
+
* @returns {Promise<object | ResponseType>} Returns the data object or an error response.
|
|
42348
42500
|
*/
|
|
42349
42501
|
fetchDataObject(appPublicKey, appJWT) {
|
|
42350
42502
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42362,16 +42514,24 @@ class Visitor extends User {
|
|
|
42362
42514
|
});
|
|
42363
42515
|
}
|
|
42364
42516
|
/**
|
|
42365
|
-
* @summary
|
|
42366
42517
|
* Sets the data object for a visitor.
|
|
42367
42518
|
*
|
|
42519
|
+
* @remarks
|
|
42368
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
|
|
42369
42521
|
*
|
|
42370
|
-
* @
|
|
42522
|
+
* @category Data Objects
|
|
42523
|
+
*
|
|
42524
|
+
* @example
|
|
42371
42525
|
* ```ts
|
|
42372
|
-
* await visitor.setDataObject(
|
|
42373
|
-
*
|
|
42374
|
-
*
|
|
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;
|
|
42375
42535
|
* ```
|
|
42376
42536
|
*/
|
|
42377
42537
|
setDataObject(dataObject, options = {}) {
|
|
@@ -42386,16 +42546,22 @@ class Visitor extends User {
|
|
|
42386
42546
|
});
|
|
42387
42547
|
}
|
|
42388
42548
|
/**
|
|
42389
|
-
* @summary
|
|
42390
42549
|
* Updates the data object for a visitor.
|
|
42391
42550
|
*
|
|
42551
|
+
* @remarks
|
|
42392
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
|
|
42393
42553
|
*
|
|
42394
|
-
* @
|
|
42554
|
+
* @category Data Objects
|
|
42555
|
+
*
|
|
42556
|
+
* @example
|
|
42395
42557
|
* ```ts
|
|
42558
|
+
* const theme = "exampleTheme";
|
|
42559
|
+
*
|
|
42396
42560
|
* await visitor.updateDataObject({
|
|
42397
|
-
*
|
|
42561
|
+
* [`${theme}.itemsCollectedByUser`]: { [dateKey]: { count: 1 }, total: 1 },
|
|
42398
42562
|
* });
|
|
42563
|
+
*
|
|
42564
|
+
* const { exampleTheme } = visitor.dataObject;
|
|
42399
42565
|
* ```
|
|
42400
42566
|
*/
|
|
42401
42567
|
updateDataObject(dataObject, options = {}) {
|
|
@@ -42410,12 +42576,14 @@ class Visitor extends User {
|
|
|
42410
42576
|
});
|
|
42411
42577
|
}
|
|
42412
42578
|
/**
|
|
42413
|
-
* @summary
|
|
42414
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.
|
|
42415
42580
|
*
|
|
42581
|
+
* @remarks
|
|
42416
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
|
|
42417
42583
|
*
|
|
42418
|
-
* @
|
|
42584
|
+
* @category Data Objects
|
|
42585
|
+
*
|
|
42586
|
+
* @example
|
|
42419
42587
|
* ```ts
|
|
42420
42588
|
* await visitor.incrementDataObjectValue("key", 1);
|
|
42421
42589
|
* ```
|
|
@@ -42435,10 +42603,9 @@ class Visitor extends User {
|
|
|
42435
42603
|
});
|
|
42436
42604
|
}
|
|
42437
42605
|
/**
|
|
42438
|
-
* @summary
|
|
42439
42606
|
* Update analytics for a given public key. Must have valid interactive credentials from a visitor in the world.
|
|
42440
42607
|
*
|
|
42441
|
-
* @
|
|
42608
|
+
* @example
|
|
42442
42609
|
* ```ts
|
|
42443
42610
|
* await visitor.updatePublicKeyAnalytics([{ analyticName: "joins", profileId, uniqueKey: profileId, urlSlug }]);
|
|
42444
42611
|
* ```
|
|
@@ -42458,10 +42625,9 @@ class Visitor extends User {
|
|
|
42458
42625
|
});
|
|
42459
42626
|
}
|
|
42460
42627
|
/**
|
|
42461
|
-
* @summary
|
|
42462
42628
|
* Setup signal to visitor
|
|
42463
42629
|
*
|
|
42464
|
-
* @
|
|
42630
|
+
* @example
|
|
42465
42631
|
* ```ts
|
|
42466
42632
|
* await visitor.sendSignalToVisitor(iceServers);
|
|
42467
42633
|
* ```
|
|
@@ -42484,12 +42650,11 @@ class Visitor extends User {
|
|
|
42484
42650
|
}
|
|
42485
42651
|
|
|
42486
42652
|
/**
|
|
42487
|
-
* @summary
|
|
42488
42653
|
* Create an instance of WebRTCConnector class with optional session credentials.
|
|
42489
42654
|
*
|
|
42490
|
-
* @
|
|
42655
|
+
* @example
|
|
42491
42656
|
* ```ts
|
|
42492
|
-
* await new WebRTCConnector(topia, {
|
|
42657
|
+
* const webRTC = await new WebRTCConnector(topia, {
|
|
42493
42658
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42494
42659
|
* });
|
|
42495
42660
|
* ```
|
|
@@ -42502,10 +42667,9 @@ class WebRTCConnector extends SDKController {
|
|
|
42502
42667
|
this.urlSlug = urlSlug;
|
|
42503
42668
|
}
|
|
42504
42669
|
/**
|
|
42505
|
-
* @summary
|
|
42506
42670
|
* Get twilio
|
|
42507
42671
|
*
|
|
42508
|
-
* @
|
|
42672
|
+
* @example
|
|
42509
42673
|
* ```ts
|
|
42510
42674
|
* await webRTCConnector.getTwilioConfig();
|
|
42511
42675
|
* ```
|
|
@@ -42526,14 +42690,14 @@ class WebRTCConnector extends SDKController {
|
|
|
42526
42690
|
|
|
42527
42691
|
var _WorldActivity_visitorsMap;
|
|
42528
42692
|
/**
|
|
42529
|
-
* @summary
|
|
42530
42693
|
* Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
|
|
42531
42694
|
*
|
|
42695
|
+
* @remarks
|
|
42532
42696
|
* This class is responsible for all activity of a specified world including editing dropped assets, moving current visitors, etc.
|
|
42533
42697
|
*
|
|
42534
|
-
* @
|
|
42698
|
+
* @example
|
|
42535
42699
|
* ```ts
|
|
42536
|
-
* await new WorldActivity(topia, "exampleWorld", {
|
|
42700
|
+
* const activity = await new WorldActivity(topia, "exampleWorld", {
|
|
42537
42701
|
* attributes: { name: "Example World" },
|
|
42538
42702
|
* credentials: { interactiveNonce: "exampleNonce", assetId: "droppedAssetId", visitorId: 1, urlSlug: "exampleWorld" }
|
|
42539
42703
|
* });
|
|
@@ -42580,13 +42744,16 @@ class WorldActivity extends SDKController {
|
|
|
42580
42744
|
});
|
|
42581
42745
|
}
|
|
42582
42746
|
/**
|
|
42583
|
-
* @summary
|
|
42584
42747
|
* Retrieve all visitors currently in a world.
|
|
42585
42748
|
*
|
|
42586
|
-
* @
|
|
42749
|
+
* @category Visitors
|
|
42750
|
+
*
|
|
42751
|
+
* @example
|
|
42587
42752
|
* ```ts
|
|
42588
42753
|
* const visitors = await worldActivity.currentVisitors("exampleLandmarkZoneId", true);
|
|
42589
42754
|
* ```
|
|
42755
|
+
*
|
|
42756
|
+
* @returns {Promise<void | ResponseType>} Returns the an object containing current visitors keyed by visitorId or an error.
|
|
42590
42757
|
*/
|
|
42591
42758
|
currentVisitors(shouldIncludeAdminPermissions) {
|
|
42592
42759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42600,13 +42767,16 @@ class WorldActivity extends SDKController {
|
|
|
42600
42767
|
});
|
|
42601
42768
|
}
|
|
42602
42769
|
/**
|
|
42603
|
-
* @summary
|
|
42604
42770
|
* Retrieve all visitors currently in a Landmark Zone.
|
|
42605
42771
|
*
|
|
42606
|
-
* @
|
|
42772
|
+
* @category Visitors
|
|
42773
|
+
*
|
|
42774
|
+
* @example
|
|
42607
42775
|
* ```ts
|
|
42608
42776
|
* const visitors = await worldActivity.fetchVisitorsInZone({ droppedAssetId: "exampleDroppedAssetId" });
|
|
42609
42777
|
* ```
|
|
42778
|
+
*
|
|
42779
|
+
* @returns {Promise<void | ResponseType>} Returns the an object containing current visitors keyed by visitorId or an error.
|
|
42610
42780
|
*/
|
|
42611
42781
|
fetchVisitorsInZone({ droppedAssetId, shouldIncludeAdminPermissions, }) {
|
|
42612
42782
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42622,12 +42792,15 @@ class WorldActivity extends SDKController {
|
|
|
42622
42792
|
});
|
|
42623
42793
|
}
|
|
42624
42794
|
/**
|
|
42625
|
-
* @summary
|
|
42626
42795
|
* Move all visitors currently in a world to a single set of coordinates.
|
|
42796
|
+
*
|
|
42797
|
+
* @remarks
|
|
42627
42798
|
* Optionally refetch visitors, teleport or walk visitors to new location,
|
|
42628
42799
|
* and scatter visitors by any number so that they don't all move to the exact same location.
|
|
42629
42800
|
*
|
|
42630
|
-
* @
|
|
42801
|
+
* @category Visitors
|
|
42802
|
+
*
|
|
42803
|
+
* @example
|
|
42631
42804
|
* ```ts
|
|
42632
42805
|
* await worldActivity.moveAllVisitors({
|
|
42633
42806
|
* shouldFetchVisitors: true,
|
|
@@ -42638,7 +42811,7 @@ class WorldActivity extends SDKController {
|
|
|
42638
42811
|
* });
|
|
42639
42812
|
* ```
|
|
42640
42813
|
*
|
|
42641
|
-
* @
|
|
42814
|
+
* @returns
|
|
42642
42815
|
* Updates each Visitor instance and worldActivity.visitors map.
|
|
42643
42816
|
*/
|
|
42644
42817
|
moveAllVisitors({ shouldFetchVisitors = true, shouldTeleportVisitors = true, scatterVisitorsBy = 0, x, y, }) {
|
|
@@ -42659,10 +42832,11 @@ class WorldActivity extends SDKController {
|
|
|
42659
42832
|
});
|
|
42660
42833
|
}
|
|
42661
42834
|
/**
|
|
42662
|
-
* @summary
|
|
42663
42835
|
* Teleport or walk a list of visitors currently in a world to various coordinates.
|
|
42664
42836
|
*
|
|
42665
|
-
* @
|
|
42837
|
+
* @category Visitors
|
|
42838
|
+
*
|
|
42839
|
+
* @example
|
|
42666
42840
|
* ```ts
|
|
42667
42841
|
* const visitorsToMove = [
|
|
42668
42842
|
* {
|
|
@@ -42680,7 +42854,7 @@ class WorldActivity extends SDKController {
|
|
|
42680
42854
|
* await worldActivity.moveVisitors(visitorsToMove);
|
|
42681
42855
|
* ```
|
|
42682
42856
|
*
|
|
42683
|
-
* @
|
|
42857
|
+
* @returns
|
|
42684
42858
|
* Updates each Visitor instance and worldActivity.visitors map.
|
|
42685
42859
|
*/
|
|
42686
42860
|
moveVisitors(visitorsToMove) {
|
|
@@ -42697,7 +42871,7 @@ class WorldActivity extends SDKController {
|
|
|
42697
42871
|
_WorldActivity_visitorsMap = new WeakMap();
|
|
42698
42872
|
|
|
42699
42873
|
/**
|
|
42700
|
-
* @
|
|
42874
|
+
* @example
|
|
42701
42875
|
* ```ts
|
|
42702
42876
|
* const Asset = new AssetFactory(myTopiaInstance);
|
|
42703
42877
|
* ```
|
|
@@ -42707,22 +42881,22 @@ class AssetFactory extends SDKController {
|
|
|
42707
42881
|
super(topia);
|
|
42708
42882
|
}
|
|
42709
42883
|
/**
|
|
42710
|
-
* @summary
|
|
42711
42884
|
* Instantiate a new instance of Asset class.
|
|
42712
42885
|
*
|
|
42713
|
-
* @
|
|
42886
|
+
* @example
|
|
42714
42887
|
* ```
|
|
42715
42888
|
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42716
42889
|
* ```
|
|
42890
|
+
*
|
|
42891
|
+
* @returns {Asset} Returns a new Asset object with the asset id.
|
|
42717
42892
|
*/
|
|
42718
42893
|
create(id, options) {
|
|
42719
42894
|
return new Asset(this.topia, id, options);
|
|
42720
42895
|
}
|
|
42721
42896
|
/**
|
|
42722
|
-
* @summary
|
|
42723
42897
|
* Upload a new Asset and return a new instance of Asset class.
|
|
42724
42898
|
*
|
|
42725
|
-
* @
|
|
42899
|
+
* @example
|
|
42726
42900
|
* ```
|
|
42727
42901
|
* const assetPayload = {
|
|
42728
42902
|
* assetName: "exampleAssetName"
|
|
@@ -42734,6 +42908,8 @@ class AssetFactory extends SDKController {
|
|
|
42734
42908
|
* }
|
|
42735
42909
|
* const asset = await Asset.upload(assetPayload, apiKey);
|
|
42736
42910
|
* ```
|
|
42911
|
+
*
|
|
42912
|
+
* @returns {AssetType} Returns a new Asset object with the asset details.
|
|
42737
42913
|
*/
|
|
42738
42914
|
upload(assetPayload, apiKey) {
|
|
42739
42915
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42753,7 +42929,7 @@ class AssetFactory extends SDKController {
|
|
|
42753
42929
|
}
|
|
42754
42930
|
|
|
42755
42931
|
/**
|
|
42756
|
-
* @
|
|
42932
|
+
* @example
|
|
42757
42933
|
* ```ts
|
|
42758
42934
|
* const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
|
|
42759
42935
|
* ```
|
|
@@ -42763,25 +42939,27 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42763
42939
|
super(topia);
|
|
42764
42940
|
}
|
|
42765
42941
|
/**
|
|
42766
|
-
* @summary
|
|
42767
42942
|
* Instantiate a new instance of DroppedAsset class.
|
|
42768
42943
|
*
|
|
42769
|
-
* @
|
|
42944
|
+
* @example
|
|
42770
42945
|
* ```
|
|
42771
42946
|
* const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42772
42947
|
* ```
|
|
42948
|
+
*
|
|
42949
|
+
* @returns {DroppedAsset} Returns a new DroppedAsset object.
|
|
42773
42950
|
*/
|
|
42774
42951
|
create(id, urlSlug, options) {
|
|
42775
42952
|
return new DroppedAsset(this.topia, id, urlSlug, options);
|
|
42776
42953
|
}
|
|
42777
42954
|
/**
|
|
42778
|
-
* @summary
|
|
42779
42955
|
* Instantiate a new instance of DroppedAsset class and retrieve all properties.
|
|
42780
42956
|
*
|
|
42781
|
-
* @
|
|
42957
|
+
* @example
|
|
42782
42958
|
* ```
|
|
42783
42959
|
* const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42784
42960
|
* ```
|
|
42961
|
+
*
|
|
42962
|
+
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
|
|
42785
42963
|
*/
|
|
42786
42964
|
get(id, urlSlug, options) {
|
|
42787
42965
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42791,16 +42969,17 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42791
42969
|
});
|
|
42792
42970
|
}
|
|
42793
42971
|
/**
|
|
42794
|
-
* @summary
|
|
42795
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.
|
|
42796
42973
|
*
|
|
42797
|
-
* @
|
|
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
|
|
42798
42978
|
* ```
|
|
42799
42979
|
* const droppedAssetInstance = await DroppedAsset.getWithUniqueName("exampleUniqueName", urlSlug, interactiveSecret, credentials);
|
|
42800
42980
|
* ```
|
|
42801
42981
|
*
|
|
42802
|
-
* @
|
|
42803
|
-
* 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.
|
|
42804
42983
|
*/
|
|
42805
42984
|
getWithUniqueName(uniqueName, urlSlug, interactiveSecret, credentials) {
|
|
42806
42985
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42825,10 +43004,9 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42825
43004
|
});
|
|
42826
43005
|
}
|
|
42827
43006
|
/**
|
|
42828
|
-
* @summary
|
|
42829
43007
|
* Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
|
|
42830
43008
|
*
|
|
42831
|
-
* @
|
|
43009
|
+
* @example
|
|
42832
43010
|
* ```
|
|
42833
43011
|
* const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42834
43012
|
* const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
|
|
@@ -42843,6 +43021,8 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42843
43021
|
urlSlug,
|
|
42844
43022
|
});
|
|
42845
43023
|
* ```
|
|
43024
|
+
*
|
|
43025
|
+
* @returns {Promise<DroppedAsset>} Returns a new DroppedAsset object with all properties.
|
|
42846
43026
|
*/
|
|
42847
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, }) {
|
|
42848
43028
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42897,7 +43077,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42897
43077
|
}
|
|
42898
43078
|
|
|
42899
43079
|
/**
|
|
42900
|
-
* @
|
|
43080
|
+
* @example
|
|
42901
43081
|
* ```ts
|
|
42902
43082
|
* const Ecosystem = new EcosystemFactory(myTopiaInstance);
|
|
42903
43083
|
* ```
|
|
@@ -42907,13 +43087,14 @@ class EcosystemFactory {
|
|
|
42907
43087
|
this.topia = topia;
|
|
42908
43088
|
}
|
|
42909
43089
|
/**
|
|
42910
|
-
* @summary
|
|
42911
43090
|
* Instantiate a new instance of Ecosystem class.
|
|
42912
43091
|
*
|
|
42913
|
-
* @
|
|
43092
|
+
* @example
|
|
42914
43093
|
* ```
|
|
42915
43094
|
* const ecosystemInstance = await Ecosystem.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }});
|
|
42916
43095
|
* ```
|
|
43096
|
+
*
|
|
43097
|
+
* @returns {Ecosystem} Returns a new Ecosystem object.
|
|
42917
43098
|
*/
|
|
42918
43099
|
create(options) {
|
|
42919
43100
|
return new Ecosystem(this.topia, options);
|
|
@@ -42921,7 +43102,7 @@ class EcosystemFactory {
|
|
|
42921
43102
|
}
|
|
42922
43103
|
|
|
42923
43104
|
/**
|
|
42924
|
-
* @
|
|
43105
|
+
* @example
|
|
42925
43106
|
* ```ts
|
|
42926
43107
|
* const Scene = new SceneFactory(myTopiaInstance);
|
|
42927
43108
|
* ```
|
|
@@ -42932,25 +43113,27 @@ class SceneFactory {
|
|
|
42932
43113
|
this.create;
|
|
42933
43114
|
}
|
|
42934
43115
|
/**
|
|
42935
|
-
* @summary
|
|
42936
43116
|
* Instantiate a new instance of Scene class.
|
|
42937
43117
|
*
|
|
42938
|
-
* @
|
|
43118
|
+
* @example
|
|
42939
43119
|
* ```
|
|
42940
43120
|
* const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42941
43121
|
* ```
|
|
43122
|
+
*
|
|
43123
|
+
* @returns {Scene} Returns a new Scene object.
|
|
42942
43124
|
*/
|
|
42943
43125
|
create(id, options) {
|
|
42944
43126
|
return new Scene(this.topia, id, options);
|
|
42945
43127
|
}
|
|
42946
43128
|
/**
|
|
42947
|
-
* @summary
|
|
42948
43129
|
* Instantiate a new instance of Scene class and retrieve all properties.
|
|
42949
43130
|
*
|
|
42950
|
-
* @
|
|
43131
|
+
* @example
|
|
42951
43132
|
* ```
|
|
42952
43133
|
* const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42953
43134
|
* ```
|
|
43135
|
+
*
|
|
43136
|
+
* @returns {Promise<Scene>} Returns a new Scene object with all properties.
|
|
42954
43137
|
*/
|
|
42955
43138
|
get(id, options) {
|
|
42956
43139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -42962,7 +43145,7 @@ class SceneFactory {
|
|
|
42962
43145
|
}
|
|
42963
43146
|
|
|
42964
43147
|
/**
|
|
42965
|
-
* @
|
|
43148
|
+
* @example
|
|
42966
43149
|
* ```ts
|
|
42967
43150
|
* const User = new UserFactory(myTopiaInstance);
|
|
42968
43151
|
* ```
|
|
@@ -42972,13 +43155,14 @@ class UserFactory {
|
|
|
42972
43155
|
this.topia = topia;
|
|
42973
43156
|
}
|
|
42974
43157
|
/**
|
|
42975
|
-
* @summary
|
|
42976
43158
|
* Instantiate a new instance of User class.
|
|
42977
43159
|
*
|
|
42978
|
-
* @
|
|
43160
|
+
* @example
|
|
42979
43161
|
* ```
|
|
42980
43162
|
* const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
42981
43163
|
* ```
|
|
43164
|
+
*
|
|
43165
|
+
* @returns {User} Returns a new User object.
|
|
42982
43166
|
*/
|
|
42983
43167
|
create(options) {
|
|
42984
43168
|
return new User(this.topia, options);
|
|
@@ -42986,7 +43170,7 @@ class UserFactory {
|
|
|
42986
43170
|
}
|
|
42987
43171
|
|
|
42988
43172
|
/**
|
|
42989
|
-
* @
|
|
43173
|
+
* @example
|
|
42990
43174
|
* ```ts
|
|
42991
43175
|
* const Visitor = new VisitorFactory(myTopiaInstance);
|
|
42992
43176
|
* ```
|
|
@@ -42996,25 +43180,27 @@ class VisitorFactory {
|
|
|
42996
43180
|
this.topia = topia;
|
|
42997
43181
|
}
|
|
42998
43182
|
/**
|
|
42999
|
-
* @summary
|
|
43000
43183
|
* Instantiate a new instance of Visitor class.
|
|
43001
43184
|
*
|
|
43002
|
-
* @
|
|
43185
|
+
* @example
|
|
43003
43186
|
* ```
|
|
43004
43187
|
* const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43005
43188
|
* ```
|
|
43189
|
+
*
|
|
43190
|
+
* @returns {Visitor} Returns a new Visitor object.
|
|
43006
43191
|
*/
|
|
43007
43192
|
create(id, urlSlug, options) {
|
|
43008
43193
|
return new Visitor(this.topia, id, urlSlug, options);
|
|
43009
43194
|
}
|
|
43010
43195
|
/**
|
|
43011
|
-
* @summary
|
|
43012
43196
|
* Instantiate a new instance of Visitor class and retrieve all properties.
|
|
43013
43197
|
*
|
|
43014
|
-
* @
|
|
43198
|
+
* @example
|
|
43015
43199
|
* ```
|
|
43016
43200
|
* const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43017
43201
|
* ```
|
|
43202
|
+
*
|
|
43203
|
+
* @returns {Promise<Visitor>} Returns a new Visitor object with all properties.
|
|
43018
43204
|
*/
|
|
43019
43205
|
get(id, urlSlug, options) {
|
|
43020
43206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -43026,7 +43212,7 @@ class VisitorFactory {
|
|
|
43026
43212
|
}
|
|
43027
43213
|
|
|
43028
43214
|
/**
|
|
43029
|
-
* @
|
|
43215
|
+
* @example
|
|
43030
43216
|
* ```ts
|
|
43031
43217
|
* const WebRTCConnector = new WebRTCConnectorFactory(myTopiaInstance);
|
|
43032
43218
|
* ```
|
|
@@ -43036,13 +43222,14 @@ class WebRTCConnectorFactory {
|
|
|
43036
43222
|
this.topia = topia;
|
|
43037
43223
|
}
|
|
43038
43224
|
/**
|
|
43039
|
-
* @summary
|
|
43040
43225
|
* Instantiate a new instance of WebRTCConnector class.
|
|
43041
43226
|
*
|
|
43042
|
-
* @
|
|
43227
|
+
* @example
|
|
43043
43228
|
* ```
|
|
43044
43229
|
* const webRTCInstance = await WebRTCConnector.create({ credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId }, twilioConfig: {} });
|
|
43045
43230
|
* ```
|
|
43231
|
+
*
|
|
43232
|
+
* @returns {WebRTCConnector} Returns a new WebRTCConnector object.
|
|
43046
43233
|
*/
|
|
43047
43234
|
create(urlSlug, options) {
|
|
43048
43235
|
return new WebRTCConnector(this.topia, urlSlug, options);
|
|
@@ -43050,7 +43237,7 @@ class WebRTCConnectorFactory {
|
|
|
43050
43237
|
}
|
|
43051
43238
|
|
|
43052
43239
|
/**
|
|
43053
|
-
* @
|
|
43240
|
+
* @example
|
|
43054
43241
|
* ```ts
|
|
43055
43242
|
* const WorldActivity = new WorldActivityFactory(myTopiaInstance);
|
|
43056
43243
|
* ```
|
|
@@ -43060,13 +43247,14 @@ class WorldActivityFactory {
|
|
|
43060
43247
|
this.topia = topia;
|
|
43061
43248
|
}
|
|
43062
43249
|
/**
|
|
43063
|
-
* @summary
|
|
43064
43250
|
* Instantiate a new instance of WorldActivity class.
|
|
43065
43251
|
*
|
|
43066
|
-
* @
|
|
43252
|
+
* @example
|
|
43067
43253
|
* ```
|
|
43068
43254
|
* const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43069
43255
|
* ```
|
|
43256
|
+
*
|
|
43257
|
+
* @returns {WorldActivity} Returns a new WorldActivity object.
|
|
43070
43258
|
*/
|
|
43071
43259
|
create(urlSlug, options) {
|
|
43072
43260
|
return new WorldActivity(this.topia, urlSlug, options);
|
|
@@ -43074,7 +43262,7 @@ class WorldActivityFactory {
|
|
|
43074
43262
|
}
|
|
43075
43263
|
|
|
43076
43264
|
/**
|
|
43077
|
-
* @
|
|
43265
|
+
* @example
|
|
43078
43266
|
* ```ts
|
|
43079
43267
|
* const World = new WorldFactory(myTopiaInstance);
|
|
43080
43268
|
* ```
|
|
@@ -43084,25 +43272,27 @@ class WorldFactory extends SDKController {
|
|
|
43084
43272
|
super(topia);
|
|
43085
43273
|
}
|
|
43086
43274
|
/**
|
|
43087
|
-
* @summary
|
|
43088
43275
|
* Instantiate a new instance of World class.
|
|
43089
43276
|
*
|
|
43090
|
-
* @
|
|
43277
|
+
* @example
|
|
43091
43278
|
* ```
|
|
43092
43279
|
* const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, assetId, urlSlug, visitorId } });
|
|
43093
43280
|
* ```
|
|
43281
|
+
*
|
|
43282
|
+
* @returns {World} Returns a new World object.
|
|
43094
43283
|
*/
|
|
43095
43284
|
create(urlSlug, options) {
|
|
43096
43285
|
return new World(this.topia, urlSlug, options);
|
|
43097
43286
|
}
|
|
43098
43287
|
/**
|
|
43099
|
-
* @summary
|
|
43100
43288
|
* Deletes an array of Dropped Assets from within a world and returns success: true
|
|
43101
43289
|
*
|
|
43102
|
-
* @
|
|
43290
|
+
* @example
|
|
43103
43291
|
* ```
|
|
43104
43292
|
* await World.deleteDroppedAssets(urlSlug, ["exampleDroppedAssetId1", "exampleDroppedAssetId2"], interactiveSecret, credentials);
|
|
43105
43293
|
* ```
|
|
43294
|
+
*
|
|
43295
|
+
* @returns {Promise<{ success: boolean }>} Returns `{ success: true }` or an error.
|
|
43106
43296
|
*/
|
|
43107
43297
|
deleteDroppedAssets(urlSlug, droppedAssetIds, interactiveSecret, credentials) {
|
|
43108
43298
|
return __awaiter(this, void 0, void 0, function* () {
|