smartling-api-sdk-nodejs 2.9.1 → 2.10.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.
@@ -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=AY3rmpPVRe7rJHsZ61td
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AY3rmpPVRe7rJHsZ61td
5
+ ceTaskId=AY9TuQLS7SpYu_MF-cEQ
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AY9TuQLS7SpYu_MF-cEQ
@@ -10,6 +10,7 @@ import { LastModifiedForLocale } from "./dto/last-modified-for-locale-dto";
10
10
  import { UploadedFileDto } from "./dto/uploaded-file-dto";
11
11
  import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
12
12
  import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
13
+ import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
13
14
 
14
15
  export class SmartlingFilesApi extends SmartlingBaseApi {
15
16
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger) {
@@ -95,11 +96,13 @@ export class SmartlingFilesApi extends SmartlingBaseApi {
95
96
  }
96
97
 
97
98
  async getRecentlyUploadedFiles(
98
- projectId: string
99
+ projectId: string,
100
+ params: RecentlyUploadedFilesParameters
99
101
  ): Promise<SmartlingListResponse<FileStatusForProjectDto>> {
100
102
  return await this.makeRequest(
101
103
  "get",
102
- `${this.entrypoint}/${projectId}/files/list`
104
+ `${this.entrypoint}/${projectId}/files/list`,
105
+ params.export()
103
106
  );
104
107
  }
105
108
 
@@ -0,0 +1,30 @@
1
+ import { SmartlingException } from "../../exception";
2
+ import { BaseParameters } from "../../parameters/index";
3
+
4
+ export class RecentlyUploadedFilesParameters extends BaseParameters {
5
+ setUriMask(uriMask: string): RecentlyUploadedFilesParameters {
6
+ this.set("uriMask", uriMask);
7
+
8
+ return this;
9
+ }
10
+
11
+ setLimit(limit: number): RecentlyUploadedFilesParameters {
12
+ if (limit > 0) {
13
+ this.set("limit", limit);
14
+
15
+ return this;
16
+ }
17
+
18
+ throw new SmartlingException("Limit must be > 0");
19
+ }
20
+
21
+ setOffset(offset: number): RecentlyUploadedFilesParameters {
22
+ if (offset >= 0) {
23
+ this.set("offset", offset);
24
+
25
+ return this;
26
+ }
27
+
28
+ throw new SmartlingException("Offset must be >= 0");
29
+ }
30
+ }
@@ -10,6 +10,7 @@ import { LastModifiedForLocale } from "./dto/last-modified-for-locale-dto";
10
10
  import { UploadedFileDto } from "./dto/uploaded-file-dto";
11
11
  import { FileStatusForProjectDto } from "./dto/file-status-for-project-dto";
12
12
  import { DownloadFileAllTranslationsParameters } from "./params/download-file-all-translations-parameters";
13
+ import { RecentlyUploadedFilesParameters } from "./params/recently-uploaded-files";
13
14
  export declare class SmartlingFilesApi extends SmartlingBaseApi {
14
15
  constructor(smartlingApiBaseUrl: string, authApi: SmartlingAuthApi, logger: Logger);
15
16
  getStatusForAllLocales(projectId: string, fileUri: string): Promise<FileStatusForAllLocalesDto>;
@@ -18,6 +19,6 @@ export declare class SmartlingFilesApi extends SmartlingBaseApi {
18
19
  downloadFileAllTranslations(projectId: string, fileUri: string, params: DownloadFileAllTranslationsParameters): Promise<string>;
19
20
  deleteFile(projectId: string, fileUri: string): Promise<boolean>;
20
21
  uploadFile(projectId: string, parameters: UploadFileParameters): Promise<UploadedFileDto>;
21
- getRecentlyUploadedFiles(projectId: string): Promise<SmartlingListResponse<FileStatusForProjectDto>>;
22
+ getRecentlyUploadedFiles(projectId: string, params: RecentlyUploadedFilesParameters): Promise<SmartlingListResponse<FileStatusForProjectDto>>;
22
23
  static fixContentTypeHeaderCase(form: FormData): Record<string, unknown>;
23
24
  }
@@ -58,9 +58,9 @@ class SmartlingFilesApi extends index_1.SmartlingBaseApi {
58
58
  return yield this.makeRequest("post", `${this.entrypoint}/${projectId}/file`, formData, false, SmartlingFilesApi.fixContentTypeHeaderCase(formData));
59
59
  });
60
60
  }
