smartling-api-sdk-nodejs 2.8.0 → 2.9.0

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.
Files changed (37) hide show
  1. package/.scannerwork/report-task.txt +2 -2
  2. package/api/dto/base-locale-dto.ts +6 -0
  3. package/api/jobs/params/create-update-job-base-parameters.ts +0 -4
  4. package/api/locales/dto/country-dto.ts +6 -0
  5. package/api/locales/dto/smartling-language-dto.ts +8 -0
  6. package/api/locales/dto/smartling-locale-dto.ts +11 -0
  7. package/api/locales/index.ts +24 -0
  8. package/api/locales/params/get-locales-parameters.ts +15 -0
  9. package/api/projects/dto/locale-dto.ts +3 -3
  10. package/built/api/dto/base-locale-dto.d.ts +5 -0
  11. package/built/api/dto/base-locale-dto.js +3 -0
  12. package/built/api/dto/base-locale-dto.js.map +1 -0
  13. package/built/api/jobs/params/create-update-job-base-parameters.js +0 -3
  14. package/built/api/jobs/params/create-update-job-base-parameters.js.map +1 -1
  15. package/built/api/locales/dto/country-dto.d.ts +5 -0
  16. package/built/api/locales/dto/country-dto.js +3 -0
  17. package/built/api/locales/dto/country-dto.js.map +1 -0
  18. package/built/api/locales/dto/smartling-language-dto.d.ts +7 -0
  19. package/built/api/locales/dto/smartling-language-dto.js +3 -0
  20. package/built/api/locales/dto/smartling-language-dto.js.map +1 -0
  21. package/built/api/locales/dto/smartling-locale-dto.d.ts +9 -0
  22. package/built/api/locales/dto/smartling-locale-dto.js +3 -0
  23. package/built/api/locales/dto/smartling-locale-dto.js.map +1 -0
  24. package/built/api/locales/index.d.ts +10 -0
  25. package/built/api/locales/index.js +27 -0
  26. package/built/api/locales/index.js.map +1 -0
  27. package/built/api/locales/params/get-locales-parameters.d.ts +5 -0
  28. package/built/api/locales/params/get-locales-parameters.js +16 -0
  29. package/built/api/locales/params/get-locales-parameters.js.map +1 -0
  30. package/built/api/projects/dto/locale-dto.d.ts +2 -3
  31. package/built/index.d.ts +5 -0
  32. package/built/index.js +5 -0
  33. package/built/index.js.map +1 -1
  34. package/built/package.json +1 -1
  35. package/index.ts +5 -0
  36. package/package.json +1 -1
  37. package/test/locales.spec.ts +68 -0
@@ -2,5 +2,5 @@ projectKey=smartling-api-sdk-nodejs
2
2
  serverUrl=https://sonar-next.connectors.stg.smartling.net
3
3
  serverVersion=8.6.1.40680
4
4
  dashboardUrl=https://sonar-next.connectors.stg.smartling.net/dashboard?id=smartling-api-sdk-nodejs
5
- ceTaskId=AYzVPng9Re7rJHsZ61o1
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYzVPng9Re7rJHsZ61o1
5
+ ceTaskId=AY3qdsctRe7rJHsZ61tY
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AY3qdsctRe7rJHsZ61tY
@@ -0,0 +1,6 @@
1
+ interface BaseLocaleDto {
2
+ localeId: string;
3
+ description: string;
4
+ }
5
+
6
+ export { BaseLocaleDto };
@@ -30,10 +30,6 @@ export abstract class CreateUpdateJobBaseParameters<T extends CreateUpdateJobBas
30
30
  }
31
31
 
