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