smartling-api-sdk-nodejs 2.3.0 → 2.5.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.
- package/.scannerwork/report-task.txt +2 -2
- package/api/file-translations/dto/error.ts +7 -0
- package/api/file-translations/dto/language-detection-dto.ts +5 -0
- package/api/file-translations/dto/language-detection-state.ts +5 -0
- package/api/file-translations/dto/language-detection-status-dto.ts +11 -0
- package/api/file-translations/dto/language-dto.ts +6 -0
- package/api/file-translations/dto/mt-state.ts +7 -0
- package/api/file-translations/dto/translation-dto.ts +5 -0
- package/api/file-translations/dto/translation-locale-status-dto.ts +11 -0
- package/api/file-translations/dto/translation-status-dto.ts +12 -0
- package/api/file-translations/dto/uploaded-file-dto.ts +5 -0
- package/api/file-translations/index.ts +114 -0
- package/api/file-translations/params/translate-file-parameters.ts +13 -0
- package/api/file-translations/params/upload-file-parameters.ts +29 -0
- package/api/files/index.ts +1 -1
- package/api/files/params/download-file-all-translations-parameters.ts +1 -7
- package/api/job-batches/dto/batch-list-item-dto.ts +14 -0
- package/api/job-batches/index.ts +13 -0
- package/api/job-batches/params/list-batches-parameters.ts +41 -0
- package/api/jobs/params/create-job-parameters.ts +6 -0
- package/built/api/file-translations/dto/error.d.ts +6 -0
- package/built/api/file-translations/dto/error.js +3 -0
- package/built/api/file-translations/dto/error.js.map +1 -0
- package/built/api/file-translations/dto/language-detection-dto.d.ts +4 -0
- package/built/api/file-translations/dto/language-detection-dto.js +3 -0
- package/built/api/file-translations/dto/language-detection-dto.js.map +1 -0
- package/built/api/file-translations/dto/language-detection-state.d.ts +5 -0
- package/built/api/file-translations/dto/language-detection-state.js +10 -0
- package/built/api/file-translations/dto/language-detection-state.js.map +1 -0
- package/built/api/file-translations/dto/language-detection-status-dto.d.ts +9 -0
- package/built/api/file-translations/dto/language-detection-status-dto.js +3 -0
- package/built/api/file-translations/dto/language-detection-status-dto.js.map +1 -0
- package/built/api/file-translations/dto/language-dto.d.ts +5 -0
- package/built/api/file-translations/dto/language-dto.js +3 -0
- package/built/api/file-translations/dto/language-dto.js.map +1 -0
- package/built/api/file-translations/dto/mt-state.d.ts +7 -0
- package/built/api/file-translations/dto/mt-state.js +12 -0
- package/built/api/file-translations/dto/mt-state.js.map +1 -0
- package/built/api/file-translations/dto/translation-dto.d.ts +4 -0
- package/built/api/file-translations/dto/translation-dto.js +3 -0
- package/built/api/file-translations/dto/translation-dto.js.map +1 -0
- package/built/api/file-translations/dto/translation-locale-status-dto.d.ts +9 -0
- package/built/api/file-translations/dto/translation-locale-status-dto.js +3 -0
- package/built/api/file-translations/dto/translation-locale-status-dto.js.map +1 -0
- package/built/api/file-translations/dto/translation-status-dto.d.ts +10 -0
- package/built/api/file-translations/dto/translation-status-dto.js +3 -0
- package/built/api/file-translations/dto/translation-status-dto.js.map +1 -0
- package/built/api/file-translations/dto/uploaded-file-dto.d.ts +4 -0
- package/built/api/file-translations/dto/uploaded-file-dto.js +3 -0
- package/built/api/file-translations/dto/uploaded-file-dto.js.map +1 -0
- package/built/api/file-translations/index.d.ts +23 -0
- package/built/api/file-translations/index.js +78 -0
- package/built/api/file-translations/index.js.map +1 -0
- package/built/api/file-translations/params/translate-file-parameters.d.ts +5 -0
- package/built/api/file-translations/params/translate-file-parameters.js +16 -0
- package/built/api/file-translations/params/translate-file-parameters.js.map +1 -0
- package/built/api/file-translations/params/upload-file-parameters.d.ts +8 -0
- package/built/api/file-translations/params/upload-file-parameters.js +52 -0
- package/built/api/file-translations/params/upload-file-parameters.js.map +1 -0
- package/built/api/files/index.js +1 -1
- package/built/api/files/index.js.map +1 -1
- package/built/api/files/params/download-file-all-translations-parameters.d.ts +0 -1
- package/built/api/files/params/download-file-all-translations-parameters.js +0 -4
- package/built/api/files/params/download-file-all-translations-parameters.js.map +1 -1
- package/built/api/job-batches/dto/batch-list-item-dto.d.ts +11 -0
- package/built/api/job-batches/dto/batch-list-item-dto.js +3 -0
- package/built/api/job-batches/dto/batch-list-item-dto.js.map +1 -0
- package/built/api/job-batches/index.d.ts +4 -0
- package/built/api/job-batches/index.js +5 -0
- package/built/api/job-batches/index.js.map +1 -1
- package/built/api/job-batches/params/list-batches-parameters.d.ts +10 -0
- package/built/api/job-batches/params/list-batches-parameters.js +33 -0
- package/built/api/job-batches/params/list-batches-parameters.js.map +1 -0
- package/built/api/jobs/params/create-job-parameters.d.ts +1 -0
- package/built/api/jobs/params/create-job-parameters.js +4 -0
- package/built/api/jobs/params/create-job-parameters.js.map +1 -1
- package/built/index.d.ts +2 -0
- package/built/index.js +2 -0
- package/built/index.js.map +1 -1
- package/built/package.json +1 -1
- package/index.ts +2 -0
- package/package.json +1 -1
- package/test/builder.spec.ts +8 -0
- package/test/file-translations.spec.ts +282 -0
- package/test/files.spec.ts +1 -23
- package/test/job-batches.spec.ts +30 -0
- package/test/jobs.spec.ts +3 -2
|
@@ -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=AYyGVn8fRe7rJHsZ61oS
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYyGVn8fRe7rJHsZ61oS
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Error } from "./error";
|
|
2
|
+
import { LanguageDetectionState } from "./language-detection-state";
|
|
3
|
+
import { LanguageDto } from "./language-dto";
|
|
4
|
+
|
|
5
|
+
interface LanguageDetectionStatusDto {
|
|
6
|
+
state: LanguageDetectionState,
|
|
7
|
+
error?: Error,
|
|
8
|
+
detectedSourceLanguages: LanguageDto[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { LanguageDetectionStatusDto };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MTState } from "./mt-state";
|
|
2
|
+
import { Error } from "./error";
|
|
3
|
+
import { TranslationLocaleStatusDto } from "./translation-locale-status-dto";
|
|
4
|
+
|
|
5
|
+
interface TranslationStatusDto {
|
|
6
|
+
state: MTState,
|
|
7
|
+
requestedStringCount: number,
|
|
8
|
+
error?: Error,
|
|
9
|
+
localeProcessStatuses: TranslationLocaleStatusDto[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { TranslationStatusDto };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import { SmartlingBaseApi } from "../base";
|
|
3
|
+
import { SmartlingAuthApi } from "../auth";
|
|
4
|
+
import { Logger } from "../logger";
|
|
5
|
+
import { UploadedFileDto } from "./dto/uploaded-file-dto";
|
|
6
|
+
import { UploadFileParameters } from "./params/upload-file-parameters";
|
|
7
|
+
import { TranslationDto } from "./dto/translation-dto";
|
|
8
|
+
import { TranslateFileParameters } from "./params/translate-file-parameters";
|
|
9
|
+
import { TranslationStatusDto } from "./dto/translation-status-dto";
|
|
10
|
+
import { LanguageDetectionDto } from "./dto/language-detection-dto";
|
|
11
|
+
import { LanguageDetectionStatusDto } from "./dto/language-detection-status-dto";
|
|
12
|
+
|
|
13
|
+
export class SmartlingFileTranslationsApi extends SmartlingBaseApi {
|
|
14
|
+
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
15
|
+
super(logger);
|
|
16
|
+
this.authApi = authApi;
|
|
17
|
+
this.entrypoint = `${smartlingApiBaseUrl}/file-translations-api/v2/accounts`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async uploadFile(
|
|
21
|
+
accountUid: string, parameters: UploadFileParameters
|
|
22
|
+
): Promise<UploadedFileDto> {
|
|
23
|
+
const formData = new FormData();
|
|
24
|
+
const exported = parameters.export();
|
|
25
|
+
|
|
26
|
+
formData.append("file", exported.file);
|
|
27
|
+
formData.append("request", JSON.stringify(exported.request), {
|
|
28
|
+
contentType: "application/json"
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return await this.makeRequest(
|
|
32
|
+
"post",
|
|
33
|
+
`${this.entrypoint}/${accountUid}/files`,
|
|
34
|
+
formData,
|
|
35
|
+
false,
|
|
36
|
+
SmartlingFileTranslationsApi.fixContentTypeHeaderCase(formData)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async translateFile(
|
|
41
|
+
accountUid: string, fileUid: string, params: TranslateFileParameters
|
|
42
|
+
): Promise<TranslationDto> {
|
|
43
|
+
return await this.makeRequest(
|
|
44
|
+
"post",
|
|
45
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/mt`,
|
|
46
|
+
JSON.stringify(params.export())
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getTranslationProgress(
|
|
51
|
+
accountUid: string, fileUid: string, mtUid: string
|
|
52
|
+
): Promise<TranslationStatusDto> {
|
|
53
|
+
return await this.makeRequest(
|
|
54
|
+
"get",
|
|
55
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/status`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async downloadTranslatedFile(
|
|
60
|
+
accountUid: string, fileUid: string, mtUid: string, localeId: string
|
|
61
|
+
): Promise<string> {
|
|
62
|
+
return await this.makeRequest(
|
|
63
|
+
"get",
|
|
64
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/locales/${localeId}/file`,
|
|
65
|
+
null,
|
|
66
|
+
true
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async downloadTranslatedFiles(
|
|
71
|
+
accountUid: string, fileUid: string, mtUid: string
|
|
72
|
+
): Promise<string> {
|
|
73
|
+
return await this.makeRequest(
|
|
74
|
+
"get",
|
|
75
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/locales/all/file/zip`,
|
|
76
|
+
null,
|
|
77
|
+
true
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async cancelFileTranslation(
|
|
82
|
+
accountUid: string, fileUid: string, mtUid: string
|
|
83
|
+
): Promise<void> {
|
|
84
|
+
await this.makeRequest(
|
|
85
|
+
"post",
|
|
86
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/mt/${mtUid}/cancel`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async detectFileLanguage(accountUid: string, fileUid: string): Promise<LanguageDetectionDto> {
|
|
91
|
+
return await this.makeRequest(
|
|
92
|
+
"post",
|
|
93
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/language-detection`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async getLanguageDetectionProgress(
|
|
98
|
+
accountUid: string, fileUid: string, languageDetectionUid: string
|
|
99
|
+
): Promise<LanguageDetectionStatusDto> {
|
|
100
|
+
return await this.makeRequest(
|
|
101
|
+
"get",
|
|
102
|
+
`${this.entrypoint}/${accountUid}/files/${fileUid}/language-detection/${languageDetectionUid}/status`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static fixContentTypeHeaderCase(form: FormData): Record<string, unknown> {
|
|
107
|
+
const headers = form.getHeaders();
|
|
108
|
+
|
|
109
|
+
headers["Content-Type"] = headers["content-type"];
|
|
110
|
+
// eslint-disable-next-line fp/no-delete
|
|
111
|
+
delete headers["content-type"];
|
|
112
|
+
return headers;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters";
|
|
2
|
+
|
|
3
|
+
export class TranslateFileParameters extends BaseParameters {
|
|
4
|
+
setSourceLocaleId(sourceLocaleId: string): TranslateFileParameters {
|
|
5
|
+
this.set("sourceLocaleId", sourceLocaleId);
|
|
6
|
+
return this;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setTargetLocaleIds(targetLocaleIds: string[]): TranslateFileParameters {
|
|
10
|
+
this.set("targetLocaleIds", targetLocaleIds);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import string2fileStream from "string-to-file-stream";
|
|
3
|
+
import { BaseParameters } from "../../parameters";
|
|
4
|
+
import { FileType } from "../../files/params/file-type";
|
|
5
|
+
|
|
6
|
+
export class UploadFileParameters extends BaseParameters {
|
|
7
|
+
constructor(parameters: Record<string, unknown> = {}) {
|
|
8
|
+
super(parameters);
|
|
9
|
+
|
|
10
|
+
this.set("request", {});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setFileFromLocalFilePath(filePath: string): UploadFileParameters {
|
|
14
|
+
this.set("file", fs.createReadStream(
|
|
15
|
+
fs.realpathSync(filePath)
|
|
16
|
+
));
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setFileContent(fileContent: string): UploadFileParameters {
|
|
21
|
+
this.set("file", string2fileStream(fileContent));
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setFileType(fileType: FileType): UploadFileParameters {
|
|
26
|
+
this.parameters.request.fileType = fileType.toUpperCase();
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/api/files/index.ts
CHANGED
|
@@ -56,7 +56,7 @@ export class SmartlingFilesApi extends SmartlingBaseApi {
|
|
|
56
56
|
): Promise<string> {
|
|
57
57
|
return await this.makeRequest(
|
|
58
58
|
"get",
|
|
59
|
-
`${this.entrypoint}/${projectId}/locales/all/file`,
|
|
59
|
+
`${this.entrypoint}/${projectId}/locales/all/file/zip`,
|
|
60
60
|
Object.assign(params.export(), { fileUri }),
|
|
61
61
|
true
|
|
62
62
|
);
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import { DownloadFileParameters } from "./download-file-parameters";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export class DownloadFileAllTranslationsParameters extends DownloadFileParameters {
|
|
5
|
-
setZipFileName(fileName: string): DownloadFileAllTranslationsParameters {
|
|
6
|
-
this.set("zipFileName", fileName);
|
|
7
|
-
return this;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
export class DownloadFileAllTranslationsParameters extends DownloadFileParameters {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BatchStatus } from "../params/batch-status";
|
|
2
|
+
import { BatchDto } from "./batch-dto";
|
|
3
|
+
|
|
4
|
+
interface BatchListItemDto extends BatchDto {
|
|
5
|
+
status: BatchStatus;
|
|
6
|
+
authorized: boolean;
|
|
7
|
+
translationJobUid: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
createdDate: Date
|
|
10
|
+
modifiedDate: Date
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { BatchListItemDto };
|
package/api/job-batches/index.ts
CHANGED
|
@@ -8,6 +8,9 @@ import { BatchStatusDto } from "./dto/batch-status-dto";
|
|
|
8
8
|
import { BatchDto } from "./dto/batch-dto";
|
|
9
9
|
import { CancelBatchFileParameters } from "./params/cancel-batch-file-parameters";
|
|
10
10
|
import { RegisterBatchFileParameters } from "./params/register-batch-file-parameters";
|
|
11
|
+
import { BatchListItemDto } from "./dto/batch-list-item-dto";
|
|
12
|
+
import { SmartlingListResponse } from "../http/smartling-list-response";
|
|
13
|
+
import { ListBatchesParameters } from "./params/list-batches-parameters";
|
|
11
14
|
|
|
12
15
|
export class SmartlingJobBatchesApi extends SmartlingBaseApi {
|
|
13
16
|
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
|
|
@@ -82,4 +85,14 @@ export class SmartlingJobBatchesApi extends SmartlingBaseApi {
|
|
|
82
85
|
`${this.entrypoint}/${projectId}/batches/${batchUid}`
|
|
83
86
|
);
|
|
84
87
|
}
|
|
88
|
+
|
|
89
|
+
async listBatches(projectId: string, params: ListBatchesParameters
|
|
90
|
+
): Promise<SmartlingListResponse<BatchListItemDto>> {
|
|
91
|
+
return await this.makeRequest(
|
|
92
|
+
"get",
|
|
93
|
+
`${this.entrypoint}/${projectId}/batches`,
|
|
94
|
+
params.export()
|
|
95
|
+
|
|
96
|
+
);
|
|
97
|
+
}
|
|
85
98
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseParameters } from "../../parameters/index";
|
|
2
|
+
import { Order } from "../../parameters/order";
|
|
3
|
+
import { BatchStatus } from "./batch-status";
|
|
4
|
+
|
|
5
|
+
export class ListBatchesParameters extends BaseParameters {
|
|
6
|
+
setTranslationJobUid(uid: string): ListBatchesParameters {
|
|
7
|
+
this.set("translationJobUid", uid);
|
|
8
|
+
|
|
9
|
+
return this;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setLimit(limit: number): ListBatchesParameters {
|
|
13
|
+
if (limit > 0) {
|
|
14
|
+
this.set("limit", limit);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setOffset(offset: number): ListBatchesParameters {
|
|
21
|
+
if (offset >= 0) {
|
|
22
|
+
this.set("offset", offset);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setStatus(status: BatchStatus): ListBatchesParameters {
|
|
29
|
+
this.set("status", status);
|
|
30
|
+
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
setSort(field: "createdDate" | "status", order: Order): ListBatchesParameters {
|
|
35
|
+
this.set("sortBy", field);
|
|
36
|
+
this.set("sortDirection", order.toLowerCase());
|
|
37
|
+
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/error.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detection-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguageDetectionState = void 0;
|
|
4
|
+
var LanguageDetectionState;
|
|
5
|
+
(function (LanguageDetectionState) {
|
|
6
|
+
LanguageDetectionState["QUEUED"] = "QUEUED";
|
|
7
|
+
LanguageDetectionState["FAILED"] = "FAILED";
|
|
8
|
+
LanguageDetectionState["COMPLETED"] = "COMPLETED";
|
|
9
|
+
})(LanguageDetectionState = exports.LanguageDetectionState || (exports.LanguageDetectionState = {}));
|
|
10
|
+
//# sourceMappingURL=language-detection-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detection-state.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAC9B,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;AAC3B,CAAC,EAJW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAIjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Error } from "./error";
|
|
2
|
+
import { LanguageDetectionState } from "./language-detection-state";
|
|
3
|
+
import { LanguageDto } from "./language-dto";
|
|
4
|
+
interface LanguageDetectionStatusDto {
|
|
5
|
+
state: LanguageDetectionState;
|
|
6
|
+
error?: Error;
|
|
7
|
+
detectedSourceLanguages: LanguageDto[];
|
|
8
|
+
}
|
|
9
|
+
export { LanguageDetectionStatusDto };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-detection-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-detection-status-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/language-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MTState = void 0;
|
|
4
|
+
var MTState;
|
|
5
|
+
(function (MTState) {
|
|
6
|
+
MTState["QUEUED"] = "QUEUED";
|
|
7
|
+
MTState["PROCESSING"] = "PROCESSING";
|
|
8
|
+
MTState["FAILED"] = "FAILED";
|
|
9
|
+
MTState["CANCELED"] = "CANCELED";
|
|
10
|
+
MTState["COMPLETED"] = "COMPLETED";
|
|
11
|
+
})(MTState = exports.MTState || (exports.MTState = {}));
|
|
12
|
+
//# sourceMappingURL=mt-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mt-state.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/mt-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAMX;AAND,WAAY,OAAO;IACf,4BAAiB,CAAA;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,gCAAqB,CAAA;IACrB,kCAAuB,CAAA;AAC3B,CAAC,EANW,OAAO,GAAP,eAAO,KAAP,eAAO,QAMlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-locale-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-locale-status-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MTState } from "./mt-state";
|
|
2
|
+
import { Error } from "./error";
|
|
3
|
+
import { TranslationLocaleStatusDto } from "./translation-locale-status-dto";
|
|
4
|
+
interface TranslationStatusDto {
|
|
5
|
+
state: MTState;
|
|
6
|
+
requestedStringCount: number;
|
|
7
|
+
error?: Error;
|
|
8
|
+
localeProcessStatuses: TranslationLocaleStatusDto[];
|
|
9
|
+
}
|
|
10
|
+
export { TranslationStatusDto };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-status-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/translation-status-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploaded-file-dto.js","sourceRoot":"","sources":["../../../../api/file-translations/dto/uploaded-file-dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import { SmartlingBaseApi } from "../base";
|
|
3
|
+
import { SmartlingAuthApi } from "../auth";
|
|
4
|
+
import { Logger } from "../logger";
|
|
5
|
+
import { UploadedFileDto } from "./dto/uploaded-file-dto";
|
|
6
|
+
import { UploadFileParameters } from "./params/upload-file-parameters";
|
|
7
|
+
import { TranslationDto } from "./dto/translation-dto";
|
|
8
|
+
import { TranslateFileParameters } from "./params/translate-file-parameters";
|
|
9
|
+
import { TranslationStatusDto } from "./dto/translation-status-dto";
|
|
10
|
+
import { LanguageDetectionDto } from "./dto/language-detection-dto";
|
|
11
|
+
import { LanguageDetectionStatusDto } from "./dto/language-detection-status-dto";
|
|
12
|
+
export declare class SmartlingFileTranslationsApi extends SmartlingBaseApi {
|
|
13
|
+
constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
|
|
14
|
+
uploadFile(accountUid: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
|
|
15
|
+
translateFile(accountUid: string, fileUid: string, params: TranslateFileParameters): Promise<TranslationDto>;
|
|
16
|
+
getTranslationProgress(accountUid: string, fileUid: string, mtUid: string): Promise<TranslationStatusDto>;
|
|
17
|
+
downloadTranslatedFile(accountUid: string, fileUid: string, mtUid: string, localeId: string): Promise<string>;
|
|
18
|
+
downloadTranslatedFiles(accountUid: string, fileUid: string, mtUid: string): Promise<string>;
|
|
19
|
+
cancelFileTranslation(accountUid: string, fileUid: string, mtUid: string): Promise<void>;
|
|
20
|
+
detectFileLanguage(accountUid: string, fileUid: string): Promise<LanguageDetectionDto>;
|
|
21
|
+
getLanguageDetectionProgress(accountUid: string, fileUid: string, languageDetectionUid: string): Promise<LanguageDetectionStatusDto>;
|
|
22
|
+
static fixContentTypeHeaderCase(form: FormData): Record<string, unknown>;
|
|
23
|
+
}
|