@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/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
 
@@ -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)\>
@@ -0,0 +1,11 @@
1
+ # Interface: TGetTranslations
2
+
3
+ ## Properties
4
+
5
+ ### translations
6
+
7
+ • **translations**: `Object`
8
+
9
+ #### Index signature
10
+
11
+ ▪ [key: `string`]: `string`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.84",
3
+ "version": "0.0.86",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,5 +34,5 @@ export interface SAWTemplateUI {
34
34
  max_spins_period_ms?: number;
35
35
  show_countdown_for_next_availability?: boolean;
36
36
  disable_background_music?: boolean;
37
-
37
+ custom_section_id?: number;
38
38
  }
@@ -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);
@@ -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);
@@ -415,4 +415,8 @@ export interface TBuyStoreItemResult {
415
415
  err_code: BuyStoreItemErrorCode;
416
416
  /** Optional error message */
417
417
  err_message: string;
418
+ }
419
+
420
+ export interface TGetTranslations {
421
+ translations: {[key: string]: string};
418
422
  }