@stackfactor/client-api 1.1.11 → 1.1.12-9.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.
- package/.eslintrc.json +13 -0
- package/{exports.js → exports.ts} +14 -0
- package/index.ts +1 -0
- package/lib/{actionNotifications.js → actionNotifications.ts} +21 -11
- package/lib/{address.js → address.ts} +4 -5
- package/lib/aiAssistant.ts +197 -0
- package/lib/avatar.ts +41 -0
- package/lib/axiosClient.ts +92 -0
- package/lib/{config.js → config.ts} +20 -9
- package/lib/{constants.js → constants.ts} +11 -41
- package/lib/{dashboard.js → dashboard.ts} +19 -10
- package/lib/{departmentTrainingPlans.js → departmentTrainingPlans.ts} +63 -32
- package/lib/{groups.js → groups.ts} +68 -29
- package/lib/{integration.js → integration.ts} +103 -47
- package/lib/{integrationConfiguration.js → integrationConfiguration.ts} +27 -22
- package/lib/integrations/{contentGenerator.js → contentGenerator.ts} +38 -18
- package/lib/{learningContent.js → learningContent.ts} +218 -62
- package/lib/{learningPath.js → learningPath.ts} +57 -30
- package/lib/{logger.js → logger.ts} +18 -8
- package/lib/microSkillsQuizes.ts +70 -0
- package/lib/quotas.ts +59 -0
- package/lib/{role.js → role.ts} +117 -69
- package/lib/{roleTemplate.js → roleTemplate.ts} +65 -30
- package/lib/security.ts +99 -0
- package/lib/{skill.js → skill.ts} +125 -87
- package/lib/{skillAssessments.js → skillAssessmentTestingSession.ts} +63 -16
- package/lib/skillAssessments.ts +192 -0
- package/lib/{skillTemplate.js → skillTemplate.ts} +73 -42
- package/lib/talentTransfromation.ts +126 -0
- package/lib/{teams.js → teams.ts} +73 -38
- package/lib/{tenants.js → tenants.ts} +17 -10
- package/lib/{trainingPlans.js → trainingPlans.ts} +159 -56
- package/lib/trainingPlansProficiencyLevels.ts +132 -0
- package/lib/{userInformation.js → userInformation.ts} +27 -26
- package/lib/{users.js → users.ts} +239 -140
- package/lib/utils.ts +64 -0
- package/package.json +12 -1
- package/index.js +0 -3
- package/lib/axiosClient.js +0 -85
- package/lib/skillAssessmentTestingSession.js +0 -148
- package/lib/utils.js +0 -48
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { client } from "./axiosClient.js";
|
|
2
2
|
|
|
3
|
+
interface LearningContentData {
|
|
4
|
+
data?: object;
|
|
5
|
+
id?: string;
|
|
6
|
+
comments?: string;
|
|
7
|
+
learningcontentid?: string;
|
|
8
|
+
microSkillId?: string;
|
|
9
|
+
tags?: object;
|
|
10
|
+
watch?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface GenerateLearningActivityContentData {
|
|
14
|
+
learningObjectives: string;
|
|
15
|
+
learningActivity: object;
|
|
16
|
+
microSkillId: string;
|
|
17
|
+
sections: string[];
|
|
18
|
+
otherLearningActivities?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
3
21
|
/**
|
|
4
22
|
* Create learning content and set information
|
|
5
23
|
* @param {Object} data Learning content data
|
|
6
24
|
* @param {String} token Authorization token
|
|
7
25
|
* @returns {Promise<Object>} The created learning content
|
|
8
26
|
*/
|
|
9
|
-
const createLearningContent = (
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
const createLearningContent = (
|
|
28
|
+
data: object,
|
|
29
|
+
token: string
|
|
30
|
+
): Promise<object> => {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const requestData: LearningContentData = {
|
|
12
33
|
data: data,
|
|
13
34
|
};
|
|
14
35
|
let confirmationRequest = client.put(
|
|
@@ -35,12 +56,16 @@ const createLearningContent = (data, token) => {
|
|
|
35
56
|
* @param {String} token Authorization token
|
|
36
57
|
* @returns {Promise<Object>} The response from the server
|
|
37
58
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
const deleteLearningContent = (
|
|
60
|
+
id: string,
|
|
61
|
+
comments: string,
|
|
62
|
+
token: string
|
|
63
|
+
): Promise<object> => {
|
|
64
|
+
const data: LearningContentData = {
|
|
40
65
|
id: id,
|
|
41
66
|
};
|
|
42
67
|
if (comments) data.comments = comments;
|
|
43
|
-
return new Promise(
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
44
69
|
const request = client.delete(`api/v1/learningcontent/`, {
|
|
45
70
|
headers: { authorization: token },
|
|
46
71
|
data: data,
|
|
@@ -61,8 +86,11 @@ export const deleteLearningContent = (id, comments, token) => {
|
|
|
61
86
|
* @param {String} token Authorization token
|
|
62
87
|
* @returns {Promise<Object>} The response from the server
|
|
63
88
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
const discardLearningContentChanges = (
|
|
90
|
+
id: string,
|
|
91
|
+
token: string
|
|
92
|
+
): Promise<object> => {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
66
94
|
const data = {};
|
|
67
95
|
const request = client.get(`api/v1/learningcontent/discard/${id}`, {
|
|
68
96
|
headers: { authorization: token },
|
|
@@ -80,25 +108,33 @@ export const discardLearningContentChanges = (id, token) => {
|
|
|
80
108
|
|
|
81
109
|
/**
|
|
82
110
|
* Generate the learning activity content
|
|
111
|
+
* @param {String} learningObjectives
|
|
83
112
|
* @param {String} skillId
|
|
84
113
|
* @param {String} microSkillId
|
|
85
114
|
* @param {Object} learningActivity
|
|
115
|
+
* @param {List<String>} otherLearningActivities
|
|
86
116
|
* @param {List<String>} sections
|
|
87
117
|
* @param {String} token
|
|
88
118
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
const generateLearningActivityContent = (
|
|
120
|
+
learningObjectives: string,
|
|
121
|
+
skillId: string,
|
|
122
|
+
microSkillId: string,
|
|
123
|
+
learningActivity: object,
|
|
124
|
+
otherLearningActivities: string[],
|
|
125
|
+
sections: string[],
|
|
126
|
+
token: string
|
|
127
|
+
): Promise<object> => {
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
const requestData: GenerateLearningActivityContentData = {
|
|
130
|
+
learningObjectives: learningObjectives,
|
|
98
131
|
learningActivity: learningActivity,
|
|
99
132
|
microSkillId: microSkillId,
|
|
100
133
|
sections: sections,
|
|
101
134
|
};
|
|
135
|
+
if (otherLearningActivities) {
|
|
136
|
+
requestData.otherLearningActivities = otherLearningActivities;
|
|
137
|
+
}
|
|
102
138
|
const request = client.post(
|
|
103
139
|
`api/v1/learningcontent/generatelearningactivitycontent/${skillId}`,
|
|
104
140
|
requestData,
|
|
@@ -116,6 +152,37 @@ export const generateLearningActivityContent = (
|
|
|
116
152
|
});
|
|
117
153
|
};
|
|
118
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Generate micro skill test knowledge
|
|
157
|
+
* @param {String} microSkill
|
|
158
|
+
* @param {String} token
|
|
159
|
+
* @returns {Promise<Object>}
|
|
160
|
+
*/
|
|
161
|
+
const generateMicroSkillTestKnowledge = (
|
|
162
|
+
microSkill: string,
|
|
163
|
+
token: string
|
|
164
|
+
): Promise<object> => {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
let data = {
|
|
167
|
+
microSkill: microSkill,
|
|
168
|
+
};
|
|
169
|
+
let confirmationRequest = client.post(
|
|
170
|
+
`api/v1/learningcontent/generatemicroskilltestknowledge`,
|
|
171
|
+
data,
|
|
172
|
+
{
|
|
173
|
+
headers: { authorization: token },
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
confirmationRequest
|
|
177
|
+
.then((response) => {
|
|
178
|
+
resolve(response.data);
|
|
179
|
+
})
|
|
180
|
+
.catch((error) => {
|
|
181
|
+
reject(error);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
119
186
|
/**
|
|
120
187
|
* Get the learning content information by id
|
|
121
188
|
* @param {String} id The id of the learning content
|
|
@@ -123,8 +190,12 @@ export const generateLearningActivityContent = (
|
|
|
123
190
|
* @param {String} token Authorization token
|
|
124
191
|
* @returns {Promise<Object>} The response from the server
|
|
125
192
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
193
|
+
const getLearningContentInformationById = (
|
|
194
|
+
id: string,
|
|
195
|
+
version: string,
|
|
196
|
+
token: string
|
|
197
|
+
): Promise<object> => {
|
|
198
|
+
return new Promise((resolve, reject) => {
|
|
128
199
|
let confirmationRequest = client.get(
|
|
129
200
|
`api/v1/learningcontent/${id}/${version}`,
|
|
130
201
|
{
|
|
@@ -149,14 +220,14 @@ export const getLearningContentInformationById = (id, version, token) => {
|
|
|
149
220
|
* @param {String} token Authorization token
|
|
150
221
|
* @returns {Promise<Array<Object>>} The list of available content
|
|
151
222
|
*/
|
|
152
|
-
|
|
153
|
-
filter,
|
|
154
|
-
version,
|
|
155
|
-
includeDeleted,
|
|
156
|
-
token
|
|
157
|
-
) => {
|
|
158
|
-
return new Promise(
|
|
159
|
-
const requestData = {
|
|
223
|
+
const getLearningContentList = (
|
|
224
|
+
filter: string[],
|
|
225
|
+
version: string,
|
|
226
|
+
includeDeleted: boolean,
|
|
227
|
+
token: string
|
|
228
|
+
): Promise<object[]> => {
|
|
229
|
+
return new Promise((resolve, reject) => {
|
|
230
|
+
const requestData: { version: string; includeDeleted: boolean; filter?: string[] } = {
|
|
160
231
|
version: version,
|
|
161
232
|
includeDeleted: includeDeleted,
|
|
162
233
|
};
|
|
@@ -178,6 +249,35 @@ export const getLearningContentList = (
|
|
|
178
249
|
});
|
|
179
250
|
};
|
|
180
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Migrate learning content storage
|
|
254
|
+
* @param {String} id The id of the content to be migrated
|
|
255
|
+
* @param {String} token Authorization token
|
|
256
|
+
* @returns {Promise<Object>} The response from the server
|
|
257
|
+
*/
|
|
258
|
+
const migrateLearningContentStorageType = (
|
|
259
|
+
id: string,
|
|
260
|
+
token: string
|
|
261
|
+
): Promise<object> => {
|
|
262
|
+
return new Promise((resolve, reject) => {
|
|
263
|
+
let data = {};
|
|
264
|
+
let confirmationRequest = client.post(
|
|
265
|
+
`api/v1/learningcontent/migratestorage/${id}`,
|
|
266
|
+
data,
|
|
267
|
+
{
|
|
268
|
+
headers: { authorization: token },
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
confirmationRequest
|
|
272
|
+
.then((response) => {
|
|
273
|
+
resolve(response.data);
|
|
274
|
+
})
|
|
275
|
+
.catch((error) => {
|
|
276
|
+
reject(error);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
|
|
181
281
|
/**
|
|
182
282
|
* Publish learning content
|
|
183
283
|
* @param {String} id The id of the content to be published
|
|
@@ -185,9 +285,13 @@ export const getLearningContentList = (
|
|
|
185
285
|
* @param {String} token Authorization token
|
|
186
286
|
* @returns {Promise<Object>} The response from the server
|
|
187
287
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
288
|
+
const publishLearningContent = (
|
|
289
|
+
id: string,
|
|
290
|
+
comments: string,
|
|
291
|
+
token: string
|
|
292
|
+
): Promise<object> => {
|
|
293
|
+
return new Promise((resolve, reject) => {
|
|
294
|
+
let data: LearningContentData = {};
|
|
191
295
|
if (comments) data.comments = comments;
|
|
192
296
|
|
|
193
297
|
let confirmationRequest = client.post(
|
|
@@ -214,9 +318,13 @@ export const publishLearningContent = (id, comments, token) => {
|
|
|
214
318
|
* @param {String} token Authorization token
|
|
215
319
|
* @returns {Promise<Object>} The updated learning content
|
|
216
320
|
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
321
|
+
const setLearningContentInformation = (
|
|
322
|
+
id: string,
|
|
323
|
+
data: object,
|
|
324
|
+
token: string
|
|
325
|
+
): Promise<object> => {
|
|
326
|
+
return new Promise((resolve, reject) => {
|
|
327
|
+
const requestData: LearningContentData = {
|
|
220
328
|
data: data,
|
|
221
329
|
id: id,
|
|
222
330
|
};
|
|
@@ -237,26 +345,65 @@ export const setLearningContentInformation = (id, data, token) => {
|
|
|
237
345
|
});
|
|
238
346
|
};
|
|
239
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Set partial content information
|
|
350
|
+
* @param {String} id
|
|
351
|
+
* @param {Object} data
|
|
352
|
+
* @param {String} token
|
|
353
|
+
* @returns {Promise<Object>}
|
|
354
|
+
*/
|
|
355
|
+
const setLearningContentPartialContentInformation = (
|
|
356
|
+
id: string,
|
|
357
|
+
data: object,
|
|
358
|
+
token: string
|
|
359
|
+
): Promise<object> => {
|
|
360
|
+
return new Promise((resolve, reject) => {
|
|
361
|
+
const requestData: LearningContentData = {
|
|
362
|
+
data: data,
|
|
363
|
+
id: id,
|
|
364
|
+
};
|
|
365
|
+
let confirmationRequest = client.post(
|
|
366
|
+
`api/v1/learningcontent/updatepartialcontent/${id}`,
|
|
367
|
+
requestData,
|
|
368
|
+
{
|
|
369
|
+
headers: { authorization: token },
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
confirmationRequest
|
|
373
|
+
.then((response) => {
|
|
374
|
+
resolve(response.data);
|
|
375
|
+
})
|
|
376
|
+
.catch((error) => {
|
|
377
|
+
reject(error);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
|
|
240
382
|
/**
|
|
241
383
|
* Set the content for a specific learning activity
|
|
242
384
|
* @param {String} id
|
|
243
385
|
* @param {String} learningcontentid
|
|
386
|
+
* @param {String} microSkillId
|
|
244
387
|
* @param {Object} data
|
|
245
388
|
* @param {String} token
|
|
246
|
-
* @returns {Promise<String>} OK word if the operation was
|
|
389
|
+
* @returns {Promise<String>} OK word if the operation was successful
|
|
247
390
|
*/
|
|
248
|
-
|
|
249
|
-
id,
|
|
250
|
-
learningcontentid,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
391
|
+
const setLearningContentLearningContentInformation = (
|
|
392
|
+
id: string,
|
|
393
|
+
learningcontentid: string,
|
|
394
|
+
microSkillId: string,
|
|
395
|
+
data: object,
|
|
396
|
+
token: string
|
|
397
|
+
): Promise<string> => {
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
const requestData: LearningContentData = {
|
|
256
400
|
data: data,
|
|
401
|
+
id: id,
|
|
402
|
+
learningcontentid: learningcontentid,
|
|
403
|
+
microSkillId: microSkillId,
|
|
257
404
|
};
|
|
258
405
|
let confirmationRequest = client.post(
|
|
259
|
-
`api/v1/learningcontent/updatelearningcontent
|
|
406
|
+
`api/v1/learningcontent/updatelearningcontent/`,
|
|
260
407
|
requestData,
|
|
261
408
|
{
|
|
262
409
|
headers: { authorization: token },
|
|
@@ -278,16 +425,16 @@ export const setLearningContentLearningContentInformation = (
|
|
|
278
425
|
* @param {String} microskillid
|
|
279
426
|
* @param {Object} data
|
|
280
427
|
* @param {String} token
|
|
281
|
-
* @returns {Promise<String>} OK word if the operation was
|
|
428
|
+
* @returns {Promise<String>} OK word if the operation was successful
|
|
282
429
|
*/
|
|
283
|
-
|
|
284
|
-
id,
|
|
285
|
-
microskillid,
|
|
286
|
-
data,
|
|
287
|
-
token
|
|
288
|
-
) => {
|
|
289
|
-
return new Promise(
|
|
290
|
-
const requestData = {
|
|
430
|
+
const setLearningContentLearningMicroSkillContentInformation = (
|
|
431
|
+
id: string,
|
|
432
|
+
microskillid: string,
|
|
433
|
+
data: object,
|
|
434
|
+
token: string
|
|
435
|
+
): Promise<string> => {
|
|
436
|
+
return new Promise((resolve, reject) => {
|
|
437
|
+
const requestData: LearningContentData = {
|
|
291
438
|
data: data,
|
|
292
439
|
};
|
|
293
440
|
let confirmationRequest = client.post(
|
|
@@ -313,9 +460,13 @@ export const setMicroSkillLearningContentInformation = (
|
|
|
313
460
|
* @param {Object} tags Updated learning content tags
|
|
314
461
|
* @param {String} token Authorization token
|
|
315
462
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
463
|
+
const setLearningContentTags = (
|
|
464
|
+
id: string,
|
|
465
|
+
tags: object,
|
|
466
|
+
token: string
|
|
467
|
+
): Promise<object> => {
|
|
468
|
+
return new Promise((resolve, reject) => {
|
|
469
|
+
const requestData: LearningContentData = {
|
|
319
470
|
tags: tags,
|
|
320
471
|
id: id,
|
|
321
472
|
};
|
|
@@ -342,9 +493,13 @@ export const setLearningContentTags = (id, tags, token) => {
|
|
|
342
493
|
* @param {Boolean} watch Set to true or false
|
|
343
494
|
* @param {String} token Authorization token
|
|
344
495
|
*/
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
496
|
+
const watchLearningContent = (
|
|
497
|
+
id: string,
|
|
498
|
+
watch: boolean,
|
|
499
|
+
token: string
|
|
500
|
+
): Promise<object> => {
|
|
501
|
+
return new Promise((resolve, reject) => {
|
|
502
|
+
const requestData: LearningContentData = {
|
|
348
503
|
id: id,
|
|
349
504
|
watch: watch,
|
|
350
505
|
};
|
|
@@ -365,19 +520,20 @@ export const watchLearningContent = (id, watch, token) => {
|
|
|
365
520
|
});
|
|
366
521
|
};
|
|
367
522
|
|
|
368
|
-
|
|
523
|
+
export default {
|
|
369
524
|
createLearningContent,
|
|
370
525
|
deleteLearningContent,
|
|
371
526
|
discardLearningContentChanges,
|
|
372
527
|
getLearningContentInformationById,
|
|
373
528
|
generateLearningActivityContent,
|
|
529
|
+
generateMicroSkillTestKnowledge,
|
|
374
530
|
getLearningContentList,
|
|
531
|
+
migrateLearningContentStorageType,
|
|
375
532
|
publishLearningContent,
|
|
533
|
+
setLearningContentPartialContentInformation,
|
|
376
534
|
setLearningContentLearningContentInformation,
|
|
377
|
-
|
|
535
|
+
setLearningContentLearningMicroSkillContentInformation,
|
|
378
536
|
setLearningContentInformation,
|
|
379
537
|
setLearningContentTags,
|
|
380
538
|
watchLearningContent,
|
|
381
539
|
};
|
|
382
|
-
|
|
383
|
-
export default learningContent;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { client } from "./axiosClient.js";
|
|
2
2
|
|
|
3
|
+
interface LearningPathData {
|
|
4
|
+
data?: object;
|
|
5
|
+
id?: string;
|
|
6
|
+
comments?: string;
|
|
7
|
+
tags?: object;
|
|
8
|
+
list?: string[];
|
|
9
|
+
version?: string;
|
|
10
|
+
includeDeleted?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
/**
|
|
4
14
|
* Create learning path and set information
|
|
5
15
|
* @param {Object} data
|
|
6
16
|
* @param {String} token Authorization token
|
|
17
|
+
* @returns {Promise<Object>}
|
|
7
18
|
*/
|
|
8
|
-
|
|
9
|
-
return new Promise(
|
|
19
|
+
const createLearningPath = (data: object, token: string): Promise<object> => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
10
21
|
let confirmationRequest = client.put(
|
|
11
22
|
"api/v1/learningpaths",
|
|
12
23
|
{ data: data },
|
|
@@ -29,10 +40,11 @@ export const createLearningPath = (data, token) => {
|
|
|
29
40
|
* @param {String} id The id of the template to be deleted
|
|
30
41
|
* @param {String} comments The comments for approver
|
|
31
42
|
* @param {String} token Authorization token
|
|
43
|
+
* @returns {Promise<Object>}
|
|
32
44
|
*/
|
|
33
|
-
|
|
34
|
-
return new Promise(
|
|
35
|
-
const data = {
|
|
45
|
+
const deleteLearningPath = (id: string, comments: string, token: string): Promise<object> => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const data: LearningPathData = {
|
|
36
48
|
id: id,
|
|
37
49
|
};
|
|
38
50
|
if (comments) data.comments = comments;
|
|
@@ -54,9 +66,10 @@ export const deleteLearningPath = (id, comments, token) => {
|
|
|
54
66
|
* Discard the training plan draft changes
|
|
55
67
|
* @param {String} id The id of the training plan to be deleted
|
|
56
68
|
* @param {String} token Authorization token
|
|
69
|
+
* @returns {Promise<Object>}
|
|
57
70
|
*/
|
|
58
|
-
|
|
59
|
-
return new Promise(
|
|
71
|
+
const discardLearningPathChanges = (id: string, token: string): Promise<object> => {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
60
73
|
const data = {};
|
|
61
74
|
const request = client.get(`api/v1/learningpaths/discard/${id}`, {
|
|
62
75
|
headers: { authorization: token },
|
|
@@ -73,12 +86,14 @@ export const discardLearningPathChanges = (id, token) => {
|
|
|
73
86
|
};
|
|
74
87
|
|
|
75
88
|
/**
|
|
76
|
-
* Get
|
|
89
|
+
* Get training plan template information
|
|
77
90
|
* @param {String} id The id of the template
|
|
91
|
+
* @param {String} version The version of the template
|
|
78
92
|
* @param {String} token Authorization token
|
|
93
|
+
* @returns {Promise<Object>}
|
|
79
94
|
*/
|
|
80
|
-
|
|
81
|
-
return new Promise(
|
|
95
|
+
const getLearningPathInformationById = (id: string, version: string, token: string): Promise<object> => {
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
82
97
|
let confirmationRequest = client.get(
|
|
83
98
|
`api/v1/learningpaths/${id}/${version}`,
|
|
84
99
|
{
|
|
@@ -99,18 +114,29 @@ export const getLearningPathInformationById = (id, version, token) => {
|
|
|
99
114
|
* Get learning path list
|
|
100
115
|
* @param {Array<String>} list The filter used to select the skill
|
|
101
116
|
* @param {String} version The version to be retrieved
|
|
117
|
+
* @param {boolean} includeDeleted When true it will return the deleted records as well
|
|
102
118
|
* @param {String} token Authorization token
|
|
119
|
+
* @returns {Promise<Array<Object>>} The list of available content
|
|
103
120
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
const getLearningPathsList = (
|
|
122
|
+
list: string[],
|
|
123
|
+
version: string,
|
|
124
|
+
includeDeleted: boolean,
|
|
125
|
+
token: string
|
|
126
|
+
): Promise<object[]> => {
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
const requestData: LearningPathData = {
|
|
107
129
|
version: version,
|
|
108
130
|
includeDeleted: includeDeleted,
|
|
109
131
|
};
|
|
110
132
|
if (list) requestData.list = list;
|
|
111
|
-
let confirmationRequest = client.post(
|
|
112
|
-
|
|
113
|
-
|
|
133
|
+
let confirmationRequest = client.post(
|
|
134
|
+
`api/v1/learningpaths`,
|
|
135
|
+
requestData,
|
|
136
|
+
{
|
|
137
|
+
headers: { authorization: token },
|
|
138
|
+
}
|
|
139
|
+
);
|
|
114
140
|
confirmationRequest
|
|
115
141
|
.then((response) => {
|
|
116
142
|
resolve(response.data);
|
|
@@ -122,14 +148,15 @@ export const getLearningPathsList = (list, version, includeDeleted, token) => {
|
|
|
122
148
|
};
|
|
123
149
|
|
|
124
150
|
/**
|
|
125
|
-
* Publish training
|
|
151
|
+
* Publish training plan template
|
|
126
152
|
* @param {String} id The id of the template to be published
|
|
127
153
|
* @param {String} comments The comments to be include with the request
|
|
128
154
|
* @param {String} token Authorization token
|
|
155
|
+
* @returns {Promise<Object>}
|
|
129
156
|
*/
|
|
130
|
-
|
|
131
|
-
return new Promise(
|
|
132
|
-
let data = {};
|
|
157
|
+
const publishLearningPath = (id: string, comments: string, token: string): Promise<object> => {
|
|
158
|
+
return new Promise((resolve, reject) => {
|
|
159
|
+
let data: LearningPathData = {};
|
|
133
160
|
if (comments) data.comments = comments;
|
|
134
161
|
let confirmationRequest = client.post(
|
|
135
162
|
`api/v1/learningpaths/publish/${id}`,
|
|
@@ -153,10 +180,11 @@ export const publishLearningPath = (id, comments, token) => {
|
|
|
153
180
|
* @param {String} id The id of the template to be updated
|
|
154
181
|
* @param {Object} data Data used to update the template
|
|
155
182
|
* @param {String} token Authorization token
|
|
183
|
+
* @returns {Promise<Object>}
|
|
156
184
|
*/
|
|
157
|
-
|
|
158
|
-
return new Promise(
|
|
159
|
-
const requestData = {
|
|
185
|
+
const setLearningPathInformation = (id: string, data: object, token: string): Promise<object> => {
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
const requestData: LearningPathData = {
|
|
160
188
|
data: data,
|
|
161
189
|
id: id,
|
|
162
190
|
};
|
|
@@ -182,10 +210,11 @@ export const setLearningPathInformation = (id, data, token) => {
|
|
|
182
210
|
* @param {String} id The id of the template to be updated
|
|
183
211
|
* @param {Object} tags The updated tags
|
|
184
212
|
* @param {String} token Authorization token
|
|
213
|
+
* @returns {Promise<Object>}
|
|
185
214
|
*/
|
|
186
|
-
|
|
187
|
-
return new Promise(
|
|
188
|
-
const requestData = {
|
|
215
|
+
const setLearningPathTags = (id: string, tags: object, token: string): Promise<object> => {
|
|
216
|
+
return new Promise((resolve, reject) => {
|
|
217
|
+
const requestData: LearningPathData = {
|
|
189
218
|
tags: tags,
|
|
190
219
|
id: id,
|
|
191
220
|
};
|
|
@@ -206,7 +235,7 @@ export const setLearningPathTags = (id, tags, token) => {
|
|
|
206
235
|
});
|
|
207
236
|
};
|
|
208
237
|
|
|
209
|
-
|
|
238
|
+
export default {
|
|
210
239
|
createLearningPath,
|
|
211
240
|
deleteLearningPath,
|
|
212
241
|
discardLearningPathChanges,
|
|
@@ -215,6 +244,4 @@ const learningPath = {
|
|
|
215
244
|
publishLearningPath,
|
|
216
245
|
setLearningPathInformation,
|
|
217
246
|
setLearningPathTags,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export default learningPath;
|
|
247
|
+
};
|
|
@@ -6,9 +6,15 @@ import { client } from "./axiosClient.js";
|
|
|
6
6
|
* @param {String} elementType
|
|
7
7
|
* @param {Object} data
|
|
8
8
|
* @param {String} token Authorization token
|
|
9
|
+
* @returns {Promise<Object>}
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const comments = (
|
|
12
|
+
elementId: string,
|
|
13
|
+
elementType: string,
|
|
14
|
+
data: object,
|
|
15
|
+
token: string
|
|
16
|
+
): Promise<object> => {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
12
18
|
let confirmationRequest = client.post(
|
|
13
19
|
"api/v1/logger/comments/",
|
|
14
20
|
{
|
|
@@ -36,10 +42,16 @@ export const comments = (elementId, elementType, data, token) => {
|
|
|
36
42
|
* @param {Number} page The results page
|
|
37
43
|
* @param {Number} elementsPerPage The number of elements per page
|
|
38
44
|
* @param {String} token
|
|
45
|
+
* @returns {Promise<Object>}
|
|
39
46
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
const getListByElementId = (
|
|
48
|
+
elementId: string,
|
|
49
|
+
page: number | null,
|
|
50
|
+
elementsPerPage: number | null,
|
|
51
|
+
token: string
|
|
52
|
+
): Promise<object> => {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
let data: { elementsPerPage?: number, page?: number } = {};
|
|
43
55
|
if (elementsPerPage !== null) data.elementsPerPage = elementsPerPage;
|
|
44
56
|
if (page !== null) data.page = page;
|
|
45
57
|
const getTokensRequest = client.post(`api/v1/logger/${elementId}`, data, {
|
|
@@ -55,6 +67,4 @@ export const getListByElementId = (elementId, page, elementsPerPage, token) => {
|
|
|
55
67
|
});
|
|
56
68
|
};
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export default logger;
|
|
70
|
+
export default { comments, getListByElementId };
|