@smartico/public-api 0.0.137 → 0.0.138
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/SmarticoAPI.d.ts +2 -2
- package/dist/Store/GetStoreHistoryRequest.d.ts +1 -1
- package/dist/Store/GetStoreHistoryResponse.d.ts +1 -1
- package/dist/WSAPI/WSAPI.d.ts +15 -9
- package/dist/index.js +45 -27
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +19 -7
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +4 -2
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +8 -4
- package/src/Store/GetStoreHistoryRequest.ts +1 -1
- package/src/Store/GetStoreHistoryResponse.ts +1 -1
- package/src/WSAPI/WSAPI.ts +9 -5
package/docs/classes/WSAPI.md
CHANGED
|
@@ -203,12 +203,14 @@ ___
|
|
|
203
203
|
|
|
204
204
|
▸ **getStorePurchasedItems**(): `Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
205
205
|
|
|
206
|
-
Returns
|
|
206
|
+
Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
207
|
+
The maximum number of items per request is limited to 20.
|
|
208
|
+
You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
|
|
207
209
|
Example usage:
|
|
208
210
|
```
|
|
209
211
|
_smartico.api.getStorePurchasedItems().then((result) => {
|
|
210
212
|
console.log(result);
|
|
211
|
-
});
|
|
213
|
+
});
|
|
212
214
|
```
|
|
213
215
|
|
|
214
216
|
#### Returns
|
package/package.json
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -465,14 +465,18 @@ class SmarticoAPI {
|
|
|
465
465
|
return StoreCategoryTransform((await this.storeGetCategories(user_ext_id)).categories);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
public async storeGetPurchasedItems(user_ext_id: string): Promise<GetStoreHistoryResponse> {
|
|
468
|
+
public async storeGetPurchasedItems(user_ext_id: string, limit: number = 20, offset: number = 0): Promise<GetStoreHistoryResponse> {
|
|
469
|
+
|
|
470
|
+
const message = this.buildMessage<GetStoreHistoryRequest, GetStoreHistoryResponse>(user_ext_id, ClassId.ACH_SHOP_ITEM_HISTORY_REQUEST, {
|
|
471
|
+
limit,
|
|
472
|
+
offset
|
|
473
|
+
});
|
|
469
474
|
|
|
470
|
-
const message = this.buildMessage<any, GetStoreHistoryResponse>(user_ext_id, ClassId.ACH_SHOP_ITEM_HISTORY_REQUEST);
|
|
471
475
|
return await this.send<GetStoreHistoryResponse>(message, ClassId.ACH_SHOP_ITEM_HISTORY_RESPONSE);
|
|
472
476
|
}
|
|
473
477
|
|
|
474
|
-
public async storeGetPurchasedItemsT(user_ext_id: string): Promise<TStoreItem[]> {
|
|
475
|
-
return StoreItemPurchasedTransform((await this.storeGetPurchasedItems(user_ext_id)).items);
|
|
478
|
+
public async storeGetPurchasedItemsT(user_ext_id: string, limit?: number, offset?: number): Promise<TStoreItem[]> {
|
|
479
|
+
return StoreItemPurchasedTransform((await this.storeGetPurchasedItems(user_ext_id, limit, offset)).items);
|
|
476
480
|
}
|
|
477
481
|
|
|
478
482
|
public async missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse> {
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { SmarticoAPI } from "../SmarticoAPI";
|
|
|
6
6
|
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
7
7
|
import { LeaderBoardPeriodType } from "../Leaderboard";
|
|
8
8
|
import { JackpotDetails, JackpotPot, JackpotWinPush, JackpotsOptinResponse, JackpotsOptoutResponse } from "../Jackpots";
|
|
9
|
-
import { AchRelatedGame } from "src/Base/AchRelatedGame";
|
|
10
9
|
|
|
11
10
|
/** @hidden */
|
|
12
11
|
const CACHE_DATA_SEC = 30;
|
|
@@ -51,7 +50,7 @@ export class WSAPI {
|
|
|
51
50
|
on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
|
|
52
51
|
on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
53
52
|
on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
|
|
54
|
-
on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache())
|
|
53
|
+
on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache());
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
/** Returns information about current user
|
|
@@ -189,7 +188,9 @@ export class WSAPI {
|
|
|
189
188
|
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
|
|
191
|
+
/** Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
|
|
192
|
+
* The maximum number of items per request is limited to 20.
|
|
193
|
+
* You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
|
|
193
194
|
* Example usage:
|
|
194
195
|
* ```
|
|
195
196
|
* _smartico.api.getStorePurchasedItems().then((result) => {
|
|
@@ -198,8 +199,11 @@ export class WSAPI {
|
|
|
198
199
|
* ```
|
|
199
200
|
*/
|
|
200
201
|
|
|
201
|
-
public async getStorePurchasedItems(): Promise<TStoreItem[]> {
|
|
202
|
-
|
|
202
|
+
public async getStorePurchasedItems({ limit, offset, onUpdate } : { limit?: number, offset?: number, onUpdate?: (data: TStoreItem[]) => void} = {}): Promise<TStoreItem[]> {
|
|
203
|
+
if (onUpdate) {
|
|
204
|
+
this.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
|
|
205
|
+
}
|
|
206
|
+
return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(null, limit, offset), CACHE_DATA_SEC);
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
/** Returns missions & badges categories */
|