smartling-api-sdk-nodejs 2.31.1 → 2.33.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 (50) hide show
  1. package/api/base/base-api.ts +3 -1
  2. package/api/files/dto/imported-file-dto.ts +14 -0
  3. package/api/files/index.ts +22 -0
  4. package/api/files/params/import-file-parameters.ts +49 -0
  5. package/api/files/params/translation-state.ts +6 -0
  6. package/api/http/smartling-bare-list-response.ts +5 -0
  7. package/api/http/smartling-list-response.ts +3 -2
  8. package/api/vendors/dto/content-assignment-dto.ts +29 -0
  9. package/api/vendors/dto/workflow-step-type.ts +15 -0
  10. package/api/vendors/index.ts +23 -0
  11. package/built/api/base/base-api.js +3 -1
  12. package/built/api/base/base-api.js.map +1 -1
  13. package/built/api/files/dto/imported-file-dto.d.ts +12 -0
  14. package/built/api/files/dto/imported-file-dto.js +3 -0
  15. package/built/api/files/dto/imported-file-dto.js.map +1 -0
  16. package/built/api/files/index.d.ts +3 -0
  17. package/built/api/files/index.js +10 -0
  18. package/built/api/files/index.js.map +1 -1
  19. package/built/api/files/params/import-file-parameters.d.ts +12 -0
  20. package/built/api/files/params/import-file-parameters.js +68 -0
  21. package/built/api/files/params/import-file-parameters.js.map +1 -0
  22. package/built/api/files/params/translation-state.d.ts +6 -0
  23. package/built/api/files/params/translation-state.js +11 -0
  24. package/built/api/files/params/translation-state.js.map +1 -0
  25. package/built/api/http/smartling-bare-list-response.d.ts +4 -0
  26. package/built/api/http/smartling-bare-list-response.js +3 -0
  27. package/built/api/http/smartling-bare-list-response.js.map +1 -0
  28. package/built/api/http/smartling-list-response.d.ts +2 -2
  29. package/built/api/vendors/dto/content-assignment-dto.d.ts +27 -0
  30. package/built/api/vendors/dto/content-assignment-dto.js +3 -0
  31. package/built/api/vendors/dto/content-assignment-dto.js.map +1 -0
  32. package/built/api/vendors/dto/workflow-step-type.d.ts +14 -0
  33. package/built/api/vendors/dto/workflow-step-type.js +19 -0
  34. package/built/api/vendors/dto/workflow-step-type.js.map +1 -0
  35. package/built/api/vendors/index.d.ts +9 -0
  36. package/built/api/vendors/index.js +27 -0
  37. package/built/api/vendors/index.js.map +1 -0
  38. package/built/index.d.ts +7 -0
  39. package/built/index.js +7 -0
  40. package/built/index.js.map +1 -1
  41. package/built/package.json +1 -1
  42. package/built/test/files.spec.js +45 -0
  43. package/built/test/files.spec.js.map +1 -1
  44. package/built/test/vendors.spec.d.ts +1 -0
  45. package/built/test/vendors.spec.js +133 -0
  46. package/built/test/vendors.spec.js.map +1 -0
  47. package/index.ts +7 -0
  48. package/package.json +1 -1
  49. package/test/files.spec.ts +109 -0
  50. package/test/vendors.spec.ts +136 -0
@@ -164,7 +164,9 @@ export class SmartlingBaseApi {
164
164
  "actionTime",
165
165
  "publishDate",
166
166
  "lastModified",
167
- "attemptDate"
167
+ "attemptDate",
168
+ "translationJobWorkflowStepDueDate",
169
+ "translationJobOverallDueDate"
168
170
  ];
169
171
 
170
172
  if (dateProperties.includes(key) && value) {
@@ -0,0 +1,14 @@
1
+ interface TranslationImportErrorDto {
2
+ importKey: string;
3
+ stringHashcode: string;
4
+ fileUri: string;
5
+ messages: string[];
6
+ }
7
+
8
+ interface ImportedFileDto {
9
+ wordCount: number;
10
+ stringCount: number;
11
+ translationImportErrors: TranslationImportErrorDto[];
12
+ }
13
+
14
+ export { TranslationImportErrorDto, ImportedFileDto };
@@ -9,6 +9,8 @@ import { FileStatusForAllLocalesDto } from "./dto/file-status-for-all-locales-dt
9
9
  import { SmartlingListResponse } from "../http/smartling-list-response";
10
10
  import { LastModifiedForLocale } from "./dto/last-modified-for-locale-dto";
11
11
  import { UploadedFileDto } from "./dto/uploaded-file-dto";
12
+ import { ImportFileParameters } from "./params/import-file-parameters";
13
+ import { ImportedFileDto } from "./dto/imported-file-dto";
12
14
  import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
13
15
  import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
14
16
  import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
@@ -119,6 +121,26 @@ export class SmartlingFilesApi extends SmartlingBaseFileApi {
119
121
  );
120
122
  }
