smartling-api-sdk-nodejs 2.25.0 → 2.27.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=AZnNaTBHjzZQmJO_qatF
6
- ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZnNaTBHjzZQmJO_qatF
5
+ ceTaskId=AZnkDu2E5pumWNxcJ_G-
6
+ ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AZnkDu2E5pumWNxcJ_G-
@@ -28,4 +28,13 @@ export class SmartlingReportServiceApi extends SmartlingBaseApi {
28
28
  params.export()
29
29
  );
30
30
  }
31
+
32
+ async getWordsCountReportCsv(params: WordCountParameters): Promise<string> {
33
+ return await this.makeRequest(
34
+ "GET",
35
+ `${this.entrypoint}/word-count/csv`,
36
+ params.export(),
37
+ true
38
+ );
39
+ }
31
40
  }
@@ -9,4 +9,5 @@ export declare class SmartlingReportServiceApi extends SmartlingBaseApi {
9
9
  constructor(smartlingApiBaseUrl: string, authApi: AccessTokenProvider, logger: Logger);
10
10
  getWorkflowStepTypes(): Promise<ReportResponse<StepTypeDto>>;
11
11
  getWordsCountReport(params: WordCountParameters): Promise<ReportResponse<WordCountDto>>;
12
+ getWordsCountReportCsv(params: WordCountParameters): Promise<string>;
12
13
  }
@@ -27,6 +27,11 @@ class SmartlingReportServiceApi extends base_1.SmartlingBaseApi {
27
27
  return yield this.makeRequest("GET", `${this.entrypoint}/word-count`, params.export());
28
28
  });
29
29
  }
30
+ getWordsCountReportCsv(params) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return yield this.makeRequest("GET", `${this.entrypoint}/word-count/csv`, params.export(), true);
33
+ });
34
+ }
30
35
  }
31
36
  exports.SmartlingReportServiceApi = SmartlingReportServiceApi;
32
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/reports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,kCAA2C;AAI3C,MAAa,yBAA0B,SAAQ,uBAAgB;IAC3D,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;IAEK,oBAAoB;;YACtB,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,mCAAmC,CACxD,CAAC;QACN,CAAC;KAAA;IAEK,mBAAmB,CAAC,MAA2B;;YACjD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,EAC/B,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;CACJ;AAtBD,8DAsBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/reports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,kCAA2C;AAI3C,MAAa,yBAA0B,SAAQ,uBAAgB;IAC3D,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;IAEK,oBAAoB;;YACtB,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,mCAAmC,CACxD,CAAC;QACN,CAAC;KAAA;IAEK,mBAAmB,CAAC,MAA2B;;YACjD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,aAAa,EAC/B,MAAM,CAAC,MAAM,EAAE,CAClB,CAAC;QACN,CAAC;KAAA;IAEK,sBAAsB,CAAC,MAA2B;;YACpD,OAAO,MAAM,IAAI,CAAC,WAAW,CACzB,KAAK,EACL,GAAG,IAAI,CAAC,UAAU,iBAAiB,EACnC,MAAM,CAAC,MAAM,EAAE,EACf,IAAI,CACP,CAAC;QACN,CAAC;KAAA;CACJ;AA/BD,8DA+BC"}
package/built/index.d.ts CHANGED
@@ -161,4 +161,10 @@ export * from "./api/mt/index";
161
161
  export * from "./api/mt/params/smartling-mt-parameters";
162
162
  export * from "./api/mt/params/source-text-item";
163
163
  export * from "./api/mt/dto/translation-text-item-dto";
164
+ export * from "./api/reports/index";
165
+ export * from "./api/reports/dto/report-response";
166
+ export * from "./api/reports/dto/step-types";
167
+ export * from "./api/reports/dto/word-count-dto";
168
+ export * from "./api/reports/params/word-count-parameters";
169
+ export * from "./api/reports/params/date-formatter";
164
170
  export * from "./api/webhooks";
package/built/index.js CHANGED
@@ -177,5 +177,11 @@ __exportStar(require("./api/mt/index"), exports);
177
177
  __exportStar(require("./api/mt/params/smartling-mt-parameters"), exports);
178
178
  __exportStar(require("./api/mt/params/source-text-item"), exports);
179
179
  __exportStar(require("./api/mt/dto/translation-text-item-dto"), exports);
180
+ __exportStar(require("./api/reports/index"), exports);
181
+ __exportStar(require("./api/reports/dto/report-response"), exports);
182
+ __exportStar(require("./api/reports/dto/step-types"), exports);
183
+ __exportStar(require("./api/reports/dto/word-count-dto"), exports);
184
+ __exportStar(require("./api/reports/params/word-count-parameters"), exports);
185
+ __exportStar(require("./api/reports/params/date-formatter"), exports);
180
186
  __exportStar(require("./api/webhooks"), exports);
