@smartico/public-api 0.0.352 → 0.0.353
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/GamePick/GPTypes.d.ts +3 -0
- package/dist/SmarticoAPI.d.ts +16 -11
- package/dist/WSAPI/WSAPI.d.ts +212 -90
- package/dist/index.d.ts +1 -0
- package/dist/index.js +772 -616
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +405 -221
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/README.md +3 -0
- package/docs/api/classes/WSAPI.md +199 -0
- package/docs/api/enums/QuizAnswersValueType.md +121 -0
- package/docs/api/enums/RaffleTicketCapVisualization.md +5 -1
- package/docs/api/enums/SAWGPMarketType.md +157 -0
- package/docs/api/interfaces/RafflePublicMeta.md +3 -2
- package/docs/api/interfaces/TRaffle.md +8 -0
- package/package.json +4 -2
- package/src/GamePick/GPTypes.ts +4 -0
- package/src/SmarticoAPI.ts +98 -62
- package/src/WSAPI/WSAPI.ts +294 -156
- package/src/index.ts +1 -0
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -29,15 +29,20 @@ import { GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo,
|
|
|
29
29
|
interface Tracker {
|
|
30
30
|
label_api_key: string;
|
|
31
31
|
userPublicProps: any;
|
|
32
|
+
params: {
|
|
33
|
+
brand_key?: string;
|
|
34
|
+
};
|
|
32
35
|
on: (callBackKey: ClassId, func: (data: any) => void) => void;
|
|
33
36
|
getLabelSetting: (key: PublicLabelSettings) => any;
|
|
34
37
|
triggerExternalCallBack: (callBackKey: string, payload: any) => void;
|
|
38
|
+
getExtUserId: () => string;
|
|
35
39
|
}
|
|
36
40
|
interface IOptions {
|
|
37
41
|
logger?: ILogger;
|
|
38
42
|
logCIDs?: ClassId[];
|
|
39
43
|
logHTTPTiming?: boolean;
|
|
40
44
|
tracker?: Tracker;
|
|
45
|
+
brand_api_key?: string;
|
|
41
46
|
}
|
|
42
47
|
type MessageSender = (message: any, publicApuUrl?: string, expectCID?: ClassId) => Promise<any>;
|
|
43
48
|
declare class SmarticoAPI {
|
|
@@ -48,7 +53,8 @@ declare class SmarticoAPI {
|
|
|
48
53
|
private wsUrl;
|
|
49
54
|
private inboxCdnUrl;
|
|
50
55
|
private partnerUrl;
|
|
51
|
-
gamesApiUrl
|
|
56
|
+
private gamesApiUrl;
|
|
57
|
+
private baseRgApiParams;
|
|
52
58
|
avatarDomain: string;
|
|
53
59
|
private envId;
|
|
54
60
|
private logger;
|
|
@@ -64,7 +70,6 @@ declare class SmarticoAPI {
|
|
|
64
70
|
static getCleanLabelApiKey(label_api_key: string): string;
|
|
65
71
|
static getPublicUrl(label_api_key: string): string;
|
|
66
72
|
static getPublicWsUrl(label_api_key: string): string;
|
|
67
|
-
static getGamesApiUrl(label_api_key: string): string;
|
|
68
73
|
static getAvatarUrl(label_api_key: string): string;
|
|
69
74
|
private send;
|
|
70
75
|
private buildMessage;
|
|
@@ -159,15 +164,15 @@ declare class SmarticoAPI {
|
|
|
159
164
|
deleteAllInboxMessages(user_ext_id: string): Promise<MarkInboxMessageDeletedResponse>;
|
|
160
165
|
private buildGamesApiParams;
|
|
161
166
|
private sendGamesApi;
|
|
162
|
-
gpGetActiveRounds(
|
|
163
|
-
gpGetActiveRound(
|
|
164
|
-
gpGetGamesHistory(
|
|
165
|
-
gpGetGameBoard(
|
|
166
|
-
gpSubmitSelection(
|
|
167
|
-
gpGetUserInfo(
|
|
168
|
-
gpGetGameInfo(
|
|
169
|
-
gpGetTranslations(
|
|
170
|
-
gpGetRoundInfoForUser(
|
|
167
|
+
gpGetActiveRounds(saw_template_id: number): Promise<GamesApiResponse<GamePickRound[]>>;
|
|
168
|
+
gpGetActiveRound(saw_template_id: number, round_id?: number): Promise<GamesApiResponse<GamePickRound>>;
|
|
169
|
+
gpGetGamesHistory(saw_template_id: number): Promise<GamesApiResponse<GamePickRound[]>>;
|
|
170
|
+
gpGetGameBoard(saw_template_id: number, round_id: number): Promise<GamesApiResponse<GamePickRoundBoard>>;
|
|
171
|
+
gpSubmitSelection(saw_template_id: number, round: any, isQuiz: boolean): Promise<GamesApiResponse<GamePickRound>>;
|
|
172
|
+
gpGetUserInfo(saw_template_id: number): Promise<GamesApiResponse<GamePickUserInfo>>;
|
|
173
|
+
gpGetGameInfo(saw_template_id: number): Promise<GamesApiResponse<GamePickGameInfo>>;
|
|
174
|
+
gpGetTranslations(saw_template_id: number): Promise<GamesApiResponse<any>>;
|
|
175
|
+
gpGetRoundInfoForUser(saw_template_id: number, round_id: number, int_user_id: number): Promise<GamesApiResponse<GamePickRound>>;
|
|
171
176
|
getWSCalls(): WSAPI;
|
|
172
177
|
getRelatedItemsForGame(user_ext_id: string, related_game_id: string): Promise<GetRelatedAchTourResponse>;
|
|
173
178
|
getRafflesT(user_ext_id: string): Promise<TRaffle[]>;
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActivityTypeLimited } from '../Core';
|
|
2
2
|
import { SmarticoAPI } from '../SmarticoAPI';
|
|
3
3
|
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TActivityLog, TRaffleOptinResponse } from './WSAPITypes';
|
|
4
|
-
import { GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo, GamePickRequestParams } from '../GamePick';
|
|
4
|
+
import { GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo, GamePickRequestParams, GamePickRoundRequestParams } from '../GamePick';
|
|
5
5
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
6
6
|
import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
|
|
7
7
|
import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
|
|
@@ -13,8 +13,9 @@ export declare class WSAPI {
|
|
|
13
13
|
private api;
|
|
14
14
|
private onUpdateCallback;
|
|
15
15
|
private jackpotGetSignature;
|
|
16
|
+
private userExtId;
|
|
16
17
|
/** @private */
|
|
17
|
-
constructor(api: SmarticoAPI);
|
|
18
|
+
constructor(api: SmarticoAPI, userExtId?: string);
|
|
18
19
|
/** @private */
|
|
19
20
|
clearCaches(): void;
|
|
20
21
|
/** Returns information about current user
|
|
@@ -584,18 +585,33 @@ export declare class WSAPI {
|
|
|
584
585
|
onUpdate?: (data: TActivityLog[]) => void;
|
|
585
586
|
}): Promise<TActivityLog[]>;
|
|
586
587
|
/**
|
|
587
|
-
* Returns the active rounds for the specified MatchX or Quiz game
|
|
588
|
-
* Each round
|
|
588
|
+
* Returns the active rounds for the specified MatchX or Quiz game.
|
|
589
|
+
* Each round includes its events (matches/questions) along with the current user's selections and scores.
|
|
590
|
+
*
|
|
591
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
592
|
+
*
|
|
593
|
+
* **Response** `GamesApiResponse<GamePickRound[]>`:
|
|
594
|
+
* - `errCode` - 0 on success
|
|
595
|
+
* - `data` - Array of rounds, each containing:
|
|
596
|
+
* - `round_id`, `round_name` - Round identifier and display name
|
|
597
|
+
* - `open_date`, `last_bet_date` - Timestamps (ms) for round open and betting deadline
|
|
598
|
+
* - `is_active_now`, `is_resolved` - Round state flags
|
|
599
|
+
* - `round_status_id` - Round status: -1 (active), 2 (no more bets), 3 (all events resolved), 4 (round resolved)
|
|
600
|
+
* - `score_full_win`, `score_part_win`, `score_lost` - Scoring rules per prediction outcome
|
|
601
|
+
* - `user_score` - Current user's total score in this round
|
|
602
|
+
* - `user_placed_bet` - Whether the user has submitted predictions
|
|
603
|
+
* - `has_open_for_bet_events` - Whether there are events still open for betting
|
|
604
|
+
* - `events[]` - Array of events with `gp_event_id`, `market_type_id`, `event_meta` (team names, images, sport), `match_date`, `is_open_for_bets`, `odds_details`, and user selection fields
|
|
589
605
|
*
|
|
590
606
|
* **Example**:
|
|
591
607
|
* ```
|
|
592
608
|
* _smartico.api.getGamePickActiveRounds({
|
|
593
|
-
* saw_template_id:
|
|
594
|
-
* ext_user_id: '149598632',
|
|
595
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
596
|
-
* lang: 'EN'
|
|
609
|
+
* saw_template_id: 1083,
|
|
597
610
|
* }).then((result) => {
|
|
598
|
-
* console.log(result);
|
|
611
|
+
* console.log(result.data); // GamePickRound[]
|
|
612
|
+
* result.data.forEach(round => {
|
|
613
|
+
* console.log(round.round_name, round.events.length);
|
|
614
|
+
* });
|
|
599
615
|
* });
|
|
600
616
|
* ```
|
|
601
617
|
*
|
|
@@ -603,36 +619,51 @@ export declare class WSAPI {
|
|
|
603
619
|
*/
|
|
604
620
|
getGamePickActiveRounds(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>>;
|
|
605
621
|
/**
|
|
606
|
-
* Returns a single active round
|
|
607
|
-
*
|
|
622
|
+
* Returns a single active round for the specified MatchX or Quiz game.
|
|
623
|
+
* The round includes full event details with the current user's selections.
|
|
624
|
+
*
|
|
625
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
626
|
+
* @param props.round_id - The specific round to retrieve
|
|
627
|
+
*
|
|
628
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
629
|
+
* - `errCode` - 0 on success
|
|
630
|
+
* - `data` - Single round object with the same structure as in `getGamePickActiveRounds`,
|
|
631
|
+
* including `events[]` with full event details, user selections, and resolution info
|
|
608
632
|
*
|
|
609
633
|
* **Example**:
|
|
610
634
|
* ```
|
|
611
635
|
* _smartico.api.getGamePickActiveRound({
|
|
612
|
-
* saw_template_id:
|
|
613
|
-
*
|
|
614
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
636
|
+
* saw_template_id: 1083,
|
|
637
|
+
* round_id: 31652,
|
|
615
638
|
* }).then((result) => {
|
|
616
|
-
* console.log(result);
|
|
639
|
+
* console.log(result.data.round_name, result.data.events.length);
|
|
640
|
+
* console.log(result.data.user_score, result.data.user_placed_bet);
|
|
617
641
|
* });
|
|
618
642
|
* ```
|
|
619
643
|
*
|
|
620
644
|
* **Visitor mode: not supported**
|
|
621
645
|
*/
|
|
622
|
-
getGamePickActiveRound(props:
|
|
623
|
-
round_id?: number;
|
|
624
|
-
}): Promise<GamesApiResponse<GamePickRound>>;
|
|
646
|
+
getGamePickActiveRound(props: GamePickRoundRequestParams): Promise<GamesApiResponse<GamePickRound>>;
|
|
625
647
|
/**
|
|
626
|
-
* Returns the history of all rounds (including resolved) for the specified MatchX or Quiz game.
|
|
648
|
+
* Returns the history of all rounds (including resolved ones) for the specified MatchX or Quiz game.
|
|
649
|
+
* Each round contains full event details with results and the current user's predictions.
|
|
650
|
+
*
|
|
651
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
652
|
+
*
|
|
653
|
+
* **Response** `GamesApiResponse<GamePickRound[]>`:
|
|
654
|
+
* - `errCode` - 0 on success
|
|
655
|
+
* - `data` - Array of rounds ordered by `round_row_id` descending (newest first).
|
|
656
|
+
* Each round has the same structure as in `getGamePickActiveRounds`, including resolved events
|
|
657
|
+
* with `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) and `resolution_score`
|
|
627
658
|
*
|
|
628
659
|
* **Example**:
|
|
629
660
|
* ```
|
|
630
661
|
* _smartico.api.getGamePickHistory({
|
|
631
|
-
* saw_template_id:
|
|
632
|
-
* ext_user_id: '149598632',
|
|
633
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
662
|
+
* saw_template_id: 1083,
|
|
634
663
|
* }).then((result) => {
|
|
635
|
-
*
|
|
664
|
+
* result.data.forEach(round => {
|
|
665
|
+
* console.log(round.round_name, 'Score:', round.user_score, 'Resolved:', round.is_resolved);
|
|
666
|
+
* });
|
|
636
667
|
* });
|
|
637
668
|
* ```
|
|
638
669
|
*
|
|
@@ -641,93 +672,146 @@ export declare class WSAPI {
|
|
|
641
672
|
getGamePickHistory(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>>;
|
|
642
673
|
/**
|
|
643
674
|
* Returns the leaderboard for a specific round within a MatchX or Quiz game.
|
|
644
|
-
* Use round_id = -1 (AllRoundsGameBoardID)
|
|
675
|
+
* Use `round_id = -1` (AllRoundsGameBoardID) to get the season/overall leaderboard across all rounds.
|
|
676
|
+
*
|
|
677
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
678
|
+
* @param props.round_id - The round to get the leaderboard for. Use -1 for overall/seasonal leaderboard
|
|
679
|
+
*
|
|
680
|
+
* **Response** `GamesApiResponse<GamePickRoundBoard>`:
|
|
681
|
+
* - `errCode` - 0 on success
|
|
682
|
+
* - `data` - Leaderboard object containing:
|
|
683
|
+
* - Round base fields (`round_id`, `round_name`, `open_date`, `last_bet_date`, etc.)
|
|
684
|
+
* - `users[]` - Ranked list of players, each with:
|
|
685
|
+
* - `ext_user_id`, `int_user_id` - User identifiers
|
|
686
|
+
* - `public_username`, `avatar_url` - Display info (usernames may be masked based on label settings)
|
|
687
|
+
* - `gp_position` - Leaderboard rank (null if not yet ranked)
|
|
688
|
+
* - `resolution_score` - Total score in this round
|
|
689
|
+
* - `full_wins_count`, `part_wins_count`, `lost_count` - Prediction outcome counts
|
|
690
|
+
* - `my_user` - Current user's entry (same fields as above), or null if user hasn't participated
|
|
645
691
|
*
|
|
646
692
|
* **Example**:
|
|
647
693
|
* ```
|
|
648
694
|
* _smartico.api.getGamePickBoard({
|
|
649
|
-
* saw_template_id:
|
|
650
|
-
*
|
|
651
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
652
|
-
* round_id: 456
|
|
695
|
+
* saw_template_id: 1083,
|
|
696
|
+
* round_id: 31652,
|
|
653
697
|
* }).then((result) => {
|
|
654
|
-
* console.log(
|
|
698
|
+
* console.log('Top players:', result.data.users);
|
|
699
|
+
* console.log('My position:', result.data.my_user?.gp_position);
|
|
655
700
|
* });
|
|
656
701
|
* ```
|
|
657
702
|
*
|
|
658
703
|
* **Visitor mode: not supported**
|
|
659
704
|
*/
|
|
660
|
-
getGamePickBoard(props:
|
|
661
|
-
round_id: number;
|
|
662
|
-
}): Promise<GamesApiResponse<GamePickRoundBoard>>;
|
|
705
|
+
getGamePickBoard(props: GamePickRoundRequestParams): Promise<GamesApiResponse<GamePickRoundBoard>>;
|
|
663
706
|
/**
|
|
664
|
-
* Submits
|
|
665
|
-
* Sends the
|
|
666
|
-
* Each event
|
|
707
|
+
* Submits score predictions for a round in a MatchX game.
|
|
708
|
+
* Sends the round object with user selections for all events at once.
|
|
709
|
+
* Each event must include `team1_user_selection` and `team2_user_selection` representing predicted scores.
|
|
710
|
+
* If the user hasn't placed bets before, one game attempt (spin) will be consumed.
|
|
711
|
+
* Predictions can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
|
|
712
|
+
*
|
|
713
|
+
* @param props.saw_template_id - The ID of the MatchX game template
|
|
714
|
+
* @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `getGamePickActiveRound`
|
|
715
|
+
* and modified with user predictions. Each event needs: `gp_event_id`, `team1_user_selection`, `team2_user_selection`
|
|
716
|
+
*
|
|
717
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
718
|
+
* - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
|
|
719
|
+
* - `data` - Updated round with all events reflecting the submitted selections.
|
|
720
|
+
* `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
|
|
667
721
|
*
|
|
668
722
|
* **Example**:
|
|
669
723
|
* ```
|
|
670
|
-
* _smartico.api.
|
|
671
|
-
* saw_template_id:
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
* round
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
*
|
|
724
|
+
* _smartico.api.getGamePickActiveRound({
|
|
725
|
+
* saw_template_id: 1190,
|
|
726
|
+
* round_id: 38665,
|
|
727
|
+
* }).then((roundData) => {
|
|
728
|
+
* const round = roundData.data;
|
|
729
|
+
* round.events = round.events.map(e => ({
|
|
730
|
+
* gp_event_id: e.gp_event_id,
|
|
731
|
+
* team1_user_selection: 1,
|
|
732
|
+
* team2_user_selection: 0,
|
|
733
|
+
* }));
|
|
734
|
+
* _smartico.api.submitGamePickSelection({
|
|
735
|
+
* saw_template_id: 1190,
|
|
736
|
+
* round: round,
|
|
737
|
+
* }).then((result) => {
|
|
738
|
+
* console.log(result.data.user_placed_bet); // true
|
|
739
|
+
* });
|
|
683
740
|
* });
|
|
684
741
|
* ```
|
|
685
742
|
*
|
|
686
743
|
* **Visitor mode: not supported**
|
|
687
744
|
*/
|
|
688
745
|
submitGamePickSelection(props: GamePickRequestParams & {
|
|
689
|
-
round:
|
|
746
|
+
round: Partial<GamePickRound>;
|
|
690
747
|
}): Promise<GamesApiResponse<GamePickRound>>;
|
|
691
748
|
/**
|
|
692
749
|
* Submits answers for a round in a Quiz game.
|
|
693
|
-
* Sends the
|
|
694
|
-
* Each event
|
|
750
|
+
* Sends the round object with user answers for all events at once.
|
|
751
|
+
* Each event must include `user_selection` with the answer value (e.g. '1', '2', 'x', 'yes', 'no' — depending on the market type).
|
|
752
|
+
* If the user hasn't placed bets before, one game attempt (spin) will be consumed.
|
|
753
|
+
* Answers can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
|
|
754
|
+
*
|
|
755
|
+
* @param props.saw_template_id - The ID of the Quiz game template
|
|
756
|
+
* @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `getGamePickActiveRound`
|
|
757
|
+
* and modified with user answers. Each event needs: `gp_event_id`, `user_selection`
|
|
758
|
+
*
|
|
759
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
760
|
+
* - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
|
|
761
|
+
* - `data` - Updated round with all events reflecting the submitted answers.
|
|
762
|
+
* `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
|
|
695
763
|
*
|
|
696
764
|
* **Example**:
|
|
697
765
|
* ```
|
|
698
|
-
* _smartico.api.
|
|
699
|
-
* saw_template_id:
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
* round
|
|
703
|
-
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
766
|
+
* _smartico.api.getGamePickActiveRound({
|
|
767
|
+
* saw_template_id: 1183,
|
|
768
|
+
* round_id: 37974,
|
|
769
|
+
* }).then((roundData) => {
|
|
770
|
+
* const round = roundData.data;
|
|
771
|
+
* round.events = round.events.map(e => ({
|
|
772
|
+
* gp_event_id: e.gp_event_id,
|
|
773
|
+
* user_selection: 'x',
|
|
774
|
+
* }));
|
|
775
|
+
* _smartico.api.submitGamePickSelectionQuiz({
|
|
776
|
+
* saw_template_id: 1183,
|
|
777
|
+
* round: round,
|
|
778
|
+
* }).then((result) => {
|
|
779
|
+
* console.log(result.data.user_placed_bet); // true
|
|
780
|
+
* });
|
|
711
781
|
* });
|
|
712
782
|
* ```
|
|
713
783
|
*
|
|
714
784
|
* **Visitor mode: not supported**
|
|
715
785
|
*/
|
|
716
786
|
submitGamePickSelectionQuiz(props: GamePickRequestParams & {
|
|
717
|
-
round:
|
|
787
|
+
round: Partial<GamePickRound>;
|
|
718
788
|
}): Promise<GamesApiResponse<GamePickRound>>;
|
|
719
789
|
/**
|
|
720
790
|
* Returns the current user's profile information within the specified MatchX or Quiz game.
|
|
721
|
-
*
|
|
791
|
+
* The user record is synced from the Smartico platform into the games DB (synced every 1 minute).
|
|
792
|
+
* If the user doesn't exist in the games DB yet, it will be created automatically on first call.
|
|
793
|
+
*
|
|
794
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
795
|
+
*
|
|
796
|
+
* **Response** `GamesApiResponse<GamePickUserInfo>`:
|
|
797
|
+
* - `errCode` - 0 on success
|
|
798
|
+
* - `data`:
|
|
799
|
+
* - `ext_user_id` - External user ID (Smartico internal numeric ID)
|
|
800
|
+
* - `int_user_id` - Internal user ID within the games system
|
|
801
|
+
* - `public_username` - Display name
|
|
802
|
+
* - `avatar_url` - User's avatar image URL
|
|
803
|
+
* - `last_wallet_sync_time` - Last time the user's balance was synced from Smartico
|
|
804
|
+
* - `ach_points_balance` - User's current points balance
|
|
805
|
+
* - `ach_gems_balance` - User's current gems balance
|
|
806
|
+
* - `ach_diamonds_balance` - User's current diamonds balance
|
|
807
|
+
* - `pubic_username_set` - Whether the user has set a custom username
|
|
722
808
|
*
|
|
723
809
|
* **Example**:
|
|
724
810
|
* ```
|
|
725
811
|
* _smartico.api.getGamePickUserInfo({
|
|
726
|
-
* saw_template_id:
|
|
727
|
-
* ext_user_id: '149598632',
|
|
728
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
812
|
+
* saw_template_id: 1083,
|
|
729
813
|
* }).then((result) => {
|
|
730
|
-
* console.log(result.data.public_username, result.data.
|
|
814
|
+
* console.log(result.data.public_username, result.data.ach_points_balance);
|
|
731
815
|
* });
|
|
732
816
|
* ```
|
|
733
817
|
*
|
|
@@ -735,16 +819,34 @@ export declare class WSAPI {
|
|
|
735
819
|
*/
|
|
736
820
|
getGamePickUserInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickUserInfo>>;
|
|
737
821
|
/**
|
|
738
|
-
* Returns the game configuration
|
|
822
|
+
* Returns the game configuration and the list of all rounds for the specified MatchX or Quiz game.
|
|
823
|
+
* Includes the SAW template definition, label settings, and round metadata (without events).
|
|
824
|
+
*
|
|
825
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
826
|
+
*
|
|
827
|
+
* **Response** `GamesApiResponse<GamePickGameInfo>`:
|
|
828
|
+
* - `errCode` - 0 on success
|
|
829
|
+
* - `data`:
|
|
830
|
+
* - `sawTemplate` - Game template configuration including:
|
|
831
|
+
* - `saw_template_id`, `saw_game_type_id` (6 = MatchX/Quiz)
|
|
832
|
+
* - `saw_template_ui_definition` - UI settings (name, ranking options, ask_for_username, etc.)
|
|
833
|
+
* - `saw_buyin_type_id` - Cost type (1=Free, 2=Points, 3=Gems, 4=Diamonds, 5=Spins)
|
|
834
|
+
* - `buyin_cost_points` - Cost per attempt
|
|
835
|
+
* - `spin_count` - Available attempts for the current user
|
|
836
|
+
* - `allRounds[]` - List of all rounds (metadata only, no events), each with:
|
|
837
|
+
* - `round_id`, `round_name`, `round_description`
|
|
838
|
+
* - `open_date`, `last_bet_date` - Timestamps (ms)
|
|
839
|
+
* - `is_active_now`, `is_resolved`, `round_status_id`
|
|
840
|
+
* - `labelInfo` - Label/brand configuration and settings
|
|
739
841
|
*
|
|
740
842
|
* **Example**:
|
|
741
843
|
* ```
|
|
742
844
|
* _smartico.api.getGamePickGameInfo({
|
|
743
|
-
* saw_template_id:
|
|
744
|
-
* ext_user_id: '149598632',
|
|
745
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
845
|
+
* saw_template_id: 1189,
|
|
746
846
|
* }).then((result) => {
|
|
747
|
-
* console.log(result.data.sawTemplate
|
|
847
|
+
* console.log(result.data.sawTemplate.saw_template_ui_definition.name);
|
|
848
|
+
* console.log('Rounds:', result.data.allRounds.length);
|
|
849
|
+
* console.log('Buy-in type:', result.data.sawTemplate.saw_buyin_type_id);
|
|
748
850
|
* });
|
|
749
851
|
* ```
|
|
750
852
|
*
|
|
@@ -753,17 +855,26 @@ export declare class WSAPI {
|
|
|
753
855
|
getGamePickGameInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickGameInfo>>;
|
|
754
856
|
/**
|
|
755
857
|
* Returns translations for the MatchX/Quiz game UI.
|
|
756
|
-
* Translations are returned as a key-value map
|
|
858
|
+
* Translations are returned as a key-value map for the Gamification and RetentionGames areas,
|
|
859
|
+
* resolved to the current user's language.
|
|
860
|
+
*
|
|
861
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
862
|
+
*
|
|
863
|
+
* **Response** `GamesApiResponse<any>`:
|
|
864
|
+
* - `errCode` - 0 on success
|
|
865
|
+
* - `data`:
|
|
866
|
+
* - `translations` - Key-value map of translation strings (e.g. `rgSubmitSelection`, `rgLeaderboardTitle`, `quizConfirmAnswer`, etc.)
|
|
867
|
+
* - `hash_code` - Hash for cache invalidation
|
|
868
|
+
* - `lang_code` - Resolved language code (e.g. 'EN')
|
|
757
869
|
*
|
|
758
870
|
* **Example**:
|
|
759
871
|
* ```
|
|
760
872
|
* _smartico.api.getGamePickTranslations({
|
|
761
|
-
* saw_template_id:
|
|
762
|
-
* ext_user_id: '149598632',
|
|
763
|
-
* smartico_ext_user_id: 'user@example.com',
|
|
764
|
-
* lang: 'EN'
|
|
873
|
+
* saw_template_id: 1083,
|
|
765
874
|
* }).then((result) => {
|
|
766
|
-
*
|
|
875
|
+
* const tr = result.data.translations;
|
|
876
|
+
* console.log(tr.rgSubmitSelection); // "Submit selection"
|
|
877
|
+
* console.log(tr.rgLeaderboardTitle); // "Leaderboard"
|
|
767
878
|
* });
|
|
768
879
|
* ```
|
|
769
880
|
*
|
|
@@ -772,25 +883,36 @@ export declare class WSAPI {
|
|
|
772
883
|
getGamePickTranslations(props: GamePickRequestParams): Promise<GamesApiResponse<any>>;
|
|
773
884
|
/**
|
|
774
885
|
* Returns round data with events and picks for a specific user (identified by their internal user ID).
|
|
775
|
-
* Useful for
|
|
886
|
+
* Useful for viewing another user's predictions from the leaderboard.
|
|
887
|
+
* The `int_user_id` can be obtained from the `getGamePickBoard` response (`users[].int_user_id`).
|
|
888
|
+
*
|
|
889
|
+
* @param props.saw_template_id - The ID of the MatchX or Quiz game template
|
|
890
|
+
* @param props.round_id - The round to get info for
|
|
891
|
+
* @param props.int_user_id - Internal user ID of the player whose predictions to view (from leaderboard data)
|
|
892
|
+
*
|
|
893
|
+
* **Response** `GamesApiResponse<GamePickRound>`:
|
|
894
|
+
* - `errCode` - 0 on success
|
|
895
|
+
* - `data` - Round object with the target user's selections.
|
|
896
|
+
* Same structure as `getGamePickActiveRound`, but `user_selection`/`team1_user_selection`/`team2_user_selection`
|
|
897
|
+
* fields on events reflect the specified user's picks instead of the current user's.
|
|
898
|
+
* Events also include `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) showing how each prediction was scored
|
|
776
899
|
*
|
|
777
900
|
* **Example**:
|
|
778
901
|
* ```
|
|
779
902
|
* _smartico.api.getGamePickRoundInfoForUser({
|
|
780
|
-
* saw_template_id:
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
* round_id: 456,
|
|
784
|
-
* int_user_id: 789
|
|
903
|
+
* saw_template_id: 1083,
|
|
904
|
+
* round_id: 31652,
|
|
905
|
+
* int_user_id: 65653810,
|
|
785
906
|
* }).then((result) => {
|
|
786
|
-
*
|
|
907
|
+
* result.data.events.forEach(e => {
|
|
908
|
+
* console.log(e.event_meta.team1_name, 'vs', e.event_meta.team2_name, '→', e.user_selection);
|
|
909
|
+
* });
|
|
787
910
|
* });
|
|
788
911
|
* ```
|
|
789
912
|
*
|
|
790
913
|
* **Visitor mode: not supported**
|
|
791
914
|
*/
|
|
792
|
-
getGamePickRoundInfoForUser(props:
|
|
793
|
-
round_id: number;
|
|
915
|
+
getGamePickRoundInfoForUser(props: GamePickRoundRequestParams & {
|
|
794
916
|
int_user_id: number;
|
|
795
917
|
}): Promise<GamesApiResponse<GamePickRound>>;
|
|
796
918
|
private updateOnSpin;
|