@smartico/public-api 0.0.126 → 0.0.128
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/Jackpots/GetJackpotsRequest.d.ts +1 -0
- package/dist/Jackpots/GetJackpotsResponse.d.ts +1 -1
- package/dist/Jackpots/JackpotHtmlTemplate.d.ts +5 -0
- package/dist/Jackpots/JackpotPublicMeta.d.ts +3 -0
- package/dist/Jackpots/index.d.ts +1 -0
- package/dist/NodeCache.d.ts +1 -0
- package/dist/OCache.d.ts +2 -1
- package/dist/SmarticoAPI.d.ts +14 -0
- package/dist/SmarticoLib/index.d.ts +2013 -0
- package/dist/WSAPI/WSAPI.d.ts +13 -0
- package/dist/index.js +288 -126
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +88 -3
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Jackpots/GetJackpotsRequest.ts +1 -0
- package/src/Jackpots/GetJackpotsResponse.ts +1 -1
- package/src/Jackpots/JackpotHtmlTemplate.ts +6 -0
- package/src/Jackpots/JackpotPot.ts +0 -1
- package/src/Jackpots/JackpotPublicMeta.ts +3 -0
- package/src/Jackpots/index.ts +2 -1
- package/src/NodeCache.ts +7 -0
- package/src/OCache.ts +9 -1
- package/src/SmarticoAPI.ts +24 -1
- package/src/SmarticoLib/index.ts +2019 -0
- package/src/WSAPI/WSAPI.ts +88 -4
package/package.json
CHANGED
package/src/Jackpots/index.ts
CHANGED
|
@@ -12,4 +12,5 @@ export * from './JackpotWinPush';
|
|
|
12
12
|
export * from './JackpotsOptinRequest';
|
|
13
13
|
export * from './JackpotsOptinResponse';
|
|
14
14
|
export * from './JackpotsOptoutRequest';
|
|
15
|
-
export * from './JackpotsOptoutResponse';
|
|
15
|
+
export * from './JackpotsOptoutResponse';
|
|
16
|
+
export * from './JackpotHtmlTemplate';
|
package/src/NodeCache.ts
CHANGED
package/src/OCache.ts
CHANGED
|
@@ -53,7 +53,15 @@ export class OCache {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
public static async clear(cacheContext: ECacheContext) {
|
|
56
|
+
public static async clear(cacheContext: ECacheContext, oKey: any) {
|
|
57
|
+
const key = cacheContext.toString() + '_' + JSON.stringify(oKey);
|
|
58
|
+
|
|
59
|
+
if (this.cache[cacheContext]) {
|
|
60
|
+
this.cache[cacheContext].remove(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static async clearContext(cacheContext: ECacheContext) {
|
|
57
65
|
if (this.cache[cacheContext]) {
|
|
58
66
|
this.cache[cacheContext].flushAll();
|
|
59
67
|
}
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { getLeaderBoardTransform } from "./Leaderboard/LeaderBoards";
|
|
|
22
22
|
import { GetAchievementsUserInfoResponse } from "./Core/GetAchievementsUserInfoResponse";
|
|
23
23
|
import { CheckSegmentMatchResponse } from "./Core/CheckSegmentMatchResponse";
|
|
24
24
|
import { CheckSegmentMatchRequest } from "./Core/CheckSegmentMatchRequest";
|
|
25
|
+
import { GetJackpotsPotsRequest, GetJackpotsPotsResponse, GetJackpotsRequest, GetJackpotsResponse, JackpotDetails, JackpotPot, JackpotsOptinRequest, JackpotsOptinResponse, JackpotsOptoutRequest, JackpotsOptoutResponse } from "./Jackpots";
|
|
25
26
|
|
|
26
27
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
27
28
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -282,9 +283,31 @@ class SmarticoAPI {
|
|
|
282
283
|
const results = await this.send<CheckSegmentMatchResponse>(message, ClassId.CHECK_SEGMENT_MATCH_RESPONSE);
|
|
283
284
|
|
|
284
285
|
return results.segments || [];
|
|
285
|
-
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
public async jackpotGet(user_ext_id: string, filter?: { related_game_id?: string, jp_template_id?: number }): Promise<JackpotDetails[]> {
|
|
289
|
+
const message = this.buildMessage<GetJackpotsRequest, GetJackpotsResponse>(user_ext_id, ClassId.JP_GET_JACKPOTS_REQUEST, filter);
|
|
290
|
+
const response = await this.send<GetJackpotsResponse>(message, ClassId.JP_GET_JACKPOTS_RESPONSE);
|
|
291
|
+
|
|
292
|
+
return response?.items || [];
|
|
293
|
+
}
|
|
286
294
|
|
|
295
|
+
public async potGet(user_ext_id: string, filter: { jp_template_ids: number[] }): Promise<JackpotPot[]> {
|
|
296
|
+
const message = this.buildMessage<GetJackpotsPotsRequest, GetJackpotsPotsResponse>(user_ext_id, ClassId.JP_GET_JACKPOTS_REQUEST, filter);
|
|
297
|
+
const response = await this.send<GetJackpotsPotsResponse>(message, ClassId.JP_GET_LATEST_POTS_RESPONSE);
|
|
287
298
|
|
|
299
|
+
return response?.items || [];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
public async jackpotOptIn(user_ext_id: string, payload: { jp_template_id: number }): Promise<JackpotsOptinResponse> {
|
|
303
|
+
const message = this.buildMessage<JackpotsOptinRequest, JackpotsOptinResponse>(user_ext_id, ClassId.JP_OPTIN_REQUEST, payload);
|
|
304
|
+
return await this.send<JackpotsOptinResponse>(message, ClassId.JP_OPTIN_RESPONSE);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
public async jackpotOptOut(user_ext_id: string, payload: { jp_template_id: number }): Promise<JackpotsOptoutResponse> {
|
|
308
|
+
const message = this.buildMessage<JackpotsOptoutRequest, JackpotsOptoutResponse>(user_ext_id, ClassId.JP_OPTOUT_REQUEST, payload);
|
|
309
|
+
return await this.send<JackpotsOptoutResponse>(message, ClassId.JP_OPTOUT_RESPONSE);
|
|
310
|
+
}
|
|
288
311
|
|
|
289
312
|
public async sawGetTemplates(user_ext_id: string, lang?: string, is_visitor_mode: boolean = false): Promise<SAWGetTemplatesResponse> {
|
|
290
313
|
|