@rtsdk/topia 0.8.4 → 0.9.0

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/dist/index.cjs CHANGED
@@ -39717,7 +39717,7 @@ class SDKController {
39717
39717
  */
39718
39718
  class Asset extends SDKController {
39719
39719
  constructor(topia, id, options = { attributes: {}, credentials: {} }) {
39720
- var _a, _b, _c, _d, _e;
39720
+ var _a, _b, _c, _d, _e, _f;
39721
39721
  // assetId and urlSlug should only be used when Asset is extended by DroppedAsset
39722
39722
  super(topia, {
39723
39723
  apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
@@ -39727,16 +39727,27 @@ class Asset extends SDKController {
39727
39727
  visitorId: (_e = options === null || options === void 0 ? void 0 : options.credentials) === null || _e === void 0 ? void 0 : _e.visitorId,
39728
39728
  });
39729
39729
  this.id = id;
39730
+ this.urlSlug = (_f = options === null || options === void 0 ? void 0 : options.credentials) === null || _f === void 0 ? void 0 : _f.urlSlug;
39730
39731
  Object.assign(this, options.attributes);
39731
39732
  }
39732
- fetchPlatformAssets() {
39733
+ /**
39734
+ * @summary
39735
+ * Retrieves platform asset details.
39736
+ *
39737
+ * @usage
39738
+ * ```ts
39739
+ * await asset.fetchAssetById();
39740
+ * const { assetName } = asset;
39741
+ * ```
39742
+ */
39743
+ fetchAssetById() {
39733
39744
  return __awaiter(this, void 0, void 0, function* () {
39734
39745
  try {
39735
- const response = yield this.topiaPublicApi().get("/assets/topia-assets", this.requestOptions);
39746
+ const response = yield this.topiaPublicApi().get(`/assets/${this.urlSlug}/${this.id}`, this.requestOptions);
39736
39747
  return response.data;
39737
39748
  }
39738
39749
  catch (error) {
39739
- throw this.errorHandler({ error, sdkMethod: "Asset.fetchPlatformAssets" });
39750
+ throw this.errorHandler({ error, sdkMethod: "Asset.fetchAssetById" });
39740
39751
  }
39741
39752
  });
39742
39753
  }
@@ -39852,8 +39863,8 @@ class DroppedAsset extends Asset {
39852
39863
  setDataObject(dataObject, options = {}) {
39853
39864
  return __awaiter(this, void 0, void 0, function* () {
39854
39865
  try {
39855
- const { lock = {} } = options;
39856
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
39866
+ const { analytics = [], lock = {} } = options;
39867
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
39857
39868
  this.dataObject = dataObject || this.dataObject;
39858
39869
  }
39859
39870
  catch (error) {
@@ -39878,8 +39889,8 @@ class DroppedAsset extends Asset {
39878
39889
  updateDataObject(dataObject, options = {}) {
39879
39890
  return __awaiter(this, void 0, void 0, function* () {
39880
39891
  try {
39881
- const { lock = {} } = options;
39882
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/update-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
39892
+ const { analytics = [], lock = {} } = options;
39893
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/update-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
39883
39894
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
39884
39895
  }
39885
39896
  catch (error) {
@@ -39904,8 +39915,8 @@ class DroppedAsset extends Asset {
39904
39915
  incrementDataObjectValue(path, amount, options = {}) {
39905
39916
  return __awaiter(this, void 0, void 0, function* () {
39906
39917
  try {
39907
- const { lock = {} } = options;
39908
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
39918
+ const { analytics = [], lock = {} } = options;
39919
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/increment-data-object-value`, { path, amount, analytics, lock }, this.requestOptions);
39909
39920
  }
39910
39921
  catch (error) {
39911
39922
  throw this.errorHandler({
@@ -40189,7 +40200,6 @@ class DroppedAsset extends Asset {
40189
40200
  * @usage
40190
40201
  * ```ts
40191
40202
  * await droppedAsset.addWebhook({
40192
- * active: true,
40193
40203
  * dataObject: {},
40194
40204
  * description: "Webhook desc",
40195
40205
  * enteredBy: "you",
@@ -40197,7 +40207,6 @@ class DroppedAsset extends Asset {
40197
40207
  * title: "title",
40198
40208
  * type: "type",
40199
40209
  * url: "https://url.com",
40200
- * urlSlug: "world",
40201
40210
  * });
40202
40211
  * ```
40203
40212
  */
@@ -40315,6 +40324,16 @@ class Scene extends SDKController {
40315
40324
  this.id = id;
40316
40325
  Object.assign(this, options.attributes);
40317
40326
  }
40327
+ /**
40328
+ * @summary
40329
+ * Retrieves scene details.
40330
+ *
40331
+ * @usage
40332
+ * ```ts
40333
+ * await scene.fetchSceneById();
40334
+ * const { name } = scene;
40335
+ * ```
40336
+ */
40318
40337
  fetchSceneById() {
40319
40338
  return __awaiter(this, void 0, void 0, function* () {
40320
40339
  try {
@@ -40415,8 +40434,8 @@ class World extends SDKController {
40415
40434
  */
40416
40435
  this.setDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
40417
40436
  try {
40418
- const { lock = {} } = options;
40419
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/set-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
40437
+ const { analytics = [], lock = {} } = options;
40438
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/set-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
40420
40439
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
40421
40440
  }
40422
40441
  catch (error) {
@@ -40439,8 +40458,8 @@ class World extends SDKController {
40439
40458
  */
40440
40459
  this.updateDataObject = (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
40441
40460
  try {
40442
- const { lock = {} } = options;
40443
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/update-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
40461
+ const { analytics = [], lock = {} } = options;
40462
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/update-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
40444
40463
  this.dataObject = dataObject || this.dataObject;
40445
40464
  }
40446
40465
  catch (error) {
@@ -40519,6 +40538,42 @@ class World extends SDKController {
40519
40538
  }
40520
40539
  });
40521
40540
  }
40541
+ /**
40542
+ * @summary
40543
+ * Set close world settings
40544
+ *
40545
+ * @usage
40546
+ * ```ts
40547
+ * await world.updateCloseWorldSettings({
40548
+ * controls: {
40549
+ * allowMuteAll: true,
40550
+ * disableHideVideo: true,
40551
+ * isMobileDisabled: false,
40552
+ * isShowingCurrentGuests: false,
40553
+ * },
40554
+ * description: 'Welcome to my world.',
40555
+ * forceAuthOnLogin: false,
40556
+ * height: 2000,
40557
+ * name: 'Example',
40558
+ * spawnPosition: { x: 100, y: 100 },
40559
+ * width: 2000
40560
+ * });
40561
+ * ```
40562
+ */
40563
+ updateCloseWorldSettings({ closeWorldDescription, isWorldClosed, }) {
40564
+ return __awaiter(this, void 0, void 0, function* () {
40565
+ const params = {
40566
+ closeWorldDescription,
40567
+ isWorldClosed,
40568
+ };
40569
+ try {
40570
+ return yield this.topiaPublicApi().put(`/world/${this.urlSlug}/set-close-world-settings`, params, this.requestOptions);
40571
+ }
40572
+ catch (error) {
40573
+ throw this.errorHandler({ error, params, sdkMethod: "World.updateCloseWorldSettings" });
40574
+ }
40575
+ });
40576
+ }
40522
40577
  ////////// dropped assets
40523
40578
  /**
40524
40579
  * @summary
@@ -40650,6 +40705,7 @@ class World extends SDKController {
40650
40705
  return outcomes;
40651
40706
  });
40652
40707
  }
40708
+ // scenes
40653
40709
  /**
40654
40710
  * @deprecated Use {@link fetchScenes} instead.
40655
40711
  *
@@ -40710,7 +40766,7 @@ class World extends SDKController {
40710
40766
  return __awaiter(this, void 0, void 0, function* () {
40711
40767
  try {
40712
40768
  const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/scenes-with-dropped-assets`, this.requestOptions);
40713
- this.scenes = response.data;
40769
+ this.scenes = response.data.scenes;
40714
40770
  return response.data;
40715
40771
  }
40716
40772
  catch (error) {
@@ -40795,8 +40851,8 @@ class World extends SDKController {
40795
40851
  incrementDataObjectValue(path, amount, options = {}) {
40796
40852
  return __awaiter(this, void 0, void 0, function* () {
40797
40853
  try {
40798
- const { lock = {} } = options;
40799
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
40854
+ const { analytics, lock = {} } = options;
40855
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/increment-data-object-value`, { path, amount, analytics, lock }, this.requestOptions);
40800
40856
  }
40801
40857
  catch (error) {
40802
40858
  throw this.errorHandler({
@@ -40920,6 +40976,12 @@ class User extends SDKController {
40920
40976
  /**
40921
40977
  * @summary
40922
40978
  * Returns all assets owned by User when an email address is provided.
40979
+ *
40980
+ * @usage
40981
+ * ```ts
40982
+ * await user.fetchAssets();
40983
+ * const userAssets = user.assets;
40984
+ * ```
40923
40985
  */
40924
40986
  fetchAssets() {
40925
40987
  return __awaiter(this, void 0, void 0, function* () {
@@ -40942,7 +41004,33 @@ class User extends SDKController {
40942
41004
  }
40943
41005
  /**
40944
41006
  * @summary
40945
- * Returns all scenes owned by User
41007
+ * Returns all platform assets.
41008
+ *
41009
+ * @usage
41010
+ * ```ts
41011
+ * const assets = await user.fetchPlatformAssets();
41012
+ * ```
41013
+ */
41014
+ fetchPlatformAssets() {
41015
+ return __awaiter(this, void 0, void 0, function* () {
41016
+ try {
41017
+ const response = yield this.topiaPublicApi().get("/assets/topia-assets", this.requestOptions);
41018
+ return response.data;
41019
+ }
41020
+ catch (error) {
41021
+ throw this.errorHandler({ error, sdkMethod: "Asset.fetchPlatformAssets" });
41022
+ }
41023
+ });
41024
+ }
41025
+ /**
41026
+ * @summary
41027
+ * Returns all scenes owned by User.
41028
+ *
41029
+ * @usage
41030
+ * ```ts
41031
+ * await user.fetchScenes();
41032
+ * const userScenes = user.scenes;
41033
+ * ```
40946
41034
  */
40947
41035
  fetchScenes() {
40948
41036
  return __awaiter(this, void 0, void 0, function* () {
@@ -41091,8 +41179,8 @@ class User extends SDKController {
41091
41179
  try {
41092
41180
  if (!this.profileId)
41093
41181
  throw "This method requires the use of a profileId";
41094
- const { lock = {} } = options;
41095
- yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41182
+ const { analytics = [], lock = {} } = options;
41183
+ yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41096
41184
  this.dataObject = dataObject || this.dataObject;
41097
41185
  }
41098
41186
  catch (error) {
@@ -41118,8 +41206,8 @@ class User extends SDKController {
41118
41206
  try {
41119
41207
  if (!this.profileId)
41120
41208
  throw "This method requires the use of a profileId";
41121
- const { lock = {} } = options;
41122
- yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41209
+ const { analytics = [], lock = {} } = options;
41210
+ yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41123
41211
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
41124
41212
  }
41125
41213
  catch (error) {
@@ -41144,8 +41232,8 @@ class User extends SDKController {
41144
41232
  incrementDataObjectValue(path, amount, options = {}) {
41145
41233
  return __awaiter(this, void 0, void 0, function* () {
41146
41234
  try {
41147
- const { lock = {} } = options;
41148
- yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
41235
+ const { analytics = [], lock = {} } = options;
41236
+ yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/increment-data-object-value`, { path, amount, analytics, lock }, this.requestOptions);
41149
41237
  }
41150
41238
  catch (error) {
41151
41239
  throw this.errorHandler({ error, params: { path, amount, options }, sdkMethod: "User.incrementDataObjectValue" });
@@ -41416,8 +41504,8 @@ class Visitor extends User {
41416
41504
  setDataObject(dataObject, options = {}) {
41417
41505
  return __awaiter(this, void 0, void 0, function* () {
41418
41506
  try {
41419
- const { lock = {} } = options;
41420
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41507
+ const { analytics = [], lock = {} } = options;
41508
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41421
41509
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
41422
41510
  }
41423
41511
  catch (error) {
@@ -41441,8 +41529,8 @@ class Visitor extends User {
41441
41529
  updateDataObject(dataObject, options = {}) {
41442
41530
  return __awaiter(this, void 0, void 0, function* () {
41443
41531
  try {
41444
- const { lock = {} } = options;
41445
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41532
+ const { analytics = [], lock = {} } = options;
41533
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { analytics, dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
41446
41534
  this.dataObject = dataObject || this.dataObject;
41447
41535
  }
41448
41536
  catch (error) {
@@ -41467,8 +41555,8 @@ class Visitor extends User {
41467
41555
  incrementDataObjectValue(path, amount, options = {}) {
41468
41556
  return __awaiter(this, void 0, void 0, function* () {
41469
41557
  try {
41470
- const { lock = {} } = options;
41471
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
41558
+ const { analytics = [], lock = {} } = options;
41559
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/increment-data-object-value`, { path, amount, analytics, lock }, this.requestOptions);
41472
41560
  }
41473
41561
  catch (error) {
41474
41562
  throw this.errorHandler({
@@ -41663,23 +41751,62 @@ class Topia {
41663
41751
  }
41664
41752
  }
41665
41753
 
41754
+ /**
41755
+ * @usage
41756
+ * ```ts
41757
+ * const Asset = new AssetFactory(myTopiaInstance);
41758
+ * ```
41759
+ */
41666
41760
  class AssetFactory {
41667
41761
  constructor(topia) {
41668
41762
  this.topia = topia;
41669
41763
  this.create;
41670
41764
  }
41765
+ /**
41766
+ * @summary
41767
+ * Instantiate a new instance of Asset class.
41768
+ *
41769
+ * @usage
41770
+ * ```
41771
+ * const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41772
+ * ```
41773
+ */
41671
41774
  create(id, options) {
41672
41775
  return new Asset(this.topia, id, options);
41673
41776
  }
41674
41777
  }
41675
41778
 
41779
+ /**
41780
+ * @usage
41781
+ * ```ts
41782
+ * const DroppedAsset = new DroppedAssetFactory(myTopiaInstance);
41783
+ * ```
41784
+ */
41676
41785
  class DroppedAssetFactory extends SDKController {
41677
41786
  constructor(topia) {
41678
41787
  super(topia);
41679
41788
  }
41789
+ /**
41790
+ * @summary
41791
+ * Instantiate a new instance of DroppedAsset class.
41792
+ *
41793
+ * @usage
41794
+ * ```
41795
+ * const droppedAssetInstance = await DroppedAsset.create(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41796
+ * ```
41797
+ */
41680
41798
  create(id, urlSlug, options) {
41681
41799
  return new DroppedAsset(this.topia, id, urlSlug, options);
41682
41800
  }
41801
+ /**
41802
+ * @summary
41803
+ * Instantiate a new instance of DroppedAsset class and retrieve all properties.
41804
+ *
41805
+ * @usage
41806
+ * ```
41807
+ * const droppedAssetInstance = await DroppedAsset.get(assetId, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41808
+ * ```
41809
+ */
41683
41810
  get(id, urlSlug, options) {
41684
41811
  return __awaiter(this, void 0, void 0, function* () {
41685
41812
  const droppedAsset = new DroppedAsset(this.topia, id, urlSlug, options);
@@ -41687,12 +41814,29 @@ class DroppedAssetFactory extends SDKController {
41687
41814
  return droppedAsset;
41688
41815
  });
41689
41816
  }
41690
- getWithUniqueName(uniqueName, urlSlug, interactivePublicKey, interactiveSecret) {
41817
+ /**
41818
+ * @summary
41819
+ * 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.
41820
+ *
41821
+ * @usage
41822
+ * ```
41823
+ * const droppedAssetInstance = await DroppedAsset.getWithUniqueName("exampleUniqueName", urlSlug, { interactivePublicKey, interactiveSecret });
41824
+ * ```
41825
+ */
41826
+ getWithUniqueName(uniqueName, urlSlug, credentials) {
41691
41827
  return __awaiter(this, void 0, void 0, function* () {
41692
- const params = { uniqueName, urlSlug, interactivePublicKey, interactiveSecret };
41828
+ const { apiKey, interactivePublicKey, interactiveSecret } = credentials;
41829
+ const params = { apiKey, interactivePublicKey, interactiveSecret, uniqueName, urlSlug };
41693
41830
  try {
41694
- const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41695
- const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers: { interactiveJWT, publickey: interactivePublicKey } });
41831
+ const headers = {};
41832
+ if (apiKey) {
41833
+ headers.Authorization = apiKey;
41834
+ }
41835
+ else if (interactivePublicKey && interactiveSecret) {
41836
+ headers.interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41837
+ headers.publickey = interactivePublicKey;
41838
+ }
41839
+ const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers });
41696
41840
  const { id } = response.data;
41697
41841
  return new DroppedAsset(this.topia, id, urlSlug, { attributes: response.data });
41698
41842
  }
@@ -41701,9 +41845,29 @@ class DroppedAssetFactory extends SDKController {
41701
41845
  }
41702
41846
  });
41703
41847
  }
41704
- drop(asset, { assetScale = 1, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41848
+ /**
41849
+ * @summary
41850
+ * Drops an asset in a world and returns a new instance of DroppedAsset class with all properties.
41851
+ *
41852
+ * @usage
41853
+ * ```
41854
+ * const assetInstance = await Asset.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41855
+ * const droppedAssetInstance = await DroppedAsset.get(assetInstance, {
41856
+ assetScale: 1.5,
41857
+ flipped: true,
41858
+ layer0: "",
41859
+ layer1: "https://pathtoimage.png",
41860
+ interactivePublicKey,
41861
+ isInteractive: true,
41862
+ position: { x: 0, y: 0 },
41863
+ uniqueName: "exampleUniqueName",
41864
+ urlSlug,
41865
+ });
41866
+ * ```
41867
+ */
41868
+ drop(asset, { assetScale = 1, flipped, interactivePublicKey, isInteractive, layer0 = "", layer1 = "", position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
41705
41869
  return __awaiter(this, void 0, void 0, function* () {
41706
- let specialType;
41870
+ let specialType = null;
41707
41871
  if (layer0 || layer1)
41708
41872
  specialType = "webImage";
41709
41873
  else if (text)
@@ -41745,14 +41909,38 @@ class DroppedAssetFactory extends SDKController {
41745
41909
  }
41746
41910
  }
41747
41911
 
41912
+ /**
41913
+ * @usage
41914
+ * ```ts
41915
+ * const Scene = new SceneFactory(myTopiaInstance);
41916
+ * ```
41917
+ */
41748
41918
  class SceneFactory {
41749
41919
  constructor(topia) {
41750
41920
  this.topia = topia;
41751
41921
  this.create;
41752
41922
  }
41923
+ /**
41924
+ * @summary
41925
+ * Instantiate a new instance of Scene class.
41926
+ *
41927
+ * @usage
41928
+ * ```
41929
+ * const sceneInstance = await Scene.create(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41930
+ * ```
41931
+ */
41753
41932
  create(id, options) {
41754
41933
  return new Scene(this.topia, id, options);
41755
41934
  }
41935
+ /**
41936
+ * @summary
41937
+ * Instantiate a new instance of Scene class and retrieve all properties.
41938
+ *
41939
+ * @usage
41940
+ * ```
41941
+ * const sceneInstance = await Scene.get(id, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41942
+ * ```
41943
+ */
41756
41944
  get(id, options) {
41757
41945
  return __awaiter(this, void 0, void 0, function* () {
41758
41946
  const scene = yield new Scene(this.topia, id, options);
@@ -41762,22 +41950,61 @@ class SceneFactory {
41762
41950
  }
41763
41951
  }
41764
41952
 
41953
+ /**
41954
+ * @usage
41955
+ * ```ts
41956
+ * const User = new UserFactory(myTopiaInstance);
41957
+ * ```
41958
+ */
41765
41959
  class UserFactory {
41766
41960
  constructor(topia) {
41767
41961
  this.topia = topia;
41768
41962
  }
41963
+ /**
41964
+ * @summary
41965
+ * Instantiate a new instance of User class.
41966
+ *
41967
+ * @usage
41968
+ * ```
41969
+ * const userInstance = await User.create({ credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41970
+ * ```
41971
+ */
41769
41972
  create(options) {
41770
41973
  return new User(this.topia, options);
41771
41974
  }
41772
41975
  }
41773
41976
 
41977
+ /**
41978
+ * @usage
41979
+ * ```ts
41980
+ * const Visitor = new VisitorFactory(myTopiaInstance);
41981
+ * ```
41982
+ */
41774
41983
  class VisitorFactory {
41775
41984
  constructor(topia) {
41776
41985
  this.topia = topia;
41777
41986
  }
41987
+ /**
41988
+ * @summary
41989
+ * Instantiate a new instance of Visitor class.
41990
+ *
41991
+ * @usage
41992
+ * ```
41993
+ * const visitorInstance = await Visitor.create(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
41994
+ * ```
41995
+ */
41778
41996
  create(id, urlSlug, options) {
41779
41997
  return new Visitor(this.topia, id, urlSlug, options);
41780
41998
  }
41999
+ /**
42000
+ * @summary
42001
+ * Instantiate a new instance of Visitor class and retrieve all properties.
42002
+ *
42003
+ * @usage
42004
+ * ```
42005
+ * const visitorInstance = await Visitor.get(id, urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
42006
+ * ```
42007
+ */
41781
42008
  get(id, urlSlug, options) {
41782
42009
  return __awaiter(this, void 0, void 0, function* () {
41783
42010
  const visitor = new Visitor(this.topia, id, urlSlug, options);
@@ -41787,39 +42014,85 @@ class VisitorFactory {
41787
42014
  }
41788
42015
  }
41789
42016
 
42017
+ /**
42018
+ * @usage
42019
+ * ```ts
42020
+ * const WorldActivity = new WorldActivityFactory(myTopiaInstance);
42021
+ * ```
42022
+ */
41790
42023
  class WorldActivityFactory {
41791
42024
  constructor(topia) {
41792
42025
  this.topia = topia;
41793
42026
  }
42027
+ /**
42028
+ * @summary
42029
+ * Instantiate a new instance of WorldActivity class.
42030
+ *
42031
+ * @usage
42032
+ * ```
42033
+ * const worldActivityInstance = await WorldActivity.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
42034
+ * ```
42035
+ */
41794
42036
  create(urlSlug, options) {
41795
42037
  return new WorldActivity(this.topia, urlSlug, options);
41796
42038
  }
41797
42039
  }
41798
42040
 
42041
+ /**
42042
+ * @usage
42043
+ * ```ts
42044
+ * const World = new WorldFactory(myTopiaInstance);
42045
+ * ```
42046
+ */
41799
42047
  class WorldFactory extends SDKController {
41800
42048
  constructor(topia) {
41801
42049
  super(topia);
41802
42050
  }
42051
+ /**
42052
+ * @summary
42053
+ * Instantiate a new instance of World class.
42054
+ *
42055
+ * @usage
42056
+ * ```
42057
+ * const worldInstance = await World.create(urlSlug, { credentials: { interactiveNonce, interactivePublicKey, visitorId } });
42058
+ * ```
42059
+ */
41803
42060
  create(urlSlug, options) {
41804
42061
  return new World(this.topia, urlSlug, options);
41805
42062
  }
41806
- deleteDroppedAssets(urlSlug, droppedAssetIds, interactivePublicKey, interactiveSecret) {
42063
+ /**
42064
+ * @summary
42065
+ * Deletes an array of Dropped Assets from within a world and returns success: true
42066
+ *
42067
+ * @usage
42068
+ * ```
42069
+ * await World.deleteDroppedAssets(urlSlug, ["exampleDroppedAssetId1", "exampleDroppedAssetId2"], { interactiveNonce, interactivePublicKey, visitorId });
42070
+ * ```
42071
+ */
42072
+ deleteDroppedAssets(urlSlug, droppedAssetIds, credentials) {
41807
42073
  return __awaiter(this, void 0, void 0, function* () {
41808
- const params = { droppedAssetIds, urlSlug, interactivePublicKey, interactiveSecret };
42074
+ const { apiKey, interactivePublicKey, interactiveSecret } = credentials;
42075
+ const params = { apiKey, droppedAssetIds, interactivePublicKey, interactiveSecret, urlSlug };
41809
42076
  try {
41810
- const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
42077
+ const headers = {};
42078
+ if (apiKey) {
42079
+ headers.Authorization = apiKey;
42080
+ }
42081
+ else if (interactivePublicKey && interactiveSecret) {
42082
+ headers.interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
42083
+ headers.publickey = interactivePublicKey;
42084
+ }
41811
42085
  const promiseArray = [];
41812
42086
  for (const id of droppedAssetIds) {
41813
42087
  promiseArray.push(this.topiaPublicApi().delete(`/world/${urlSlug}/assets/${id}`, {
41814
- headers: { interactiveJWT, publickey: interactivePublicKey },
42088
+ headers,
41815
42089
  }));
41816
42090
  }
41817
- const result = yield Promise.all(promiseArray);
41818
- console.log(result);
42091
+ yield Promise.all(promiseArray);
41819
42092
  return { success: true };
41820
42093
  }
41821
42094
  catch (error) {
41822
- throw this.errorHandler({ error, params, sdkMethod: "DroppedAssetFactory.getWithUniqueName" });
42095
+ throw this.errorHandler({ error, params, sdkMethod: "WorldFactory.deleteDroppedAssets" });
41823
42096
  }
41824
42097
  });
41825
42098
  }