61
- getRecentlyUploadedFiles(projectId) {
61
+ getRecentlyUploadedFiles(projectId, params) {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
- return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/files/list`);
63
+ return yield this.makeRequest("get", `${this.entrypoint}/${projectId}/files/list`, params.export());
64
64
  });
65
65
  }
66
66
  static fixContentTypeHeaderCase(form) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,yCAAiD;AAYjD,MAAa,iBAAkB,SAAQ,wBAAgB;IACnD,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,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,UAAU,IAAI,SAAS,qBAAqB,EACpD,EAAE,OAAO,EAAE,CACd,CAAC;QACN,CAAC;KAAA;IAEK,YAAY,CACd,SAAiB,EAAE,OAAe,EAAE,MAAc,EAAE,MAA8B;;YAElF,OAAO,MAAM,IAAI,C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EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,MAAM,EACN,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EACtC,QAAQ,EACR,KAAK,EACL,iBAAiB,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CACvD,CAAC;QACN,CAAC;KAAA;IAEK,wBAAwB,CAC1B,SAAiB,EACjB,MAAuC;;YAEvC,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,IAAI,SAAS,aAAa,EAC5C,MAAM,CAAC,MAAM,EAAE,CAClB,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;AAtGD,8CAsGC"}
@@ -0,0 +1,6 @@
1
+ import { BaseParameters } from "../../parameters/index";
2
+ export declare class RecentlyUploadedFilesParameters extends BaseParameters {
3
+ setUriMask(uriMask: string): RecentlyUploadedFilesParameters;
4
+ setLimit(limit: number): RecentlyUploadedFilesParameters;
5
+ setOffset(offset: number): RecentlyUploadedFilesParameters;
6
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecentlyUploadedFilesParameters = void 0;
4
+ const exception_1 = require("../../exception");
5
+ const index_1 = require("../../parameters/index");
6
+ class RecentlyUploadedFilesParameters extends index_1.BaseParameters {
7
+ setUriMask(uriMask) {
8
+ this.set("uriMask", uriMask);
9
+ return this;
10
+ }
11
+ setLimit(limit) {
12
+ if (limit > 0) {
13
+ this.set("limit", limit);
14
+ return this;
15
+ }
16
+ throw new exception_1.SmartlingException("Limit must be > 0");
17
+ }
18
+ setOffset(offset) {
19
+ if (offset >= 0) {
20
+ this.set("offset", offset);
21
+ return this;
22
+ }
23
+ throw new exception_1.SmartlingException("Offset must be >= 0");
24
+ }
25
+ }
26
+ exports.RecentlyUploadedFilesParameters = RecentlyUploadedFilesParameters;
27
+ //# sourceMappingURL=recently-uploaded-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recently-uploaded-files.js","sourceRoot":"","sources":["../../../../api/files/params/recently-uploaded-files.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,kDAAwD;AAExD,MAAa,+BAAgC,SAAQ,sBAAc;IAC/D,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,CAAC,KAAa;QAClB,IAAI,KAAK,GAAG,CAAC,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAEzB,OAAO,IAAI,CAAC;SACf;QAED,MAAM,IAAI,8BAAkB,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;IAED,SAAS,CAAC,MAAc;QACpB,IAAI,MAAM,IAAI,CAAC,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAE3B,OAAO,IAAI,CAAC;SACf;QAED,MAAM,IAAI,8BAAkB,CAAC,qBAAqB,CAAC,CAAC;IACxD,CAAC;CACJ;AA1BD,0EA0BC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
@@ -10,6 +10,7 @@ import { SmartlingAuthApi } from "../api/auth/index";
10
10
  import { FileType } from "../api/files/params/file-type";
11
11
  import { streamToString } from "./stream-to-string";
12
12
  import { DownloadFileAllTranslationsParameters } from "../api/files/params/download-file-all-translations-parameters";
13
+ import { RecentlyUploadedFilesParameters } from "../api/files/params/recently-uploaded-files";
13
14
 
14
15
  describe("SmartlingFilesApi class tests.", () => {
15
16
  const projectId = "testProjectId";
@@ -58,12 +59,17 @@ describe("SmartlingFilesApi class tests.", () => {
58
59
  });
59
60
 
60
61
  it("Get recently uploaded files for project", async () => {
61
- await filesApi.getRecentlyUploadedFiles(projectId);
62
+ const params = new RecentlyUploadedFilesParameters()
63
+ .setOffset(0)
64
+ .setLimit(99)
65
+ .setUriMask("TEST");
66
+
67
+ await filesApi.getRecentlyUploadedFiles(projectId, params);
62
68
 
63
69
  sinon.assert.calledOnce(filesApiFetchStub);
64
70
  sinon.assert.calledWithExactly(
65
71
  filesApiFetchStub,
66
- `https://test.com/files-api/v2/projects/${projectId}/files/list`,
72
+ `https://test.com/files-api/v2/projects/${projectId}/files/list?offset=0&limit=99&uriMask=TEST`,
67
73
  {
68
74
  headers: {
69
75
  Authorization: "test_token_type test_access_token",