smartling-api-sdk-nodejs 2.8.1 → 2.9.1
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/.scannerwork/report-task.txt +2 -2
- package/api/dto/base-locale-dto.ts +6 -0
- package/api/locales/dto/country-dto.ts +6 -0
- package/api/locales/dto/direction.ts +4 -0
- package/api/locales/dto/smartling-language-dto.ts +11 -0
- package/api/locales/dto/smartling-locale-dto.ts +11 -0
- package/api/locales/dto/word-delimeter.ts +4 -0
- package/api/locales/index.ts +24 -0
- package/api/locales/params/get-locales-parameters.ts +15 -0
- package/api/projects/dto/locale-dto.ts +3 -3
- package/built/api/dto/base-locale-dto.d.ts +5 -0
- package/built/api/dto/base-locale-dto.js +3 -0
- package/built/api/dto/base-locale-dto.js.map +1 -0
- package/built/api/locales/dto/country-dto.d.ts +5 -0
- package/built/api/locales/dto/country-dto.js +3 -0
- package/built/api/locales/dto/country-dto.js.map +1 -0
- package/built/api/locales/dto/direction.d.ts +4 -0
- package/built/api/locales/dto/direction.js +9 -0
- package/built/api/locales/dto/direction.js.map +1 -0
- package/built/api/locales/dto/smartling-language-dto.d.ts +9 -0
- package/built/api/locales/dto/smartling-language-dto.js +3 -0
- package/built/api/locales/dto/smartling-language-dto.js.map +1 -0
- package/built/api/locales/dto/smartling-locale-dto.d.ts +9 -0
- package/built/api/locales/dto/smartling-locale-dto.js +3 -0
- package/built/api/locales/dto/smartling-locale-dto.js.map +1 -0
- package/built/api/locales/dto/word-delimeter.d.ts +4 -0
- package/built/api/locales/dto/word-delimeter.js +9 -0
- package/built/api/locales/dto/word-delimeter.js.map +1 -0
- package/built/api/locales/index.d.ts +10 -0
- package/built/api/locales/index.js +27 -0
- package/built/api/locales/index.js.map +1 -0
- package/built/api/locales/params/get-locales-parameters.d.ts +5 -0
- package/built/api/locales/params/get-locales-parameters.js +16 -0
- package/built/api/locales/params/get-locales-parameters.js.map +1 -0
- package/built/api/projects/dto/locale-dto.d.ts +2 -3
- package/built/index.d.ts +7 -0
- package/built/index.js +7 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +7 -0
- package/package.json +1 -1
- 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=
|
|
6
|
-
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=
|
|
5
|
+
ceTaskId=AY3rmpPVRe7rJHsZ61td
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AY3rmpPVRe7rJHsZ61td
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Direction } from "./direction";
|
|
2
|
+
import { WordDelimiter } from "./word-delimeter";
|
|
3
|
+
|
|
4
|
+
interface SmartlingLanguageDto {
|
|
5
|
+
description: string;
|
|
6
|
+
direction: Direction;
|
|
7
|
+
languageId: string;
|
|
8
|
+
wordDelimiter: WordDelimiter;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-locale-dto.js","sourceRoot":"","sources":["../../../api/dto/base-locale-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-dto.js","sourceRoot":"","sources":["../../../../api/locales/dto/country-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Direction = void 0;
|
|
4
|
+
var Direction;
|
|
5
|
+
(function (Direction) {
|
|
6
|
+
Direction["LTR"] = "LTR";
|
|
7
|
+
Direction["RTL"] = "RTL";
|
|
8
|
+
})(Direction = exports.Direction || (exports.Direction = {}));
|
|
9
|
+
//# sourceMappingURL=direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../../api/locales/dto/direction.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,wBAAW,CAAA;IACX,wBAAW,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Direction } from "./direction";
|
|
2
|
+
import { WordDelimiter } from "./word-delimeter";
|
|
3
|
+
interface SmartlingLanguageDto {
|
|
4
|
+
description: string;
|
|
5
|
+
direction: Direction;
|
|
6
|
+
languageId: string;
|
|
7
|
+
wordDelimiter: WordDelimiter;
|
|
8
|
+
}
|
|
9
|
+
export { SmartlingLanguageDto };
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"smartling-locale-dto.js","sourceRoot":"","sources":["../../../../api/locales/dto/smartling-locale-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WordDelimiter = void 0;
|
|
4
|
+
var WordDelimiter;
|
|
5
|
+
(function (WordDelimiter) {
|
|
6
|
+
WordDelimiter["SPACE"] = "SPACE";
|
|
7
|
+
WordDelimiter["CHARACTER"] = "CHARACTER";
|
|
8
|
+
})(WordDelimiter = exports.WordDelimiter || (exports.WordDelimiter = {}));
|
|
9
|
+
//# sourceMappingURL=word-delimeter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word-delimeter.js","sourceRoot":"","sources":["../../../../api/locales/dto/word-delimeter.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,gCAAe,CAAA;IACf,wCAAuB,CAAA;AAC3B,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB"}
|
|
@@ -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,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"}
|
package/built/index.d.ts
CHANGED
|
@@ -96,3 +96,10 @@ 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/dto/direction";
|
|
103
|
+
export * from "./api/locales/dto/word-delimeter";
|
|
104
|
+
export * from "./api/locales/params/get-locales-parameters";
|
|
105
|
+
export * from "./api/locales/index";
|
package/built/index.js
CHANGED
|
@@ -112,4 +112,11 @@ __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/dto/direction"), exports);
|
|
119
|
+
__exportStar(require("./api/locales/dto/word-delimeter"), exports);
|
|
120
|
+
__exportStar(require("./api/locales/params/get-locales-parameters"), exports);
|
|
121
|
+
__exportStar(require("./api/locales/index"), exports);
|
|
115
122
|
//# sourceMappingURL=index.js.map
|
package/built/index.js.map
CHANGED
|
@@ -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":";;;;;;;;;;;;;;;;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;AAC3D,gEAA8C;AAC9C,2EAAyD;AACzD,yEAAuD;AACvD,8DAA4C;AAC5C,mEAAiD;AACjD,8EAA4D;AAC5D,sDAAoC"}
|
package/built/package.json
CHANGED
package/index.ts
CHANGED
|
@@ -96,3 +96,10 @@ 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/dto/direction";
|
|
103
|
+
export * from "./api/locales/dto/word-delimeter";
|
|
104
|
+
export * from "./api/locales/params/get-locales-parameters";
|
|
105
|
+
export * from "./api/locales/index";
|
package/package.json
CHANGED
|
@@ -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
|
+
});
|