121
123
 
124
+ async importFile(
125
+ projectId: string,
126
+ locale: string,
127
+ parameters: ImportFileParameters
128
+ ): Promise<ImportedFileDto> {
129
+ const formData = new FormData();
130
+ const exported = parameters.export();
131
+ Object.keys(exported).forEach((key) => {
132
+ formData.append(key, exported[key]);
133
+ });
134
+
135
+ return await this.makeRequest(
136
+ "post",
137
+ `${this.entrypoint}/${projectId}/locales/${locale}/file/import`,
138
+ formData,
139
+ false,
140
+ SmartlingFilesApi.fixContentTypeHeaderCase(formData)
141
+ );
142
+ }
143
+
122
144
  async getRecentlyUploadedFiles(
123
145
  projectId: string,
124
146
  params: RecentlyUploadedFilesParameters
@@ -0,0 +1,49 @@
1
+ import * as fs from "fs";
2
+ import string2fileStream from "string-to-file-stream";
3
+ import { BaseParameters } from "../../parameters/index";
4
+ import { FileType } from "./file-type";
5
+ import { TranslationState } from "./translation-state";
6
+ import { SmartlingException } from "../../exception";
7
+
8
+ export class ImportFileParameters extends BaseParameters {
9
+ setFileFromLocalFilePath(filePath: string): ImportFileParameters {
10
+ this.set("file", fs.createReadStream(
11
+ fs.realpathSync(filePath)
12
+ ));
13
+ return this;
14
+ }
15
+
16
+ setFileContent(fileContent: string): ImportFileParameters {
17
+ this.set("file", string2fileStream(fileContent));
18
+ return this;
19
+ }
20
+
21
+ setFileUri(fileUri: string): ImportFileParameters {
22
+ this.set("fileUri", fileUri);
23
+ return this;
24
+ }
25
+
26
+ setFileType(fileType: FileType): ImportFileParameters {
27
+ this.set("fileType", fileType);
28
+ return this;
29
+ }
30
+
31
+ setTranslationState(translationState: TranslationState): ImportFileParameters {
32
+ this.set("translationState", translationState);
33
+ return this;
34
+ }
35
+
36
+ setOverwrite(overwrite: boolean): ImportFileParameters {
37
+ this.set("overwrite", String(overwrite));
38
+ return this;
39
+ }
40
+
41
+ setCallbackUrl(callbackUrl: string): ImportFileParameters {
42
+ if (callbackUrl && (callbackUrl.length > 255)) {
43
+ throw new SmartlingException("File callback URL should be not greater than 255 characters.");
44
+ }
45
+
46
+ this.set("callbackUrl", callbackUrl);
47
+ return this;
48
+ }
49
+ }
@@ -0,0 +1,6 @@
1
+ export enum TranslationState {
2
+ IN_TRANSLATION = "IN_TRANSLATION",
3
+ IN_EDITING = "IN_EDITING",
4
+ IN_REVIEW = "IN_REVIEW",
5
+ PUBLISHED = "PUBLISHED"
6
+ }
@@ -0,0 +1,5 @@
1
+ interface SmartlingBareListResponse<T> {
2
+ items: Array<T>;
3
+ }
4
+
5
+ export { SmartlingBareListResponse };
@@ -1,6 +1,7 @@
1
- interface SmartlingListResponse<T> {
1
+ import { SmartlingBareListResponse } from "./smartling-bare-list-response";
2
+
3
+ interface SmartlingListResponse<T> extends SmartlingBareListResponse<T> {
2
4
  totalCount: number;
3
- items: Array<T>;
4
5
  }
5
6
 
6
7
  export { SmartlingListResponse };
@@ -0,0 +1,29 @@
1
+ import { WorkflowStepType } from "./workflow-step-type";
2
+
3
+ interface ContentAssignmentDto {
4
+ accountUid: string;
5
+ accountName: string;
6
+ projectUid: string;
7
+ projectName: string;
8
+ localeId: string;
9
+ workflowUid: string;
10
+ workflowName: string;
11
+ workflowStepUid: string;
12
+ workflowStepName: string;
13
+ workflowStepType: WorkflowStepType;
14
+ translationJobUid: string;
15
+ translationJobName: string;
16
+ translationJobWorkflowStepDueDate: Date;
17
+ translationJobOverallDueDate: Date;
18
+ userUid: string | null;
19
+ userFirstName: string | null;
20
+ userLastName: string | null;
21
+ userEmail: string | null;
22
+ agencyUid: string | null;
23
+ agencyName: string | null;
24
+ wordCount: number;
25
+ workflowStepOrder: number;
26
+ assignmentEnabled: boolean;
27
+ }
28
+
29
+ export { ContentAssignmentDto };
@@ -0,0 +1,15 @@
1
+ enum WorkflowStepType {
2
+ AWAITING_AUTHORIZATION = "AWAITING_AUTHORIZATION",
3
+ ANALYSIS = "ANALYSIS",
4
+ WORK_APPROVAL = "WORK_APPROVAL",
5
+ TRANSLATION = "TRANSLATION",
6
+ POST_TRANSLATION__EDIT = "POST_TRANSLATION__EDIT",
7
+ POST_TRANSLATION__REVIEW = "POST_TRANSLATION__REVIEW",
8
+ ADMIN_APPROVAL = "ADMIN_APPROVAL",
9
+ PUBLISH = "PUBLISH",
10
+ POST_TRANSLATION__MONOLINGUAL_REVIEW = "POST_TRANSLATION__MONOLINGUAL_REVIEW",
11
+ POST_TRANSLATION__POST_MACHINE_REVISION = "POST_TRANSLATION__POST_MACHINE_REVISION",
12
+ POST_TRANSLATION__POST_MACHINE_REVISION_PRO = "POST_TRANSLATION__POST_MACHINE_REVISION_PRO"
13
+ }
14
+
15
+ export { WorkflowStepType };
@@ -0,0 +1,23 @@
1
+ import { SmartlingBaseApi } from "../base/index";
2
+ import { AccessTokenProvider } from "../auth/access-token-provider";
3
+ import { Logger } from "../logger";
4
+ import { ContentAssignmentDto } from "./dto/content-assignment-dto";
5
+ import { SmartlingBareListResponse } from "../http/smartling-bare-list-response";
6
+
7
+ export class SmartlingVendorsApi extends SmartlingBaseApi {
8
+ constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger) {
9
+ super(logger);
10
+
11
+ this.authApi = authApi;
12
+ this.entrypoint = `${smartlingApiBaseUrl}/vendors-api/v2`;
13
+ }
14
+
15
+ public async getContentAssignmentsByAccount(
16
+ accountUid: string
17
+ ): Promise<SmartlingBareListResponse<ContentAssignmentDto>> {
18
+ return await this.makeRequest(
19
+ "get",
20
+ `${this.entrypoint}/accounts/${accountUid}/content-assignments`
21
+ );
22
+ }
23
+ }
@@ -126,7 +126,9 @@ class SmartlingBaseApi {
126
126
  "actionTime",
127
127
  "publishDate",
128
128
  "lastModified",
129
- "attemptDate"
129
+ "attemptDate",
130
+ "translationJobWorkflowStepDueDate",
131
+ "translationJobOverallDueDate"
130
132
  ];
131
133
  if (dateProperties.includes(key) && value) {
132
134
  return new Date(value);
@@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code: string;
4
+ fileUri: string;
5
+ messages: string[];
6
+ }
7
+ interface ImportedFileDto {
8
+ wordCount: number;
9
+ stringCount: number;
10
+ translationImportErrors: TranslationImportErrorDto[];
11
+ }
12
+ export { TranslationImportErrorDto, ImportedFileDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=imported-file-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imported-file-dto.js","sourceRoot":"","sources":["../../../../api/files/dto/imported-file-dto.ts"],"names":[],"mappings":""}
@@ -9,6 +9,8 @@ import { FileStatusForAllLocalesDto } from "./dto/file-status-for-all-locales-dt
9
9
  import { SmartlingListResponse } from "../http/smartling-list-response";
10
10
  import { LastModifiedForLocale } from "./dto/last-modified-for-locale-dto";
11
11
  import { UploadedFileDto } from "./dto/uploaded-file-dto";
12
+ import { ImportFileParameters } from "./params/import-file-parameters";
13
+ import { ImportedFileDto } from "./dto/imported-file-dto";
12
14
  import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
13
15
  import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
14
16
  import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
@@ -24,6 +26,7 @@ export declare class SmartlingFilesApi extends SmartlingBaseFileApi {
24
26
  downloadFileAllTranslations(projectId: string, fileUri: string, params: DownloadFileAllTranslationsParameters): Promise<string>;
25
27
  deleteFile(projectId: string, fileUri: string): Promise<boolean>;
26
28
  uploadFile(projectId: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
29
+ importFile(projectId: string, locale: string, parameters: ImportFileParameters): Promise<ImportedFileDto>;
27
30
  getRecentlyUploadedFiles(projectId: string, params: RecentlyUploadedFilesParameters): Promise<SmartlingListResponse<FileStatusForProjectDto>>;
28
31
  downloadMultipleFilesTranslations(projectId: string, params: DownloadMultipleFilesTranslationsParameters): Promise<ArrayBuffer | null>;
29
32
  static fixContentTypeHeaderCase(form: FormData): Record<string, unknown>;
@@ -64,6 +64,16 @@ class SmartlingFilesApi extends base_1.SmartlingBaseFileApi {
64
64
  return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/file`, formData, false, SmartlingFilesApi.fixContentTypeHeaderCase(formData));
65
65
  });
66
66
  }
67
+ importFile(projectId, locale, parameters) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const formData = new form_data_1.default();
70
+ const exported = parameters.export();
71
+ Object.keys(exported).forEach((key) => {
72
+ formData.append(key, exported[key]);
73
+ });
74
+ return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/locales/${locale}/file/import`, formData, false, SmartlingFilesApi.fixContentTypeHeaderCase(formData));
75
+ });
76
+ }
67
77
  getRecentlyUploadedFiles(projectId, params) {
68
78
  return __awaiter(this, void 0, void 0, function* () {
69
79
  return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/files/list`, params.export());
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,kCAA+C;AAc/C,wEAAmE;AAGnE,MAAa,iBAAkB,SAAQ,2BAAoB;IACvD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,wBAAwB,CAAC;IACrE,CAAC;IAEK,sBAAsB,CACxB,SAAiB,EAAE,OAAe;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,cAAc,EAC7C,EAAE,OAAO,EAAE,CACd,CAAC;QACN,CAAC;KAAA;IAEK,eAAe,CACjB,SAAiB,EAAE,OAAe;;YAElC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,U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AAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAC/B,qCAAgB,CAAC,YAAY,CAChC,CAAC;QACN,CAAC;KAAA;IAED,MAAM,CAAC,wBAAwB,CAAC,IAAc;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAElC,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAElD,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAhKD,8CAgKC"}
@@ -0,0 +1,12 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ import { FileType } from "./file-type";
3
+ import { TranslationState } from "./translation-state";
4
+ export declare class ImportFileParameters extends BaseParameters {
5
+ setFileFromLocalFilePath(filePath: string): ImportFileParameters;
6
+ setFileContent(fileContent: string): ImportFileParameters;
7
+ setFileUri(fileUri: string): ImportFileParameters;
8
+ setFileType(fileType: FileType): ImportFileParameters;
9
+ setTranslationState(translationState: TranslationState): ImportFileParameters;
10
+ setOverwrite(overwrite: boolean): ImportFileParameters;
11
+ setCallbackUrl(callbackUrl: string): ImportFileParameters;
12
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ImportFileParameters = void 0;
30
+ const fs = __importStar(require("fs"));
31
+ const string_to_file_stream_1 = __importDefault(require("string-to-file-stream"));
32
+ const index_1 = require("../../parameters/index");
33
+ const exception_1 = require("../../exception");
34
+ class ImportFileParameters extends index_1.BaseParameters {
35
+ setFileFromLocalFilePath(filePath) {
36
+ this.set("file", fs.createReadStream(fs.realpathSync(filePath)));
37
+ return this;
38
+ }
39
+ setFileContent(fileContent) {
40
+ this.set("file", (0, string_to_file_stream_1.default)(fileContent));
41
+ return this;
42
+ }
43
+ setFileUri(fileUri) {
44
+ this.set("fileUri", fileUri);
45
+ return this;
46
+ }
47
+ setFileType(fileType) {
48
+ this.set("fileType", fileType);
49
+ return this;
50
+ }
51
+ setTranslationState(translationState) {
52
+ this.set("translationState", translationState);
53
+ return this;
54
+ }
55
+ setOverwrite(overwrite) {
56
+ this.set("overwrite", String(overwrite));
57
+ return this;
58
+ }
59
+ setCallbackUrl(callbackUrl) {
60
+ if (callbackUrl && (callbackUrl.length > 255)) {
61
+ throw new exception_1.SmartlingException("File callback URL should be not greater than 255 characters.");
62
+ }
63
+ this.set("callbackUrl", callbackUrl);
64
+ return this;
65
+ }
66
+ }
67
+ exports.ImportFileParameters = ImportFileParameters;
68
+ //# sourceMappingURL=import-file-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/import-file-parameters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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1,6 @@
1
+ export declare enum TranslationState {
2
+ IN_TRANSLATION = "IN_TRANSLATION",
3
+ IN_EDITING = "IN_EDITING",
4
+ IN_REVIEW = "IN_REVIEW",
5
+ PUBLISHED = "PUBLISHED"
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranslationState = void 0;
4
+ var TranslationState;
5
+ (function (TranslationState) {
6
+ TranslationState["IN_TRANSLATION"] = "IN_TRANSLATION";
7
+ TranslationState["IN_EDITING"] = "IN_EDITING";
8
+ TranslationState["IN_REVIEW"] = "IN_REVIEW";
9
+ TranslationState["PUBLISHED"] = "PUBLISHED";
10
+ })(TranslationState = exports.TranslationState || (exports.TranslationState = {}));
11
+ //# sourceMappingURL=translation-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation-state.js","sourceRoot":"","sources":["../../../../api/files/params/translation-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,qDAAiC,CAAA;IACjC,6CAAyB,CAAA;IACzB,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;AAC3B,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B"}
@@ -0,0 +1,4 @@
1
+ interface SmartlingBareListResponse<T> {
2
+ items: Array<T>;
3
+ }
4
+ export { SmartlingBareListResponse };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=smartling-bare-list-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartling-bare-list-response.js","sourceRoot":"","sources":["../../../api/http/smartling-bare-list-response.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- interface SmartlingListResponse<T> {
1
+ import { SmartlingBareListResponse } from "./smartling-bare-list-response";
2
+ interface SmartlingListResponse<T> extends SmartlingBareListResponse<T> {
2
3
  totalCount: number;
3
- items: Array<T>;
4
4
  }
5
5
  export { SmartlingListResponse };
@@ -0,0 +1,27 @@
1
+ import { WorkflowStepType } from "./workflow-step-type";
2
+ interface ContentAssignmentDto {
3
+ accountUid: string;
4
+ accountName: string;
5
+ projectUid: string;
6
+ projectName: string;
7
+ localeId: string;
8
+ workflowUid: string;
9
+ workflowName: string;
10
+ workflowStepUid: string;
11
+ workflowStepName: string;
12
+ workflowStepType: WorkflowStepType;
13
+ translationJobUid: string;
14
+ translationJobName: string;
15
+ translationJobWorkflowStepDueDate: Date;
16
+ translationJobOverallDueDate: Date;
17
+ userUid: string | null;
18
+ userFirstName: string | null;
19
+ userLastName: string | null;
20
+ userEmail: string | null;
21
+ agencyUid: string | null;
22
+ agencyName: string | null;
23
+ wordCount: number;
24
+ workflowStepOrder: number;
25
+ assignmentEnabled: boolean;
26
+ }
27
+ export { ContentAssignmentDto };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=content-assignment-dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-assignment-dto.js","sourceRoot":"","sources":["../../../../api/vendors/dto/content-assignment-dto.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ declare enum WorkflowStepType {
2
+ AWAITING_AUTHORIZATION = "AWAITING_AUTHORIZATION",
3
+ ANALYSIS = "ANALYSIS",
4
+ WORK_APPROVAL = "WORK_APPROVAL",
5
+ TRANSLATION = "TRANSLATION",
6
+ POST_TRANSLATION__EDIT = "POST_TRANSLATION__EDIT",
7
+ POST_TRANSLATION__REVIEW = "POST_TRANSLATION__REVIEW",
8
+ ADMIN_APPROVAL = "ADMIN_APPROVAL",
9
+ PUBLISH = "PUBLISH",
10
+ POST_TRANSLATION__MONOLINGUAL_REVIEW = "POST_TRANSLATION__MONOLINGUAL_REVIEW",
11
+ POST_TRANSLATION__POST_MACHINE_REVISION = "POST_TRANSLATION__POST_MACHINE_REVISION",
12
+ POST_TRANSLATION__POST_MACHINE_REVISION_PRO = "POST_TRANSLATION__POST_MACHINE_REVISION_PRO"
13
+ }
14
+ export { WorkflowStepType };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowStepType = void 0;
4
+ var WorkflowStepType;
5
+ (function (WorkflowStepType) {
6
+ WorkflowStepType["AWAITING_AUTHORIZATION"] = "AWAITING_AUTHORIZATION";
7
+ WorkflowStepType["ANALYSIS"] = "ANALYSIS";
8
+ WorkflowStepType["WORK_APPROVAL"] = "WORK_APPROVAL";
9
+ WorkflowStepType["TRANSLATION"] = "TRANSLATION";
10
+ WorkflowStepType["POST_TRANSLATION__EDIT"] = "POST_TRANSLATION__EDIT";
11
+ WorkflowStepType["POST_TRANSLATION__REVIEW"] = "POST_TRANSLATION__REVIEW";
12
+ WorkflowStepType["ADMIN_APPROVAL"] = "ADMIN_APPROVAL";
13
+ WorkflowStepType["PUBLISH"] = "PUBLISH";
14
+ WorkflowStepType["POST_TRANSLATION__MONOLINGUAL_REVIEW"] = "POST_TRANSLATION__MONOLINGUAL_REVIEW";
15
+ WorkflowStepType["POST_TRANSLATION__POST_MACHINE_REVISION"] = "POST_TRANSLATION__POST_MACHINE_REVISION";
16
+ WorkflowStepType["POST_TRANSLATION__POST_MACHINE_REVISION_PRO"] = "POST_TRANSLATION__POST_MACHINE_REVISION_PRO";
17
+ })(WorkflowStepType || (WorkflowStepType = {}));
18
+ exports.WorkflowStepType = WorkflowStepType;
19
+ //# sourceMappingURL=workflow-step-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-step-type.js","sourceRoot":"","sources":["../../../../api/vendors/dto/workflow-step-type.ts"],"names":[],"mappings":";;;AAAA,IAAK,gBAYJ;AAZD,WAAK,gBAAgB;IACjB,qEAAiD,CAAA;IACjD,yCAAqB,CAAA;IACrB,mDAA+B,CAAA;IAC/B,+CAA2B,CAAA;IAC3B,qEAAiD,CAAA;IACjD,yEAAqD,CAAA;IACrD,qDAAiC,CAAA;IACjC,uCAAmB,CAAA;IACnB,iGAA6E,CAAA;IAC7E,uGAAmF,CAAA;IACnF,+GAA2F,CAAA;AAC/F,CAAC,EAZI,gBAAgB,KAAhB,gBAAgB,QAYpB;AAEQ,4CAAgB"}
@@ -0,0 +1,9 @@
1
+ import { SmartlingBaseApi } from "../base/index";
2
+ import { AccessTokenProvider } from "../auth/access-token-provider";
3
+ import { Logger } from "../logger";
4
+ import { ContentAssignmentDto } from "./dto/content-assignment-dto";
5
+ import { SmartlingBareListResponse } from "../http/smartling-bare-list-response";
6
+ export declare class SmartlingVendorsApi extends SmartlingBaseApi {
7
+ constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
8
+ getContentAssignmentsByAccount(accountUid: string): Promise<SmartlingBareListResponse<ContentAssignmentDto>>;
9
+ }
@@ -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.SmartlingVendorsApi = void 0;
13
+ const index_1 = require("../base/index");
14
+ class SmartlingVendorsApi extends index_1.SmartlingBaseApi {
15
+ constructor(smartlingApiBaseUrl, authApi, logger) {
16
+ super(logger);
17
+ this.authApi = authApi;
18
+ this.entrypoint = `${smartlingApiBaseUrl}/vendors-api/v2`;
19
+ }
20
+ getContentAssignmentsByAccount(accountUid) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ return yield this.makeRequest("get", `${this.entrypoint}/accounts/${accountUid}/content-assignments`);
23
+ });
24
+ }
25
+ }
26
+ exports.SmartlingVendorsApi = SmartlingVendorsApi;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/vendors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAMjD,MAAa,mBAAoB,SAAQ,wBAAgB;IACrD,YAAY,mBAA2B,EAAE,OAA4B,EAAE,MAAc;QACjF,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,mBAAmB,iBAAiB,CAAC;IAC9D,CAAC;IAEY,8BAA8B,CACvC,UAAkB;;YAElB,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,UAAU,sBAAsB,CAClE,CAAC;QACN,CAAC;KAAA;CACJ;AAhBD,kDAgBC"}
package/built/index.d.ts CHANGED
@@ -48,10 +48,13 @@ export * from "./api/files/params/file-type";
48
48
  export * from "./api/files/params/filename-mode";
49
49
  export * from "./api/files/params/translation-file-name-mode";
50
50
  export * from "./api/files/params/upload-file-parameters";
51
+ export * from "./api/files/params/import-file-parameters";
52
+ export * from "./api/files/params/translation-state";
51
53
  export * from "./api/files/dto/file-status-for-all-locales-dto";
52
54
  export * from "./api/files/dto/file-status-for-locale-item-dto";
53
55
  export * from "./api/files/dto/last-modified-for-locale-dto";
54
56
  export * from "./api/files/dto/uploaded-file-dto";
57
+ export * from "./api/files/dto/imported-file-dto";
55
58
  export * from "./api/glossaries/index";
56
59
  export * from "./api/glossaries/dto/glossary-dto";
57
60
  export * from "./api/glossaries/dto/fallback-locale-dto";
@@ -176,3 +179,7 @@ export * from "./api/reports/dto/word-count-dto";
176
179
  export * from "./api/reports/params/word-count-parameters";
177
180
  export * from "./api/reports/params/date-formatter";
178
181
  export * from "./api/webhooks";
182
+ export * from "./api/http/smartling-bare-list-response";
183
+ export * from "./api/vendors/index";
184
+ export * from "./api/vendors/dto/content-assignment-dto";
185
+ export * from "./api/vendors/dto/workflow-step-type";
package/built/index.js CHANGED
@@ -64,10 +64,13 @@ __exportStar(require("./api/files/params/file-type"), exports);
64
64
  __exportStar(require("./api/files/params/filename-mode"), exports);
65
65
  __exportStar(require("./api/files/params/translation-file-name-mode"), exports);
66
66
  __exportStar(require("./api/files/params/upload-file-parameters"), exports);
67
+ __exportStar(require("./api/files/params/import-file-parameters"), exports);
68
+ __exportStar(require("./api/files/params/translation-state"), exports);
67
69
  __exportStar(require("./api/files/dto/file-status-for-all-locales-dto"), exports);
68
70
  __exportStar(require("./api/files/dto/file-status-for-locale-item-dto"), exports);
69
71
  __exportStar(require("./api/files/dto/last-modified-for-locale-dto"), exports);
70
72
  __exportStar(require("./api/files/dto/uploaded-file-dto"), exports);
73
+ __exportStar(require("./api/files/dto/imported-file-dto"), exports);
71
74
  __exportStar(require("./api/glossaries/index"), exports);
72
75
  __exportStar(require("./api/glossaries/dto/glossary-dto"), exports);
73
76
  __exportStar(require("./api/glossaries/dto/fallback-locale-dto"), exports);
@@ -192,4 +195,8 @@ __exportStar(require("./api/reports/dto/word-count-dto"), exports);
192
195
  __exportStar(require("./api/reports/params/word-count-parameters"), exports);
193
196
  __exportStar(require("./api/reports/params/date-formatter"), exports);
194
197
  __exportStar(require("./api/webhooks"), exports);
198
+ __exportStar(require("./api/http/smartling-bare-list-response"), exports);
199
+ __exportStar(require("./api/vendors/index"), exports);
200
+ __exportStar(require("./api/vendors/dto/content-assignment-dto"), exports);
201
+ __exportStar(require("./api/vendors/dto/workflow-step-type"), exports);
195
202
  //# sourceMappingURL=index.js.map