smartling-api-sdk-nodejs 1.4.1 → 1.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/files/params/download-file-parameters.ts +12 -0
- package/built/api/files/params/download-file-parameters.d.ts +2 -0
- package/built/api/files/params/download-file-parameters.js +8 -0
- package/built/api/files/params/download-file-parameters.js.map +1 -1
- package/built/package.json +1 -1
- package/package.json +1 -1
- package/test/files.spec.ts +88 -22
|
@@ -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=AYbms_u9gRVcM-XZbdl1
|
|
6
|
+
ceTaskUrl=https://sonar-next.connectors.stg.smartling.net/api/ce/task?id=AYbms_u9gRVcM-XZbdl1
|
|
@@ -13,4 +13,16 @@ export class DownloadFileParameters extends BaseParameters {
|
|
|
13
13
|
|
|
14
14
|
return this;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
includeOriginalStrings(): DownloadFileParameters {
|
|
18
|
+
this.set("includeOriginalStrings", true);
|
|
19
|
+
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
excludeOriginalStrings(): DownloadFileParameters {
|
|
24
|
+
this.set("includeOriginalStrings", false);
|
|
25
|
+
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
16
28
|
}
|
|
@@ -3,4 +3,6 @@ import { RetrievalType } from "./retrieval-type";
|
|
|
3
3
|
export declare class DownloadFileParameters extends BaseParameters {
|
|
4
4
|
enableDebugMode(): DownloadFileParameters;
|
|
5
5
|
setRetrievalType(retrievalType: RetrievalType): DownloadFileParameters;
|
|
6
|
+
includeOriginalStrings(): DownloadFileParameters;
|
|
7
|
+
excludeOriginalStrings(): DownloadFileParameters;
|
|
6
8
|
}
|
|
@@ -11,6 +11,14 @@ class DownloadFileParameters extends index_1.BaseParameters {
|
|
|
11
11
|
this.set("retrievalType", retrievalType);
|
|
12
12
|
return this;
|
|
13
13
|
}
|
|
14
|
+
includeOriginalStrings() {
|
|
15
|
+
this.set("includeOriginalStrings", true);
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
excludeOriginalStrings() {
|
|
19
|
+
this.set("includeOriginalStrings", false);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
exports.DownloadFileParameters = DownloadFileParameters;
|
|
16
24
|
//# sourceMappingURL=download-file-parameters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-file-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAGxD,MAAa,sBAAuB,SAAQ,sBAAc;IACtD,eAAe;QACX,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB,CAAC,aAA4B;QACzC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;
|
|
1
|
+
{"version":3,"file":"download-file-parameters.js","sourceRoot":"","sources":["../../../../api/files/params/download-file-parameters.ts"],"names":[],"mappings":";;;AAAA,kDAAwD;AAGxD,MAAa,sBAAuB,SAAQ,sBAAc;IACtD,eAAe;QACX,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB,CAAC,aAA4B;QACzC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAsB;QAClB,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sBAAsB;QAClB,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxBD,wDAwBC"}
|
package/built/package.json
CHANGED
package/package.json
CHANGED
package/test/files.spec.ts
CHANGED
|
@@ -74,29 +74,95 @@ describe("SmartlingFilesApi class tests.", () => {
|
|
|
74
74
|
);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
describe("Download file", () => {
|
|
78
78
|
const localeId = "fr-FR";
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
let params: DownloadFileParameters;
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
params = new DownloadFileParameters();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("Download file with debugMode enabled and retrievalType published", async () => {
|
|
86
|
+
params
|
|
87
|
+
.setRetrievalType(RetrievalType.PUBLISHED)
|
|
88
|
+
.enableDebugMode();
|
|
89
|
+
|
|
90
|
+
await filesApi.downloadFile(projectId, fileUri, localeId, params);
|
|
91
|
+
|
|
92
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
93
|
+
sinon.assert.calledWithExactly(
|
|
94
|
+
filesApiFetchStub,
|
|
95
|
+
`https://test.com/files-api/v2/projects/${projectId}/locales/${localeId}/file?retrievalType=published&debugMode=1&fileUri=testFileUri`,
|
|
96
|
+
{
|
|
97
|
+
headers: {
|
|
98
|
+
Authorization: "test_token_type test_access_token",
|
|
99
|
+
"Content-Type": "application/json",
|
|
100
|
+
"User-Agent": "test_user_agent"
|
|
101
|
+
},
|
|
102
|
+
method: "get"
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("Download file with debugMode disabled and retrievalType published", async () => {
|
|
108
|
+
params.setRetrievalType(RetrievalType.PUBLISHED);
|
|
109
|
+
|
|
110
|
+
await filesApi.downloadFile(projectId, fileUri, localeId, params);
|
|
111
|
+
|
|
112
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
113
|
+
sinon.assert.calledWithExactly(
|
|
114
|
+
filesApiFetchStub,
|
|
115
|
+
`https://test.com/files-api/v2/projects/${projectId}/locales/${localeId}/file?retrievalType=published&fileUri=testFileUri`,
|
|
116
|
+
{
|
|
117
|
+
headers: {
|
|
118
|
+
Authorization: "test_token_type test_access_token",
|
|
119
|
+
"Content-Type": "application/json",
|
|
120
|
+
"User-Agent": "test_user_agent"
|
|
121
|
+
},
|
|
122
|
+
method: "get"
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("Download file with includeOriginalStrings enabled", async() => {
|
|
128
|
+
params.setRetrievalType(RetrievalType.PUBLISHED).includeOriginalStrings();
|
|
129
|
+
|
|
130
|
+
await filesApi.downloadFile(projectId, fileUri, localeId, params);
|
|
131
|
+
|
|
132
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
133
|
+
sinon.assert.calledWithExactly(
|
|
134
|
+
filesApiFetchStub,
|
|
135
|
+
`https://test.com/files-api/v2/projects/${projectId}/locales/${localeId}/file?retrievalType=published&includeOriginalStrings=true&fileUri=testFileUri`,
|
|
136
|
+
{
|
|
137
|
+
headers: {
|
|
138
|
+
Authorization: "test_token_type test_access_token",
|
|
139
|
+
"Content-Type": "application/json",
|
|
140
|
+
"User-Agent": "test_user_agent"
|
|
141
|
+
},
|
|
142
|
+
method: "get"
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("Download file with includeOriginalStrings disabled", async() => {
|
|
148
|
+
params.setRetrievalType(RetrievalType.PUBLISHED).excludeOriginalStrings();
|
|
149
|
+
|
|
150
|
+
await filesApi.downloadFile(projectId, fileUri, localeId, params);
|
|
151
|
+
|
|
152
|
+
sinon.assert.calledOnce(filesApiFetchStub);
|
|
153
|
+
sinon.assert.calledWithExactly(
|
|
154
|
+
filesApiFetchStub,
|
|
155
|
+
`https://test.com/files-api/v2/projects/${projectId}/locales/${localeId}/file?retrievalType=published&includeOriginalStrings=false&fileUri=testFileUri`,
|
|
156
|
+
{
|
|
157
|
+
headers: {
|
|
158
|
+
Authorization: "test_token_type test_access_token",
|
|
159
|
+
"Content-Type": "application/json",
|
|
160
|
+
"User-Agent": "test_user_agent"
|
|
161
|
+
},
|
|
162
|
+
method: "get"
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
});
|
|
100
166
|
});
|
|
101
167
|
|
|
102
168
|
it("Delete file", async () => {
|