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