@smartico/public-api 0.0.83 → 0.0.85

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`
@@ -28,9 +28,9 @@ Name of the mission or badge, translated to the user language
28
28
 
29
29
  ___
30
30
 
31
- ### desription
31
+ ### description
32
32
 
33
- • **desription**: `string`
33
+ • **description**: `string`
34
34
 
35
35
  Description of the mission or badge, translated to the user language
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,7 +33,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
33
33
  {
34
34
  id: r.ach_id,
35
35
  name: r.ach_public_meta.name,
36
- desription: r.ach_public_meta.description,
36
+ description: r.ach_public_meta.description,
37
37
  unlock_mission_description: r.ach_public_meta.unlock_mission_description,
38
38
  image: r.ach_public_meta.image_url,
39
39
  is_completed: r.isCompleted,
@@ -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);
@@ -332,7 +332,7 @@ export interface TMissionOrBadge {
332
332
  /** Name of the mission or badge, translated to the user language */
333
333
  name: string;
334
334
  /** Description of the mission or badge, translated to the user language */
335
- desription: string;
335
+ description: string;
336
336
  /** Description of the mission reward if defined */
337
337
  reward: string;
338
338
  /** URL of the image of the mission or badge */
@@ -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
  }