@smartico/public-api 0.0.166 → 0.0.167

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.
@@ -150,15 +150,22 @@ ___
150
150
 
151
151
  ### getBonuses
152
152
 
153
- ▸ **getBonuses**(): `Promise`\<[`TBonus`](../interfaces/TBonus.md)[]\>
153
+ ▸ **getBonuses**(`«destructured»?`): `Promise`\<[`TBonus`](../interfaces/TBonus.md)[]\>
154
154
 
155
- Returns all the bonuses for the current user.
155
+ Returns all the bonuses for the current user
156
156
  The returned bonuss are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
157
157
  Note that each time you call getBonuses with a new onUpdate callback, the old one will be overwritten by the new one.
158
- The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
158
+ The onUpdate callback will be called on bonus claimed and the updated bonuses will be passed to it.
159
159
 
160
160
  **Visitor mode: not supported**
161
161
 
162
+ #### Parameters
163
+
164
+ | Name | Type |
165
+ | :------ | :------ |
166
+ | `«destructured»` | `Object` |
167
+ | › `onUpdate?` | (`data`: [`TBonus`](../interfaces/TBonus.md)[]) => `void` |
168
+
162
169
  #### Returns
163
170
 
164
171
  `Promise`\<[`TBonus`](../interfaces/TBonus.md)[]\>
@@ -847,3 +854,36 @@ _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
847
854
  #### Returns
848
855
 
849
856
  `Promise`\<[`JackpotsOptoutResponse`](../interfaces/JackpotsOptoutResponse.md)\>
857
+
858
+ ___
859
+
860
+ ### getRelatedItemsForGame
861
+
862
+ ▸ **getRelatedItemsForGame**(`related_game_id`): `Promise`\<`GetAchievementMapResponse`\>
863
+
864
+ Returns all the related tournaments and missions for the provided game id for the current user
865
+ The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
866
+
867
+ **Example**:
868
+ ```
869
+ _smartico.api.getRelatedItemsForGame('gold-slot2').then((result) => {
870
+ console.log(result);
871
+ });
872
+ ```
873
+
874
+ **Example in the Visitor mode**:
875
+ ```
876
+ _smartico.vapi('EN').getRelatedItemsForGame('gold-slot2').then((result) => {
877
+ console.log(result);
878
+ });
879
+ ```
880
+
881
+ #### Parameters
882
+
883
+ | Name | Type |
884
+ | :------ | :------ |
885
+ | `related_game_id` | `string` |
886
+
887
+ #### Returns
888
+
889
+ `Promise`\<`GetAchievementMapResponse`\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.166",
3
+ "version": "0.0.167",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -2,7 +2,7 @@ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
2
  import { Tournament } from '../Tournaments';
3
3
  import { UserAchievement } from './UserAchievement';
4
4
 
5
- export interface GetAchievementMapResponse extends ProtocolResponse {
5
+ export interface GetRelatedAchTourResponse extends ProtocolResponse {
6
6
  achievements: UserAchievement[];
7
7
  tournaments?: Tournament[];
8
8
  }
@@ -109,6 +109,8 @@ import {
109
109
  import { GetCustomSectionsRequest, GetCustomSectionsResponse, UICustomSectionTransform } from './CustomSections';
110
110
  import { BonusItemsTransform, ClaimBonusRequest, ClaimBonusResponse, GetBonusesResponse } from './Bonuses';
111
111
  import { GetBonusesRequest } from './Bonuses/GetBonusesRequest';
112
+ import { GetRelatedAchTourRequest } from './Missions/GetRelatedAchTourRequest';
113
+ import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
112
114
 
113
115
  const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
114
116
  const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
@@ -1027,6 +1029,19 @@ class SmarticoAPI {
1027
1029
  public getWSCalls(): WSAPI {
1028
1030
  return new WSAPI(this);
1029
1031
  }
1032
+
1033
+ public async getRelatedItemsForGame(user_ext_id: string, related_game_id: string,): Promise<GetRelatedAchTourResponse> {
1034
+ const message = this.buildMessage< GetRelatedAchTourRequest, GetRelatedAchTourResponse>(
1035
+ user_ext_id,
1036
+ ClassId.GET_RELATED_ACH_N_TOURNAMENTS_REQUEST,
1037
+ {
1038
+ related_game_id: related_game_id
1039
+ }
1040
+ );
1041
+
1042
+ return await this.send<GetRelatedAchTourResponse>(message, ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE);
1043
+
1044
+ }
1030
1045
  }
1031
1046
 
1032
1047
  export { SmarticoAPI, MessageSender };
@@ -1,6 +1,6 @@
1
1
  import { ClassId } from '../Base/ClassId';
2
2
  import { CoreUtils } from '../Core';
3
- import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from '../MiniGames';
3
+ import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWGetTemplatesResponse, SAWSpinErrorCode, SAWSpinsCountPush } from '../MiniGames';
4
4
  import { ECacheContext, OCache } from '../OCache';
5
5
  import { SmarticoAPI } from '../SmarticoAPI';
6
6
  import {
@@ -37,6 +37,8 @@ import {
37
37
  JackpotsOptoutRequest,
38
38
  JackpotsOptoutResponse,
39
39
  } from '../Jackpots';
40
+ import { GetTournamentsResponse } from 'src/Tournaments';
41
+ import { GetAchievementMapResponse } from 'src/Missions';
40
42
 
41
43
  /** @hidden */
42
44
  const CACHE_DATA_SEC = 30;
@@ -202,6 +204,9 @@ export class WSAPI {
202
204
 
203
205
  /**
204
206
  * Returns all the bonuses for the current user
207
+ * The returned bonuss are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
208
+ * Note that each time you call getBonuses with a new onUpdate callback, the old one will be overwritten by the new one.
209
+ * The onUpdate callback will be called on bonus claimed and the updated bonuses will be passed to it.
205
210
  *
206
211
  * **Visitor mode: not supported**
207
212
  */
@@ -890,4 +895,28 @@ export class WSAPI {
890
895
 
891
896
  return result;
892
897
  }
898
+ /**
899
+ * Returns all the related tournaments and missions for the provided game id for the current user
900
+ * The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
901
+ *
902
+ * **Example**:
903
+ * ```
904
+ * _smartico.api.getRelatedItemsForGame('gold-slot2').then((result) => {
905
+ * console.log(result);
906
+ * });
907
+ * ```
908
+ *
909
+ * **Example in the Visitor mode**:
910
+ * ```
911
+ * _smartico.vapi('EN').getRelatedItemsForGame('gold-slot2').then((result) => {
912
+ * console.log(result);
913
+ * });
914
+ * ```
915
+ */
916
+ public async getRelatedItemsForGame(related_game_id: string): Promise<GetAchievementMapResponse> {
917
+
918
+ const result = await this.api.getRelatedItemsForGame(null, related_game_id);
919
+ return result;
920
+
921
+ }
893
922
  }