@smartico/public-api 0.0.84 → 0.0.86
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/README.md +1 -1
- package/dist/MiniGames/SAWTemplateUI.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +1 -0
- package/dist/WSAPI/WSAPI.d.ts +3 -1
- package/dist/WSAPI/WSAPITypes.d.ts +5 -0
- package/dist/index.js +38 -18
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +10 -0
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +18 -0
- package/docs/interfaces/TGetTranslations.md +11 -0
- package/package.json +1 -1
- package/src/MiniGames/SAWTemplateUI.ts +1 -1
- package/src/SmarticoAPI.ts +4 -0
- package/src/WSAPI/WSAPI.ts +10 -1
- package/src/WSAPI/WSAPITypes.ts +4 -0
package/docs/README.md
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
- [TMissionOptInResult](interfaces/TMissionOptInResult.md)
|
|
27
27
|
- [TTournamentRegistrationResult](interfaces/TTournamentRegistrationResult.md)
|
|
28
28
|
- [TBuyStoreItemResult](interfaces/TBuyStoreItemResult.md)
|
|
29
|
+
- [TGetTranslations](interfaces/TGetTranslations.md)
|
|
29
30
|
|
|
30
31
|
## General API
|
|
31
32
|
|
package/docs/classes/WSAPI.md
CHANGED
|
@@ -203,3 +203,21 @@ Requests registration for the specified tournament instance. Returns the err_cod
|
|
|
203
203
|
#### Returns
|
|
204
204
|
|
|
205
205
|
`Promise`<[`TTournamentRegistrationResult`](../interfaces/TTournamentRegistrationResult.md)\>
|
|
206
|
+
|
|
207
|
+
___
|
|
208
|
+
|
|
209
|
+
### getTranslations
|
|
210
|
+
|
|
211
|
+
▸ **getTranslations**(`lang_code`): `Promise`<[`TGetTranslations`](../interfaces/TGetTranslations.md)\>
|
|
212
|
+
|
|
213
|
+
Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
|
|
214
|
+
|
|
215
|
+
#### Parameters
|
|
216
|
+
|
|
217
|
+
| Name | Type |
|
|
218
|
+
| :------ | :------ |
|
|
219
|
+
| `lang_code` | `string` |
|
|
220
|
+
|
|
221
|
+
#### Returns
|
|
222
|
+
|
|
223
|
+
`Promise`<[`TGetTranslations`](../interfaces/TGetTranslations.md)\>
|
package/package.json
CHANGED
package/src/SmarticoAPI.ts
CHANGED
|
@@ -521,6 +521,10 @@ class SmarticoAPI {
|
|
|
521
521
|
return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
+
public async getTranslationsT(user_ext_id: string, lang_code: string, areas: TranslationArea[], cacheSec: number = 60): Promise<GetTranslationsResponse> {
|
|
525
|
+
return await this.coreGetTranslations(user_ext_id, lang_code, areas, 30);
|
|
526
|
+
}
|
|
527
|
+
|
|
524
528
|
|
|
525
529
|
public getWSCalls(): WSAPI {
|
|
526
530
|
return new WSAPI(this);
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CoreUtils } from "../Core";
|
|
|
3
3
|
import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from "../MiniGames";
|
|
4
4
|
import { ECacheContext, OCache } from "../OCache";
|
|
5
5
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
6
|
-
import { TBuyStoreItemResult, TLevel, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile } from "./WSAPITypes";
|
|
6
|
+
import { TBuyStoreItemResult, TGetTranslations, TLevel, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile } from "./WSAPITypes";
|
|
7
7
|
|
|
8
8
|
/** @hidden */
|
|
9
9
|
const CACHE_DATA_SEC = 30;
|
|
@@ -159,6 +159,15 @@ export class WSAPI {
|
|
|
159
159
|
return o;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
/** Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office. */
|
|
163
|
+
public async getTranslations(lang_code: string): Promise<TGetTranslations> {
|
|
164
|
+
const r = await this.api.getTranslationsT(null, lang_code, []);
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
translations: r.translations
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
162
171
|
private async updateOnSpin(data: SAWSpinsCountPush) {
|
|
163
172
|
const templates: TMiniGameTemplate[] = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
|
|
164
173
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
package/src/WSAPI/WSAPITypes.ts
CHANGED