@rtsdk/topia 0.3.3 → 0.3.5
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 +1 -1
- package/dist/index.cjs +86 -3
- package/dist/index.d.ts +45 -1
- package/dist/index.js +86 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Javascript RTSDK - Topia Client Library
|
|
2
2
|
|
|
3
|
-
The Topia Client Library leverages the Topia Public API and allows users to interact with the topia systems and modify their world programmatically. With the SDK you can now build new features to be used in Topia! Check out a
|
|
3
|
+
The Topia Client Library leverages the Topia Public API and allows users to interact with the topia systems and modify their world programmatically. With the SDK you can now build new features to be used in Topia! Check out a list of examples [here](https://github.com/metaversecloud-com/sdk-examples).
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -40532,6 +40532,32 @@ class World extends SDKController {
|
|
|
40532
40532
|
return outcomes;
|
|
40533
40533
|
});
|
|
40534
40534
|
}
|
|
40535
|
+
/**
|
|
40536
|
+
* @summary
|
|
40537
|
+
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
40538
|
+
*
|
|
40539
|
+
* @usage
|
|
40540
|
+
* ```ts
|
|
40541
|
+
* await world.fetchSceneDropIds();
|
|
40542
|
+
* ```
|
|
40543
|
+
*
|
|
40544
|
+
* @result
|
|
40545
|
+
* ```ts
|
|
40546
|
+
* { sceneDropIds: [] }
|
|
40547
|
+
* ```
|
|
40548
|
+
*/
|
|
40549
|
+
fetchSceneDropIds() {
|
|
40550
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40551
|
+
try {
|
|
40552
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/scenes`, this.requestOptions);
|
|
40553
|
+
this.sceneDropIds = response.data;
|
|
40554
|
+
return response.data;
|
|
40555
|
+
}
|
|
40556
|
+
catch (error) {
|
|
40557
|
+
throw this.errorHandler({ error });
|
|
40558
|
+
}
|
|
40559
|
+
});
|
|
40560
|
+
}
|
|
40535
40561
|
/**
|
|
40536
40562
|
* @summary
|
|
40537
40563
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -40619,7 +40645,7 @@ class World extends SDKController {
|
|
|
40619
40645
|
}
|
|
40620
40646
|
_World_droppedAssetsMap = new WeakMap();
|
|
40621
40647
|
|
|
40622
|
-
var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
40648
|
+
var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
40623
40649
|
/**
|
|
40624
40650
|
* @summary
|
|
40625
40651
|
* Create an instance of User class with optional session credentials.
|
|
@@ -40632,16 +40658,21 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40632
40658
|
class User extends SDKController {
|
|
40633
40659
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40634
40660
|
super(topia, Object.assign({ profileId: options.profileId }, options.credentials));
|
|
40661
|
+
_User_adminWorldsMap.set(this, void 0);
|
|
40635
40662
|
_User_assetsMap.set(this, void 0);
|
|
40636
40663
|
_User_scenesMap.set(this, void 0);
|
|
40637
40664
|
_User_worldsMap.set(this, void 0);
|
|
40638
40665
|
this.profileId = options.profileId;
|
|
40639
40666
|
this.dataObject = {};
|
|
40640
40667
|
this.profile = {};
|
|
40668
|
+
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
40641
40669
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40642
40670
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40643
40671
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40644
40672
|
}
|
|
40673
|
+
get adminWorlds() {
|
|
40674
|
+
return __classPrivateFieldGet(this, _User_adminWorldsMap, "f");
|
|
40675
|
+
}
|
|
40645
40676
|
get assets() {
|
|
40646
40677
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
40647
40678
|
}
|
|
@@ -40733,6 +40764,57 @@ class User extends SDKController {
|
|
|
40733
40764
|
}
|
|
40734
40765
|
});
|
|
40735
40766
|
}
|
|
40767
|
+
/**
|
|
40768
|
+
* @summary
|
|
40769
|
+
* Retrieves all worlds a user with matching API Key is an admin in,
|
|
40770
|
+
* creates a new World object for each,
|
|
40771
|
+
* and creates new map of Worlds accessible via user.adminWorlds.
|
|
40772
|
+
*
|
|
40773
|
+
* @usage
|
|
40774
|
+
* ```ts
|
|
40775
|
+
* await user.fetchAdminWorldsByKey();
|
|
40776
|
+
* const adminWorlds = user.adminWorlds;
|
|
40777
|
+
* ```
|
|
40778
|
+
*/
|
|
40779
|
+
fetchAdminWorldsByKey() {
|
|
40780
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40781
|
+
try {
|
|
40782
|
+
const response = yield this.topiaPublicApi().get("/user/admin-worlds", this.requestOptions);
|
|
40783
|
+
const tempAdminWorldsMap = {};
|
|
40784
|
+
for (const i in response.data) {
|
|
40785
|
+
const urlSlug = response.data[i];
|
|
40786
|
+
tempAdminWorldsMap[urlSlug] = new World(this.topia, urlSlug, {
|
|
40787
|
+
credentials: this.credentials,
|
|
40788
|
+
});
|
|
40789
|
+
}
|
|
40790
|
+
__classPrivateFieldSet(this, _User_adminWorldsMap, tempAdminWorldsMap, "f");
|
|
40791
|
+
}
|
|
40792
|
+
catch (error) {
|
|
40793
|
+
throw this.errorHandler({ error });
|
|
40794
|
+
}
|
|
40795
|
+
});
|
|
40796
|
+
}
|
|
40797
|
+
/**
|
|
40798
|
+
* @summary
|
|
40799
|
+
* Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
|
|
40800
|
+
*
|
|
40801
|
+
* @usage
|
|
40802
|
+
* ```ts
|
|
40803
|
+
* await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
|
|
40804
|
+
* const interactiveWorlds = user.interactiveWorlds;
|
|
40805
|
+
* ```
|
|
40806
|
+
*/
|
|
40807
|
+
fetchInteractiveWorldsByKey(interactivePublicKey) {
|
|
40808
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40809
|
+
try {
|
|
40810
|
+
const response = yield this.topiaPublicApi().get(`/user/interactive-worlds?interactivePublicKey=${interactivePublicKey}`, this.requestOptions);
|
|
40811
|
+
return response.data;
|
|
40812
|
+
}
|
|
40813
|
+
catch (error) {
|
|
40814
|
+
throw this.errorHandler({ error });
|
|
40815
|
+
}
|
|
40816
|
+
});
|
|
40817
|
+
}
|
|
40736
40818
|
/**
|
|
40737
40819
|
* @summary
|
|
40738
40820
|
* Retrieves the data object for a user.
|
|
@@ -40836,7 +40918,7 @@ class User extends SDKController {
|
|
|
40836
40918
|
});
|
|
40837
40919
|
}
|
|
40838
40920
|
}
|
|
40839
|
-
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40921
|
+
_User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40840
40922
|
|
|
40841
40923
|
/**
|
|
40842
40924
|
* @summary
|
|
@@ -41269,11 +41351,12 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41269
41351
|
return droppedAsset;
|
|
41270
41352
|
});
|
|
41271
41353
|
}
|
|
41272
|
-
drop(asset, { position: { x, y }, uniqueName, urlSlug, }) {
|
|
41354
|
+
drop(asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }) {
|
|
41273
41355
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41274
41356
|
try {
|
|
41275
41357
|
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41276
41358
|
assetId: asset.id,
|
|
41359
|
+
interactivePublicKey,
|
|
41277
41360
|
position: { x, y },
|
|
41278
41361
|
uniqueName,
|
|
41279
41362
|
}, asset.requestOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -373,6 +373,7 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
373
373
|
#private;
|
|
374
374
|
urlSlug: string;
|
|
375
375
|
dataObject?: object | null | undefined;
|
|
376
|
+
sceneDropIds?: [string] | null | undefined;
|
|
376
377
|
constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
|
|
377
378
|
get droppedAssets(): {
|
|
378
379
|
[key: string]: DroppedAsset;
|
|
@@ -475,6 +476,21 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
475
476
|
* Updates each DroppedAsset instance and world.droppedAssets map.
|
|
476
477
|
*/
|
|
477
478
|
updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
|
|
479
|
+
/**
|
|
480
|
+
* @summary
|
|
481
|
+
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
482
|
+
*
|
|
483
|
+
* @usage
|
|
484
|
+
* ```ts
|
|
485
|
+
* await world.fetchSceneDropIds();
|
|
486
|
+
* ```
|
|
487
|
+
*
|
|
488
|
+
* @result
|
|
489
|
+
* ```ts
|
|
490
|
+
* { sceneDropIds: [] }
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
fetchSceneDropIds(): Promise<object | ResponseType>;
|
|
478
494
|
/**
|
|
479
495
|
* @summary
|
|
480
496
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -607,6 +623,9 @@ declare class User extends SDKController implements UserInterface {
|
|
|
607
623
|
dataObject?: object | null | undefined;
|
|
608
624
|
profile?: Record<string, any>;
|
|
609
625
|
constructor(topia: Topia, options?: UserOptionalInterface);
|
|
626
|
+
get adminWorlds(): {
|
|
627
|
+
[key: string]: World;
|
|
628
|
+
};
|
|
610
629
|
get assets(): {
|
|
611
630
|
[key: string]: Asset;
|
|
612
631
|
};
|
|
@@ -644,6 +663,30 @@ declare class User extends SDKController implements UserInterface {
|
|
|
644
663
|
* ```
|
|
645
664
|
*/
|
|
646
665
|
fetchWorldsByKey(): Promise<void | ResponseType>;
|
|
666
|
+
/**
|
|
667
|
+
* @summary
|
|
668
|
+
* Retrieves all worlds a user with matching API Key is an admin in,
|
|
669
|
+
* creates a new World object for each,
|
|
670
|
+
* and creates new map of Worlds accessible via user.adminWorlds.
|
|
671
|
+
*
|
|
672
|
+
* @usage
|
|
673
|
+
* ```ts
|
|
674
|
+
* await user.fetchAdminWorldsByKey();
|
|
675
|
+
* const adminWorlds = user.adminWorlds;
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
fetchAdminWorldsByKey(): Promise<void | ResponseType>;
|
|
679
|
+
/**
|
|
680
|
+
* @summary
|
|
681
|
+
* Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
|
|
682
|
+
*
|
|
683
|
+
* @usage
|
|
684
|
+
* ```ts
|
|
685
|
+
* await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
|
|
686
|
+
* const interactiveWorlds = user.interactiveWorlds;
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
fetchInteractiveWorldsByKey(interactivePublicKey: string): Promise<object | ResponseType>;
|
|
647
690
|
/**
|
|
648
691
|
* @summary
|
|
649
692
|
* Retrieves the data object for a user.
|
|
@@ -1400,7 +1443,8 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
1400
1443
|
constructor(topia: Topia);
|
|
1401
1444
|
create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
|
|
1402
1445
|
get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
|
|
1403
|
-
drop(asset: Asset, { position: { x, y }, uniqueName, urlSlug, }: {
|
|
1446
|
+
drop(asset: Asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }: {
|
|
1447
|
+
interactivePublicKey?: string;
|
|
1404
1448
|
position: {
|
|
1405
1449
|
x: number;
|
|
1406
1450
|
y: number;
|
package/dist/index.js
CHANGED
|
@@ -40530,6 +40530,32 @@ class World extends SDKController {
|
|
|
40530
40530
|
return outcomes;
|
|
40531
40531
|
});
|
|
40532
40532
|
}
|
|
40533
|
+
/**
|
|
40534
|
+
* @summary
|
|
40535
|
+
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
40536
|
+
*
|
|
40537
|
+
* @usage
|
|
40538
|
+
* ```ts
|
|
40539
|
+
* await world.fetchSceneDropIds();
|
|
40540
|
+
* ```
|
|
40541
|
+
*
|
|
40542
|
+
* @result
|
|
40543
|
+
* ```ts
|
|
40544
|
+
* { sceneDropIds: [] }
|
|
40545
|
+
* ```
|
|
40546
|
+
*/
|
|
40547
|
+
fetchSceneDropIds() {
|
|
40548
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40549
|
+
try {
|
|
40550
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/scenes`, this.requestOptions);
|
|
40551
|
+
this.sceneDropIds = response.data;
|
|
40552
|
+
return response.data;
|
|
40553
|
+
}
|
|
40554
|
+
catch (error) {
|
|
40555
|
+
throw this.errorHandler({ error });
|
|
40556
|
+
}
|
|
40557
|
+
});
|
|
40558
|
+
}
|
|
40533
40559
|
/**
|
|
40534
40560
|
* @summary
|
|
40535
40561
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -40617,7 +40643,7 @@ class World extends SDKController {
|
|
|
40617
40643
|
}
|
|
40618
40644
|
_World_droppedAssetsMap = new WeakMap();
|
|
40619
40645
|
|
|
40620
|
-
var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
40646
|
+
var _User_adminWorldsMap, _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
40621
40647
|
/**
|
|
40622
40648
|
* @summary
|
|
40623
40649
|
* Create an instance of User class with optional session credentials.
|
|
@@ -40630,16 +40656,21 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40630
40656
|
class User extends SDKController {
|
|
40631
40657
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40632
40658
|
super(topia, Object.assign({ profileId: options.profileId }, options.credentials));
|
|
40659
|
+
_User_adminWorldsMap.set(this, void 0);
|
|
40633
40660
|
_User_assetsMap.set(this, void 0);
|
|
40634
40661
|
_User_scenesMap.set(this, void 0);
|
|
40635
40662
|
_User_worldsMap.set(this, void 0);
|
|
40636
40663
|
this.profileId = options.profileId;
|
|
40637
40664
|
this.dataObject = {};
|
|
40638
40665
|
this.profile = {};
|
|
40666
|
+
__classPrivateFieldSet(this, _User_adminWorldsMap, {}, "f");
|
|
40639
40667
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40640
40668
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40641
40669
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40642
40670
|
}
|
|
40671
|
+
get adminWorlds() {
|
|
40672
|
+
return __classPrivateFieldGet(this, _User_adminWorldsMap, "f");
|
|
40673
|
+
}
|
|
40643
40674
|
get assets() {
|
|
40644
40675
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
40645
40676
|
}
|
|
@@ -40731,6 +40762,57 @@ class User extends SDKController {
|
|
|
40731
40762
|
}
|
|
40732
40763
|
});
|
|
40733
40764
|
}
|
|
40765
|
+
/**
|
|
40766
|
+
* @summary
|
|
40767
|
+
* Retrieves all worlds a user with matching API Key is an admin in,
|
|
40768
|
+
* creates a new World object for each,
|
|
40769
|
+
* and creates new map of Worlds accessible via user.adminWorlds.
|
|
40770
|
+
*
|
|
40771
|
+
* @usage
|
|
40772
|
+
* ```ts
|
|
40773
|
+
* await user.fetchAdminWorldsByKey();
|
|
40774
|
+
* const adminWorlds = user.adminWorlds;
|
|
40775
|
+
* ```
|
|
40776
|
+
*/
|
|
40777
|
+
fetchAdminWorldsByKey() {
|
|
40778
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40779
|
+
try {
|
|
40780
|
+
const response = yield this.topiaPublicApi().get("/user/admin-worlds", this.requestOptions);
|
|
40781
|
+
const tempAdminWorldsMap = {};
|
|
40782
|
+
for (const i in response.data) {
|
|
40783
|
+
const urlSlug = response.data[i];
|
|
40784
|
+
tempAdminWorldsMap[urlSlug] = new World(this.topia, urlSlug, {
|
|
40785
|
+
credentials: this.credentials,
|
|
40786
|
+
});
|
|
40787
|
+
}
|
|
40788
|
+
__classPrivateFieldSet(this, _User_adminWorldsMap, tempAdminWorldsMap, "f");
|
|
40789
|
+
}
|
|
40790
|
+
catch (error) {
|
|
40791
|
+
throw this.errorHandler({ error });
|
|
40792
|
+
}
|
|
40793
|
+
});
|
|
40794
|
+
}
|
|
40795
|
+
/**
|
|
40796
|
+
* @summary
|
|
40797
|
+
* Retrieves ids of all dropped assets in all worlds with a matching interactivePublicKey.
|
|
40798
|
+
*
|
|
40799
|
+
* @usage
|
|
40800
|
+
* ```ts
|
|
40801
|
+
* await user.fetchInteractiveWorldsByKey("interactivePublicKeyExample");
|
|
40802
|
+
* const interactiveWorlds = user.interactiveWorlds;
|
|
40803
|
+
* ```
|
|
40804
|
+
*/
|
|
40805
|
+
fetchInteractiveWorldsByKey(interactivePublicKey) {
|
|
40806
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40807
|
+
try {
|
|
40808
|
+
const response = yield this.topiaPublicApi().get(`/user/interactive-worlds?interactivePublicKey=${interactivePublicKey}`, this.requestOptions);
|
|
40809
|
+
return response.data;
|
|
40810
|
+
}
|
|
40811
|
+
catch (error) {
|
|
40812
|
+
throw this.errorHandler({ error });
|
|
40813
|
+
}
|
|
40814
|
+
});
|
|
40815
|
+
}
|
|
40734
40816
|
/**
|
|
40735
40817
|
* @summary
|
|
40736
40818
|
* Retrieves the data object for a user.
|
|
@@ -40834,7 +40916,7 @@ class User extends SDKController {
|
|
|
40834
40916
|
});
|
|
40835
40917
|
}
|
|
40836
40918
|
}
|
|
40837
|
-
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40919
|
+
_User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40838
40920
|
|
|
40839
40921
|
/**
|
|
40840
40922
|
* @summary
|
|
@@ -41267,11 +41349,12 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41267
41349
|
return droppedAsset;
|
|
41268
41350
|
});
|
|
41269
41351
|
}
|
|
41270
|
-
drop(asset, { position: { x, y }, uniqueName, urlSlug, }) {
|
|
41352
|
+
drop(asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }) {
|
|
41271
41353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41272
41354
|
try {
|
|
41273
41355
|
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41274
41356
|
assetId: asset.id,
|
|
41357
|
+
interactivePublicKey,
|
|
41275
41358
|
position: { x, y },
|
|
41276
41359
|
uniqueName,
|
|
41277
41360
|
}, asset.requestOptions);
|
package/package.json
CHANGED