@rtsdk/topia 0.9.2 → 0.10.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
@@ -40280,10 +40280,15 @@ class DroppedAsset extends Asset {
40280
40280
  switch (periodType) {
40281
40281
  case "week":
40282
40282
  query = `&week=W${dateValue}`;
40283
+ break;
40283
40284
  case "month":
40284
40285
  query = `&month=${dateValue}`;
40286
+ break;
40285
40287
  case "quarter":
40286
40288
  query = `&quarter=Q${dateValue}`;
40289
+ break;
40290
+ default:
40291
+ "";
40287
40292
  }
40288
40293
  const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
40289
40294
  return response.data;
@@ -40834,6 +40839,53 @@ class World extends SDKController {
40834
40839
  }
40835
40840
  });
40836
40841
  }
40842
+ /**
40843
+ * @summary
40844
+ * Get all particles available
40845
+ *
40846
+ * @usage
40847
+ * ```ts
40848
+ * await world.getAllParticles();
40849
+ * ```
40850
+ */
40851
+ getAllParticles() {
40852
+ return __awaiter(this, void 0, void 0, function* () {
40853
+ try {
40854
+ const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
40855
+ return result.data;
40856
+ }
40857
+ catch (error) {
40858
+ throw this.errorHandler({ error, params: {}, sdkMethod: "World.getAllParticles" });
40859
+ }
40860
+ });
40861
+ }
40862
+ /**
40863
+ * @summary
40864
+ * Trigger a particle effect at a position in the world
40865
+ *
40866
+ * @usage
40867
+ * ```ts
40868
+ * await world.triggerParticle({ name: "Flame" });
40869
+ * ```
40870
+ */
40871
+ triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
40872
+ return __awaiter(this, void 0, void 0, function* () {
40873
+ if (!id && !name)
40874
+ throw "An particle name is required.";
40875
+ try {
40876
+ let particleId = id;
40877
+ if (name) {
40878
+ const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
40879
+ particleId = response.data[0].id;
40880
+ }
40881
+ const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
40882
+ return result;
40883
+ }
40884
+ catch (error) {
40885
+ throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
40886
+ }
40887
+ });
40888
+ }
40837
40889
  /**
40838
40890
  * @summary
40839
40891
  * 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.
@@ -41492,6 +41544,53 @@ class Visitor extends User {
41492
41544
  }
41493
41545
  });
41494
41546
  }
41547
+ /**
41548
+ * @summary
41549
+ * Get all particles available
41550
+ *
41551
+ * @usage
41552
+ * ```ts
41553
+ * await visitor.getAllParticles();
41554
+ * ```
41555
+ */
41556
+ getAllParticles() {
41557
+ return __awaiter(this, void 0, void 0, function* () {
41558
+ try {
41559
+ const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
41560
+ return result.data;
41561
+ }
41562
+ catch (error) {
41563
+ throw this.errorHandler({ error, params: {}, sdkMethod: "Visitor.getAllParticles" });
41564
+ }
41565
+ });
41566
+ }
41567
+ /**
41568
+ * @summary
41569
+ * Trigger a particle effect on a visitor
41570
+ *
41571
+ * @usage
41572
+ * ```ts
41573
+ * await visitor.triggerParticle({ name: "Flame" });
41574
+ * ```
41575
+ */
41576
+ triggerParticle({ id, name, duration = 10, }) {
41577
+ return __awaiter(this, void 0, void 0, function* () {
41578
+ if (!id && !name)
41579
+ throw "An particle name is required.";
41580
+ try {
41581
+ let particleId = id;
41582
+ if (name) {
41583
+ const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
41584
+ particleId = response.data[0].id;
41585
+ }
41586
+ const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
41587
+ return result;
41588
+ }
41589
+ catch (error) {
41590
+ throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
41591
+ }
41592
+ });
41593
+ }
41495
41594
  /**
41496
41595
  * @summary
41497
41596
  * Retrieves the data object for a visitor.
package/dist/index.d.ts CHANGED
@@ -649,6 +649,31 @@ declare class World extends SDKController implements WorldInterface {
649
649
  * ```
650
650
  */
651
651
  replaceScene(sceneId: string): Promise<void | ResponseType$1>;
