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