@smartico/public-api 0.0.73 → 0.0.75

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.
@@ -797,7 +797,6 @@ class WSAPI {
797
797
  this.api = api;
798
798
  const on = this.api.tracker.on;
799
799
  on(ClassId.SAW_SPINS_COUNT_PUSH, data => this.updateOnSpin(data));
800
- on(ClassId.SAW_SPINS_COUNT_PUSH, data => this.updateOnSpin(data));
801
800
  on(ClassId.SAW_SHOW_SPIN_PUSH, () => this.updateOnAddSpin());
802
801
  on(ClassId.SAW_DO_SPIN_RESPONSE, data => on(ClassId.SAW_AKNOWLEDGE_RESPONSE, () => this.updateOnPrizeWin(data)));
803
802
  on(ClassId.MISSION_OPTIN_RESPONSE, () => this.updateMissionsOnOptIn());
@@ -869,6 +868,15 @@ class WSAPI {
869
868
  };
870
869
  return o;
871
870
  }
871
+ /** Requests an opt-in for the specified mission_id. Returns the err_code. */
872
+ async requestMissionOptIn(mission_id) {
873
+ const r = await this.api.missionOptIn(null, mission_id);
874
+ const o = {
875
+ err_code: r.errCode,
876
+ err_message: r.errMsg
877
+ };
878
+ return o;
879
+ }
872
880
  /** Returns all the active instances of tournaments
873
881
  * The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
874
882
  * The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
@@ -1174,6 +1182,13 @@ class SmarticoAPI {
1174
1182
  request_id
1175
1183
  });
1176
1184
  }
1185
+ async missionOptIn(user_ext_id, mission_id) {
1186
+ const message = this.buildMessage(user_ext_id, ClassId.MISSION_OPTIN_REQUEST, {
1187
+ achievementId: mission_id
1188
+ });
1189
+ const res = await this.send(message, ClassId.MISSION_OPTIN_RESPONSE);
1190
+ return res;
1191
+ }
1177
1192
  async inboxGetMessages(user_ext_id, limit = 10, offset = 0) {
1178
1193
  const message = this.buildMessage(user_ext_id, ClassId.GET_INBOX_MESSAGES_REQUEST, {
1179
1194
  limit,