@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
|
@@ -5,8 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
> **gamePickGetActiveRounds**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
7
7
|
|
|
8
|
-
Returns
|
|
9
|
-
|
|
8
|
+
Returns every open round for a MatchX or Quiz game template, with the full
|
|
9
|
+
event list (matches / questions) and the current user's selections per event.
|
|
10
|
+
|
|
11
|
+
Use to power the rounds-lobby screen — typically a list of round cards a user
|
|
12
|
+
can tap into to make predictions. For a single round, use
|
|
13
|
+
[gamePickGetActiveRound](#gamepickgetactiveround) (lighter payload when only one round is shown).
|
|
10
14
|
|
|
11
15
|
#### Parameters
|
|
12
16
|
|
|
@@ -18,14 +22,72 @@ Each round includes its events (matches/questions) along with the current user's
|
|
|
18
22
|
|
|
19
23
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
20
24
|
|
|
25
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array.
|
|
26
|
+
|
|
27
|
+
#### Remarks
|
|
28
|
+
|
|
29
|
+
**Preconditions**
|
|
30
|
+
- User must be authenticated.
|
|
31
|
+
- `saw_template_id` must reference a MatchX or Quiz game template. The SDK
|
|
32
|
+
throws synchronously if it's missing.
|
|
33
|
+
|
|
34
|
+
**Transport**
|
|
35
|
+
Game Pick methods are HTTP REST calls to a separate Game Pick games server
|
|
36
|
+
(not the main WebSocket). One consequence: there is no SDK cache and no push
|
|
37
|
+
subscription — every call is a fresh server roundtrip.
|
|
38
|
+
|
|
39
|
+
**Round status**
|
|
40
|
+
Each round's `round_status_id` is a [GPRoundStatus](../enumerations/GPRoundStatus.md) value. Rounds with
|
|
41
|
+
status `NoEventsDefined` (1) are filtered out server-side and never appear
|
|
42
|
+
here. Other values: `Other` (-1, normally open), `NoMoreBetsAllowed` (2),
|
|
43
|
+
`AllEventsResolved_ButNotRound` (3), `RoundResolved` (4 — appears here only
|
|
44
|
+
briefly during transition; use [gamePickGetHistory](#gamepickgethistory) for resolved rounds).
|
|
45
|
+
|
|
46
|
+
**Error codes** (in `errCode`)
|
|
47
|
+
- `0` — success.
|
|
48
|
+
- `100002` — template not found (the `saw_template_id` doesn't reference a
|
|
49
|
+
MatchX/Quiz game).
|
|
50
|
+
- `100003` — no open rounds available for this template right now.
|
|
51
|
+
- `100000` — auth hash invalid; SDK session needs re-initialization.
|
|
52
|
+
- `100004` — generic server error.
|
|
53
|
+
|
|
54
|
+
**Refresh**
|
|
55
|
+
- No cache; every call is live.
|
|
56
|
+
- No push subscription. Poll while the user is on the screen if you need
|
|
57
|
+
live round-status changes (typically every 30–60 s is enough).
|
|
58
|
+
|
|
59
|
+
**Visitor mode**: not supported. The SDK throws synchronously on visitor
|
|
60
|
+
sessions.
|
|
61
|
+
|
|
62
|
+
**UI guidance**: see [UI Guide — `gamePickGetActiveRounds`](../_media/UIGuide_gamePickGetActiveRounds.md).
|
|
63
|
+
|
|
64
|
+
#### Example
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const r = await window._smartico.api.gamePickGetActiveRounds({ saw_template_id: 1083 });
|
|
68
|
+
|
|
69
|
+
if (r.errCode !== 0) {
|
|
70
|
+
console.error('[smartico] active rounds fetch failed — show empty rounds lobby:', r.errMessage);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for (const round of r.data ?? []) {
|
|
75
|
+
console.log('[smartico] render a round card:', round.round_name, '— events:', round.events.length, 'user has placed bet:', round.user_placed_bet);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
21
79
|
***
|
|
22
80
|
|
|
23
81
|
### gamePickGetActiveRound()
|
|
24
82
|
|
|
25
83
|
> **gamePickGetActiveRound**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
26
84
|
|
|
27
|
-
Returns a single
|
|
28
|
-
|
|
85
|
+
Returns a single round (events, user selections, scoring rules) for a
|
|
86
|
+
MatchX or Quiz game. Use to power the round-detail / prediction-input
|
|
87
|
+
screen the user lands on after picking a round from the lobby.
|
|
88
|
+
|
|
89
|
+
Same shape as one entry of [gamePickGetActiveRounds](#gamepickgetactiverounds); cheaper when the
|
|
90
|
+
UI only shows one round at a time.
|
|
29
91
|
|
|
30
92
|
#### Parameters
|
|
31
93
|
|
|
@@ -37,14 +99,62 @@ The round includes full event details with the current user's selections.
|
|
|
37
99
|
|
|
38
100
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
39
101
|
|
|
102
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of a single [GamePickRound](../interfaces/GamePickRound.md).
|
|
103
|
+
|
|
104
|
+
#### Remarks
|
|
105
|
+
|
|
106
|
+
**Preconditions**
|
|
107
|
+
- User must be authenticated. Visitor mode not supported.
|
|
108
|
+
- `saw_template_id` and `round_id` are mandatory — the SDK throws if either
|
|
109
|
+
is missing.
|
|
110
|
+
|
|
111
|
+
**Error codes** (in `errCode`)
|
|
112
|
+
- `0` — success.
|
|
113
|
+
- `4` — round / event not found (e.g. round resolved after the last
|
|
114
|
+
`gamePickGetActiveRounds` poll); non-fatal — retry after a fresh active-
|
|
115
|
+
rounds fetch.
|
|
116
|
+
- `100002` — template not found.
|
|
117
|
+
- `100000` — auth hash invalid.
|
|
118
|
+
- `100004` — generic server error.
|
|
119
|
+
|
|
120
|
+
**Refresh**
|
|
121
|
+
- No cache; every call is live.
|
|
122
|
+
- Re-call after [gamePickSubmitSelection](#gamepicksubmitselection) or
|
|
123
|
+
[gamePickSubmitSelectionQuiz](#gamepicksubmitselectionquiz) to surface the persisted predictions.
|
|
124
|
+
- Poll while the user is on the prediction screen if event resolution
|
|
125
|
+
updates are needed (typically every 30–60 s).
|
|
126
|
+
|
|
127
|
+
**Visitor mode**: not supported.
|
|
128
|
+
|
|
129
|
+
**UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../_media/UIGuide_gamePickGetActiveRound.md).
|
|
130
|
+
|
|
131
|
+
#### Example
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const r = await window._smartico.api.gamePickGetActiveRound({
|
|
135
|
+
saw_template_id: 1083,
|
|
136
|
+
round_id: 31652,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (r.errCode === 0 && r.data) {
|
|
140
|
+
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);
|
|
141
|
+
} else {
|
|
142
|
+
console.error('[smartico] round fetch failed — bounce back to the lobby and refresh:', r.errMessage);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
40
146
|
***
|
|
41
147
|
|
|
42
148
|
### gamePickGetHistory()
|
|
43
149
|
|
|
44
150
|
> **gamePickGetHistory**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
45
151
|
|
|
46
|
-
Returns the
|
|
47
|
-
Each round
|
|
152
|
+
Returns the full round history (active + resolved) for a MatchX or Quiz game
|
|
153
|
+
template, newest-first. Each round carries the user's predictions plus the
|
|
154
|
+
server-resolved outcome on each event.
|
|
155
|
+
|
|
156
|
+
Use to power a "Past predictions" / history tab. For just the open rounds,
|
|
157
|
+
use [gamePickGetActiveRounds](#gamepickgetactiverounds) (faster — skips resolved data).
|
|
48
158
|
|
|
49
159
|
#### Parameters
|
|
50
160
|
|
|
@@ -56,14 +166,56 @@ Each round contains full event details with results and the current user's predi
|
|
|
56
166
|
|
|
57
167
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
|
|
58
168
|
|
|
169
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array,
|
|
170
|
+
newest-first.
|
|
171
|
+
|
|
172
|
+
#### Remarks
|
|
173
|
+
|
|
174
|
+
**Preconditions**
|
|
175
|
+
- User must be authenticated. Visitor mode not supported.
|
|
176
|
+
|
|
177
|
+
**Sort order**
|
|
178
|
+
Server returns rounds newest-first. No client-side sort needed.
|
|
179
|
+
|
|
180
|
+
**Per-event resolution**
|
|
181
|
+
Each event in the rounds carries `resolution_type_id` — values are from
|
|
182
|
+
[GamePickResolutionType](../enumerations/GamePickResolutionType.md): `None` (0, not yet resolved), `Lost` (2),
|
|
183
|
+
`PartialWin` (3), `FullWin` (4). Use these to render result badges on
|
|
184
|
+
each event row.
|
|
185
|
+
|
|
186
|
+
**Error codes** (in `errCode`)
|
|
187
|
+
- `0` — success.
|
|
188
|
+
- `100002` — template not found.
|
|
189
|
+
- `100000` — auth hash invalid.
|
|
190
|
+
- `100004` — generic server error.
|
|
191
|
+
|
|
192
|
+
**Refresh**
|
|
193
|
+
- No cache.
|
|
194
|
+
- No push subscription. Re-call when the user opens the history tab.
|
|
195
|
+
|
|
196
|
+
**Visitor mode**: not supported.
|
|
197
|
+
|
|
198
|
+
**UI guidance**: see [UI Guide — `gamePickGetHistory`](../_media/UIGuide_gamePickGetHistory.md).
|
|
199
|
+
|
|
200
|
+
#### Example
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
const r = await window._smartico.api.gamePickGetHistory({ saw_template_id: 1083 });
|
|
204
|
+
|
|
205
|
+
for (const round of r.data ?? []) {
|
|
206
|
+
console.log('[smartico] history row —', round.round_name, 'score:', round.user_score, 'resolved:', round.is_resolved);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
59
210
|
***
|
|
60
211
|
|
|
61
212
|
### gamePickGetBoard()
|
|
62
213
|
|
|
63
214
|
> **gamePickGetBoard**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
|
|
64
215
|
|
|
65
|
-
Returns the leaderboard for a
|
|
66
|
-
|
|
216
|
+
Returns the leaderboard for a MatchX or Quiz game round — ranked list of
|
|
217
|
+
players plus the current user's entry (`my_user`). Pass `round_id: -1` for
|
|
218
|
+
the season / overall leaderboard across every round in the template.
|
|
67
219
|
|
|
68
220
|
#### Parameters
|
|
69
221
|
|
|
@@ -75,17 +227,77 @@ Use `round_id = -1` (AllRoundsGameBoardID) to get the season/overall leaderboard
|
|
|
75
227
|
|
|
76
228
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
|
|
77
229
|
|
|
230
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRoundBoard](../interfaces/GamePickRoundBoard.md).
|
|
231
|
+
|
|
232
|
+
#### Remarks
|
|
233
|
+
|
|
234
|
+
**Preconditions**
|
|
235
|
+
- User must be authenticated. Visitor mode not supported.
|
|
236
|
+
|
|
237
|
+
**`round_id` semantics**
|
|
238
|
+
- Positive `round_id` — per-round leaderboard scoped to that round's events.
|
|
239
|
+
- `-1` — season / overall leaderboard aggregating scores across every round
|
|
240
|
+
of the template.
|
|
241
|
+
|
|
242
|
+
**`my_user`**
|
|
243
|
+
The current user's entry is returned separately from the `users[]` array
|
|
244
|
+
— `my_user` may be `null` if the user has never made a prediction on this
|
|
245
|
+
round / template. Use it to render the user's rank in a sticky footer or
|
|
246
|
+
"you are here" highlight regardless of pagination.
|
|
247
|
+
|
|
248
|
+
**Username masking**
|
|
249
|
+
`public_username` on other players may be masked / anonymized by operator
|
|
250
|
+
label settings. Always pair with `avatar_url` so the user can recognize
|
|
251
|
+
themselves in the ranking by avatar even when usernames are hidden.
|
|
252
|
+
|
|
253
|
+
**Error codes** (in `errCode`)
|
|
254
|
+
- `0` — success.
|
|
255
|
+
- `100002` — template not found.
|
|
256
|
+
- `100000` — auth hash invalid.
|
|
257
|
+
- `100004` — generic server error.
|
|
258
|
+
|
|
259
|
+
**Refresh**
|
|
260
|
+
- No cache.
|
|
261
|
+
- No push subscription. Poll while the leaderboard is visible
|
|
262
|
+
(every 30–60 s) if you want live rank updates after match
|
|
263
|
+
resolution.
|
|
264
|
+
|
|
265
|
+
**Visitor mode**: not supported.
|
|
266
|
+
|
|
267
|
+
**UI guidance**: see [UI Guide — `gamePickGetBoard`](../_media/UIGuide_gamePickGetBoard.md).
|
|
268
|
+
|
|
269
|
+
#### Example
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
const r = await window._smartico.api.gamePickGetBoard({
|
|
273
|
+
saw_template_id: 1083,
|
|
274
|
+
round_id: -1, // season leaderboard
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
if (r.errCode === 0 && r.data) {
|
|
278
|
+
console.log('[smartico] render leaderboard rows for top', r.data.users.length, 'players');
|
|
279
|
+
if (r.data.my_user) {
|
|
280
|
+
console.log('[smartico] pin "you are rank #' + r.data.my_user.gp_position + '" footer to bottom');
|
|
281
|
+
} else {
|
|
282
|
+
console.log('[smartico] user not ranked — render "Play a round to join the leaderboard" CTA');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
78
287
|
***
|
|
79
288
|
|
|
80
289
|
### gamePickSubmitSelection()
|
|
81
290
|
|
|
82
291
|
> **gamePickSubmitSelection**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
83
292
|
|
|
84
|
-
Submits score predictions for a round in a MatchX game.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
293
|
+
Submits all score predictions for a round in a MatchX game in one shot.
|
|
294
|
+
Each event in the round must carry `team1_user_selection` and
|
|
295
|
+
`team2_user_selection` (the predicted scores).
|
|
296
|
+
|
|
297
|
+
On the user's FIRST submit for a round, the server charges one buy-in (one
|
|
298
|
+
"spin" / one currency deduction based on the template's `saw_buyin_type_id`).
|
|
299
|
+
Subsequent edits within the same round are free and only persist changed
|
|
300
|
+
selections.
|
|
89
301
|
|
|
90
302
|
#### Parameters
|
|
91
303
|
|
|
@@ -97,17 +309,112 @@ Predictions can be edited until each match starts (if `allow_edit_answers` is en
|
|
|
97
309
|
|
|
98
310
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
99
311
|
|
|
312
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
|
|
313
|
+
|
|
314
|
+
#### Remarks
|
|
315
|
+
|
|
316
|
+
**Preconditions**
|
|
317
|
+
- User must be authenticated. Visitor mode not supported.
|
|
318
|
+
- `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
|
|
319
|
+
either is missing.
|
|
320
|
+
- Each event passed must include `gp_event_id` and the two
|
|
321
|
+
`team{1,2}_user_selection` fields. Missing events default to "no change".
|
|
322
|
+
|
|
323
|
+
**Error codes** (in `errCode`)
|
|
324
|
+
- `0` — success; the response `data` is the updated round with
|
|
325
|
+
`user_placed_bet === true` and `has_not_submitted_changes === false`.
|
|
326
|
+
- `3` (`NoBetsUpdatedOnSubmit`) — submit produced no changes, OR every event
|
|
327
|
+
is past its `last_bet_date` deadline. The buy-in is NOT consumed; the
|
|
328
|
+
current round is still returned in `data`.
|
|
329
|
+
- `4` — round / event not found; refresh state and retry.
|
|
330
|
+
- `100002` — template not found.
|
|
331
|
+
- `100000` — auth hash invalid.
|
|
332
|
+
- `100004` — generic server error.
|
|
333
|
+
|
|
334
|
+
Buy-in failures pass through the [SAWSpinErrorCode](../enumerations/SAWSpinErrorCode.md) values on first
|
|
335
|
+
submit:
|
|
336
|
+
- `40001` — no spins left (when `saw_buyin_type_id` is Spins).
|
|
337
|
+
- `40003` — insufficient points.
|
|
338
|
+
- `40004` — global max-spins cap hit.
|
|
339
|
+
- `40007` — template outside its active date window.
|
|
340
|
+
- `40009` — user excluded by segment rule.
|
|
341
|
+
- `40011` — insufficient gems.
|
|
342
|
+
- `40012` — insufficient diamonds.
|
|
343
|
+
|
|
344
|
+
**Idempotency**
|
|
345
|
+
Re-submitting identical selections returns `errCode: 3` (no changes); the
|
|
346
|
+
buy-in is consumed exactly once per round-per-user. Re-submitting after
|
|
347
|
+
`last_bet_date` also returns `errCode: 3` without consuming the buy-in.
|
|
348
|
+
|
|
349
|
+
**Side effects**
|
|
350
|
+
- First successful submit deducts the buy-in (Points / Gems / Diamonds /
|
|
351
|
+
one Spin) per `saw_buyin_type_id`.
|
|
352
|
+
- Reports a `minigame_matchx_prediction` event to the operator's event log.
|
|
353
|
+
- Updates the round's participant counter (`users_cnt`) and per-event
|
|
354
|
+
counters (`num_users`).
|
|
355
|
+
- Score is awarded after the operator resolves the round
|
|
356
|
+
([GPRoundStatus](../enumerations/GPRoundStatus.md) = `RoundResolved`).
|
|
357
|
+
|
|
358
|
+
**Visitor mode**: not supported.
|
|
359
|
+
|
|
360
|
+
**UI guidance**: see [UI Guide — `gamePickSubmitSelection`](../_media/UIGuide_gamePickSubmitSelection.md).
|
|
361
|
+
|
|
362
|
+
#### Example
|
|
363
|
+
|
|
364
|
+
```ts
|
|
365
|
+
const ar = await window._smartico.api.gamePickGetActiveRound({
|
|
366
|
+
saw_template_id: 1190,
|
|
367
|
+
round_id: 38665,
|
|
368
|
+
});
|
|
369
|
+
if (ar.errCode !== 0 || !ar.data) {
|
|
370
|
+
console.error('[smartico] could not fetch round to submit — show error and bounce back');
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const round = ar.data;
|
|
375
|
+
round.events = round.events.map(e => ({
|
|
376
|
+
gp_event_id: e.gp_event_id,
|
|
377
|
+
team1_user_selection: 1,
|
|
378
|
+
team2_user_selection: 0,
|
|
379
|
+
}));
|
|
380
|
+
|
|
381
|
+
const r = await window._smartico.api.gamePickSubmitSelection({
|
|
382
|
+
saw_template_id: 1190,
|
|
383
|
+
round,
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
switch (r.errCode) {
|
|
387
|
+
case 0:
|
|
388
|
+
console.log('[smartico] predictions saved — show confirmation, refresh leaderboard');
|
|
389
|
+
break;
|
|
390
|
+
case 3:
|
|
391
|
+
console.log('[smartico] nothing changed (or all events closed) — silent no-op');
|
|
392
|
+
break;
|
|
393
|
+
case 40001:
|
|
394
|
+
case 40003:
|
|
395
|
+
case 40011:
|
|
396
|
+
case 40012:
|
|
397
|
+
console.error('[smartico] insufficient balance / spins — show top-up CTA:', r.errMessage);
|
|
398
|
+
break;
|
|
399
|
+
default:
|
|
400
|
+
console.error('[smartico] submit failed — show generic error toast:', r.errMessage);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
100
404
|
***
|
|
101
405
|
|
|
102
406
|
### gamePickSubmitSelectionQuiz()
|
|
103
407
|
|
|
104
408
|
> **gamePickSubmitSelectionQuiz**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
105
409
|
|
|
106
|
-
Submits answers for a round in
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
410
|
+
Submits all quiz answers for a round in one shot. Each event in the round
|
|
411
|
+
must carry `user_selection` (the answer value — typically `"1"` / `"2"` /
|
|
412
|
+
`"x"` for 1×2 markets, `"yes"` / `"no"` for binary markets, or any
|
|
413
|
+
operator-defined string for custom markets).
|
|
414
|
+
|
|
415
|
+
Same first-submit buy-in behavior as [gamePickSubmitSelection](#gamepicksubmitselection) — one
|
|
416
|
+
buy-in is charged on the first successful submit; subsequent edits within
|
|
417
|
+
the same round are free.
|
|
111
418
|
|
|
112
419
|
#### Parameters
|
|
113
420
|
|
|
@@ -119,15 +426,89 @@ Answers can be edited until each match starts (if `allow_edit_answers` is enable
|
|
|
119
426
|
|
|
120
427
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
121
428
|
|
|
429
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
|
|
430
|
+
|
|
431
|
+
#### Remarks
|
|
432
|
+
|
|
433
|
+
**Preconditions**
|
|
434
|
+
- User must be authenticated. Visitor mode not supported.
|
|
435
|
+
- `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
|
|
436
|
+
either is missing.
|
|
437
|
+
- Each event must include `gp_event_id` and `user_selection`. Missing
|
|
438
|
+
events default to "no change".
|
|
439
|
+
|
|
440
|
+
**Error codes** (in `errCode`)
|
|
441
|
+
- `0` — success.
|
|
442
|
+
- `3` (`NoBetsUpdatedOnSubmit`) — no changes, OR every event past
|
|
443
|
+
`last_bet_date`. Buy-in NOT consumed; current round returned in `data`.
|
|
444
|
+
- `4` — round / event not found.
|
|
445
|
+
- `100002` — template not found.
|
|
446
|
+
- `100000` — auth hash invalid.
|
|
447
|
+
- `100004` — generic server error.
|
|
448
|
+
|
|
449
|
+
Buy-in failures use the same [SAWSpinErrorCode](../enumerations/SAWSpinErrorCode.md) pass-through values
|
|
450
|
+
as [gamePickSubmitSelection](#gamepicksubmitselection) — see that method's TSDoc for the
|
|
451
|
+
`40001` / `40003` / `40004` / `40007` / `40009` / `40011` / `40012`
|
|
452
|
+
semantics.
|
|
453
|
+
|
|
454
|
+
**Idempotency**: identical to [gamePickSubmitSelection](#gamepicksubmitselection) — re-submit
|
|
455
|
+
returns `errCode: 3` and never double-charges the buy-in.
|
|
456
|
+
|
|
457
|
+
**Side effects**: identical to [gamePickSubmitSelection](#gamepicksubmitselection), with the
|
|
458
|
+
reported event being `minigame_quiz_prediction` instead of
|
|
459
|
+
`minigame_matchx_prediction`.
|
|
460
|
+
|
|
461
|
+
**Visitor mode**: not supported.
|
|
462
|
+
|
|
463
|
+
**UI guidance**: see [UI Guide — `gamePickSubmitSelectionQuiz`](../_media/UIGuide_gamePickSubmitSelectionQuiz.md).
|
|
464
|
+
|
|
465
|
+
#### Example
|
|
466
|
+
|
|
467
|
+
```ts
|
|
468
|
+
const ar = await window._smartico.api.gamePickGetActiveRound({
|
|
469
|
+
saw_template_id: 1183,
|
|
470
|
+
round_id: 37974,
|
|
471
|
+
});
|
|
472
|
+
if (ar.errCode !== 0 || !ar.data) {
|
|
473
|
+
console.error('[smartico] could not fetch round to submit answers — show error');
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const round = ar.data;
|
|
478
|
+
round.events = round.events.map(e => ({
|
|
479
|
+
gp_event_id: e.gp_event_id,
|
|
480
|
+
user_selection: 'x',
|
|
481
|
+
}));
|
|
482
|
+
|
|
483
|
+
const r = await window._smartico.api.gamePickSubmitSelectionQuiz({
|
|
484
|
+
saw_template_id: 1183,
|
|
485
|
+
round,
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
if (r.errCode === 0) {
|
|
489
|
+
console.log('[smartico] quiz answers saved — show confirmation');
|
|
490
|
+
} else if (r.errCode === 3) {
|
|
491
|
+
console.log('[smartico] nothing changed — silent no-op');
|
|
492
|
+
} else {
|
|
493
|
+
console.error('[smartico] quiz submit failed:', r.errMessage);
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
122
497
|
***
|
|
123
498
|
|
|
124
499
|
### gamePickGetUserInfo()
|
|
125
500
|
|
|
126
501
|
> **gamePickGetUserInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
|
|
127
502
|
|
|
128
|
-
Returns the current user's profile
|
|
129
|
-
|
|
130
|
-
|
|
503
|
+
Returns the current user's profile within the Game Pick system — display
|
|
504
|
+
name, avatar, balances, and last wallet-sync timestamp. The Game Pick server
|
|
505
|
+
maintains its own user record that mirrors the user's Smartico balances; the
|
|
506
|
+
mirror is updated at most once per minute, so `last_wallet_sync_time` tells
|
|
507
|
+
the consumer how stale the balances on the response are.
|
|
508
|
+
|
|
509
|
+
On the user's first call for a given game, the Game Pick server lazily
|
|
510
|
+
provisions a user record — so this method doubles as a "register the user
|
|
511
|
+
with this game" call.
|
|
131
512
|
|
|
132
513
|
#### Parameters
|
|
133
514
|
|
|
@@ -139,14 +520,58 @@ If the user doesn't exist in the games DB yet, it will be created automatically
|
|
|
139
520
|
|
|
140
521
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
|
|
141
522
|
|
|
523
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickUserInfo](../interfaces/GamePickUserInfo.md).
|
|
524
|
+
|
|
525
|
+
#### Remarks
|
|
526
|
+
|
|
527
|
+
**Preconditions**
|
|
528
|
+
- User must be authenticated. Visitor mode not supported.
|
|
529
|
+
|
|
530
|
+
**Balance freshness**
|
|
531
|
+
The balances returned here are the cached mirror — at most ~1 minute stale.
|
|
532
|
+
For an up-to-the-second view of Points / Gems / Diamonds, read from
|
|
533
|
+
[getUserProfile](WSAPIUser.md#getuserprofile) instead. Use this method's balances only for
|
|
534
|
+
in-Game-Pick display.
|
|
535
|
+
|
|
536
|
+
**Error codes** (in `errCode`)
|
|
537
|
+
- `0` — success.
|
|
538
|
+
- `100002` — template not found.
|
|
539
|
+
- `100000` — auth hash invalid.
|
|
540
|
+
- `100004` — generic server error.
|
|
541
|
+
|
|
542
|
+
**Refresh**
|
|
543
|
+
- No cache. Server-side mirror refreshes at most every 60 s.
|
|
544
|
+
- No push subscription.
|
|
545
|
+
|
|
546
|
+
**Visitor mode**: not supported.
|
|
547
|
+
|
|
548
|
+
**UI guidance**: see [UI Guide — `gamePickGetUserInfo`](../_media/UIGuide_gamePickGetUserInfo.md).
|
|
549
|
+
|
|
550
|
+
#### Example
|
|
551
|
+
|
|
552
|
+
```ts
|
|
553
|
+
const r = await window._smartico.api.gamePickGetUserInfo({ saw_template_id: 1083 });
|
|
554
|
+
|
|
555
|
+
if (r.errCode === 0 && r.data) {
|
|
556
|
+
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);
|
|
557
|
+
}
|
|
558
|
+
```
|
|
559
|
+
|
|
142
560
|
***
|
|
143
561
|
|
|
144
562
|
### gamePickGetGameInfo()
|
|
145
563
|
|
|
146
564
|
> **gamePickGetGameInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
|
|
147
565
|
|
|
148
|
-
Returns the game configuration
|
|
149
|
-
|
|
566
|
+
Returns the game template configuration plus a metadata listing of every
|
|
567
|
+
round (without events). Use to power the game's welcome / lobby screen —
|
|
568
|
+
shows the template name, buy-in cost, the user's remaining attempts, and
|
|
569
|
+
the full round list.
|
|
570
|
+
|
|
571
|
+
The `allRounds[]` here is a lightweight metadata-only view — to render
|
|
572
|
+
predictions or leaderboards, call [gamePickGetActiveRound](#gamepickgetactiveround) /
|
|
573
|
+
[gamePickGetActiveRounds](#gamepickgetactiverounds) / [gamePickGetBoard](#gamepickgetboard) for the rounds
|
|
574
|
+
the user actually opens.
|
|
150
575
|
|
|
151
576
|
#### Parameters
|
|
152
577
|
|
|
@@ -158,15 +583,61 @@ Includes the SAW template definition, label settings, and round metadata (withou
|
|
|
158
583
|
|
|
159
584
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
|
|
160
585
|
|
|
586
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickGameInfo](../interfaces/GamePickGameInfo.md).
|
|
587
|
+
|
|
588
|
+
#### Remarks
|
|
589
|
+
|
|
590
|
+
**Preconditions**
|
|
591
|
+
- User must be authenticated. Visitor mode not supported.
|
|
592
|
+
|
|
593
|
+
**Buy-in semantics**
|
|
594
|
+
The `sawTemplate.saw_buyin_type_id` value determines which currency is
|
|
595
|
+
deducted on the user's first prediction in any round:
|
|
596
|
+
- Free — no deduction.
|
|
597
|
+
- Points — `buyin_cost_points` deducted from the user's points balance.
|
|
598
|
+
- Gems — deducted from the user's gems balance.
|
|
599
|
+
- Diamonds — deducted from the user's diamonds balance.
|
|
600
|
+
- Spins — one spin counted from `spin_count`.
|
|
601
|
+
|
|
602
|
+
**Error codes** (in `errCode`)
|
|
603
|
+
- `0` — success.
|
|
604
|
+
- `100002` — template not found.
|
|
605
|
+
- `100000` — auth hash invalid.
|
|
606
|
+
- `100004` — generic server error.
|
|
607
|
+
|
|
608
|
+
**Refresh**
|
|
609
|
+
- No cache.
|
|
610
|
+
- No push subscription. Re-call after a successful
|
|
611
|
+
[gamePickSubmitSelection](#gamepicksubmitselection) to refresh `spin_count`.
|
|
612
|
+
|
|
613
|
+
**Visitor mode**: not supported.
|
|
614
|
+
|
|
615
|
+
**UI guidance**: see [UI Guide — `gamePickGetGameInfo`](../_media/UIGuide_gamePickGetGameInfo.md).
|
|
616
|
+
|
|
617
|
+
#### Example
|
|
618
|
+
|
|
619
|
+
```ts
|
|
620
|
+
const r = await window._smartico.api.gamePickGetGameInfo({ saw_template_id: 1189 });
|
|
621
|
+
|
|
622
|
+
if (r.errCode === 0 && r.data) {
|
|
623
|
+
console.log('[smartico] render Game Pick lobby — title:', r.data.sawTemplate.saw_template_ui_definition.name);
|
|
624
|
+
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);
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
161
628
|
***
|
|
162
629
|
|
|
163
630
|
### gamePickGetRoundInfoForUser()
|
|
164
631
|
|
|
165
632
|
> **gamePickGetRoundInfoForUser**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
166
633
|
|
|
167
|
-
Returns round
|
|
168
|
-
|
|
169
|
-
|
|
634
|
+
Returns a round with another player's predictions instead of the current
|
|
635
|
+
user's. The target player is identified by `int_user_id` (the Game Pick
|
|
636
|
+
system's internal user ID, obtained from [gamePickGetBoard](#gamepickgetboard)'s
|
|
637
|
+
`users[].int_user_id`).
|
|
638
|
+
|
|
639
|
+
Use to power "view this player's picks" affordances opened from leaderboard
|
|
640
|
+
rows — community / social inspection of how a top-ranked user predicted.
|
|
170
641
|
|
|
171
642
|
#### Parameters
|
|
172
643
|
|
|
@@ -178,4 +649,62 @@ The `int_user_id` can be obtained from the `gamePickGetBoard` response (`users[]
|
|
|
178
649
|
|
|
179
650
|
`Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
|
|
180
651
|
|
|
652
|
+
Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the target user's
|
|
653
|
+
[GamePickRound](../interfaces/GamePickRound.md).
|
|
654
|
+
|
|
655
|
+
#### Remarks
|
|
656
|
+
|
|
657
|
+
**Preconditions**
|
|
658
|
+
- User must be authenticated. Visitor mode not supported.
|
|
659
|
+
- `saw_template_id`, `round_id`, and `int_user_id` are all mandatory — SDK
|
|
660
|
+
throws synchronously if any is missing.
|
|
661
|
+
- `int_user_id` must come from a leaderboard fetch in the same game
|
|
662
|
+
template; it is stable within a template but not portable across
|
|
663
|
+
templates.
|
|
664
|
+
|
|
665
|
+
**Shape vs `gamePickGetActiveRound`**
|
|
666
|
+
Same [GamePickRound](../interfaces/GamePickRound.md) structure, but `user_selection` /
|
|
667
|
+
`team1_user_selection` / `team2_user_selection` reflect the TARGET user's
|
|
668
|
+
predictions instead of the caller's. Each event still carries its own
|
|
669
|
+
`resolution_type_id` (see [GamePickResolutionType](../enumerations/GamePickResolutionType.md)) so the UI can
|
|
670
|
+
render result badges per pick.
|
|
671
|
+
|
|
672
|
+
**Error codes** (in `errCode`)
|
|
673
|
+
- `0` — success.
|
|
674
|
+
- `4` — round / event / user not found.
|
|
675
|
+
- `100002` — template not found.
|
|
676
|
+
- `100000` — auth hash invalid.
|
|
677
|
+
- `100004` — generic server error.
|
|
678
|
+
|
|
679
|
+
**Refresh**
|
|
680
|
+
- No cache. Re-call when opening a different leaderboard row's
|
|
681
|
+
"view picks" modal.
|
|
682
|
+
- No push subscription.
|
|
683
|
+
|
|
684
|
+
**Visitor mode**: not supported.
|
|
685
|
+
|
|
686
|
+
**UI guidance**: see [UI Guide — `gamePickGetRoundInfoForUser`](../_media/UIGuide_gamePickGetRoundInfoForUser.md).
|
|
687
|
+
|
|
688
|
+
#### Example
|
|
689
|
+
|
|
690
|
+
```ts
|
|
691
|
+
const board = await window._smartico.api.gamePickGetBoard({
|
|
692
|
+
saw_template_id: 1083, round_id: 31652,
|
|
693
|
+
});
|
|
694
|
+
const topPlayer = board.data?.users?.[0];
|
|
695
|
+
if (!topPlayer) return;
|
|
696
|
+
|
|
697
|
+
const r = await window._smartico.api.gamePickGetRoundInfoForUser({
|
|
698
|
+
saw_template_id: 1083,
|
|
699
|
+
round_id: 31652,
|
|
700
|
+
int_user_id: topPlayer.int_user_id,
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
if (r.errCode === 0 && r.data) {
|
|
704
|
+
for (const ev of r.data.events) {
|
|
705
|
+
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);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
```
|
|
709
|
+
|
|
181
710
|
***
|