smartling-api-sdk-nodejs 1.5.0 → 1.5.2

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.
@@ -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=AYbms_u9gRVcM-XZbdl1
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYbms_u9gRVcM-XZbdl1
5
+ ceTaskId=AYe0xU8AgRVcM-XZbdri
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYe0xU8AgRVcM-XZbdri
@@ -1,7 +1,7 @@
1
1
  import { SourceFileDto } from "./source-file-dto";
2
2
 
3
3
  interface FullSourceFileDto extends SourceFileDto {
4
- name: string;
4
+ localeIds: Array<string>;
5
5
  }
6
6
 
7
7
  export { FullSourceFileDto };
@@ -1,9 +1,9 @@
1
1
  import { JobDto } from "./job-dto";
2
- import { FullSourceFileDto } from "./full-source-file-dto";
2
+ import { SourceFileDto } from "./source-file-dto";
3
3
 
4
4
  interface JobDetailsDto extends JobDto {
5
5
  priority: string;
6
- sourceFiles: Array<FullSourceFileDto>;
6
+ sourceFiles: Array<SourceFileDto>;
7
7
  }
8
8
 
9
9
  export { JobDetailsDto };
@@ -1,5 +1,7 @@
1
1
  interface SourceFileDto {
2
2
  uri: string;
3
+ name: string;
4
+ fileUid: string;
3
5
  }
4
6
 
5
7
  export { SourceFileDto };
package/api/jobs/index.ts CHANGED
@@ -11,12 +11,13 @@ import { JobDetailsDto } from "./dto/job-details-dto";
11
11
  import { SmartlingListResponse } from "../http/smartling-list-response";
12
12
  import { BaseJobDto } from "./dto/base-job-dto";
13
13
  import { FileProgressDto } from "./dto/file-progress-dto";
14
- import { SourceFileDto } from "./dto/source-file-dto";
15
14
  import { RemovedFileDto } from "./dto/removed-file-dto";
16
15
  import { JobProgressDto } from "./dto/job-progress-dto";
17
16
  import { JobProgressParameters } from "./params/job-progress-parameters";
18
17
  import { CancelJobParameters } from "./params/cancel-job-parameters";
18
+ import { CloseJobParameters } from "./params/close-job-parameters";
19
19
  import { SearchJobsParameters } from "./params/search-jobs-parameters";
20
+ import { FullSourceFileDto } from "./dto/full-source-file-dto";
20
21
 