652
+ /**
653
+ * @summary
654
+ * Get all particles available
655
+ *
656
+ * @usage
657
+ * ```ts
658
+ * await world.getAllParticles();
659
+ * ```
660
+ */
661
+ getAllParticles(): Promise<object | ResponseType$1>;
662
+ /**
663
+ * @summary
664
+ * Trigger a particle effect at a position in the world
665
+ *
666
+ * @usage
667
+ * ```ts
668
+ * await world.triggerParticle({ name: "Flame" });
669
+ * ```
670
+ */
671
+ triggerParticle({ id, name, duration, position, }: {
672
+ id?: string;
673
+ name?: string;
674
+ duration?: number;
675
+ position?: object;
676
+ }): Promise<object | ResponseType$1>;
652
677
  /**
653
678
  * @summary
654
679
  * Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
@@ -1057,6 +1082,30 @@ declare class Visitor extends User implements VisitorInterface {
1057
1082
  id?: string;
1058
1083
  name?: string;
1059
1084
  }): Promise<object | ResponseType$1>;
1085
+ /**
1086
+ * @summary
1087
+ * Get all particles available
1088
+ *
1089
+ * @usage
1090
+ * ```ts
1091
+ * await visitor.getAllParticles();
1092
+ * ```
1093
+ */
1094
+ getAllParticles(): Promise<object | ResponseType$1>;
1095
+ /**
1096
+ * @summary
1097
+ * Trigger a particle effect on a visitor
1098
+ *
1099
+ * @usage
1100
+ * ```ts
1101
+ * await visitor.triggerParticle({ name: "Flame" });
1102
+ * ```
1103
+ */
1104
+ triggerParticle({ id, name, duration, }: {
1105
+ id?: string;
1106
+ name?: string;
1107
+ duration?: number;
1108
+ }): Promise<object | ResponseType$1>;
1060
1109
  /**
1061
1110
  * @summary
1062
1111
  * Retrieves the data object for a visitor.
package/dist/index.js CHANGED
@@ -40278,10 +40278,15 @@ class DroppedAsset extends Asset {
40278
40278
  switch (periodType) {
40279
40279
  case "week":
40280
40280
  query = `&week=W${dateValue}`;
40281
+ break;
40281
40282
  case "month":
40282
40283
  query = `&month=${dateValue}`;
40284
+ break;
40283
40285
  case "quarter":
40284
40286
  query = `&quarter=Q${dateValue}`;
40287
+ break;
40288
+ default:
40289
+ "";
40285
40290
  }
40286
40291
  const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
40287
40292
  return response.data;
@@ -40832,6 +40837,53 @@ class World extends SDKController {
40832
40837
  }
40833
40838
  });
40834
40839
  }
40840
+ /**
40841
+ * @summary
40842
+ * Get all particles available
40843
+ *
40844
+ * @usage
40845
+ * ```ts
40846
+ * await world.getAllParticles();
40847
+ * ```
40848
+ */
40849
+ getAllParticles() {
40850
+ return __awaiter(this, void 0, void 0, function* () {
40851
+ try {
40852
+ const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
40853
+ return result.data;
40854
+ }
40855
+ catch (error) {
40856
+ throw this.errorHandler({ error, params: {}, sdkMethod: "World.getAllParticles" });
40857
+ }
40858
+ });
40859
+ }
40860
+ /**
40861
+ * @summary
40862
+ * Trigger a particle effect at a position in the world
40863
+ *
40864
+ * @usage
40865
+ * ```ts
40866
+ * await world.triggerParticle({ name: "Flame" });
40867
+ * ```
40868
+ */
40869
+ triggerParticle({ id, name, duration = 10, position = { x: 1, y: 1 }, }) {
40870
+ return __awaiter(this, void 0, void 0, function* () {
40871
+ if (!id && !name)
40872
+ throw "An particle name is required.";
40873
+ try {
40874
+ let particleId = id;
40875
+ if (name) {
40876
+ const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
40877
+ particleId = response.data[0].id;
40878
+ }
40879
+ const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
40880
+ return result;
40881
+ }
40882
+ catch (error) {
40883
+ throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
40884
+ }
40885
+ });
40886
+ }
40835
40887
  /**
40836
40888
  * @summary
40837
40889
  * 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.
@@ -41490,6 +41542,53 @@ class Visitor extends User {
41490
41542
  }
41491
41543
  });
41492
41544
  }
41545
+ /**
41546
+ * @summary
41547
+ * Get all particles available
41548
+ *
41549
+ * @usage
41550
+ * ```ts
41551
+ * await visitor.getAllParticles();
41552
+ * ```
41553
+ */
41554
+ getAllParticles() {
41555
+ return __awaiter(this, void 0, void 0, function* () {
41556
+ try {
41557
+ const result = yield this.topiaPublicApi().get(`/particles`, this.requestOptions);
41558
+ return result.data;
41559
+ }
41560
+ catch (error) {
41561
+ throw this.errorHandler({ error, params: {}, sdkMethod: "Visitor.getAllParticles" });
41562
+ }
41563
+ });
41564
+ }
41565
+ /**
41566
+ * @summary
41567
+ * Trigger a particle effect on a visitor
41568
+ *
41569
+ * @usage
41570
+ * ```ts
41571
+ * await visitor.triggerParticle({ name: "Flame" });
41572
+ * ```
41573
+ */
41574
+ triggerParticle({ id, name, duration = 10, }) {
41575
+ return __awaiter(this, void 0, void 0, function* () {
41576
+ if (!id && !name)
41577
+ throw "An particle name is required.";
41578
+ try {
41579
+ let particleId = id;
41580
+ if (name) {
41581
+ const response = yield this.topiaPublicApi().get(`/particles?name=${name}`, this.requestOptions);
41582
+ particleId = response.data[0].id;
41583
+ }
41584
+ const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
41585
+ return result;
41586
+ }
41587
+ catch (error) {
41588
+ throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
41589
+ }
41590
+ });
41591
+ }
41493
41592
  /**
41494
41593
  * @summary
41495
41594
  * Retrieves the data object for a visitor.
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.9.2"
62
+ "version": "0.10.0"
63
63
  }