@rtsdk/topia 0.2.3 → 0.3.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
@@ -31,13 +31,13 @@ declare enum DroppedAssetMediaType {
31
31
  }
32
32
 
33
33
  type InteractiveCredentials = {
34
+ apiKey?: string;
34
35
  assetId?: string;
35
36
  interactiveNonce?: string;
36
37
  interactivePublicKey?: string;
37
- visitorId?: number;
38
- urlSlug?: string;
39
- apiKey?: string;
40
38
  profileId?: string | null;
39
+ urlSlug?: string;
40
+ visitorId?: number;
41
41
  };
42
42
 
43
43
  type AssetOptions = {
@@ -56,7 +56,7 @@ type VisitorOptions = {
56
56
  credentials?: InteractiveCredentials | undefined;
57
57
  };
58
58
  type WorldOptions = {
59
- attributes?: WorldInterface | undefined;
59
+ attributes?: WorldDetailsInterface | undefined;
60
60
  credentials?: InteractiveCredentials | undefined;
61
61
  };
62
62
 
@@ -125,8 +125,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
125
125
  *
126
126
  * @usage
127
127
  * ```ts
128
- * await droppedAsset.fetchDataObject();
129
- * const { dataObject } = droppedAsset;
128
+ * const dataObject = await droppedAsset.fetchDataObject();
130
129
  * ```
131
130
  */
132
131
  fetchDataObject(): Promise<void | ResponseType>;
@@ -141,7 +140,6 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
141
140
  * await droppedAsset.setDataObject({
142
141
  * "exampleKey": "exampleValue",
143
142
  * });
144
- * const { dataObject } = droppedAsset;
145
143
  * ```
146
144
  */
147
145
  setDataObject(dataObject: object, options?: {
@@ -161,10 +159,29 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
161
159
  * await droppedAsset.updateDataObject({
162
160
  * "exampleKey": "exampleValue",
163
161
  * });
164
- * const { dataObject } = droppedAsset;
165
162
  * ```
166
163
  */
167
- updateDroppedAssetDataObject(dataObject: object, options?: {
164
+ updateDataObject(dataObject: object, options?: {
165
+ lock?: {
166
+ lockId: string;
167
+ releaseLock?: boolean;
168
+ };
169
+ }): Promise<void | ResponseType>;
170
+ /**
171
+ * @summary
172
+ * 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.
173
+ *
174
+ * 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
175
+ *
176
+ * @usage
177
+ * ```ts
178
+ * await droppedAsset.incrementDataObjectValue(
179
+ * "path": "key",
180
+ * "amount": 1,
181
+ * );
182
+ * ```
183
+ */
184
+ incrementDataObjectValue(path: string, amount: number, options?: {
168
185
  lock?: {
169
186
  lockId: string;
170
187
  releaseLock?: boolean;
@@ -372,6 +389,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
372
389
  declare class World extends SDKController implements WorldInterface {
373
390
  #private;
374
391
  urlSlug: string;
392
+ dataObject?: object | null | undefined;
375
393
  constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
376
394
  get droppedAssets(): {
377
395
  [key: string]: DroppedAsset;
@@ -409,7 +427,7 @@ declare class World extends SDKController implements WorldInterface {
409
427
  * });
410
428
  * ```
411
429
  */
412
- updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldInterface): Promise<void | ResponseType>;
430
+ updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldDetailsInterface): Promise<void | ResponseType>;
413
431
  /**
414
432
  * @summary
415
433
  * Retrieve all assets dropped in a world.
@@ -496,6 +514,77 @@ declare class World extends SDKController implements WorldInterface {
496
514
  * ```
497
515
  */
498
516
  replaceScene(sceneId: string): Promise<void | ResponseType>;
517
+ /**
518
+ * @summary
519
+ * Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
520
+ *
521
+ * @usage
522
+ * ```ts
523
+ * await world.fetchDataObject();
524
+ * const { dataObject } = world;
525
+ * ```
526
+ */
527
+ fetchDataObject: () => Promise<void | ResponseType>;
528
+ /**
529
+ * @summary
530
+ * Sets the data object for a user. Must have valid interactive credentials from a visitor in the world.
531
+ *
532
+ * 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
533
+ *
534
+ * @usage
535
+ * ```ts
536
+ * await world.setDataObject({
537
+ * "exampleKey": "exampleValue",
538
+ * });
539
+ * const { dataObject } = world;
540
+ * ```
541
+ */
542
+ setDataObject: (dataObject: object | null | undefined, options?: {
543
+ lock?: {
544
+ lockId: string;
545
+ releaseLock?: boolean;
546
+ };
547
+ }) => Promise<void | ResponseType>;
548
+ /**
549
+ * @summary
550
+ * Updates the data object for a world. Must have valid interactive credentials from a visitor in the world.
551
+ *
552
+ * 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
553
+ *
554
+ * @usage
555
+ * ```ts
556
+ * await world.updateDataObject({
557
+ * "exampleKey": "exampleValue",
558
+ * });
559
+ * const { dataObject } = world;
560
+ * ```
561
+ */
562
+ updateDataObject: (dataObject: object, options?: {
563
+ lock?: {
564
+ lockId: string;
565
+ releaseLock?: boolean;
566
+ };
567
+ }) => Promise<void | ResponseType>;
568
+ /**
569
+ * @summary
570
+ * 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.
571
+ *
572
+ * 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
573
+ *
574
+ * @usage
575
+ * ```ts
576
+ * await world.incrementDataObjectValue(
577
+ * "path": "key",
578
+ * "amount": 1,
579
+ * );
580
+ * ```
581
+ */
582
+ incrementDataObjectValue(path: string, amount: number, options?: {
583
+ lock?: {
584
+ lockId: string;
585
+ releaseLock?: boolean;
586
+ };
587
+ }): Promise<void | ResponseType>;
499
588
  }
500
589
 
501
590
  /**
@@ -507,7 +596,7 @@ declare class World extends SDKController implements WorldInterface {
507
596
  * await new User(topia, { interactiveNonce: "exampleNonce", interactivePublicKey: "examplePublicKey", visitorId: 1 });
508
597
  * ```
509
598
  */
510
- declare class User extends SDKController {
599
+ declare class User extends SDKController implements UserInterface {
511
600
  #private;
512
601
  profileId?: string | null;
513
602
  dataObject?: object | null | undefined;
@@ -556,8 +645,7 @@ declare class User extends SDKController {
556
645
  *
557
646
  * @usage
558
647
  * ```ts
559
- * await droppedAsset.fetchDataObject();
560
- * const { dataObject } = droppedAsset;
648
+ * const dataObject = await user.fetchDataObject();
561
649
  * ```
562
650
  */
563
651
  fetchDataObject(): Promise<void | ResponseType>;
@@ -569,10 +657,9 @@ declare class User extends SDKController {
569
657
  *
570
658
  * @usage
571
659
  * ```ts
572
- * await droppedAsset.setDataObject({
660
+ * await user.setDataObject({
573
661
  * "exampleKey": "exampleValue",
574
662
  * });
575
- * const { dataObject } = droppedAsset;
576
663
  * ```
577
664
  */
578
665
  setDataObject(dataObject: object | null | undefined, options?: {
@@ -589,10 +676,9 @@ declare class User extends SDKController {
589
676
  *
590
677
  * @usage
591
678
  * ```ts
592
- * await droppedAsset.updateUserDataObject({
679
+ * await user.updateUserDataObject({
593
680
  * "exampleKey": "exampleValue",
594
681
  * });
595
- * const { dataObject } = droppedAsset;
596
682
  * ```
597
683
  */
598
684
  updateDataObject(dataObject: object, options?: {
@@ -601,6 +687,26 @@ declare class User extends SDKController {
601
687
  releaseLock?: boolean;
602
688
  };
603
689
  }): Promise<void | ResponseType>;
690
+ /**
691
+ * @summary
692
+ * 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.
693
+ *
694
+ * 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
695
+ *
696
+ * @usage
697
+ * ```ts
698
+ * await user.incrementDataObjectValue(
699
+ * "path": "key",
700
+ * "amount": 1,
701
+ * );
702
+ * ```
703
+ */
704
+ incrementDataObjectValue(path: string, amount: number, options?: {
705
+ lock?: {
706
+ lockId: string;
707
+ releaseLock?: boolean;
708
+ };
709
+ }): Promise<void | ResponseType>;
604
710
  }
605
711
 
606
712
  /**
@@ -613,7 +719,6 @@ declare class User extends SDKController {
613
719
  * ```
614
720
  */
615
721
  declare class Visitor extends User implements VisitorInterface {
616
- #private;
617
722
  readonly id: number;
618
723
  urlSlug: string;
619
724
  user?: User;
@@ -682,8 +787,7 @@ declare class Visitor extends User implements VisitorInterface {
682
787
  *
683
788
  * @usage
684
789
  * ```ts
685
- * await droppedAsset.fetchVisitorDataObject();
686
- * const { dataObject } = droppedAsset;
790
+ * const dataObject = await visitor.fetchVisitorDataObject();
687
791
  * ```
688
792
  */
689
793
  fetchDataObject(): Promise<void | ResponseType>;
@@ -695,10 +799,9 @@ declare class Visitor extends User implements VisitorInterface {
695
799
  *
696
800
  * @usage
697
801
  * ```ts
698
- * await droppedAsset.setVisitorDataObject({
802
+ * await visitor.setVisitorDataObject({
699
803
  * "exampleKey": "exampleValue",
700
804
  * });
701
- * const { dataObject } = droppedAsset;
702
805
  * ```
703
806
  */
704
807
  setDataObject(dataObject: object | null | undefined, options?: {
@@ -715,10 +818,9 @@ declare class Visitor extends User implements VisitorInterface {
715
818
  *
716
819
  * @usage
717
820
  * ```ts
718
- * await droppedAsset.updateVisitorDataObject({
821
+ * await visitor.updateVisitorDataObject({
719
822
  * "exampleKey": "exampleValue",
720
823
  * });
721
- * const { dataObject } = droppedAsset;
722
824
  * ```
723
825
  */
724
826
  updateDataObject(dataObject: object, options?: {
@@ -727,6 +829,26 @@ declare class Visitor extends User implements VisitorInterface {
727
829
  releaseLock?: boolean;
728
830
  };
729
831
  }): Promise<void | ResponseType>;
832
+ /**
833
+ * @summary
834
+ * 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.
835
+ *
836
+ * 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
837
+ *
838
+ * @usage
839
+ * ```ts
840
+ * await visitor.incrementDataObjectValue(
841
+ * "path": "key",
842
+ * "amount": 1,
843
+ * );
844
+ * ```
845
+ */
846
+ incrementDataObjectValue(path: string, amount: number, options?: {
847
+ lock?: {
848
+ lockId: string;
849
+ releaseLock?: boolean;
850
+ };
851
+ }): Promise<void | ResponseType>;
730
852
  }
731
853
 
732
854
  type VisitorType = {
@@ -795,6 +917,35 @@ type AssetOptionalInterface = {
795
917
  };
796
918
 
797
919
  interface DroppedAssetInterface extends AssetInterface {
920
+ fetchDroppedAssetById(): Promise<void | ResponseType>;
921
+ deleteDroppedAsset(): Promise<void | ResponseType>;
922
+ fetchDataObject(): Promise<void | ResponseType>;
923
+ setDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
924
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
925
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
926
+ updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }: UpdateBroadcastInterface): Promise<void | ResponseType>;
927
+ updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
928
+ updateCustomTextAsset(style: object | undefined | null, text: string | null | undefined): Promise<void | ResponseType>;
929
+ updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }: UpdateMediaTypeInterface): Promise<void | ResponseType>;
930
+ updateMuteZone(isMutezone: boolean): Promise<void | ResponseType>;
931
+ updateWebhookZone(isWebhookZoneEnabled: boolean): Promise<void | ResponseType>;
932
+ updatePosition(x: number, y: number): Promise<void | ResponseType>;
933
+ updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }: UpdatePrivateZoneInterface): Promise<void | ResponseType>;
934
+ updateScale(assetScale: number): Promise<void | ResponseType>;
935
+ updateUploadedMediaSelected(mediaId: string): Promise<void | ResponseType>;
936
+ updateWebImageLayers(bottom: string, top: string): Promise<void | ResponseType>;
937
+ addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }: {
938
+ dataObject: object;
939
+ description: string;
940
+ isUniqueOnly: boolean;
941
+ title: string;
942
+ type: string;
943
+ url: string;
944
+ }): Promise<void | AxiosResponse>;
945
+ setInteractiveSettings({ isInteractive, interactivePublicKey, }: {
946
+ isInteractive?: boolean;
947
+ interactivePublicKey: string;
948
+ }): Promise<void | ResponseType>;
798
949
  id?: string;
799
950
  assetId?: string;
800
951
  assetScale?: number | null;
@@ -898,6 +1049,7 @@ interface UpdatePrivateZoneInterface {
898
1049
  }
899
1050
 
900
1051
  interface SceneInterface {
1052
+ fetchSceneById(): Promise<void | ResponseType>;
901
1053
  id: string;
902
1054
  background?: null;
903
1055
  description?: string;
@@ -933,6 +1085,14 @@ interface TopiaInterface {
933
1085
  interactiveSecret?: jwt.Secret;
934
1086
  }
935
1087
 
1088
+ interface UserInterface {
1089
+ fetchAssets(): Promise<void | ResponseType>;
1090
+ fetchScenes(): Promise<void | ResponseType>;
1091
+ fetchWorldsByKey(): Promise<void | ResponseType>;
1092
+ fetchDataObject(): Promise<void | ResponseType>;
1093
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1094
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
1095
+ }
936
1096
  interface UserOptionalInterface {
937
1097
  credentials?: InteractiveCredentials | object;
938
1098
  profileId?: string | null;
@@ -941,6 +1101,14 @@ interface UserOptionalInterface {
941
1101
  }
942
1102
 
943
1103
  interface VisitorInterface extends SDKInterface {
1104
+ fetchVisitor(): Promise<void | ResponseType>;
1105
+ moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType>;
1106
+ fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType>;
1107
+ openIframe({ link, shouldOpenInDrawer, title }: OpenIframeInterface): Promise<void | ResponseType>;
1108
+ fetchDataObject(): Promise<void | ResponseType>;
1109
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1110
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
1111
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
944
1112
  color?: string;
945
1113
  dataObject?: object | null | undefined;
946
1114
  displayName?: string;
@@ -998,7 +1166,7 @@ interface MoveAllVisitorsInterface {
998
1166
  y: number;
999
1167
  }
1000
1168
 
1001
- interface WorldInterface extends SDKInterface {
1169
+ interface WorldDetailsInterface {
1002
1170
  background?: string | null;
1003
1171
  controls?: {
1004
1172
  allowMuteAll?: boolean;
@@ -1024,8 +1192,29 @@ interface WorldInterface extends SDKInterface {
1024
1192
  useTopiaPassword?: boolean;
1025
1193
  width?: number;
1026
1194
  }
1195
+ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
1196
+ fetchDetails(): Promise<void | ResponseType>;
1197
+ updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldDetailsInterface): Promise<void | ResponseType>;
1198
+ fetchDroppedAssets(): Promise<void | ResponseType>;
1199
+ fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial, isReversed, }: {
1200
+ uniqueName: string;
1201
+ isPartial?: boolean;
1202
+ isReversed?: boolean;
1203
+ }): Promise<DroppedAsset[]>;
1204
+ updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
1205
+ dropScene({ assetSuffix, position, sceneId, }: {
1206
+ assetSuffix: string;
1207
+ position: object;
1208
+ sceneId: string;
1209
+ }): Promise<void | ResponseType>;
1210
+ replaceScene(sceneId: string): Promise<void | ResponseType>;
1211
+ fetchDataObject(): Promise<void | ResponseType>;
1212
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1213
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
1214
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
1215
+ }
1027
1216
  interface WorldOptionalInterface {
1028
- attributes?: WorldInterface | object;
1217
+ attributes?: WorldDetailsInterface | object;
1029
1218
  credentials?: InteractiveCredentials | object;
1030
1219
  }
1031
1220
 
@@ -1248,4 +1437,4 @@ declare class WorldFactory {
1248
1437
  create(urlSlug: string, options?: WorldOptionalInterface): World;
1249
1438
  }
1250
1439
 
1251
- export { AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKInterface, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, UserFactory, UserOptionalInterface, UserOptions, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WorldActivityFactory, WorldActivityOptionalInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions };
1440
+ export { AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKInterface, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, UserFactory, UserInterface, UserOptionalInterface, UserOptions, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WorldActivityFactory, WorldActivityOptionalInterface, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions };
package/dist/index.d.ts CHANGED
@@ -31,13 +31,13 @@ declare enum DroppedAssetMediaType {
31
31
  }
32
32
 
33
33
  type InteractiveCredentials = {
34
+ apiKey?: string;
34
35
  assetId?: string;
35
36
  interactiveNonce?: string;
36
37
  interactivePublicKey?: string;
37
- visitorId?: number;
38
- urlSlug?: string;
39
- apiKey?: string;
40
38
  profileId?: string | null;
39
+ urlSlug?: string;
40
+ visitorId?: number;
41
41
  };
42
42
 
43
43
  type AssetOptions = {
@@ -56,7 +56,7 @@ type VisitorOptions = {
56
56
  credentials?: InteractiveCredentials | undefined;
57
57
  };
58
58
  type WorldOptions = {
59
- attributes?: WorldInterface | undefined;
59
+ attributes?: WorldDetailsInterface | undefined;
60
60
  credentials?: InteractiveCredentials | undefined;
61
61
  };
62
62
 
@@ -125,8 +125,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
125
125
  *
126
126
  * @usage
127
127
  * ```ts
128
- * await droppedAsset.fetchDataObject();
129
- * const { dataObject } = droppedAsset;
128
+ * const dataObject = await droppedAsset.fetchDataObject();
130
129
  * ```
131
130
  */
132
131
  fetchDataObject(): Promise<void | ResponseType>;
@@ -141,7 +140,6 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
141
140
  * await droppedAsset.setDataObject({
142
141
  * "exampleKey": "exampleValue",
143
142
  * });
144
- * const { dataObject } = droppedAsset;
145
143
  * ```
146
144
  */
147
145
  setDataObject(dataObject: object, options?: {
@@ -161,10 +159,29 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
161
159
  * await droppedAsset.updateDataObject({
162
160
  * "exampleKey": "exampleValue",
163
161
  * });
164
- * const { dataObject } = droppedAsset;
165
162
  * ```
166
163
  */
167
- updateDroppedAssetDataObject(dataObject: object, options?: {
164
+ updateDataObject(dataObject: object, options?: {
165
+ lock?: {
166
+ lockId: string;
167
+ releaseLock?: boolean;
168
+ };
169
+ }): Promise<void | ResponseType>;
170
+ /**
171
+ * @summary
172
+ * 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.
173
+ *
174
+ * 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
175
+ *
176
+ * @usage
177
+ * ```ts
178
+ * await droppedAsset.incrementDataObjectValue(
179
+ * "path": "key",
180
+ * "amount": 1,
181
+ * );
182
+ * ```
183
+ */
184
+ incrementDataObjectValue(path: string, amount: number, options?: {
168
185
  lock?: {
169
186
  lockId: string;
170
187
  releaseLock?: boolean;
@@ -372,6 +389,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
372
389
  declare class World extends SDKController implements WorldInterface {
373
390
  #private;
374
391
  urlSlug: string;
392
+ dataObject?: object | null | undefined;
375
393
  constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
376
394
  get droppedAssets(): {
377
395
  [key: string]: DroppedAsset;
@@ -409,7 +427,7 @@ declare class World extends SDKController implements WorldInterface {
409
427
  * });
410
428
  * ```
411
429
  */
412
- updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldInterface): Promise<void | ResponseType>;
430
+ updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldDetailsInterface): Promise<void | ResponseType>;
413
431
  /**
414
432
  * @summary
415
433
  * Retrieve all assets dropped in a world.
@@ -496,6 +514,77 @@ declare class World extends SDKController implements WorldInterface {
496
514
  * ```
497
515
  */
498
516
  replaceScene(sceneId: string): Promise<void | ResponseType>;
517
+ /**
518
+ * @summary
519
+ * Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
520
+ *
521
+ * @usage
522
+ * ```ts
523
+ * await world.fetchDataObject();
524
+ * const { dataObject } = world;
525
+ * ```
526
+ */
527
+ fetchDataObject: () => Promise<void | ResponseType>;
528
+ /**
529
+ * @summary
530
+ * Sets the data object for a user. Must have valid interactive credentials from a visitor in the world.
531
+ *
532
+ * 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
533
+ *
534
+ * @usage
535
+ * ```ts
536
+ * await world.setDataObject({
537
+ * "exampleKey": "exampleValue",
538
+ * });
539
+ * const { dataObject } = world;
540
+ * ```
541
+ */
542
+ setDataObject: (dataObject: object | null | undefined, options?: {
543
+ lock?: {
544
+ lockId: string;
545
+ releaseLock?: boolean;
546
+ };
547
+ }) => Promise<void | ResponseType>;
548
+ /**
549
+ * @summary
550
+ * Updates the data object for a world. Must have valid interactive credentials from a visitor in the world.
551
+ *
552
+ * 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
553
+ *
554
+ * @usage
555
+ * ```ts
556
+ * await world.updateDataObject({
557
+ * "exampleKey": "exampleValue",
558
+ * });
559
+ * const { dataObject } = world;
560
+ * ```
561
+ */
562
+ updateDataObject: (dataObject: object, options?: {
563
+ lock?: {
564
+ lockId: string;
565
+ releaseLock?: boolean;
566
+ };
567
+ }) => Promise<void | ResponseType>;
568
+ /**
569
+ * @summary
570
+ * 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.
571
+ *
572
+ * 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
573
+ *
574
+ * @usage
575
+ * ```ts
576
+ * await world.incrementDataObjectValue(
577
+ * "path": "key",
578
+ * "amount": 1,
579
+ * );
580
+ * ```
581
+ */
582
+ incrementDataObjectValue(path: string, amount: number, options?: {
583
+ lock?: {
584
+ lockId: string;
585
+ releaseLock?: boolean;
586
+ };
587
+ }): Promise<void | ResponseType>;
499
588
  }
500
589
 
501
590
  /**
@@ -507,7 +596,7 @@ declare class World extends SDKController implements WorldInterface {
507
596
  * await new User(topia, { interactiveNonce: "exampleNonce", interactivePublicKey: "examplePublicKey", visitorId: 1 });
508
597
  * ```
509
598
  */
510
- declare class User extends SDKController {
599
+ declare class User extends SDKController implements UserInterface {
511
600
  #private;
512
601
  profileId?: string | null;
513
602
  dataObject?: object | null | undefined;
@@ -556,8 +645,7 @@ declare class User extends SDKController {
556
645
  *
557
646
  * @usage
558
647
  * ```ts
559
- * await droppedAsset.fetchDataObject();
560
- * const { dataObject } = droppedAsset;
648
+ * const dataObject = await user.fetchDataObject();
561
649
  * ```
562
650
  */
563
651
  fetchDataObject(): Promise<void | ResponseType>;
@@ -569,10 +657,9 @@ declare class User extends SDKController {
569
657
  *
570
658
  * @usage
571
659
  * ```ts
572
- * await droppedAsset.setDataObject({
660
+ * await user.setDataObject({
573
661
  * "exampleKey": "exampleValue",
574
662
  * });
575
- * const { dataObject } = droppedAsset;
576
663
  * ```
577
664
  */
578
665
  setDataObject(dataObject: object | null | undefined, options?: {
@@ -589,10 +676,9 @@ declare class User extends SDKController {
589
676
  *
590
677
  * @usage
591
678
  * ```ts
592
- * await droppedAsset.updateUserDataObject({
679
+ * await user.updateUserDataObject({
593
680
  * "exampleKey": "exampleValue",
594
681
  * });
595
- * const { dataObject } = droppedAsset;
596
682
  * ```
597
683
  */
598
684
  updateDataObject(dataObject: object, options?: {
@@ -601,6 +687,26 @@ declare class User extends SDKController {
601
687
  releaseLock?: boolean;
602
688
  };
603
689
  }): Promise<void | ResponseType>;
690
+ /**
691
+ * @summary
692
+ * 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.
693
+ *
694
+ * 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
695
+ *
696
+ * @usage
697
+ * ```ts
698
+ * await user.incrementDataObjectValue(
699
+ * "path": "key",
700
+ * "amount": 1,
701
+ * );
702
+ * ```
703
+ */
704
+ incrementDataObjectValue(path: string, amount: number, options?: {
705
+ lock?: {
706
+ lockId: string;
707
+ releaseLock?: boolean;
708
+ };
709
+ }): Promise<void | ResponseType>;
604
710
  }
605
711
 
606
712
  /**
@@ -613,7 +719,6 @@ declare class User extends SDKController {
613
719
  * ```
614
720
  */
615
721
  declare class Visitor extends User implements VisitorInterface {
616
- #private;
617
722
  readonly id: number;
618
723
  urlSlug: string;
619
724
  user?: User;
@@ -682,8 +787,7 @@ declare class Visitor extends User implements VisitorInterface {
682
787
  *
683
788
  * @usage
684
789
  * ```ts
685
- * await droppedAsset.fetchVisitorDataObject();
686
- * const { dataObject } = droppedAsset;
790
+ * const dataObject = await visitor.fetchVisitorDataObject();
687
791
  * ```
688
792
  */
689
793
  fetchDataObject(): Promise<void | ResponseType>;
@@ -695,10 +799,9 @@ declare class Visitor extends User implements VisitorInterface {
695
799
  *
696
800
  * @usage
697
801
  * ```ts
698
- * await droppedAsset.setVisitorDataObject({
802
+ * await visitor.setVisitorDataObject({
699
803
  * "exampleKey": "exampleValue",
700
804
  * });
701
- * const { dataObject } = droppedAsset;
702
805
  * ```
703
806
  */
704
807
  setDataObject(dataObject: object | null | undefined, options?: {
@@ -715,10 +818,9 @@ declare class Visitor extends User implements VisitorInterface {
715
818
  *
716
819
  * @usage
717
820
  * ```ts
718
- * await droppedAsset.updateVisitorDataObject({
821
+ * await visitor.updateVisitorDataObject({
719
822
  * "exampleKey": "exampleValue",
720
823
  * });
721
- * const { dataObject } = droppedAsset;
722
824
  * ```
723
825
  */
724
826
  updateDataObject(dataObject: object, options?: {
@@ -727,6 +829,26 @@ declare class Visitor extends User implements VisitorInterface {
727
829
  releaseLock?: boolean;
728
830
  };
729
831
  }): Promise<void | ResponseType>;
832
+ /**
833
+ * @summary
834
+ * 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.
835
+ *
836
+ * 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
837
+ *
838
+ * @usage
839
+ * ```ts
840
+ * await visitor.incrementDataObjectValue(
841
+ * "path": "key",
842
+ * "amount": 1,
843
+ * );
844
+ * ```
845
+ */
846
+ incrementDataObjectValue(path: string, amount: number, options?: {
847
+ lock?: {
848
+ lockId: string;
849
+ releaseLock?: boolean;
850
+ };
851
+ }): Promise<void | ResponseType>;
730
852
  }
731
853
 
732
854
  type VisitorType = {
@@ -795,6 +917,35 @@ type AssetOptionalInterface = {
795
917
  };
796
918
 
797
919
  interface DroppedAssetInterface extends AssetInterface {
920
+ fetchDroppedAssetById(): Promise<void | ResponseType>;
921
+ deleteDroppedAsset(): Promise<void | ResponseType>;
922
+ fetchDataObject(): Promise<void | ResponseType>;
923
+ setDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
924
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
925
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
926
+ updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }: UpdateBroadcastInterface): Promise<void | ResponseType>;
927
+ updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
928
+ updateCustomTextAsset(style: object | undefined | null, text: string | null | undefined): Promise<void | ResponseType>;
929
+ updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }: UpdateMediaTypeInterface): Promise<void | ResponseType>;
930
+ updateMuteZone(isMutezone: boolean): Promise<void | ResponseType>;
931
+ updateWebhookZone(isWebhookZoneEnabled: boolean): Promise<void | ResponseType>;
932
+ updatePosition(x: number, y: number): Promise<void | ResponseType>;
933
+ updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }: UpdatePrivateZoneInterface): Promise<void | ResponseType>;
934
+ updateScale(assetScale: number): Promise<void | ResponseType>;
935
+ updateUploadedMediaSelected(mediaId: string): Promise<void | ResponseType>;
936
+ updateWebImageLayers(bottom: string, top: string): Promise<void | ResponseType>;
937
+ addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }: {
938
+ dataObject: object;
939
+ description: string;
940
+ isUniqueOnly: boolean;
941
+ title: string;
942
+ type: string;
943
+ url: string;
944
+ }): Promise<void | AxiosResponse>;
945
+ setInteractiveSettings({ isInteractive, interactivePublicKey, }: {
946
+ isInteractive?: boolean;
947
+ interactivePublicKey: string;
948
+ }): Promise<void | ResponseType>;
798
949
  id?: string;
799
950
  assetId?: string;
800
951
  assetScale?: number | null;
@@ -898,6 +1049,7 @@ interface UpdatePrivateZoneInterface {
898
1049
  }
899
1050
 
900
1051
  interface SceneInterface {
1052
+ fetchSceneById(): Promise<void | ResponseType>;
901
1053
  id: string;
902
1054
  background?: null;
903
1055
  description?: string;
@@ -933,6 +1085,14 @@ interface TopiaInterface {
933
1085
  interactiveSecret?: jwt.Secret;
934
1086
  }
935
1087
 
1088
+ interface UserInterface {
1089
+ fetchAssets(): Promise<void | ResponseType>;
1090
+ fetchScenes(): Promise<void | ResponseType>;
1091
+ fetchWorldsByKey(): Promise<void | ResponseType>;
1092
+ fetchDataObject(): Promise<void | ResponseType>;
1093
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1094
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
1095
+ }
936
1096
  interface UserOptionalInterface {
937
1097
  credentials?: InteractiveCredentials | object;
938
1098
  profileId?: string | null;
@@ -941,6 +1101,14 @@ interface UserOptionalInterface {
941
1101
  }
942
1102
 
943
1103
  interface VisitorInterface extends SDKInterface {
1104
+ fetchVisitor(): Promise<void | ResponseType>;
1105
+ moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType>;
1106
+ fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType>;
1107
+ openIframe({ link, shouldOpenInDrawer, title }: OpenIframeInterface): Promise<void | ResponseType>;
1108
+ fetchDataObject(): Promise<void | ResponseType>;
1109
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1110
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
1111
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
944
1112
  color?: string;
945
1113
  dataObject?: object | null | undefined;
946
1114
  displayName?: string;
@@ -998,7 +1166,7 @@ interface MoveAllVisitorsInterface {
998
1166
  y: number;
999
1167
  }
1000
1168
 
1001
- interface WorldInterface extends SDKInterface {
1169
+ interface WorldDetailsInterface {
1002
1170
  background?: string | null;
1003
1171
  controls?: {
1004
1172
  allowMuteAll?: boolean;
@@ -1024,8 +1192,29 @@ interface WorldInterface extends SDKInterface {
1024
1192
  useTopiaPassword?: boolean;
1025
1193
  width?: number;
1026
1194
  }
1195
+ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
1196
+ fetchDetails(): Promise<void | ResponseType>;
1197
+ updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }: WorldDetailsInterface): Promise<void | ResponseType>;
1198
+ fetchDroppedAssets(): Promise<void | ResponseType>;
1199
+ fetchDroppedAssetsWithUniqueName({ uniqueName, isPartial, isReversed, }: {
1200
+ uniqueName: string;
1201
+ isPartial?: boolean;
1202
+ isReversed?: boolean;
1203
+ }): Promise<DroppedAsset[]>;
1204
+ updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
1205
+ dropScene({ assetSuffix, position, sceneId, }: {
1206
+ assetSuffix: string;
1207
+ position: object;
1208
+ sceneId: string;
1209
+ }): Promise<void | ResponseType>;
1210
+ replaceScene(sceneId: string): Promise<void | ResponseType>;
1211
+ fetchDataObject(): Promise<void | ResponseType>;
1212
+ setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType>;
1213
+ updateDataObject(dataObject: object, options: object): Promise<void | ResponseType>;
1214
+ incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType>;
1215
+ }
1027
1216
  interface WorldOptionalInterface {
1028
- attributes?: WorldInterface | object;
1217
+ attributes?: WorldDetailsInterface | object;
1029
1218
  credentials?: InteractiveCredentials | object;
1030
1219
  }
1031
1220
 
@@ -1248,4 +1437,4 @@ declare class WorldFactory {
1248
1437
  create(urlSlug: string, options?: WorldOptionalInterface): World;
1249
1438
  }
1250
1439
 
1251
- export { AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKInterface, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, UserFactory, UserOptionalInterface, UserOptions, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WorldActivityFactory, WorldActivityOptionalInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions };
1440
+ export { AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType, SDKInterface, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, UserFactory, UserInterface, UserOptionalInterface, UserOptions, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WorldActivityFactory, WorldActivityOptionalInterface, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions };
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "local-publish": "yarn build && yalc publish --push --no-scripts"
60
60
  },
61
61
  "type": "module",
62
- "version": "0.2.3"
62
+ "version": "0.3.0"
63
63
  }