@smartico/public-api 0.0.327 → 0.0.328
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/Base/ClassId.d.ts +2 -0
- package/dist/Raffle/RaffleOptinRequest.d.ts +6 -0
- package/dist/Raffle/RaffleOptinResponse.d.ts +3 -0
- package/dist/Raffle/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +6 -1
- package/dist/WSAPI/WSAPI.d.ts +11 -1
- package/dist/WSAPI/WSAPITypes.d.ts +6 -0
- package/dist/index.js +49 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +29 -4
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +23 -0
- package/docs/interfaces/RaffleOptinRequest.md +55 -0
- package/docs/interfaces/RaffleOptinResponse.md +57 -0
- package/docs/interfaces/TRaffleOptinResponse.md +17 -0
- package/docs/interfaces/TStoreItem.md +2 -2
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/Raffle/RaffleOptinRequest.ts +7 -0
- package/src/Raffle/RaffleOptinResponse.ts +5 -0
- package/src/Raffle/index.ts +2 -0
- package/src/SmarticoAPI.ts +12 -1
- package/src/WSAPI/WSAPI.ts +29 -4
- package/src/WSAPI/WSAPITypes.ts +49 -43
package/dist/index.modern.mjs
CHANGED
|
@@ -137,6 +137,8 @@ var ClassId;
|
|
|
137
137
|
ClassId[ClassId["RAF_GET_DRAW_HISTORY_RESPONSE"] = 907] = "RAF_GET_DRAW_HISTORY_RESPONSE";
|
|
138
138
|
ClassId[ClassId["RAF_CLAIM_PRIZE_REQUEST"] = 908] = "RAF_CLAIM_PRIZE_REQUEST";
|
|
139
139
|
ClassId[ClassId["RAF_CLAIM_PRIZE_RESPONSE"] = 909] = "RAF_CLAIM_PRIZE_RESPONSE";
|
|
140
|
+
ClassId[ClassId["RAF_OPTIN_REQUEST"] = 910] = "RAF_OPTIN_REQUEST";
|
|
141
|
+
ClassId[ClassId["RAF_OPTIN_RESPONSE"] = 911] = "RAF_OPTIN_RESPONSE";
|
|
140
142
|
/*
|
|
141
143
|
RAF_GET_TICKETS_REQUEST = 902,
|
|
142
144
|
RAF_GET_TICKETS_RESPONSE = 903,
|
|
@@ -2145,10 +2147,7 @@ class WSAPI {
|
|
|
2145
2147
|
this.reloadMiniGameTemplate();
|
|
2146
2148
|
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
2147
2149
|
});
|
|
2148
|
-
on(ClassId.RAF_CLAIM_PRIZE_RESPONSE, () =>
|
|
2149
|
-
this.updateRaffles();
|
|
2150
|
-
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Raffles);
|
|
2151
|
-
});
|
|
2150
|
+
on(ClassId.RAF_CLAIM_PRIZE_RESPONSE, () => this.updateRaffles());
|
|
2152
2151
|
on(ClassId.GET_INBOX_MESSAGES_RESPONSE, res => {
|
|
2153
2152
|
if (res.unread_count !== undefined && res.unread_count !== null) {
|
|
2154
2153
|
this.updateInboxUnreadCount(res.unread_count);
|
|
@@ -2163,6 +2162,7 @@ class WSAPI {
|
|
|
2163
2162
|
this.notifyPointsHistoryUpdate();
|
|
2164
2163
|
}
|
|
2165
2164
|
});
|
|
2165
|
+
on(ClassId.RAF_OPTIN_RESPONSE, () => this.updateRaffles());
|
|
2166
2166
|
}
|
|
2167
2167
|
}
|
|
2168
2168
|
/** @private */
|
|
@@ -3258,6 +3258,27 @@ class WSAPI {
|
|
|
3258
3258
|
});
|
|
3259
3259
|
return raffleClaimPrizeResponseTransform(res);
|
|
3260
3260
|
}
|
|
3261
|
+
/**
|
|
3262
|
+
* Requests an opt-in for the specified raffle. Returns the err_code.
|
|
3263
|
+
*
|
|
3264
|
+
* **Visitor mode: not supported**
|
|
3265
|
+
*/
|
|
3266
|
+
async requestRaffleOptin(props) {
|
|
3267
|
+
if (!props.raffle_id) {
|
|
3268
|
+
throw new Error('raffle_id is required');
|
|
3269
|
+
}
|
|
3270
|
+
if (!props.draw_id) {
|
|
3271
|
+
throw new Error('draw_id is required');
|
|
3272
|
+
}
|
|
3273
|
+
if (!props.raffle_run_id) {
|
|
3274
|
+
throw new Error('raffle_run_id is required');
|
|
3275
|
+
}
|
|
3276
|
+
const r = await this.api.raffleOptin(null, props);
|
|
3277
|
+
return {
|
|
3278
|
+
err_code: r.errCode,
|
|
3279
|
+
err_message: r.errMsg
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3261
3282
|
}
|
|
3262
3283
|
|
|
3263
3284
|
var AchCustomSectionType;
|
|
@@ -4206,6 +4227,10 @@ class SmarticoAPI {
|
|
|
4206
4227
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
|
|
4207
4228
|
return await this.send(message, ClassId.RAF_CLAIM_PRIZE_RESPONSE);
|
|
4208
4229
|
}
|
|
4230
|
+
async raffleOptin(user_ext_id, props) {
|
|
4231
|
+
const message = this.buildMessage(user_ext_id, ClassId.RAF_OPTIN_REQUEST, props);
|
|
4232
|
+
return await this.send(message, ClassId.RAF_OPTIN_RESPONSE);
|
|
4233
|
+
}
|
|
4209
4234
|
async getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
|
|
4210
4235
|
const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
|
|
4211
4236
|
startTimeSeconds,
|