21
22
  export class SmartlingJobsApi extends SmartlingBaseApi {
22
23
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
@@ -42,7 +43,7 @@ export class SmartlingJobsApi extends SmartlingBaseApi {
42
43
 
43
44
  async getJobFiles(
44
45
  projectId: string, translationJobUid: string, params: ListJobFilesParameters
45
- ): Promise<SmartlingListResponse<SourceFileDto>> {
46
+ ): Promise<SmartlingListResponse<FullSourceFileDto>> {
46
47
  return await this.makeRequest(
47
48
  "get",
48
49
  `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/files`,
@@ -110,4 +111,14 @@ export class SmartlingJobsApi extends SmartlingBaseApi {
110
111
  JSON.stringify(params.export())
111
112
  );
112
113
  }
114
+
115
+ async closeJob(
116
+ projectId: string, translationJobUid: string, params: CloseJobParameters
117
+ ): Promise<void> {
118
+ await this.makeRequest(
119
+ "post",
120
+ `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/close`,
121
+ JSON.stringify(params.export())
122
+ );
123
+ }
113
124
  }
@@ -0,0 +1,5 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+
3
+ export class CloseJobParameters extends BaseParameters {
4
+
5
+ }
@@ -1,5 +1,5 @@
1
1
  import { SourceFileDto } from "./source-file-dto";
2
2
  interface FullSourceFileDto extends SourceFileDto {
3
- name: string;
3
+ localeIds: Array<string>;
4
4
  }
5
5
  export { FullSourceFileDto };
@@ -1,7 +1,7 @@
1
1
  import { JobDto } from "./job-dto";
2
- import { FullSourceFileDto } from "./full-source-file-dto";
2
+ import { SourceFileDto } from "./source-file-dto";
3
3
  interface JobDetailsDto extends JobDto {
4
4
  priority: string;
5
- sourceFiles: Array<FullSourceFileDto>;
5
+ sourceFiles: Array<SourceFileDto>;
6
6
  }
7
7
  export { JobDetailsDto };
@@ -1,4 +1,6 @@
1
1
  interface SourceFileDto {
2
2
  uri: string;
3
+ name: string;
4
+ fileUid: string;
3
5
  }
4
6
  export { SourceFileDto };
@@ -11,21 +11,23 @@ import { JobDetailsDto } from "./dto/job-details-dto";
11
11
  import { SmartlingListResponse } from "../http/smartling-list-response";
12
12
  import { BaseJobDto } from "./dto/base-job-dto";
13
13
  import { FileProgressDto } from "./dto/file-progress-dto";
14
- import { SourceFileDto } from "./dto/source-file-dto";
15
14
  import { RemovedFileDto } from "./dto/removed-file-dto";
16
15
  import { JobProgressDto } from "./dto/job-progress-dto";
17
16
  import { JobProgressParameters } from "./params/job-progress-parameters";
18
17
  import { CancelJobParameters } from "./params/cancel-job-parameters";
18
+ import { CloseJobParameters } from "./params/close-job-parameters";
19
19
  import { SearchJobsParameters } from "./params/search-jobs-parameters";
20
+ import { FullSourceFileDto } from "./dto/full-source-file-dto";
20
21
  export declare class SmartlingJobsApi extends SmartlingBaseApi {
21
22
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
22
23
  createJob(projectId: string, params: CreateJobParameters): Promise<JobDto>;
23
24
  getJob(projectId: string, translationJobUid: string): Promise<JobDetailsDto>;
24
- getJobFiles(projectId: string, translationJobUid: string, params: ListJobFilesParameters): Promise<SmartlingListResponse<SourceFileDto>>;
25
+ getJobFiles(projectId: string, translationJobUid: string, params: ListJobFilesParameters): Promise<SmartlingListResponse<FullSourceFileDto>>;
25
26
  listJobs(projectId: string, params: ListJobsParameters): Promise<SmartlingListResponse<BaseJobDto>>;
26
27
  searchJobs(projectId: string, params: SearchJobsParameters): Promise<SmartlingListResponse<BaseJobDto>>;
27
28
  removeFileFromJob(projectId: string, translationJobUid: string, params: RemoveFileParameters): Promise<RemovedFileDto>;
28
29
  getJobProgress(projectId: string, translationJobUid: string, params: JobProgressParameters): Promise<JobProgressDto>;
29
30
  getJobFileProgress(projectId: string, translationJobUid: string, params: FileProgressParameters): Promise<FileProgressDto>;
30
31
  cancelJob(projectId: string, translationJobUid: string, params: CancelJobParameters): Promise<void>;
32
+ closeJob(projectId: string, translationJobUid: string, params: CloseJobParameters): Promise<void>;
31
33
  }
@@ -62,6 +62,11 @@ class SmartlingJobsApi extends index_1.SmartlingBaseApi {
62
62
  yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/cancel`, JSON.stringify(params.export()));
63
63
  });
64
64
  }
65
+ closeJob(projectId, translationJobUid, params) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ yield this.makeRequest("post", `${this.entrypoint}/${projectId}/jobs/${translationJobUid}/close`, JSON.stringify(params.export()));
68
+ });
69
+ }
65
70
  }
66
71
  exports.SmartlingJobsApi = SmartlingJobsApi;
67
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/jobs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiD;AAoBjD,MAAa,gBAAiB,SAAQ,wBAAgB;IAClD,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,uBAAuB,CAAC;IACpE,CAAC;IAEK,SAAS,CAAC,SAAiB,EAAE,MAA2B;;YAC1D,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EACtC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,MAAM,CAAC,SAAiB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;YAE5E,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,gBAAgB,EACzE,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,SAAS,CACX,SAAiB,EAAE,iBAAyB,EAAE,MAA2B;;YAEzE,MAAM,IAAI,CAAC,WAAW,CAClB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,SAAS,EAClE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;IAEK,QAAQ,CACV,SAAiB,EAAE,iBAAyB,EAAE,MAA0B;;YAExE,MAAM,IAAI,CAAC,WAAW,CAClB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,SAAS,iBAAiB,QAAQ,EACjE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAClC,CAAC;QACN,CAAC;KAAA;CACJ;AAtGD,4CAsGC"}
@@ -0,0 +1,3 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ export declare class CloseJobParameters extends BaseParameters {
3
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloseJobParameters = void 0;
4
+ const index_1 = require("../../parameters/index");
5
+ class CloseJobParameters extends index_1.BaseParameters {
6
+ }
7
+ exports.CloseJobParameters = CloseJobParameters;
8
+ //# sourceMappingURL=close-job-parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-job-parameters.js","sourceRoot":"","sources":["../../../../api/jobs/params/close-job-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAExD,MAAa,kBAAmB,SAAQ,sBAAc;CAErD;AAFD,gDAEC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "scripts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "scripts": {
package/test/jobs.spec.ts CHANGED
@@ -11,6 +11,7 @@ import { JobStatus } from "../api/jobs/params/job-status";
11
11
  import { RemoveFileParameters } from "../api/jobs/params/remove-file-parameters";
12
12
  import { JobProgressParameters } from "../api/jobs/params/job-progress-parameters";
13
13
  import { CancelJobParameters } from "../api/jobs/params/cancel-job-parameters";
14
+ import { CloseJobParameters } from "../api/jobs/params/close-job-parameters";
14
15
 
15
16
  describe("SmartlingJobsAPI class tests.", () => {
16
17
  const projectId = "testProjectId";
@@ -225,5 +226,26 @@ describe("SmartlingJobsAPI class tests.", () => {
225
226
  }
226
227
  );
227
228
  });
229
+
230
+ it("Close job", async () => {
231
+ const params = new CloseJobParameters();
232
+
233
+ await jobApi.closeJob(projectId, jobUid, params);
234
+
235
+ sinon.assert.calledOnce(jobServiceApiFetchStub);
236
+ sinon.assert.calledWithExactly(
237
+ jobServiceApiFetchStub,
238
+ `https://test.com/jobs-api/v3/projects/${projectId}/jobs/${jobUid}/close`,
239
+ {
240
+ body: "{}",
241
+ headers: {
242
+ Authorization: "test_token_type test_access_token",
243
+ "Content-Type": "application/json",
244
+ "User-Agent": "test_user_agent"
245
+ },
246
+ method: "post"
247
+ }
248
+ );
249
+ });
228
250
  });
229
251
  });