@smartico/public-api 0.0.380 → 0.0.382
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/CLAUDE.md +103 -0
- package/README.md +32 -10
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/Jackpots/JackpotDetails.d.ts +14 -15
- package/dist/Jackpots/JackpotPot.d.ts +10 -6
- package/dist/MiniGames/SAWGameType.d.ts +3 -1
- package/dist/MiniGames/SAWTemplateUI.d.ts +7 -0
- package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
- package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
- package/dist/Raffle/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +6 -1
- package/dist/SmarticoLib/index.d.ts +5 -1
- package/dist/WSAPI/WSAPIAvatars.d.ts +267 -49
- package/dist/WSAPI/WSAPIBonuses.d.ts +224 -10
- package/dist/WSAPI/WSAPIGamePick.d.ts +538 -253
- package/dist/WSAPI/WSAPIGeneral.d.ts +156 -14
- package/dist/WSAPI/WSAPIInbox.d.ts +547 -58
- package/dist/WSAPI/WSAPIJackpots.d.ts +292 -57
- package/dist/WSAPI/WSAPILeaderBoard.d.ts +127 -13
- package/dist/WSAPI/WSAPIMiniGames.d.ts +465 -49
- package/dist/WSAPI/WSAPIRaffles.d.ts +576 -52
- package/dist/WSAPI/WSAPITournaments.d.ts +3 -3
- package/dist/WSAPI/WSAPITypes.d.ts +243 -132
- package/dist/WSAPI/WSAPIUser.d.ts +193 -43
- package/dist/index.js +3412 -616
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +3395 -609
- package/dist/index.modern.mjs.map +1 -1
- package/docs/Callbacks.md +162 -0
- package/docs/SmarticoObject.md +445 -0
- package/docs/Transforms.md +99 -0
- package/docs/api/README.md +26 -0
- package/docs/api/classes/WSAPIAvatars.md +282 -54
- package/docs/api/classes/WSAPIBonuses.md +233 -12
- package/docs/api/classes/WSAPIClans.md +380 -10
- package/docs/api/classes/WSAPIGamePick.md +555 -26
- package/docs/api/classes/WSAPIGeneral.md +165 -16
- package/docs/api/classes/WSAPIInbox.md +588 -64
- package/docs/api/classes/WSAPIJackpots.md +320 -66
- package/docs/api/classes/WSAPILeaderBoard.md +133 -15
- package/docs/api/classes/WSAPIMiniGames.md +501 -64
- package/docs/api/classes/WSAPIMissions.md +58 -79
- package/docs/api/classes/WSAPIRaffles.md +647 -69
- package/docs/api/classes/WSAPIStore.md +83 -108
- package/docs/api/classes/WSAPITournaments.md +495 -28
- package/docs/api/classes/WSAPIUser.md +520 -83
- package/docs/api/documents/Callbacks.md +162 -0
- package/docs/api/documents/SmarticoObject.md +445 -0
- package/docs/api/documents/Transforms.md +99 -0
- package/docs/api/enumerations/BonusStatus-1.md +11 -6
- package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
- package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
- package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
- package/docs/api/interfaces/AvatarCustomized.md +25 -0
- package/docs/api/interfaces/AvatarDefinition.md +94 -0
- package/docs/api/interfaces/AvatarPrompt.md +45 -0
- package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
- package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
- package/docs/api/interfaces/Clan.md +4 -0
- package/docs/api/interfaces/ClanInfo.md +109 -0
- package/docs/api/interfaces/ClanMember.md +53 -0
- package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
- package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
- package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
- package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
- package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
- package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
- package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
- package/docs/api/interfaces/JackpotDetails.md +14 -15
- package/docs/api/interfaces/JackpotPot.md +9 -6
- package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
- package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
- package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
- package/docs/api/interfaces/PointsLog.md +43 -0
- package/docs/api/interfaces/RaffleWonPrize.md +59 -0
- package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
- package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
- package/docs/api/interfaces/TAchCategory.md +2 -7
- package/docs/api/interfaces/TAvatarCustomized.md +4 -4
- package/docs/api/interfaces/TAvatarDefinition.md +13 -14
- package/docs/api/interfaces/TAvatarPrompt.md +6 -6
- package/docs/api/interfaces/TBonus.md +16 -8
- package/docs/api/interfaces/TBuyStoreItemResult.md +4 -29
- package/docs/api/interfaces/TClaimBonusResult.md +5 -5
- package/docs/api/interfaces/TClan.md +8 -4
- package/docs/api/interfaces/TClanInfo.md +47 -0
- package/docs/api/interfaces/TClanJoinResult.md +11 -1
- package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
- package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
- package/docs/api/interfaces/TClans.md +3 -1
- package/docs/api/interfaces/TGetTranslations.md +4 -0
- package/docs/api/interfaces/TInboxMessage.md +14 -6
- package/docs/api/interfaces/TInboxMessageBody.md +18 -12
- package/docs/api/interfaces/TLevel.md +17 -20
- package/docs/api/interfaces/TLevelCurrent.md +19 -18
- package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
- package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
- package/docs/api/interfaces/TMissionClaimRewardResult.md +1 -9
- package/docs/api/interfaces/TMissionOptInResult.md +1 -5
- package/docs/api/interfaces/TMissionOrBadge.md +4 -7
- package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
- package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
- package/docs/api/interfaces/TSetAvatarResult.md +3 -3
- package/docs/api/interfaces/TStoreItem.md +3 -13
- package/docs/api/interfaces/TTournament.md +1 -1
- package/docs/api/interfaces/TTournamentDetailed.md +1 -1
- package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
- package/docs/api/interfaces/TUICustomSection.md +23 -19
- package/docs/api/interfaces/TUserProfile.md +18 -16
- package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
- package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
- package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
- package/docs/native/ADDING_METHODS.md +7 -2
- package/docs/native/PROTOCOL.md +337 -0
- package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
- package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
- package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
- package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
- package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
- package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
- package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
- package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
- package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
- package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
- package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
- package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
- package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
- package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
- package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
- package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
- package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
- package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
- package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
- package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
- package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
- package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
- package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
- package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
- package/docs/ui/user/UIGuide_getLevels.md +47 -42
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/Jackpots/JackpotDetails.ts +14 -15
- package/src/Jackpots/JackpotPot.ts +10 -6
- package/src/MiniGames/SAWGameType.ts +3 -0
- package/src/MiniGames/SAWTemplateUI.ts +10 -0
- package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
- package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
- package/src/Raffle/index.ts +3 -1
- package/src/SmarticoAPI.ts +14 -1
- package/src/SmarticoLib/index.ts +4 -0
- package/src/WSAPI/WSAPIAvatars.ts +267 -49
- package/src/WSAPI/WSAPIBonuses.ts +224 -10
- package/src/WSAPI/WSAPIGamePick.ts +538 -253
- package/src/WSAPI/WSAPIGeneral.ts +156 -14
- package/src/WSAPI/WSAPIInbox.ts +545 -56
- package/src/WSAPI/WSAPIJackpots.ts +297 -61
- package/src/WSAPI/WSAPILeaderBoard.ts +127 -13
- package/src/WSAPI/WSAPIMiniGames.ts +465 -49
- package/src/WSAPI/WSAPIRaffles.ts +592 -64
- package/src/WSAPI/WSAPITournaments.ts +3 -3
- package/src/WSAPI/WSAPITypes.ts +243 -132
- package/src/WSAPI/WSAPIUser.ts +193 -43
- package/tsconfig.json +9 -1
|
@@ -12,37 +12,65 @@ import { WSAPIAvatars } from './WSAPIAvatars';
|
|
|
12
12
|
/** @group GamePick */
|
|
13
13
|
export class WSAPIGamePick extends WSAPIAvatars {
|
|
14
14
|
/**
|
|
15
|
-
* Returns
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* **
|
|
15
|
+
* Returns every open round for a MatchX or Quiz game template, with the full
|
|
16
|
+
* event list (matches / questions) and the current user's selections per event.
|
|
17
|
+
*
|
|
18
|
+
* Use to power the rounds-lobby screen — typically a list of round cards a user
|
|
19
|
+
* can tap into to make predictions. For a single round, use
|
|
20
|
+
* {@link gamePickGetActiveRound} (lighter payload when only one round is shown).
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* **Preconditions**
|
|
24
|
+
* - User must be authenticated.
|
|
25
|
+
* - `saw_template_id` must reference a MatchX or Quiz game template. The SDK
|
|
26
|
+
* throws synchronously if it's missing.
|
|
27
|
+
*
|
|
28
|
+
* **Transport**
|
|
29
|
+
* Game Pick methods are HTTP REST calls to a separate Game Pick games server
|
|
30
|
+
* (not the main WebSocket). One consequence: there is no SDK cache and no push
|
|
31
|
+
* subscription — every call is a fresh server roundtrip.
|
|
32
|
+
*
|
|
33
|
+
* **Round status**
|
|
34
|
+
* Each round's `round_status_id` is a {@link GPRoundStatus} value. Rounds with
|
|
35
|
+
* status `NoEventsDefined` (1) are filtered out server-side and never appear
|
|
36
|
+
* here. Other values: `Other` (-1, normally open), `NoMoreBetsAllowed` (2),
|
|
37
|
+
* `AllEventsResolved_ButNotRound` (3), `RoundResolved` (4 — appears here only
|
|
38
|
+
* briefly during transition; use {@link gamePickGetHistory} for resolved rounds).
|
|
39
|
+
*
|
|
40
|
+
* **Error codes** (in `errCode`)
|
|
41
|
+
* - `0` — success.
|
|
42
|
+
* - `100002` — template not found (the `saw_template_id` doesn't reference a
|
|
43
|
+
* MatchX/Quiz game).
|
|
44
|
+
* - `100003` — no open rounds available for this template right now.
|
|
45
|
+
* - `100000` — auth hash invalid; SDK session needs re-initialization.
|
|
46
|
+
* - `100004` — generic server error.
|
|
47
|
+
*
|
|
48
|
+
* **Refresh**
|
|
49
|
+
* - No cache; every call is live.
|
|
50
|
+
* - No push subscription. Poll while the user is on the screen if you need
|
|
51
|
+
* live round-status changes (typically every 30–60 s is enough).
|
|
52
|
+
*
|
|
53
|
+
* **Visitor mode**: not supported. The SDK throws synchronously on visitor
|
|
54
|
+
* sessions.
|
|
55
|
+
*
|
|
56
|
+
* **UI guidance**: see [UI Guide — `gamePickGetActiveRounds`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md).
|
|
57
|
+
*
|
|
58
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
59
|
+
* @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const r = await window._smartico.api.gamePickGetActiveRounds({ saw_template_id: 1083 });
|
|
64
|
+
*
|
|
65
|
+
* if (r.errCode !== 0) {
|
|
66
|
+
* console.error('[smartico] active rounds fetch failed — show empty rounds lobby:', r.errMessage);
|
|
67
|
+
* return;
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* for (const round of r.data ?? []) {
|
|
71
|
+
* console.log('[smartico] render a round card:', round.round_name, '— events:', round.events.length, 'user has placed bet:', round.user_placed_bet);
|
|
72
|
+
* }
|
|
34
73
|
* ```
|
|
35
|
-
* _smartico.api.gamePickGetActiveRounds({
|
|
36
|
-
* saw_template_id: 1083,
|
|
37
|
-
* }).then((result) => {
|
|
38
|
-
* console.log(result.data); // GamePickRound[]
|
|
39
|
-
* result.data.forEach(round => {
|
|
40
|
-
* console.log(round.round_name, round.events.length);
|
|
41
|
-
* });
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* **Visitor mode: not supported**
|
|
46
74
|
*/
|
|
47
75
|
public async gamePickGetActiveRounds(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>> {
|
|
48
76
|
if (!props.saw_template_id) {
|
|
@@ -52,29 +80,56 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
52
80
|
}
|
|
53
81
|
|
|
54
82
|
/**
|
|
55
|
-
* Returns a single
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
83
|
+
* Returns a single round (events, user selections, scoring rules) for a
|
|
84
|
+
* MatchX or Quiz game. Use to power the round-detail / prediction-input
|
|
85
|
+
* screen the user lands on after picking a round from the lobby.
|
|
86
|
+
*
|
|
87
|
+
* Same shape as one entry of {@link gamePickGetActiveRounds}; cheaper when the
|
|
88
|
+
* UI only shows one round at a time.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* **Preconditions**
|
|
92
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
93
|
+
* - `saw_template_id` and `round_id` are mandatory — the SDK throws if either
|
|
94
|
+
* is missing.
|
|
95
|
+
*
|
|
96
|
+
* **Error codes** (in `errCode`)
|
|
97
|
+
* - `0` — success.
|
|
98
|
+
* - `4` — round / event not found (e.g. round resolved after the last
|
|
99
|
+
* `gamePickGetActiveRounds` poll); non-fatal — retry after a fresh active-
|
|
100
|
+
* rounds fetch.
|
|
101
|
+
* - `100002` — template not found.
|
|
102
|
+
* - `100000` — auth hash invalid.
|
|
103
|
+
* - `100004` — generic server error.
|
|
104
|
+
*
|
|
105
|
+
* **Refresh**
|
|
106
|
+
* - No cache; every call is live.
|
|
107
|
+
* - Re-call after {@link gamePickSubmitSelection} or
|
|
108
|
+
* {@link gamePickSubmitSelectionQuiz} to surface the persisted predictions.
|
|
109
|
+
* - Poll while the user is on the prediction screen if event resolution
|
|
110
|
+
* updates are needed (typically every 30–60 s).
|
|
111
|
+
*
|
|
112
|
+
* **Visitor mode**: not supported.
|
|
113
|
+
*
|
|
114
|
+
* **UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md).
|
|
115
|
+
*
|
|
116
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
117
|
+
* @param props.round_id ID of the round to fetch.
|
|
118
|
+
* @returns Wrapped {@link GamesApiResponse} of a single {@link GamePickRound}.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const r = await window._smartico.api.gamePickGetActiveRound({
|
|
123
|
+
* saw_template_id: 1083,
|
|
124
|
+
* round_id: 31652,
|
|
74
125
|
* });
|
|
75
|
-
* ```
|
|
76
126
|
*
|
|
77
|
-
*
|
|
127
|
+
* if (r.errCode === 0 && r.data) {
|
|
128
|
+
* console.log('[smartico] render round detail page —', r.data.round_name, '— user has placed bet:', r.data.user_placed_bet, 'score so far:', r.data.user_score);
|
|
129
|
+
* } else {
|
|
130
|
+
* console.error('[smartico] round fetch failed — bounce back to the lobby and refresh:', r.errMessage);
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
78
133
|
*/
|
|
79
134
|
public async gamePickGetActiveRound(props: GamePickRoundRequestParams): Promise<GamesApiResponse<GamePickRound>> {
|
|
80
135
|
if (!props.saw_template_id) {
|
|
@@ -87,29 +142,52 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
87
142
|
}
|
|
88
143
|
|
|
89
144
|
/**
|
|
90
|
-
* Returns the
|
|
91
|
-
* Each round
|
|
145
|
+
* Returns the full round history (active + resolved) for a MatchX or Quiz game
|
|
146
|
+
* template, newest-first. Each round carries the user's predictions plus the
|
|
147
|
+
* server-resolved outcome on each event.
|
|
92
148
|
*
|
|
93
|
-
*
|
|
149
|
+
* Use to power a "Past predictions" / history tab. For just the open rounds,
|
|
150
|
+
* use {@link gamePickGetActiveRounds} (faster — skips resolved data).
|
|
94
151
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* -
|
|
98
|
-
* Each round has the same structure as in `gamePickGetActiveRounds`, including resolved events
|
|
99
|
-
* with `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) and `resolution_score`
|
|
152
|
+
* @remarks
|
|
153
|
+
* **Preconditions**
|
|
154
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
100
155
|
*
|
|
101
|
-
* **
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
156
|
+
* **Sort order**
|
|
157
|
+
* Server returns rounds newest-first. No client-side sort needed.
|
|
158
|
+
*
|
|
159
|
+
* **Per-event resolution**
|
|
160
|
+
* Each event in the rounds carries `resolution_type_id` — values are from
|
|
161
|
+
* {@link GamePickResolutionType}: `None` (0, not yet resolved), `Lost` (2),
|
|
162
|
+
* `PartialWin` (3), `FullWin` (4). Use these to render result badges on
|
|
163
|
+
* each event row.
|
|
164
|
+
*
|
|
165
|
+
* **Error codes** (in `errCode`)
|
|
166
|
+
* - `0` — success.
|
|
167
|
+
* - `100002` — template not found.
|
|
168
|
+
* - `100000` — auth hash invalid.
|
|
169
|
+
* - `100004` — generic server error.
|
|
170
|
+
*
|
|
171
|
+
* **Refresh**
|
|
172
|
+
* - No cache.
|
|
173
|
+
* - No push subscription. Re-call when the user opens the history tab.
|
|
174
|
+
*
|
|
175
|
+
* **Visitor mode**: not supported.
|
|
111
176
|
*
|
|
112
|
-
* **
|
|
177
|
+
* **UI guidance**: see [UI Guide — `gamePickGetHistory`](../../docs/ui/gamepick/UIGuide_gamePickGetHistory.md).
|
|
178
|
+
*
|
|
179
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
180
|
+
* @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array,
|
|
181
|
+
* newest-first.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* const r = await window._smartico.api.gamePickGetHistory({ saw_template_id: 1083 });
|
|
186
|
+
*
|
|
187
|
+
* for (const round of r.data ?? []) {
|
|
188
|
+
* console.log('[smartico] history row —', round.round_name, 'score:', round.user_score, 'resolved:', round.is_resolved);
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
113
191
|
*/
|
|
114
192
|
public async gamePickGetHistory(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickRound[]>> {
|
|
115
193
|
if (!props.saw_template_id) {
|
|
@@ -119,36 +197,66 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
119
197
|
}
|
|
120
198
|
|
|
121
199
|
/**
|
|
122
|
-
* Returns the leaderboard for a
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* @
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
200
|
+
* Returns the leaderboard for a MatchX or Quiz game round — ranked list of
|
|
201
|
+
* players plus the current user's entry (`my_user`). Pass `round_id: -1` for
|
|
202
|
+
* the season / overall leaderboard across every round in the template.
|
|
203
|
+
*
|
|
204
|
+
* @remarks
|
|
205
|
+
* **Preconditions**
|
|
206
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
207
|
+
*
|
|
208
|
+
* **`round_id` semantics**
|
|
209
|
+
* - Positive `round_id` — per-round leaderboard scoped to that round's events.
|
|
210
|
+
* - `-1` — season / overall leaderboard aggregating scores across every round
|
|
211
|
+
* of the template.
|
|
212
|
+
*
|
|
213
|
+
* **`my_user`**
|
|
214
|
+
* The current user's entry is returned separately from the `users[]` array
|
|
215
|
+
* — `my_user` may be `null` if the user has never made a prediction on this
|
|
216
|
+
* round / template. Use it to render the user's rank in a sticky footer or
|
|
217
|
+
* "you are here" highlight regardless of pagination.
|
|
218
|
+
*
|
|
219
|
+
* **Username masking**
|
|
220
|
+
* `public_username` on other players may be masked / anonymized by operator
|
|
221
|
+
* label settings. Always pair with `avatar_url` so the user can recognize
|
|
222
|
+
* themselves in the ranking by avatar even when usernames are hidden.
|
|
223
|
+
*
|
|
224
|
+
* **Error codes** (in `errCode`)
|
|
225
|
+
* - `0` — success.
|
|
226
|
+
* - `100002` — template not found.
|
|
227
|
+
* - `100000` — auth hash invalid.
|
|
228
|
+
* - `100004` — generic server error.
|
|
229
|
+
*
|
|
230
|
+
* **Refresh**
|
|
231
|
+
* - No cache.
|
|
232
|
+
* - No push subscription. Poll while the leaderboard is visible
|
|
233
|
+
* (every 30–60 s) if you want live rank updates after match
|
|
234
|
+
* resolution.
|
|
235
|
+
*
|
|
236
|
+
* **Visitor mode**: not supported.
|
|
237
|
+
*
|
|
238
|
+
* **UI guidance**: see [UI Guide — `gamePickGetBoard`](../../docs/ui/gamepick/UIGuide_gamePickGetBoard.md).
|
|
239
|
+
*
|
|
240
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
241
|
+
* @param props.round_id Round ID, or `-1` for the season leaderboard.
|
|
242
|
+
* @returns Wrapped {@link GamesApiResponse} of {@link GamePickRoundBoard}.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const r = await window._smartico.api.gamePickGetBoard({
|
|
247
|
+
* saw_template_id: 1083,
|
|
248
|
+
* round_id: -1, // season leaderboard
|
|
148
249
|
* });
|
|
149
|
-
* ```
|
|
150
250
|
*
|
|
151
|
-
*
|
|
251
|
+
* if (r.errCode === 0 && r.data) {
|
|
252
|
+
* console.log('[smartico] render leaderboard rows for top', r.data.users.length, 'players');
|
|
253
|
+
* if (r.data.my_user) {
|
|
254
|
+
* console.log('[smartico] pin "you are rank #' + r.data.my_user.gp_position + '" footer to bottom');
|
|
255
|
+
* } else {
|
|
256
|
+
* console.log('[smartico] user not ranked — render "Play a round to join the leaderboard" CTA');
|
|
257
|
+
* }
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
152
260
|
*/
|
|
153
261
|
public async gamePickGetBoard(props: GamePickRoundRequestParams): Promise<GamesApiResponse<GamePickRoundBoard>> {
|
|
154
262
|
if (!props.saw_template_id) {
|
|
@@ -161,43 +269,107 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
161
269
|
}
|
|
162
270
|
|
|
163
271
|
/**
|
|
164
|
-
* Submits score predictions for a round in a MatchX game.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* **
|
|
175
|
-
* -
|
|
176
|
-
* - `
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
272
|
+
* Submits all score predictions for a round in a MatchX game in one shot.
|
|
273
|
+
* Each event in the round must carry `team1_user_selection` and
|
|
274
|
+
* `team2_user_selection` (the predicted scores).
|
|
275
|
+
*
|
|
276
|
+
* On the user's FIRST submit for a round, the server charges one buy-in (one
|
|
277
|
+
* "spin" / one currency deduction based on the template's `saw_buyin_type_id`).
|
|
278
|
+
* Subsequent edits within the same round are free and only persist changed
|
|
279
|
+
* selections.
|
|
280
|
+
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* **Preconditions**
|
|
283
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
284
|
+
* - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
|
|
285
|
+
* either is missing.
|
|
286
|
+
* - Each event passed must include `gp_event_id` and the two
|
|
287
|
+
* `team{1,2}_user_selection` fields. Missing events default to "no change".
|
|
288
|
+
*
|
|
289
|
+
* **Error codes** (in `errCode`)
|
|
290
|
+
* - `0` — success; the response `data` is the updated round with
|
|
291
|
+
* `user_placed_bet === true` and `has_not_submitted_changes === false`.
|
|
292
|
+
* - `3` (`NoBetsUpdatedOnSubmit`) — submit produced no changes, OR every event
|
|
293
|
+
* is past its `last_bet_date` deadline. The buy-in is NOT consumed; the
|
|
294
|
+
* current round is still returned in `data`.
|
|
295
|
+
* - `4` — round / event not found; refresh state and retry.
|
|
296
|
+
* - `100002` — template not found.
|
|
297
|
+
* - `100000` — auth hash invalid.
|
|
298
|
+
* - `100004` — generic server error.
|
|
299
|
+
*
|
|
300
|
+
* Buy-in failures pass through the {@link SAWSpinErrorCode} values on first
|
|
301
|
+
* submit:
|
|
302
|
+
* - `40001` — no spins left (when `saw_buyin_type_id` is Spins).
|
|
303
|
+
* - `40003` — insufficient points.
|
|
304
|
+
* - `40004` — global max-spins cap hit.
|
|
305
|
+
* - `40007` — template outside its active date window.
|
|
306
|
+
* - `40009` — user excluded by segment rule.
|
|
307
|
+
* - `40011` — insufficient gems.
|
|
308
|
+
* - `40012` — insufficient diamonds.
|
|
309
|
+
*
|
|
310
|
+
* **Idempotency**
|
|
311
|
+
* Re-submitting identical selections returns `errCode: 3` (no changes); the
|
|
312
|
+
* buy-in is consumed exactly once per round-per-user. Re-submitting after
|
|
313
|
+
* `last_bet_date` also returns `errCode: 3` without consuming the buy-in.
|
|
314
|
+
*
|
|
315
|
+
* **Side effects**
|
|
316
|
+
* - First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
317
|
+
* one Spin) per `saw_buyin_type_id`.
|
|
318
|
+
* - Reports a `minigame_matchx_prediction` event to the operator's event log.
|
|
319
|
+
* - Updates the round's participant counter (`users_cnt`) and per-event
|
|
320
|
+
* counters (`num_users`).
|
|
321
|
+
* - Score is awarded after the operator resolves the round
|
|
322
|
+
* ({@link GPRoundStatus} = `RoundResolved`).
|
|
323
|
+
*
|
|
324
|
+
* **Visitor mode**: not supported.
|
|
325
|
+
*
|
|
326
|
+
* **UI guidance**: see [UI Guide — `gamePickSubmitSelection`](../../docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md).
|
|
327
|
+
*
|
|
328
|
+
* @param props.saw_template_id ID of the MatchX game template.
|
|
329
|
+
* @param props.round Round object with `round_id` + `events[]`
|
|
330
|
+
* carrying the user's score predictions.
|
|
331
|
+
* @returns Wrapped {@link GamesApiResponse} with the updated round.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* const ar = await window._smartico.api.gamePickGetActiveRound({
|
|
336
|
+
* saw_template_id: 1190,
|
|
337
|
+
* round_id: 38665,
|
|
338
|
+
* });
|
|
339
|
+
* if (ar.errCode !== 0 || !ar.data) {
|
|
340
|
+
* console.error('[smartico] could not fetch round to submit — show error and bounce back');
|
|
341
|
+
* return;
|
|
342
|
+
* }
|
|
343
|
+
*
|
|
344
|
+
* const round = ar.data;
|
|
345
|
+
* round.events = round.events.map(e => ({
|
|
346
|
+
* gp_event_id: e.gp_event_id,
|
|
347
|
+
* team1_user_selection: 1,
|
|
348
|
+
* team2_user_selection: 0,
|
|
349
|
+
* }));
|
|
350
|
+
*
|
|
351
|
+
* const r = await window._smartico.api.gamePickSubmitSelection({
|
|
352
|
+
* saw_template_id: 1190,
|
|
353
|
+
* round,
|
|
197
354
|
* });
|
|
198
|
-
* ```
|
|
199
355
|
*
|
|
200
|
-
*
|
|
356
|
+
* switch (r.errCode) {
|
|
357
|
+
* case 0:
|
|
358
|
+
* console.log('[smartico] predictions saved — show confirmation, refresh leaderboard');
|
|
359
|
+
* break;
|
|
360
|
+
* case 3:
|
|
361
|
+
* console.log('[smartico] nothing changed (or all events closed) — silent no-op');
|
|
362
|
+
* break;
|
|
363
|
+
* case 40001:
|
|
364
|
+
* case 40003:
|
|
365
|
+
* case 40011:
|
|
366
|
+
* case 40012:
|
|
367
|
+
* console.error('[smartico] insufficient balance / spins — show top-up CTA:', r.errMessage);
|
|
368
|
+
* break;
|
|
369
|
+
* default:
|
|
370
|
+
* console.error('[smartico] submit failed — show generic error toast:', r.errMessage);
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
201
373
|
*/
|
|
202
374
|
public async gamePickSubmitSelection(props: GamePickRequestParams & { round: Partial<GamePickRound> }): Promise<GamesApiResponse<GamePickRound>> {
|
|
203
375
|
if (!props.saw_template_id) {
|
|
@@ -210,42 +382,83 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
210
382
|
}
|
|
211
383
|
|
|
212
384
|
/**
|
|
213
|
-
* Submits answers for a round in
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* **
|
|
224
|
-
* -
|
|
225
|
-
* - `
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
385
|
+
* Submits all quiz answers for a round in one shot. Each event in the round
|
|
386
|
+
* must carry `user_selection` (the answer value — typically `"1"` / `"2"` /
|
|
387
|
+
* `"x"` for 1×2 markets, `"yes"` / `"no"` for binary markets, or any
|
|
388
|
+
* operator-defined string for custom markets).
|
|
389
|
+
*
|
|
390
|
+
* Same first-submit buy-in behavior as {@link gamePickSubmitSelection} — one
|
|
391
|
+
* buy-in is charged on the first successful submit; subsequent edits within
|
|
392
|
+
* the same round are free.
|
|
393
|
+
*
|
|
394
|
+
* @remarks
|
|
395
|
+
* **Preconditions**
|
|
396
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
397
|
+
* - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
|
|
398
|
+
* either is missing.
|
|
399
|
+
* - Each event must include `gp_event_id` and `user_selection`. Missing
|
|
400
|
+
* events default to "no change".
|
|
401
|
+
*
|
|
402
|
+
* **Error codes** (in `errCode`)
|
|
403
|
+
* - `0` — success.
|
|
404
|
+
* - `3` (`NoBetsUpdatedOnSubmit`) — no changes, OR every event past
|
|
405
|
+
* `last_bet_date`. Buy-in NOT consumed; current round returned in `data`.
|
|
406
|
+
* - `4` — round / event not found.
|
|
407
|
+
* - `100002` — template not found.
|
|
408
|
+
* - `100000` — auth hash invalid.
|
|
409
|
+
* - `100004` — generic server error.
|
|
410
|
+
*
|
|
411
|
+
* Buy-in failures use the same {@link SAWSpinErrorCode} pass-through values
|
|
412
|
+
* as {@link gamePickSubmitSelection} — see that method's TSDoc for the
|
|
413
|
+
* `40001` / `40003` / `40004` / `40007` / `40009` / `40011` / `40012`
|
|
414
|
+
* semantics.
|
|
415
|
+
*
|
|
416
|
+
* **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
|
|
417
|
+
* returns `errCode: 3` and never double-charges the buy-in.
|
|
418
|
+
*
|
|
419
|
+
* **Side effects**: identical to {@link gamePickSubmitSelection}, with the
|
|
420
|
+
* reported event being `minigame_quiz_prediction` instead of
|
|
421
|
+
* `minigame_matchx_prediction`.
|
|
422
|
+
*
|
|
423
|
+
* **Visitor mode**: not supported.
|
|
424
|
+
*
|
|
425
|
+
* **UI guidance**: see [UI Guide — `gamePickSubmitSelectionQuiz`](../../docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md).
|
|
426
|
+
*
|
|
427
|
+
* @param props.saw_template_id ID of the Quiz game template.
|
|
428
|
+
* @param props.round Round object with `round_id` + `events[]`
|
|
429
|
+
* carrying the user's answer selections.
|
|
430
|
+
* @returns Wrapped {@link GamesApiResponse} with the updated round.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```ts
|
|
434
|
+
* const ar = await window._smartico.api.gamePickGetActiveRound({
|
|
435
|
+
* saw_template_id: 1183,
|
|
436
|
+
* round_id: 37974,
|
|
437
|
+
* });
|
|
438
|
+
* if (ar.errCode !== 0 || !ar.data) {
|
|
439
|
+
* console.error('[smartico] could not fetch round to submit answers — show error');
|
|
440
|
+
* return;
|
|
441
|
+
* }
|
|
442
|
+
*
|
|
443
|
+
* const round = ar.data;
|
|
444
|
+
* round.events = round.events.map(e => ({
|
|
445
|
+
* gp_event_id: e.gp_event_id,
|
|
446
|
+
* user_selection: 'x',
|
|
447
|
+
* }));
|
|
448
|
+
*
|
|
449
|
+
* const r = await window._smartico.api.gamePickSubmitSelectionQuiz({
|
|
450
|
+
* saw_template_id: 1183,
|
|
451
|
+
* round,
|
|
245
452
|
* });
|
|
246
|
-
* ```
|
|
247
453
|
*
|
|
248
|
-
*
|
|
454
|
+
* if (r.errCode === 0) {
|
|
455
|
+
* console.log('[smartico] quiz answers saved — show confirmation');
|
|
456
|
+
* } else if (r.errCode === 3) {
|
|
457
|
+
* console.log('[smartico] nothing changed — silent no-op');
|
|
458
|
+
* } else {
|
|
459
|
+
* console.error('[smartico] quiz submit failed:', r.errMessage);
|
|
460
|
+
* }
|
|
461
|
+
* ```
|
|
249
462
|
*/
|
|
250
463
|
public async gamePickSubmitSelectionQuiz(props: GamePickRequestParams & { round: Partial<GamePickRound> }): Promise<GamesApiResponse<GamePickRound>> {
|
|
251
464
|
if (!props.saw_template_id) {
|
|
@@ -258,35 +471,51 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
258
471
|
}
|
|
259
472
|
|
|
260
473
|
/**
|
|
261
|
-
* Returns the current user's profile
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
474
|
+
* Returns the current user's profile within the Game Pick system — display
|
|
475
|
+
* name, avatar, balances, and last wallet-sync timestamp. The Game Pick server
|
|
476
|
+
* maintains its own user record that mirrors the user's Smartico balances; the
|
|
477
|
+
* mirror is updated at most once per minute, so `last_wallet_sync_time` tells
|
|
478
|
+
* the consumer how stale the balances on the response are.
|
|
479
|
+
*
|
|
480
|
+
* On the user's first call for a given game, the Game Pick server lazily
|
|
481
|
+
* provisions a user record — so this method doubles as a "register the user
|
|
482
|
+
* with this game" call.
|
|
483
|
+
*
|
|
484
|
+
* @remarks
|
|
485
|
+
* **Preconditions**
|
|
486
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
487
|
+
*
|
|
488
|
+
* **Balance freshness**
|
|
489
|
+
* The balances returned here are the cached mirror — at most ~1 minute stale.
|
|
490
|
+
* For an up-to-the-second view of Points / Gems / Diamonds, read from
|
|
491
|
+
* {@link getUserProfile} instead. Use this method's balances only for
|
|
492
|
+
* in-Game-Pick display.
|
|
493
|
+
*
|
|
494
|
+
* **Error codes** (in `errCode`)
|
|
495
|
+
* - `0` — success.
|
|
496
|
+
* - `100002` — template not found.
|
|
497
|
+
* - `100000` — auth hash invalid.
|
|
498
|
+
* - `100004` — generic server error.
|
|
499
|
+
*
|
|
500
|
+
* **Refresh**
|
|
501
|
+
* - No cache. Server-side mirror refreshes at most every 60 s.
|
|
502
|
+
* - No push subscription.
|
|
503
|
+
*
|
|
504
|
+
* **Visitor mode**: not supported.
|
|
505
|
+
*
|
|
506
|
+
* **UI guidance**: see [UI Guide — `gamePickGetUserInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md).
|
|
507
|
+
*
|
|
508
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
509
|
+
* @returns Wrapped {@link GamesApiResponse} of {@link GamePickUserInfo}.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* const r = await window._smartico.api.gamePickGetUserInfo({ saw_template_id: 1083 });
|
|
514
|
+
*
|
|
515
|
+
* if (r.errCode === 0 && r.data) {
|
|
516
|
+
* console.log('[smartico] render Game Pick header — name:', r.data.public_username, '— points:', r.data.ach_points_balance, '— synced:', r.data.last_wallet_sync_time);
|
|
517
|
+
* }
|
|
281
518
|
* ```
|
|
282
|
-
* _smartico.api.gamePickGetUserInfo({
|
|
283
|
-
* saw_template_id: 1083,
|
|
284
|
-
* }).then((result) => {
|
|
285
|
-
* console.log(result.data.public_username, result.data.ach_points_balance);
|
|
286
|
-
* });
|
|
287
|
-
* ```
|
|
288
|
-
*
|
|
289
|
-
* **Visitor mode: not supported**
|
|
290
519
|
*/
|
|
291
520
|
public async gamePickGetUserInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickUserInfo>> {
|
|
292
521
|
if (!props.saw_template_id) {
|
|
@@ -296,38 +525,56 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
296
525
|
}
|
|
297
526
|
|
|
298
527
|
/**
|
|
299
|
-
* Returns the game configuration
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
528
|
+
* Returns the game template configuration plus a metadata listing of every
|
|
529
|
+
* round (without events). Use to power the game's welcome / lobby screen —
|
|
530
|
+
* shows the template name, buy-in cost, the user's remaining attempts, and
|
|
531
|
+
* the full round list.
|
|
532
|
+
*
|
|
533
|
+
* The `allRounds[]` here is a lightweight metadata-only view — to render
|
|
534
|
+
* predictions or leaderboards, call {@link gamePickGetActiveRound} /
|
|
535
|
+
* {@link gamePickGetActiveRounds} / {@link gamePickGetBoard} for the rounds
|
|
536
|
+
* the user actually opens.
|
|
537
|
+
*
|
|
538
|
+
* @remarks
|
|
539
|
+
* **Preconditions**
|
|
540
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
541
|
+
*
|
|
542
|
+
* **Buy-in semantics**
|
|
543
|
+
* The `sawTemplate.saw_buyin_type_id` value determines which currency is
|
|
544
|
+
* deducted on the user's first prediction in any round:
|
|
545
|
+
* - Free — no deduction.
|
|
546
|
+
* - Points — `buyin_cost_points` deducted from the user's points balance.
|
|
547
|
+
* - Gems — deducted from the user's gems balance.
|
|
548
|
+
* - Diamonds — deducted from the user's diamonds balance.
|
|
549
|
+
* - Spins — one spin counted from `spin_count`.
|
|
550
|
+
*
|
|
551
|
+
* **Error codes** (in `errCode`)
|
|
552
|
+
* - `0` — success.
|
|
553
|
+
* - `100002` — template not found.
|
|
554
|
+
* - `100000` — auth hash invalid.
|
|
555
|
+
* - `100004` — generic server error.
|
|
556
|
+
*
|
|
557
|
+
* **Refresh**
|
|
558
|
+
* - No cache.
|
|
559
|
+
* - No push subscription. Re-call after a successful
|
|
560
|
+
* {@link gamePickSubmitSelection} to refresh `spin_count`.
|
|
561
|
+
*
|
|
562
|
+
* **Visitor mode**: not supported.
|
|
563
|
+
*
|
|
564
|
+
* **UI guidance**: see [UI Guide — `gamePickGetGameInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md).
|
|
565
|
+
*
|
|
566
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
567
|
+
* @returns Wrapped {@link GamesApiResponse} of {@link GamePickGameInfo}.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* const r = await window._smartico.api.gamePickGetGameInfo({ saw_template_id: 1189 });
|
|
572
|
+
*
|
|
573
|
+
* if (r.errCode === 0 && r.data) {
|
|
574
|
+
* console.log('[smartico] render Game Pick lobby — title:', r.data.sawTemplate.saw_template_ui_definition.name);
|
|
575
|
+
* console.log('[smartico] rounds available:', r.data.allRounds.length, '— buy-in type:', r.data.sawTemplate.saw_buyin_type_id, 'cost:', r.data.sawTemplate.buyin_cost_points);
|
|
576
|
+
* }
|
|
320
577
|
* ```
|
|
321
|
-
* _smartico.api.gamePickGetGameInfo({
|
|
322
|
-
* saw_template_id: 1189,
|
|
323
|
-
* }).then((result) => {
|
|
324
|
-
* console.log(result.data.sawTemplate.saw_template_ui_definition.name);
|
|
325
|
-
* console.log('Rounds:', result.data.allRounds.length);
|
|
326
|
-
* console.log('Buy-in type:', result.data.sawTemplate.saw_buyin_type_id);
|
|
327
|
-
* });
|
|
328
|
-
* ```
|
|
329
|
-
*
|
|
330
|
-
* **Visitor mode: not supported**
|
|
331
578
|
*/
|
|
332
579
|
public async gamePickGetGameInfo(props: GamePickRequestParams): Promise<GamesApiResponse<GamePickGameInfo>> {
|
|
333
580
|
if (!props.saw_template_id) {
|
|
@@ -337,35 +584,73 @@ export class WSAPIGamePick extends WSAPIAvatars {
|
|
|
337
584
|
}
|
|
338
585
|
|
|
339
586
|
/**
|
|
340
|
-
* Returns round
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
* -
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* })
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
587
|
+
* Returns a round with another player's predictions instead of the current
|
|
588
|
+
* user's. The target player is identified by `int_user_id` (the Game Pick
|
|
589
|
+
* system's internal user ID, obtained from {@link gamePickGetBoard}'s
|
|
590
|
+
* `users[].int_user_id`).
|
|
591
|
+
*
|
|
592
|
+
* Use to power "view this player's picks" affordances opened from leaderboard
|
|
593
|
+
* rows — community / social inspection of how a top-ranked user predicted.
|
|
594
|
+
*
|
|
595
|
+
* @remarks
|
|
596
|
+
* **Preconditions**
|
|
597
|
+
* - User must be authenticated. Visitor mode not supported.
|
|
598
|
+
* - `saw_template_id`, `round_id`, and `int_user_id` are all mandatory — SDK
|
|
599
|
+
* throws synchronously if any is missing.
|
|
600
|
+
* - `int_user_id` must come from a leaderboard fetch in the same game
|
|
601
|
+
* template; it is stable within a template but not portable across
|
|
602
|
+
* templates.
|
|
603
|
+
*
|
|
604
|
+
* **Shape vs `gamePickGetActiveRound`**
|
|
605
|
+
* Same {@link GamePickRound} structure, but `user_selection` /
|
|
606
|
+
* `team1_user_selection` / `team2_user_selection` reflect the TARGET user's
|
|
607
|
+
* predictions instead of the caller's. Each event still carries its own
|
|
608
|
+
* `resolution_type_id` (see {@link GamePickResolutionType}) so the UI can
|
|
609
|
+
* render result badges per pick.
|
|
610
|
+
*
|
|
611
|
+
* **Error codes** (in `errCode`)
|
|
612
|
+
* - `0` — success.
|
|
613
|
+
* - `4` — round / event / user not found.
|
|
614
|
+
* - `100002` — template not found.
|
|
615
|
+
* - `100000` — auth hash invalid.
|
|
616
|
+
* - `100004` — generic server error.
|
|
617
|
+
*
|
|
618
|
+
* **Refresh**
|
|
619
|
+
* - No cache. Re-call when opening a different leaderboard row's
|
|
620
|
+
* "view picks" modal.
|
|
621
|
+
* - No push subscription.
|
|
622
|
+
*
|
|
623
|
+
* **Visitor mode**: not supported.
|
|
624
|
+
*
|
|
625
|
+
* **UI guidance**: see [UI Guide — `gamePickGetRoundInfoForUser`](../../docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md).
|
|
626
|
+
*
|
|
627
|
+
* @param props.saw_template_id ID of the MatchX or Quiz game template.
|
|
628
|
+
* @param props.round_id ID of the round to inspect.
|
|
629
|
+
* @param props.int_user_id Internal user ID from
|
|
630
|
+
* `gamePickGetBoard.users[].int_user_id`.
|
|
631
|
+
* @returns Wrapped {@link GamesApiResponse} with the target user's
|
|
632
|
+
* {@link GamePickRound}.
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```ts
|
|
636
|
+
* const board = await window._smartico.api.gamePickGetBoard({
|
|
637
|
+
* saw_template_id: 1083, round_id: 31652,
|
|
365
638
|
* });
|
|
366
|
-
*
|
|
639
|
+
* const topPlayer = board.data?.users?.[0];
|
|
640
|
+
* if (!topPlayer) return;
|
|
367
641
|
*
|
|
368
|
-
*
|
|
642
|
+
* const r = await window._smartico.api.gamePickGetRoundInfoForUser({
|
|
643
|
+
* saw_template_id: 1083,
|
|
644
|
+
* round_id: 31652,
|
|
645
|
+
* int_user_id: topPlayer.int_user_id,
|
|
646
|
+
* });
|
|
647
|
+
*
|
|
648
|
+
* if (r.errCode === 0 && r.data) {
|
|
649
|
+
* for (const ev of r.data.events) {
|
|
650
|
+
* console.log('[smartico] render row —', ev.event_meta.team1_name, 'vs', ev.event_meta.team2_name, '— picked:', ev.user_selection, '— resolution:', ev.resolution_type_id);
|
|
651
|
+
* }
|
|
652
|
+
* }
|
|
653
|
+
* ```
|
|
369
654
|
*/
|
|
370
655
|
public async gamePickGetRoundInfoForUser(props: GamePickRoundRequestParams & { int_user_id: number }): Promise<GamesApiResponse<GamePickRound>> {
|
|
371
656
|
if (!props.saw_template_id) {
|