32
32
  setDueDate(dueDate: Date | null): T {
33
- if (dueDate && (dueDate.getTime() < (new Date()).getTime())) {
34
- throw new SmartlingException("Job Due Date cannot be in the past.");
35
- }
36
-
37
33
  this.set("dueDate", dueDate ? dueDate.toISOString() : null);
38
34
 
39
35
  return this as unknown as T;
@@ -0,0 +1,6 @@
1
+ interface CountryDto {
2
+ countryId: string;
3
+ description: string;
4
+ }
5
+
6
+ export { CountryDto };
@@ -0,0 +1,8 @@
1
+ interface SmartlingLanguageDto {
2
+ description: string;
3
+ direction: string;
4
+ languageId: string;
5
+ wordDelimiter: string;
6
+ }
7
+
8
+ export { SmartlingLanguageDto };
@@ -0,0 +1,11 @@
1
+ import { BaseLocaleDto } from "../../dto/base-locale-dto";
2
+ import { CountryDto } from "./country-dto";
3
+ import { SmartlingLanguageDto } from "./smartling-language-dto";
4
+
5
+ interface SmartlingLocaleDto extends BaseLocaleDto {
6
+ mtSupported: boolean;
7
+ country: CountryDto;
8
+ language: SmartlingLanguageDto;
9
+ }
10
+
11
+ export { SmartlingLocaleDto };
@@ -0,0 +1,24 @@
1
+ import { SmartlingBaseApi } from "../base/index";
2
+ import { SmartlingAuthApi } from "../auth/index";
3
+ import { Logger } from "../logger";
4
+ import { SmartlingLocaleDto } from "./dto/smartling-locale-dto";
5
+ import { SmartlingListResponse } from "../http/smartling-list-response";
6
+ import { GetLocalesParameters } from "./params/get-locales-parameters";
7
+
8
+ export class SmartlingLocalesApi extends SmartlingBaseApi {
9
+ constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
10
+ super(logger);
11
+ this.authApi = authApi;
12
+ this.entrypoint = `${smartlingApiBaseUrl}/locales-api/v2/dictionary`;
13
+ }
14
+
15
+ async getLocales(
16
+ params?: GetLocalesParameters
17
+ ): Promise<SmartlingListResponse<SmartlingLocaleDto>> {
18
+ return await this.makeRequest(
19
+ "get",
20
+ `${this.entrypoint}/locales`,
21
+ params ? params.export() : null
22
+ );
23
+ }
24
+ }
@@ -0,0 +1,15 @@
1
+ import { BaseParameters } from "../../parameters";
2
+
3
+ export class GetLocalesParameters extends BaseParameters {
4
+ public setLocaleIds(localeIds: Array<string>): GetLocalesParameters {
5
+ this.set("localeIds", localeIds);
6
+
7
+ return this;
8
+ }
9
+
10
+ public setSupportedOnly(supportedOnly: boolean): GetLocalesParameters {
11
+ this.set("supportedOnly", supportedOnly);
12
+
13
+ return this;
14
+ }
15
+ }
@@ -1,6 +1,6 @@
1
- interface LocaleDto {
2
- localeId: string;
3
- description: string;
1
+ import { BaseLocaleDto } from "../../dto/base-locale-dto";
2
+
3
+ interface LocaleDto extends BaseLocaleDto {
4
4
  enabled: boolean;
5
5
  }
6
6
 
@@ -0,0 +1,5 @@
1
+ interface BaseLocaleDto {
2
+ localeId: string;
3
+ description: string;
4
+ }
5
+ export { BaseLocaleDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=base-locale-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-locale-dto.js","sourceRoot":"","sources":["../../../api/dto/base-locale-dto.ts"],"names":[],"mappings":""}
@@ -19,9 +19,6 @@ class CreateUpdateJobBaseParameters extends parameters_1.BaseParameters {
19
19
  return this;
20
20
  }
21
21
  setDueDate(dueDate) {
22
- if (dueDate && (dueDate.getTime() < (new Date()).getTime())) {
23
- throw new exception_1.SmartlingException("Job Due Date cannot be in the past.");
24
- }
25
22
  this.set("dueDate", dueDate ? dueDate.toISOString() : null);
26
23
  return this;
27
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-update-job-base-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/create-update-job-base-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAQrD,MAAsB,6BAClB,SAAQ,2BAAc;IACtB,OAAO,CAAC,OAAe;QACnB,IAAI,OAAO,CAAC,MAAM,IAAI,GAAG,EAAE;YACvB,MAAM,IAAI,8BAAkB,CAAC,8CAA8C,CAAC,CAAC;SAChF;QAED,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,cAAc,CAAC,WAA0B;QACrC,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE;YAC7C,MAAM,IAAI,8BAAkB,CAAC,sDAAsD,CAAC,CAAC;SACxF;QAED,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErC,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,UAAU,CAAC,OAAoB;QAC3B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE;YACzD,MAAM,IAAI,8BAAkB,CAAC,qCAAqC,CAAC,CAAC;SACvE;QAED,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAE5D,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,kBAAkB,CAAC,eAA8B;QAC7C,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;QAE7C,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,cAAc,CAAC,WAA0B;QACrC,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE;YAC5C,MAAM,IAAI,8BAAkB,CAAC,8DAA8D,CAAC,CAAC;SAChG;QAED,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErC,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,iBAAiB,CAAC,cAAqC;QACnD,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAE3C,OAAO,IAAoB,CAAC;IAChC,CAAC;IAED,eAAe,CAAC,YAAuC;QACnD,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAEvC,OAAO,IAAoB,CAAC;IAChC,CAAC;CACJ;AA3DD,sEA2DC"}
1
+ {"version":3,"file":"create-update-job-base-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/create-update-job-base-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAClD,+CAAqD;AAQrD,MAAsB,6BAClB,SAAQ,2BAAc;IACtB,OAAO,CAAC,OAAe;QACnB,IAAI,OAAO,CAAC,MAAM,IAAI,GAAG,EAAE;YACvB,MAAM,IAAI,8BAAkB,CAAC,8CAA8C,CAAC,CAAC;SAChF;QAED,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAoB,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+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=country-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-dto.js","sourceRoot":"","sources":["../../../../api/locales/dto/country-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ interface SmartlingLanguageDto {
2
+ description: string;
3
+ direction: string;
4
+ languageId: string;
5
+ wordDelimiter: string;
6
+ }
7
+ export { SmartlingLanguageDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=smartling-language-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartling-language-dto.js","sourceRoot":"","sources":["../../../../api/locales/dto/smartling-language-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { BaseLocaleDto } from "../../dto/base-locale-dto";
2
+ import { CountryDto } from "./country-dto";
3
+ import { SmartlingLanguageDto } from "./smartling-language-dto";
4
+ interface SmartlingLocaleDto extends BaseLocaleDto {
5
+ mtSupported: boolean;
6
+ country: CountryDto;
7
+ language: SmartlingLanguageDto;
8
+ }
9
+ export { SmartlingLocaleDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=smartling-locale-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartling-locale-dto.js","sourceRoot":"","sources":["../../../../api/locales/dto/smartling-locale-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { SmartlingBaseApi } from "../base/index";
2
+ import { SmartlingAuthApi } from "../auth/index";
3
+ import { Logger } from "../logger";
4
+ import { SmartlingLocaleDto } from "./dto/smartling-locale-dto";
5
+ import { SmartlingListResponse } from "../http/smartling-list-response";
6
+ import { GetLocalesParameters } from "./params/get-locales-parameters";
7
+ export declare class SmartlingLocalesApi extends SmartlingBaseApi {
8
+ constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
9
+ getLocales(params?: GetLocalesParameters): Promise<SmartlingListResponse<SmartlingLocaleDto>>;
10
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SmartlingLocalesApi = void 0;
13
+ const index_1 = require("../base/index");
14
+ class SmartlingLocalesApi extends index_1.SmartlingBaseApi {
15
+ constructor(smartlingApiBaseUrl, authApi, logger) {
16
+ super(logger);
17
+ this.authApi = authApi;
18
+ this.entrypoint = `${smartlingApiBaseUrl}/locales-api/v2/dictionary`;
19
+ }
20
+ getLocales(params) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return yield this.makeRequest("get", `${this.entrypoint}/locales`, params ? params.export() : null);
23
+ });
24
+ }
25
+ }
26
+ exports.SmartlingLocalesApi = SmartlingLocalesApi;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/locales/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAOjD,MAAa,mBAAoB,SAAQ,wBAAgB;IACrD,YAAY,mBAA2B,EAAE,OAAyB,EAAE,MAAc;QAC9E,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,4BAA4B,CAAC;IACzE,CAAC;IAEK,UAAU,CACZ,MAA6B;;YAE7B,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,UAAU,EAC5B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAClC,CAAC;QACN,CAAC;KAAA;CACJ;AAhBD,kDAgBC"}
@@ -0,0 +1,5 @@
1
+ import { BaseParameters } from "../../parameters";
2
+ export declare class GetLocalesParameters extends BaseParameters {
3
+ setLocaleIds(localeIds: Array<string>): GetLocalesParameters;
4
+ setSupportedOnly(supportedOnly: boolean): GetLocalesParameters;
5
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetLocalesParameters = void 0;
4
+ const parameters_1 = require("../../parameters");
5
+ class GetLocalesParameters extends parameters_1.BaseParameters {
6
+ setLocaleIds(localeIds) {
7
+ this.set("localeIds", localeIds);
8
+ return this;
9
+ }
10
+ setSupportedOnly(supportedOnly) {
11
+ this.set("supportedOnly", supportedOnly);
12
+ return this;
13
+ }
14
+ }
15
+ exports.GetLocalesParameters = GetLocalesParameters;
16
+ //# sourceMappingURL=get-locales-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-locales-parameters.js","sourceRoot":"","sources":["../../../../api/locales/params/get-locales-parameters.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAElD,MAAa,oBAAqB,SAAQ,2BAAc;IAC7C,YAAY,CAAC,SAAwB;QACxC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAEjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,gBAAgB,CAAC,aAAsB;QAC1C,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAZD,oDAYC"}
@@ -1,6 +1,5 @@
1
- interface LocaleDto {
2
- localeId: string;
3
- description: string;
1
+ import { BaseLocaleDto } from "../../dto/base-locale-dto";
2
+ interface LocaleDto extends BaseLocaleDto {
4
3
  enabled: boolean;
5
4
  }
6
5
  export { LocaleDto };
package/built/index.d.ts CHANGED
@@ -96,3 +96,8 @@ export * from "./api/logger";
96
96
  export * from "./api/jobs/params/add-file-parameters";
97
97
  export * from "./api/files/params/download-file-all-translations-parameters";
98
98
  export * from "./api/jobs/params/authorize-job-parameters";
99
+ export * from "./api/locales/dto/country-dto";
100
+ export * from "./api/locales/dto/smartling-language-dto";
101
+ export * from "./api/locales/dto/smartling-locale-dto";
102
+ export * from "./api/locales/params/get-locales-parameters";
103
+ export * from "./api/locales/index";
package/built/index.js CHANGED
@@ -112,4 +112,9 @@ __exportStar(require("./api/logger"), exports);
112
112
  __exportStar(require("./api/jobs/params/add-file-parameters"), exports);
113
113
  __exportStar(require("./api/files/params/download-file-all-translations-parameters"), exports);
114
114
  __exportStar(require("./api/jobs/params/authorize-job-parameters"), exports);
115
+ __exportStar(require("./api/locales/dto/country-dto"), exports);
116
+ __exportStar(require("./api/locales/dto/smartling-language-dto"), exports);
117
+ __exportStar(require("./api/locales/dto/smartling-locale-dto"), exports);
118
+ __exportStar(require("./api/locales/params/get-locales-parameters"), exports);
119
+ __exportStar(require("./api/locales/index"), exports);
115
120
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,mDAAiC;AACjC,sDAAoC;AACpC,sDAAoC;AACpC,wEAAsD;AACtD,6EAA2D;AAC3D,gEAA8C;AAC9C,4EAA0D;AAC1D,uEAAqD;AACrD,0FAAwE;AACxE,oEAAkD;AAClD,iFAA+D;AAC/D,kFAAgE;AAChE,uEAAqD;AACrD,sEAAoD;AACpD,wDAAsC;AACtC,gEAA8C;AAC9C,4FAA0E;AAC1E,2FAAyE;AACzE,oEAAkD;AAClD,oFAAkE;AAClE,qFAAmE;AACnE,uFAAqE;AACrE,4FAA0E;AAC1E,2EAAyD;AACzD,uEAAqD;AACrD,8EAA4D;AAC5D,4FAA0E;AAC1E,qFAAmE;AACnE,oDAAkC;AAClC,8EAA4D;AAC5D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,kFAAgE;AAChE,kFAAgE;AAChE,+EAA6D;AAC7D,oEAAkD;AAClD,qEAAmD;AACnD,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,yEAAuD;AACvD,yEAAuD;AACvD,4EAA0D;AAC1D,mFAAiE;AACjE,wFAAsE;AACtE,2FAAyE;AACzE,wFAAsE;AACtE,0FAAwE;AACxE,wEAAsD;AACtD,wEAAsD;AACtD,mFAAiE;AACjE,6EAA2D;AAC3D,mDAAiC;AACjC,8DAA4C;AAC5C,kFAAgE;AAChE,kEAAgD;AAChD,mEAAiD;AACjD,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C;AAC/C,mFAAiE;AACjE,uFAAqE;AACrE,kEAAgD;AAChD,mEAAiD;AACjD,yEAAuD;AACvD,kEAAgD;AAChD,oEAAkD;AAClD,0EAAwD;AACxD,6EAA2D;AAC3D,4EAA0D;AAC1D,+DAA6C;AAC7C,8EAA4D;AAC5D,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yEAAuD;AACvD,2EAAyD;AACzD,0EAAwD;AACxD,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;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yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,iEAA+C;AAC/C,gEAA8C;AAC9C,8DAA4C;AAC5C,+EAA6D;AAC7D,mGAAiF;AACjF,sDAAoC;AACpC,sEAAoD;AACpD,0EAAwD;AACxD,uFAAqE;AACrE,+CAA6B;AAC7B,wEAAsD;AACtD,+FAA6E;AAC7E,6EAA2D;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8EAA4D;AAC5D,sDAAoC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
package/index.ts CHANGED
@@ -96,3 +96,8 @@ export * from "./api/logger";
96
96
  export * from "./api/jobs/params/add-file-parameters";
97
97
  export * from "./api/files/params/download-file-all-translations-parameters";
98
98
  export * from "./api/jobs/params/authorize-job-parameters";
99
+ export * from "./api/locales/dto/country-dto";
100
+ export * from "./api/locales/dto/smartling-language-dto";
101
+ export * from "./api/locales/dto/smartling-locale-dto";
102
+ export * from "./api/locales/params/get-locales-parameters";
103
+ export * from "./api/locales/index";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
@@ -0,0 +1,68 @@
1
+ import sinon from "sinon";
2
+ import { SmartlingLocalesApi } from "../api/locales";
3
+ import { GetLocalesParameters } from "../api/locales/params/get-locales-parameters";
4
+ import { SmartlingAuthApi } from "../api/auth/index";
5
+ import { loggerMock, authMock, responseMock } from "./mock";
6
+
7
+ describe("SmartlingLocalesApi class tests.", () => {
8
+ let localesApi;
9
+ let localesApiFetchStub;
10
+ let localesApiUaStub;
11
+ let responseMockTextStub;
12
+
13
+ beforeEach(() => {
14
+ localesApi = new SmartlingLocalesApi("https://test.com", authMock as unknown as SmartlingAuthApi, loggerMock);
15
+
16
+ localesApiFetchStub = sinon.stub(localesApi, "fetch");
17
+ localesApiUaStub = sinon.stub(localesApi, "ua");
18
+ responseMockTextStub = sinon.stub(responseMock, "text");
19
+
20
+ localesApiUaStub.returns("test_user_agent");
21
+ localesApiFetchStub.returns(responseMock);
22
+ responseMockTextStub.returns("{\"response\": {}}");
23
+ });
24
+
25
+ afterEach(() => {
26
+ localesApiFetchStub.restore();
27
+ responseMockTextStub.restore();
28
+ localesApiUaStub.restore();
29
+ });
30
+
31
+ it("Get all locales", async () => {
32
+ await localesApi.getLocales();
33
+
34
+ sinon.assert.calledOnce(localesApiFetchStub);
35
+ sinon.assert.calledWithExactly(
36
+ localesApiFetchStub,
37
+ "https://test.com/locales-api/v2/dictionary/locales", {
38
+ headers: {
39
+ Authorization: "test_token_type test_access_token",
40
+ "Content-Type": "application/json",
41
+ "User-Agent": "test_user_agent"
42
+ },
43
+ method: "get"
44
+ }
45
+ );
46
+ });
47
+
48
+ it("Get locales with filters", async () => {
49
+ const params = new GetLocalesParameters()
50
+ .setLocaleIds(["fr-FR", "de-DE"])
51
+ .setSupportedOnly(true);
52
+
53
+ await localesApi.getLocales(params);
54
+
55
+ sinon.assert.calledOnce(localesApiFetchStub);
56
+ sinon.assert.calledWithExactly(
57
+ localesApiFetchStub,
58
+ "https://test.com/locales-api/v2/dictionary/locales?localeIds=fr-FR&localeIds=de-DE&supportedOnly=true", {
59
+ headers: {
60
+ Authorization: "test_token_type test_access_token",
61
+ "Content-Type": "application/json",
62
+ "User-Agent": "test_user_agent"
63
+ },
64
+ method: "get"
65
+ }
66
+ );
67
+ });
68
+ });