181
187
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"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 {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,kEAAgD;AAChD,0EAAwD;AACxD,mEAAiD;AACjD,mDAAiC;AACjC,qEAAmD;AACnD,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,wFAAsE;AACtE,qFAAmE;AACnE,4FAA0E;AAC1E,+FAA6E;AAC7E,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,6EAA2D;AAC3D,oEAAkD;AAClD,+DAA6C;AAC7C,4EAA0D;AAC1D,kFAAgE;AAChE,kFAAgE;AAChE,+EAA6D;AAC7D,oEAAkD;AAClD,yDAAuC;AACvC,oEAAkD;AAClD,2EAAyD;AACzD,sEAAoD;AACpD,mEAAiD;AACjD,uFAAqE;AACrE,oFAAkE;AAClE,iFAA+D;AAC/D,uEAAqD;AACrD,yEAAuD;AACvD,sEAAoD;AACpD,uEAAqD;AACrD,+DAA6C;AAC7C,0EAAwD;AACxD,qEAAmD;AACnD,uEAAqD;AACrD,sEAAoD;AACpD,oEAAkD;AAClD,wEAAsD;AACtD,oEAAkD;AAClD,qEAAmD;AACnD,qEAAmD;AACnD,0DAAwC;AACxC,kEAAgD;AAChD,uEAAqD;AACrD,yEAAuD;AACvD,yEAAuD;AACvD,4EAA0D;AAC1D,oFAAkE;AAClE,oFAAkE;AAClE,mFAAiE;AACjE,kFAAgE;AAChE,wFAA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AAiD;AACjD,yEAAuD;AACvD,sDAAoC;AACpC,oEAAkD;AAClD,+DAA6C;AAC7C,mEAAiD;AACjD,6EAA2D;AAC3D,sEAAoD;AACpD,iDAA+B"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.25.0",
3
+ "version": "2.27.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
package/index.ts CHANGED
@@ -161,4 +161,10 @@ export * from "./api/mt/index";
161
161
  export * from "./api/mt/params/smartling-mt-parameters";
162
162
  export * from "./api/mt/params/source-text-item";
163
163
  export * from "./api/mt/dto/translation-text-item-dto";
164
+ export * from "./api/reports/index";
165
+ export * from "./api/reports/dto/report-response";
166
+ export * from "./api/reports/dto/step-types";
167
+ export * from "./api/reports/dto/word-count-dto";
168
+ export * from "./api/reports/params/word-count-parameters";
169
+ export * from "./api/reports/params/date-formatter";
164
170
  export * from "./api/webhooks";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartling-api-sdk-nodejs",
3
- "version": "2.25.0",
3
+ "version": "2.27.0",
4
4
  "description": "Package for Smartling API",
5
5
  "main": "built/index.js",
6
6
  "engines": {
@@ -143,4 +143,59 @@ describe("SmartlingReportServiceApi class tests.", () => {
143
143
  assert.deepStrictEqual(result, payload);
144
144
  });
145
145
  });
146
+
147
+ describe("getWordsCountReportCsv", () => {
148
+ it("Should call CSV endpoint and return CSV string", async () => {
149
+ const csvResponse = `projectId,projectName,targetLocaleId,jobUid,jobName,translationResourceName,workflowStepType,wordCount,characterCount
150
+ project123,Test Project,es-ES,job123,Test Job,Test Resource,TRANSLATION,1000,5000
151
+ project123,Test Project,fr-FR,job456,Another Job,Another Resource,REVIEW,500,2500`;
152
+
153
+ responseMockTextStub.returns(csvResponse);
154
+
155
+ const startDate = new Date("2024-01-01T00:00:00Z");
156
+ const endDate = new Date("2024-12-31T23:59:59Z");
157
+
158
+ const params = new WordCountParameters()
159
+ .setStartDate(startDate)
160
+ .setEndDate(endDate)
161
+ .setAccountUid("account123")
162
+ .setProjectIds(["project123"])
163
+ .setUserUids(["user123"])
164
+ .setAgencyUid("agency123")
165
+ .setJobUids(["job123"])
166
+ .setTargetLocaleIds(["fr-FR"])
167
+ .setWorkflowStepTypes(["TRANSLATION", "REVIEW"])
168
+ .setFields("projectId,projectName,targetLocaleId,jobUid,jobName,translationResourceName,workflowStepType,wordCount,characterCount")
169
+ .setLimit(100)
170
+ .setOffset(0);
171
+
172
+ const result = await reportServiceApi.getWordsCountReportCsv(params);
173
+
174
+ sinon.assert.calledOnce(reportServiceApiFetchStub);
175
+ const callArgs = reportServiceApiFetchStub.getCall(0).args;
176
+
177
+ assert.strictEqual(callArgs[0], "https://test.com/reports-api/v3/word-count/csv"
178
+ + "?startDate=2024-01-01"
179
+ + "&endDate=2024-12-31"
180
+ + "&accountUid=account123"
181
+ + "&projectIds=project123"
182
+ + "&userUids=user123"
183
+ + "&agencyUid=agency123"
184
+ + "&jobUids=job123"
185
+ + "&targetLocaleIds=fr-FR"
186
+ + "&workflowStepTypes=TRANSLATION"
187
+ + "&workflowStepTypes=REVIEW"
188
+ + "&fields=projectId%2CprojectName%2CtargetLocaleId%2CjobUid%2CjobName%2CtranslationResourceName%2CworkflowStepType%2CwordCount%2CcharacterCount"
189
+ + "&limit=100"
190
+ + "&offset=0");
191
+ assert.strictEqual(callArgs[1].method, "GET");
192
+ assert.deepStrictEqual(callArgs[1].headers, {
193
+ Authorization: "test_token_type test_access_token",
194
+ "Content-Type": "application/json",
195
+ "User-Agent": "test_user_agent"
196
+ });
197
+
198
+ assert.strictEqual(result, csvResponse);
199
+ });
200
+ });
146
201
  });