@smartico/public-api 0.0.214 → 0.0.215
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/WSAPI/WSAPI.d.ts +12 -2
- package/dist/index.js +87 -69
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +13 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +26 -2
- package/docs/interfaces/TMiniGameTemplate.md +6 -0
- package/package.json +1 -1
- package/src/WSAPI/WSAPI.ts +55 -22
package/docs/classes/WSAPI.md
CHANGED
|
@@ -178,7 +178,7 @@ ___
|
|
|
178
178
|
|
|
179
179
|
Claim the bonus by bonus_id. Returns the err_code in case of success or error.
|
|
180
180
|
Note that this method can be used only on integrations where originally failed bonus can be claimed again.
|
|
181
|
-
For example, user won a bonus in the mini-game, but Operator rejected this bonus.
|
|
181
|
+
For example, user won a bonus in the mini-game, but Operator rejected this bonus.
|
|
182
182
|
This bonus will be available for the user to claim again.
|
|
183
183
|
|
|
184
184
|
**Visitor mode: not supported**
|
|
@@ -453,7 +453,7 @@ ___
|
|
|
453
453
|
▸ **playMiniGame**(`template_id`, `«destructured»?`): `Promise`\<[`TMiniGamePlayResult`](../interfaces/TMiniGamePlayResult.md)\>
|
|
454
454
|
|
|
455
455
|
Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
456
|
-
|
|
456
|
+
After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
457
457
|
The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
|
|
458
458
|
|
|
459
459
|
**Example**:
|
|
@@ -479,6 +479,30 @@ _smartico.api.playMiniGame(55).then((result) => {
|
|
|
479
479
|
|
|
480
480
|
___
|
|
481
481
|
|
|
482
|
+
### miniGameWinAcknowledgeRequest
|
|
483
|
+
|
|
484
|
+
▸ **miniGameWinAcknowledgeRequest**(`request_id`): `Promise`\<`SAWDoAknowledgeResponse`\>
|
|
485
|
+
|
|
486
|
+
Sends the acknowledge request with specific client_request_id from minigame history in order to claim prize
|
|
487
|
+
**Example**:
|
|
488
|
+
```
|
|
489
|
+
_smartico.api.miniGameWinAcknowledgeRequest('12dvq1r24b6h').then((result) => {
|
|
490
|
+
console.log(result);
|
|
491
|
+
});
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
#### Parameters
|
|
495
|
+
|
|
496
|
+
| Name | Type |
|
|
497
|
+
| :------ | :------ |
|
|
498
|
+
| `request_id` | `string` |
|
|
499
|
+
|
|
500
|
+
#### Returns
|
|
501
|
+
|
|
502
|
+
`Promise`\<`SAWDoAknowledgeResponse`\>
|
|
503
|
+
|
|
504
|
+
___
|
|
505
|
+
|
|
482
506
|
### playMiniGameBatch
|
|
483
507
|
|
|
484
508
|
▸ **playMiniGameBatch**(`template_id`, `spin_count`, `«destructured»?`): `Promise`\<[`TMiniGamePlayBatchResult`](../interfaces/TMiniGamePlayBatchResult.md)[]\>
|
package/package.json
CHANGED
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ClassId } from '../Base/ClassId';
|
|
2
2
|
import { CoreUtils } from '../Core';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
MiniGamePrizeTypeName,
|
|
5
|
+
SAWDoSpinResponse,
|
|
6
|
+
SAWGetTemplatesResponse,
|
|
7
|
+
SAWSpinErrorCode,
|
|
8
|
+
SAWSpinsCountPush,
|
|
9
|
+
SAWWinningHistoryRequest,
|
|
10
|
+
SAWWinningHistoryResponse,
|
|
11
|
+
} from '../MiniGames';
|
|
4
12
|
import { ECacheContext, OCache } from '../OCache';
|
|
5
13
|
import { SmarticoAPI } from '../SmarticoAPI';
|
|
6
14
|
import {
|
|
@@ -25,10 +33,11 @@ import {
|
|
|
25
33
|
TTournamentRegistrationResult,
|
|
26
34
|
TUICustomSection,
|
|
27
35
|
TUserProfile,
|
|
28
|
-
UserLevelExtraCountersT,
|
|
36
|
+
UserLevelExtraCountersT,
|
|
37
|
+
TBonus,
|
|
29
38
|
TClaimBonusResult,
|
|
30
39
|
TMiniGamePlayBatchResult,
|
|
31
|
-
TSawHistory
|
|
40
|
+
TSawHistory,
|
|
32
41
|
} from './WSAPITypes';
|
|
33
42
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
34
43
|
import {
|
|
@@ -68,7 +77,7 @@ enum onUpdateContextKey {
|
|
|
68
77
|
Pots = 'Pots',
|
|
69
78
|
CustomSections = 'customSections',
|
|
70
79
|
Bonuses = 'bonuses',
|
|
71
|
-
SAWHistory = 'sawHistory'
|
|
80
|
+
SAWHistory = 'sawHistory',
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
/** @group General API */
|
|
@@ -211,7 +220,12 @@ export class WSAPI {
|
|
|
211
220
|
this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
|
|
212
221
|
}
|
|
213
222
|
|
|
214
|
-
return OCache.use(
|
|
223
|
+
return OCache.use(
|
|
224
|
+
onUpdateContextKey.Missions,
|
|
225
|
+
ECacheContext.WSAPI,
|
|
226
|
+
() => this.api.missionsGetItemsT(null),
|
|
227
|
+
CACHE_DATA_SEC,
|
|
228
|
+
);
|
|
215
229
|
}
|
|
216
230
|
|
|
217
231
|
/**
|
|
@@ -242,11 +256,11 @@ export class WSAPI {
|
|
|
242
256
|
/**
|
|
243
257
|
* Claim the bonus by bonus_id. Returns the err_code in case of success or error.
|
|
244
258
|
* Note that this method can be used only on integrations where originally failed bonus can be claimed again.
|
|
245
|
-
* For example, user won a bonus in the mini-game, but Operator rejected this bonus.
|
|
259
|
+
* For example, user won a bonus in the mini-game, but Operator rejected this bonus.
|
|
246
260
|
* This bonus will be available for the user to claim again.
|
|
247
261
|
*
|
|
248
262
|
* **Visitor mode: not supported**
|
|
249
|
-
*/
|
|
263
|
+
*/
|
|
250
264
|
public async claimBonus(bonus_id: number): Promise<TClaimBonusResult> {
|
|
251
265
|
const r = await this.api.bonusClaimItem(null, bonus_id);
|
|
252
266
|
|
|
@@ -259,7 +273,6 @@ export class WSAPI {
|
|
|
259
273
|
return o;
|
|
260
274
|
}
|
|
261
275
|
|
|
262
|
-
|
|
263
276
|
/**
|
|
264
277
|
* Returns the extra counters for the current user level.
|
|
265
278
|
* These are counters that are configured for each Smartico client separatly by request.
|
|
@@ -488,14 +501,17 @@ export class WSAPI {
|
|
|
488
501
|
* ```
|
|
489
502
|
*
|
|
490
503
|
* **Visitor mode: not supported**
|
|
491
|
-
|
|
504
|
+
*/
|
|
492
505
|
|
|
493
506
|
public async getMiniGamesHistory({
|
|
494
507
|
limit,
|
|
495
508
|
offset,
|
|
496
|
-
saw_template_id
|
|
497
|
-
}
|
|
498
|
-
|
|
509
|
+
saw_template_id,
|
|
510
|
+
}: {
|
|
511
|
+
limit?: number;
|
|
512
|
+
offset?: number;
|
|
513
|
+
saw_template_id?: number;
|
|
514
|
+
}): Promise<TSawHistory[]> {
|
|
499
515
|
return OCache.use(
|
|
500
516
|
onUpdateContextKey.SAWHistory,
|
|
501
517
|
ECacheContext.WSAPI,
|
|
@@ -506,7 +522,7 @@ export class WSAPI {
|
|
|
506
522
|
|
|
507
523
|
/**
|
|
508
524
|
* Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
|
|
509
|
-
|
|
525
|
+
* After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
510
526
|
* The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
|
|
511
527
|
*
|
|
512
528
|
* **Example**:
|
|
@@ -518,8 +534,10 @@ export class WSAPI {
|
|
|
518
534
|
*
|
|
519
535
|
* **Visitor mode: not supported**
|
|
520
536
|
*/
|
|
521
|
-
public async playMiniGame(
|
|
522
|
-
|
|
537
|
+
public async playMiniGame(
|
|
538
|
+
template_id: number,
|
|
539
|
+
{ onUpdate }: { onUpdate?: (data: TMiniGameTemplate[]) => void } = {},
|
|
540
|
+
): Promise<TMiniGamePlayResult> {
|
|
523
541
|
if (onUpdate) {
|
|
524
542
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
525
543
|
}
|
|
@@ -536,6 +554,20 @@ export class WSAPI {
|
|
|
536
554
|
return o;
|
|
537
555
|
}
|
|
538
556
|
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Sends the acknowledge request with specific client_request_id from minigame history in order to claim prize
|
|
560
|
+
* **Example**:
|
|
561
|
+
* ```
|
|
562
|
+
* _smartico.api.miniGameWinAcknowledgeRequest('12dvq1r24b6h').then((result) => {
|
|
563
|
+
* console.log(result);
|
|
564
|
+
* });
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
public async miniGameWinAcknowledgeRequest (request_id: string) {
|
|
568
|
+
return this.api.doAcknowledgeRequest(null, request_id);
|
|
569
|
+
}
|
|
570
|
+
|
|
539
571
|
/**
|
|
540
572
|
* Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
|
|
541
573
|
* After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
@@ -549,8 +581,11 @@ export class WSAPI {
|
|
|
549
581
|
* ```
|
|
550
582
|
* **Visitor mode: not supported**
|
|
551
583
|
*/
|
|
552
|
-
public async playMiniGameBatch(
|
|
553
|
-
|
|
584
|
+
public async playMiniGameBatch(
|
|
585
|
+
template_id: number,
|
|
586
|
+
spin_count: number,
|
|
587
|
+
{ onUpdate }: { onUpdate?: (data: TMissionOrBadge[]) => void } = {},
|
|
588
|
+
): Promise<TMiniGamePlayBatchResult[]> {
|
|
554
589
|
if (onUpdate) {
|
|
555
590
|
this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
|
|
556
591
|
}
|
|
@@ -851,7 +886,7 @@ export class WSAPI {
|
|
|
851
886
|
const payload = await this.api.bonusesGetItemsT(null);
|
|
852
887
|
this.updateEntity(onUpdateContextKey.Bonuses, payload);
|
|
853
888
|
}
|
|
854
|
-
|
|
889
|
+
|
|
855
890
|
private async updateTournaments() {
|
|
856
891
|
const payload = await this.api.tournamentsGetLobbyT(null);
|
|
857
892
|
this.updateEntity(onUpdateContextKey.TournamentList, payload);
|
|
@@ -990,7 +1025,7 @@ export class WSAPI {
|
|
|
990
1025
|
/**
|
|
991
1026
|
* Returns all the related tournaments and missions for the provided game id for the current user
|
|
992
1027
|
* The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
|
|
993
|
-
*
|
|
1028
|
+
*
|
|
994
1029
|
* **Example**:
|
|
995
1030
|
* ```
|
|
996
1031
|
* _smartico.api.getRelatedItemsForGame('gold-slot2').then((result) => {
|
|
@@ -1006,9 +1041,7 @@ export class WSAPI {
|
|
|
1006
1041
|
* ```
|
|
1007
1042
|
*/
|
|
1008
1043
|
public async getRelatedItemsForGame(related_game_id: string): Promise<GetRelatedAchTourResponse> {
|
|
1009
|
-
|
|
1010
1044
|
const result = await this.api.getRelatedItemsForGame(null, related_game_id);
|
|
1011
|
-
|
|
1012
|
-
|
|
1045
|
+
return result;
|
|
1013
1046
|
}
|
|
1014
1047
|
}
|