@stackfactor/client-api 1.1.149 → 1.1.150
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/dist/actionNotifications.js +73 -0
- package/dist/address.js +22 -0
- package/dist/aiAssistant.js +134 -0
- package/dist/avatar.js +32 -0
- package/dist/axiosClient.js +89 -0
- package/dist/cjs/actionNotifications.js.map +1 -1
- package/dist/cjs/address.js.map +1 -1
- package/dist/cjs/aiAssistant.js.map +1 -1
- package/dist/cjs/avatar.js.map +1 -1
- package/dist/cjs/axiosClient.js.map +1 -1
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/dashboard.js.map +1 -1
- package/dist/cjs/departmentTrainingPlans.d.ts +4 -4
- package/dist/cjs/departmentTrainingPlans.js +2 -2
- package/dist/cjs/departmentTrainingPlans.js.map +1 -1
- package/dist/cjs/groups.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/integration.d.ts +2 -2
- package/dist/cjs/integration.d.ts.map +1 -1
- package/dist/cjs/integration.js +1 -1
- package/dist/cjs/integration.js.map +1 -1
- package/dist/cjs/integrationConfiguration.d.ts +2 -2
- package/dist/cjs/integrationConfiguration.js +1 -1
- package/dist/cjs/integrationConfiguration.js.map +1 -1
- package/dist/cjs/integrations/contentGenerator.js.map +1 -1
- package/dist/cjs/learningContent.js.map +1 -1
- package/dist/cjs/learningPath.js.map +1 -1
- package/dist/cjs/logger.js.map +1 -1
- package/dist/cjs/microSkillsQuizes.js.map +1 -1
- package/dist/cjs/quotas.js.map +1 -1
- package/dist/cjs/role.js.map +1 -1
- package/dist/cjs/roleTemplate.js.map +1 -1
- package/dist/cjs/security.js.map +1 -1
- package/dist/cjs/skill.js.map +1 -1
- package/dist/cjs/skillAssessmentTestingSession.js.map +1 -1
- package/dist/cjs/skillAssessments.js.map +1 -1
- package/dist/cjs/skillTemplate.js.map +1 -1
- package/dist/cjs/talentTransfromation.js.map +1 -1
- package/dist/cjs/teams.js.map +1 -1
- package/dist/cjs/tenants.js.map +1 -1
- package/dist/cjs/trainingPlans.js.map +1 -1
- package/dist/cjs/trainingPlansProficiencyLevels.js.map +1 -1
- package/dist/cjs/userInformation.js.map +1 -1
- package/dist/cjs/users.js.map +1 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/config.js +63 -0
- package/dist/constants.js +94 -0
- package/dist/dashboard.js +74 -0
- package/dist/departmentTrainingPlans.js +154 -0
- package/dist/esm/actionNotifications.js.map +1 -1
- package/dist/esm/address.js.map +1 -1
- package/dist/esm/aiAssistant.js.map +1 -1
- package/dist/esm/avatar.js.map +1 -1
- package/dist/esm/axiosClient.js.map +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/dashboard.js.map +1 -1
- package/dist/esm/departmentTrainingPlans.d.ts +4 -4
- package/dist/esm/departmentTrainingPlans.js +2 -2
- package/dist/esm/departmentTrainingPlans.js.map +1 -1
- package/dist/esm/groups.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integration.d.ts +2 -2
- package/dist/esm/integration.d.ts.map +1 -1
- package/dist/esm/integration.js +1 -1
- package/dist/esm/integration.js.map +1 -1
- package/dist/esm/integrationConfiguration.d.ts +2 -2
- package/dist/esm/integrationConfiguration.js +1 -1
- package/dist/esm/integrationConfiguration.js.map +1 -1
- package/dist/esm/integrations/contentGenerator.js.map +1 -1
- package/dist/esm/learningContent.js.map +1 -1
- package/dist/esm/learningPath.js.map +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/microSkillsQuizes.js.map +1 -1
- package/dist/esm/quotas.js.map +1 -1
- package/dist/esm/role.js.map +1 -1
- package/dist/esm/roleTemplate.js.map +1 -1
- package/dist/esm/security.js.map +1 -1
- package/dist/esm/skill.js.map +1 -1
- package/dist/esm/skillAssessmentTestingSession.js.map +1 -1
- package/dist/esm/skillAssessments.js.map +1 -1
- package/dist/esm/skillTemplate.js.map +1 -1
- package/dist/esm/talentTransfromation.js.map +1 -1
- package/dist/esm/teams.js.map +1 -1
- package/dist/esm/tenants.js.map +1 -1
- package/dist/esm/trainingPlans.js.map +1 -1
- package/dist/esm/trainingPlansProficiencyLevels.js.map +1 -1
- package/dist/esm/userInformation.js.map +1 -1
- package/dist/esm/users.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/exports.js +77 -0
- package/dist/groups.js +273 -0
- package/dist/index.js +77 -0
- package/dist/integration.js +319 -0
- package/dist/integrationConfiguration.js +86 -0
- package/dist/integrations/contentGenerator.js +70 -0
- package/dist/learningContent.js +394 -0
- package/dist/learningPath.js +205 -0
- package/dist/logger.js +57 -0
- package/dist/microSkillsQuizes.js +53 -0
- package/dist/quotas.js +50 -0
- package/dist/role.js +363 -0
- package/dist/roleTemplate.js +236 -0
- package/dist/security.js +79 -0
- package/dist/skill.js +439 -0
- package/dist/skillAssessmentTestingSession.js +156 -0
- package/dist/skillAssessments.js +156 -0
- package/dist/skillTemplate.js +281 -0
- package/dist/talentTransfromation.js +100 -0
- package/dist/teams.js +252 -0
- package/dist/tenants.js +52 -0
- package/dist/trainingPlans.js +308 -0
- package/dist/trainingPlansProficiencyLevels.js +98 -0
- package/dist/userInformation.js +81 -0
- package/dist/users.js +694 -0
- package/dist/utils.js +65 -0
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axiosClient_1 = require("./axiosClient");
|
|
4
|
+
/**
|
|
5
|
+
* Get the integration configuration
|
|
6
|
+
* @param {Array<String>} ids
|
|
7
|
+
* @param {Number} type
|
|
8
|
+
* @param {String} token Authorization token
|
|
9
|
+
* @returns {Promise<Object>}
|
|
10
|
+
*/
|
|
11
|
+
const getIntegrationsConfiguration = (ids, type, token) => {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
let requestData = { type: type };
|
|
14
|
+
if (ids)
|
|
15
|
+
requestData.ids = ids;
|
|
16
|
+
let confirmationRequest = axiosClient_1.client.post("api/v1/integrationsconfiguration", requestData, {
|
|
17
|
+
headers: { authorization: token },
|
|
18
|
+
});
|
|
19
|
+
confirmationRequest
|
|
20
|
+
.then((response) => {
|
|
21
|
+
resolve(response.data);
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
reject(error);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Save integration configuration
|
|
30
|
+
* @param {String} id The id of the integration configuration to be updated
|
|
31
|
+
* @param {Number} type The type of configuration
|
|
32
|
+
* @param {Object} configuration Data used to update the integration configuration
|
|
33
|
+
* @param {String} token Authorization token
|
|
34
|
+
* @returns {Promise<Object>}
|
|
35
|
+
*/
|
|
36
|
+
const saveIntegrationConfiguration = (id, type, configuration, token) => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const requestData = {
|
|
39
|
+
id: id,
|
|
40
|
+
configuration: configuration,
|
|
41
|
+
type: type,
|
|
42
|
+
};
|
|
43
|
+
let confirmationRequest = axiosClient_1.client.put(`api/v1/integrationsconfiguration`, requestData, {
|
|
44
|
+
headers: { authorization: token },
|
|
45
|
+
});
|
|
46
|
+
confirmationRequest
|
|
47
|
+
.then((response) => {
|
|
48
|
+
resolve(response.data);
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
reject(error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Test integration configuration
|
|
57
|
+
* @param {String} id The id of the integration to be updated
|
|
58
|
+
* @param {String} type The type of configuration
|
|
59
|
+
* @param {Object} configuration Configuration to be tested
|
|
60
|
+
* @param {String} token Authorization token
|
|
61
|
+
* @returns {Promise<Object>}
|
|
62
|
+
*/
|
|
63
|
+
const testIntegrationConfiguration = (id, type, configuration, token) => {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const requestData = {
|
|
66
|
+
id: id,
|
|
67
|
+
configuration: configuration,
|
|
68
|
+
type: type,
|
|
69
|
+
};
|
|
70
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/integrationsconfiguration/testConfiguration`, requestData, {
|
|
71
|
+
headers: { authorization: token },
|
|
72
|
+
});
|
|
73
|
+
confirmationRequest
|
|
74
|
+
.then((response) => {
|
|
75
|
+
resolve(response.data);
|
|
76
|
+
})
|
|
77
|
+
.catch((error) => {
|
|
78
|
+
reject(error);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
exports.default = {
|
|
83
|
+
getIntegrationsConfiguration,
|
|
84
|
+
saveIntegrationConfiguration,
|
|
85
|
+
testIntegrationConfiguration,
|
|
86
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateContentAsync = exports.generateContent = void 0;
|
|
4
|
+
const axiosClient_1 = require("../axiosClient");
|
|
5
|
+
/**
|
|
6
|
+
* Generate content
|
|
7
|
+
* @param {Array<String>} data
|
|
8
|
+
* @param {String} contentType
|
|
9
|
+
* @param {String} integrationId
|
|
10
|
+
* @param {String} token
|
|
11
|
+
* @returns {Promise<Object>}
|
|
12
|
+
*/
|
|
13
|
+
const generateContent = (data, contentType, integrationId, token) => {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
let data_ = {
|
|
16
|
+
data: data,
|
|
17
|
+
contentType: contentType,
|
|
18
|
+
};
|
|
19
|
+
if (integrationId)
|
|
20
|
+
data_.integrationId = integrationId;
|
|
21
|
+
const request = axiosClient_1.client.post(`api/v1/contentgenerators/generate`, data_, {
|
|
22
|
+
headers: { authorization: token },
|
|
23
|
+
});
|
|
24
|
+
request
|
|
25
|
+
.then((response) => {
|
|
26
|
+
resolve(response.data);
|
|
27
|
+
})
|
|
28
|
+
.catch((error) => {
|
|
29
|
+
reject(error);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.generateContent = generateContent;
|
|
34
|
+
/**
|
|
35
|
+
* Generate content async
|
|
36
|
+
* @param {String} id
|
|
37
|
+
* @param {Object} data
|
|
38
|
+
* @param {String} contentType
|
|
39
|
+
* @param {String} elementType
|
|
40
|
+
* @param {String} integrationId
|
|
41
|
+
* @param {String} comments
|
|
42
|
+
* @param {String} token
|
|
43
|
+
* @returns {Promise<Object>}
|
|
44
|
+
*/
|
|
45
|
+
const generateContentAsync = (id, data, contentType, elementType, integrationId, comments, token) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
let data_ = {
|
|
48
|
+
id: id,
|
|
49
|
+
data: data,
|
|
50
|
+
comments: comments,
|
|
51
|
+
contentType: contentType,
|
|
52
|
+
elementType: elementType,
|
|
53
|
+
};
|
|
54
|
+
if (integrationId)
|
|
55
|
+
data_.integrationId = integrationId;
|
|
56
|
+
const request = axiosClient_1.client.post(`api/v1/contentgenerators/generateasync`, data_, {
|
|
57
|
+
headers: { authorization: token },
|
|
58
|
+
});
|
|
59
|
+
request
|
|
60
|
+
.then((response) => {
|
|
61
|
+
resolve(response.data);
|
|
62
|
+
})
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
reject(error);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.generateContentAsync = generateContentAsync;
|
|
69
|
+
const contentGenerator = { generateContent: exports.generateContent, generateContentAsync: exports.generateContentAsync };
|
|
70
|
+
exports.default = contentGenerator;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const axiosClient_1 = require("./axiosClient");
|
|
4
|
+
/**
|
|
5
|
+
* Create learning content and set information
|
|
6
|
+
* @param {Object} data Learning content data
|
|
7
|
+
* @param {String} token Authorization token
|
|
8
|
+
* @returns {Promise<Object>} The created learning content
|
|
9
|
+
*/
|
|
10
|
+
const createLearningContent = (data, token) => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const requestData = {
|
|
13
|
+
data: data,
|
|
14
|
+
};
|
|
15
|
+
let confirmationRequest = axiosClient_1.client.put("api/v1/learningcontent", requestData, {
|
|
16
|
+
headers: { authorization: token },
|
|
17
|
+
});
|
|
18
|
+
confirmationRequest
|
|
19
|
+
.then((response) => {
|
|
20
|
+
resolve(response.data);
|
|
21
|
+
})
|
|
22
|
+
.catch((error) => {
|
|
23
|
+
reject(error);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Delete learning content
|
|
29
|
+
* @param {String} id The id of the learning content to be deleted
|
|
30
|
+
* @param {String} comments The comments included with the deletion
|
|
31
|
+
* @param {String} token Authorization token
|
|
32
|
+
* @returns {Promise<Object>} The response from the server
|
|
33
|
+
*/
|
|
34
|
+
const deleteLearningContent = (id, comments, token) => {
|
|
35
|
+
const data = {
|
|
36
|
+
id: id,
|
|
37
|
+
};
|
|
38
|
+
if (comments)
|
|
39
|
+
data.comments = comments;
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const request = axiosClient_1.client.delete(`api/v1/learningcontent/`, {
|
|
42
|
+
headers: { authorization: token },
|
|
43
|
+
data: data,
|
|
44
|
+
});
|
|
45
|
+
request
|
|
46
|
+
.then((response) => {
|
|
47
|
+
resolve(response.data);
|
|
48
|
+
})
|
|
49
|
+
.catch((error) => {
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Discard the learning content draft changes
|
|
56
|
+
* @param {String} id The id of the learning content to be deleted
|
|
57
|
+
* @param {String} token Authorization token
|
|
58
|
+
* @returns {Promise<Object>} The response from the server
|
|
59
|
+
*/
|
|
60
|
+
const discardLearningContentChanges = (id, token) => {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const data = {};
|
|
63
|
+
const request = axiosClient_1.client.get(`api/v1/learningcontent/discard/${id}`, {
|
|
64
|
+
headers: { authorization: token },
|
|
65
|
+
data: data,
|
|
66
|
+
});
|
|
67
|
+
request
|
|
68
|
+
.then((response) => {
|
|
69
|
+
resolve(response.data);
|
|
70
|
+
})
|
|
71
|
+
.catch((error) => {
|
|
72
|
+
reject(error);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Generate the learning activity content
|
|
78
|
+
* @param {String} learningObjectives
|
|
79
|
+
* @param {String} skillId
|
|
80
|
+
* @param {String} microSkillId
|
|
81
|
+
* @param {Object} learningActivity
|
|
82
|
+
* @param {List<String>} otherLearningActivities
|
|
83
|
+
* @param {List<String>} sections
|
|
84
|
+
* @param {String} token
|
|
85
|
+
*/
|
|
86
|
+
const generateLearningActivityContent = (learningObjectives, skillId, microSkillId, learningActivity, otherLearningActivities, sections, token) => {
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const requestData = {
|
|
89
|
+
learningObjectives: learningObjectives,
|
|
90
|
+
learningActivity: learningActivity,
|
|
91
|
+
microSkillId: microSkillId,
|
|
92
|
+
sections: sections,
|
|
93
|
+
};
|
|
94
|
+
if (otherLearningActivities) {
|
|
95
|
+
requestData.otherLearningActivities = otherLearningActivities;
|
|
96
|
+
}
|
|
97
|
+
const request = axiosClient_1.client.post(`api/v1/learningcontent/generatelearningactivitycontent/${skillId}`, requestData, {
|
|
98
|
+
headers: { authorization: token },
|
|
99
|
+
});
|
|
100
|
+
request
|
|
101
|
+
.then((response) => {
|
|
102
|
+
resolve(response.data);
|
|
103
|
+
})
|
|
104
|
+
.catch((error) => {
|
|
105
|
+
reject(error);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Generate micro skill test knowledge
|
|
111
|
+
* @param {String} microSkill
|
|
112
|
+
* @param {String} token
|
|
113
|
+
* @returns {Promise<Object>}
|
|
114
|
+
*/
|
|
115
|
+
const generateMicroSkillTestKnowledge = (microSkill, token) => {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
let data = {
|
|
118
|
+
microSkill: microSkill,
|
|
119
|
+
};
|
|
120
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/generatemicroskilltestknowledge`, data, {
|
|
121
|
+
headers: { authorization: token },
|
|
122
|
+
});
|
|
123
|
+
confirmationRequest
|
|
124
|
+
.then((response) => {
|
|
125
|
+
resolve(response.data);
|
|
126
|
+
})
|
|
127
|
+
.catch((error) => {
|
|
128
|
+
reject(error);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Get the learning content information by id
|
|
134
|
+
* @param {String} id The id of the learning content
|
|
135
|
+
* @param {String} version The version of the learning content
|
|
136
|
+
* @param {String} token Authorization token
|
|
137
|
+
* @returns {Promise<Object>} The response from the server
|
|
138
|
+
*/
|
|
139
|
+
const getLearningContentInformationById = (id, version, token) => {
|
|
140
|
+
return new Promise((resolve, reject) => {
|
|
141
|
+
let confirmationRequest = axiosClient_1.client.get(`api/v1/learningcontent/${id}/${version}`, {
|
|
142
|
+
headers: { authorization: token },
|
|
143
|
+
});
|
|
144
|
+
confirmationRequest
|
|
145
|
+
.then((response) => {
|
|
146
|
+
resolve(response.data);
|
|
147
|
+
})
|
|
148
|
+
.catch((error) => {
|
|
149
|
+
reject(error);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Get the list of available content types
|
|
155
|
+
* @param {Array<String>} filter The filter used to select the learning content
|
|
156
|
+
* @param {String} version The version to be retrieved
|
|
157
|
+
* @param {boolean} includeDeleted When true it will return the deleted records as well
|
|
158
|
+
* @param {String} token Authorization token
|
|
159
|
+
* @returns {Promise<Array<Object>>} The list of available content
|
|
160
|
+
*/
|
|
161
|
+
const getLearningContentList = (filter, version, includeDeleted, token) => {
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
const requestData = {
|
|
164
|
+
version: version,
|
|
165
|
+
includeDeleted: includeDeleted,
|
|
166
|
+
};
|
|
167
|
+
if (filter)
|
|
168
|
+
requestData.filter = filter;
|
|
169
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent`, requestData, {
|
|
170
|
+
headers: { authorization: token },
|
|
171
|
+
});
|
|
172
|
+
confirmationRequest
|
|
173
|
+
.then((response) => {
|
|
174
|
+
resolve(response.data);
|
|
175
|
+
})
|
|
176
|
+
.catch((error) => {
|
|
177
|
+
reject(error);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Migrate learning content storage
|
|
183
|
+
* @param {String} id The id of the content to be migrated
|
|
184
|
+
* @param {String} token Authorization token
|
|
185
|
+
* @returns {Promise<Object>} The response from the server
|
|
186
|
+
*/
|
|
187
|
+
const migrateLearningContentStorageType = (id, token) => {
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
let data = {};
|
|
190
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/migratestorage/${id}`, data, {
|
|
191
|
+
headers: { authorization: token },
|
|
192
|
+
});
|
|
193
|
+
confirmationRequest
|
|
194
|
+
.then((response) => {
|
|
195
|
+
resolve(response.data);
|
|
196
|
+
})
|
|
197
|
+
.catch((error) => {
|
|
198
|
+
reject(error);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Publish learning content
|
|
204
|
+
* @param {String} id The id of the content to be published
|
|
205
|
+
* @param {String} comments The comments to be include with the request
|
|
206
|
+
* @param {String} token Authorization token
|
|
207
|
+
* @returns {Promise<Object>} The response from the server
|
|
208
|
+
*/
|
|
209
|
+
const publishLearningContent = (id, comments, token) => {
|
|
210
|
+
return new Promise((resolve, reject) => {
|
|
211
|
+
let data = {};
|
|
212
|
+
if (comments)
|
|
213
|
+
data.comments = comments;
|
|
214
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/publish/${id}`, data, {
|
|
215
|
+
headers: { authorization: token },
|
|
216
|
+
});
|
|
217
|
+
confirmationRequest
|
|
218
|
+
.then((response) => {
|
|
219
|
+
resolve(response.data);
|
|
220
|
+
})
|
|
221
|
+
.catch((error) => {
|
|
222
|
+
reject(error);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Set learning content information
|
|
228
|
+
* @param {String} id The id of the learning content to be updated
|
|
229
|
+
* @param {Object} data Data used to update the learning content
|
|
230
|
+
* @param {String} token Authorization token
|
|
231
|
+
* @returns {Promise<Object>} The updated learning content
|
|
232
|
+
*/
|
|
233
|
+
const setLearningContentInformation = (id, data, token) => {
|
|
234
|
+
return new Promise((resolve, reject) => {
|
|
235
|
+
const requestData = {
|
|
236
|
+
data: data,
|
|
237
|
+
id: id,
|
|
238
|
+
};
|
|
239
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/update`, requestData, {
|
|
240
|
+
headers: { authorization: token },
|
|
241
|
+
});
|
|
242
|
+
confirmationRequest
|
|
243
|
+
.then((response) => {
|
|
244
|
+
resolve(response.data);
|
|
245
|
+
})
|
|
246
|
+
.catch((error) => {
|
|
247
|
+
reject(error);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Set partial content information
|
|
253
|
+
* @param {String} id
|
|
254
|
+
* @param {Object} data
|
|
255
|
+
* @param {String} token
|
|
256
|
+
* @returns {Promise<Object>}
|
|
257
|
+
*/
|
|
258
|
+
const setLearningContentPartialContentInformation = (id, data, token) => {
|
|
259
|
+
return new Promise((resolve, reject) => {
|
|
260
|
+
const requestData = {
|
|
261
|
+
data: data,
|
|
262
|
+
id: id,
|
|
263
|
+
};
|
|
264
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/updatepartialcontent/${id}`, requestData, {
|
|
265
|
+
headers: { authorization: token },
|
|
266
|
+
});
|
|
267
|
+
confirmationRequest
|
|
268
|
+
.then((response) => {
|
|
269
|
+
resolve(response.data);
|
|
270
|
+
})
|
|
271
|
+
.catch((error) => {
|
|
272
|
+
reject(error);
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Set the content for a specific learning activity
|
|
278
|
+
* @param {String} id
|
|
279
|
+
* @param {String} learningcontentid
|
|
280
|
+
* @param {String} microSkillId
|
|
281
|
+
* @param {Object} data
|
|
282
|
+
* @param {String} token
|
|
283
|
+
* @returns {Promise<String>} OK word if the operation was successful
|
|
284
|
+
*/
|
|
285
|
+
const setLearningContentLearningContentInformation = (id, learningcontentid, microSkillId, data, token) => {
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
const requestData = {
|
|
288
|
+
data: data,
|
|
289
|
+
id: id,
|
|
290
|
+
learningcontentid: learningcontentid,
|
|
291
|
+
microSkillId: microSkillId,
|
|
292
|
+
};
|
|
293
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/updatelearningcontent/`, requestData, {
|
|
294
|
+
headers: { authorization: token },
|
|
295
|
+
});
|
|
296
|
+
confirmationRequest
|
|
297
|
+
.then((response) => {
|
|
298
|
+
resolve(response.data);
|
|
299
|
+
})
|
|
300
|
+
.catch((error) => {
|
|
301
|
+
reject(error);
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Set all the learning content for a specific micro skill
|
|
307
|
+
* @param {String} id
|
|
308
|
+
* @param {String} microskillid
|
|
309
|
+
* @param {Object} data
|
|
310
|
+
* @param {String} token
|
|
311
|
+
* @returns {Promise<String>} OK word if the operation was successful
|
|
312
|
+
*/
|
|
313
|
+
const setLearningContentLearningMicroSkillContentInformation = (id, microskillid, data, token) => {
|
|
314
|
+
return new Promise((resolve, reject) => {
|
|
315
|
+
const requestData = {
|
|
316
|
+
data: data,
|
|
317
|
+
};
|
|
318
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/updatemicroskilllearningcontent/${id}/${microskillid}`, requestData, {
|
|
319
|
+
headers: { authorization: token },
|
|
320
|
+
});
|
|
321
|
+
confirmationRequest
|
|
322
|
+
.then((response) => {
|
|
323
|
+
resolve(response.data);
|
|
324
|
+
})
|
|
325
|
+
.catch((error) => {
|
|
326
|
+
reject(error);
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Update the learning content tags
|
|
332
|
+
* @param {String} id The id of the learning to be updated
|
|
333
|
+
* @param {Object} tags Updated learning content tags
|
|
334
|
+
* @param {String} token Authorization token
|
|
335
|
+
*/
|
|
336
|
+
const setLearningContentTags = (id, tags, token) => {
|
|
337
|
+
return new Promise((resolve, reject) => {
|
|
338
|
+
const requestData = {
|
|
339
|
+
tags: tags,
|
|
340
|
+
id: id,
|
|
341
|
+
};
|
|
342
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/updatetags/`, requestData, {
|
|
343
|
+
headers: { authorization: token },
|
|
344
|
+
});
|
|
345
|
+
confirmationRequest
|
|
346
|
+
.then((response) => {
|
|
347
|
+
resolve(response.data);
|
|
348
|
+
})
|
|
349
|
+
.catch((error) => {
|
|
350
|
+
reject(error);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Watch learning content
|
|
356
|
+
* @param {String} id The id of the learning content to be updated
|
|
357
|
+
* @param {Boolean} watch Set to true or false
|
|
358
|
+
* @param {String} token Authorization token
|
|
359
|
+
*/
|
|
360
|
+
const watchLearningContent = (id, watch, token) => {
|
|
361
|
+
return new Promise((resolve, reject) => {
|
|
362
|
+
const requestData = {
|
|
363
|
+
id: id,
|
|
364
|
+
watch: watch,
|
|
365
|
+
};
|
|
366
|
+
let confirmationRequest = axiosClient_1.client.post(`api/v1/learningcontent/watch`, requestData, {
|
|
367
|
+
headers: { authorization: token },
|
|
368
|
+
});
|
|
369
|
+
confirmationRequest
|
|
370
|
+
.then((response) => {
|
|
371
|
+
resolve(response.data);
|
|
372
|
+
})
|
|
373
|
+
.catch((error) => {
|
|
374
|
+
reject(error);
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
exports.default = {
|
|
379
|
+
createLearningContent,
|
|
380
|
+
deleteLearningContent,
|
|
381
|
+
discardLearningContentChanges,
|
|
382
|
+
getLearningContentInformationById,
|
|
383
|
+
generateLearningActivityContent,
|
|
384
|
+
generateMicroSkillTestKnowledge,
|
|
385
|
+
getLearningContentList,
|
|
386
|
+
migrateLearningContentStorageType,
|
|
387
|
+
publishLearningContent,
|
|
388
|
+
setLearningContentPartialContentInformation,
|
|
389
|
+
setLearningContentLearningContentInformation,
|
|
390
|
+
setLearningContentLearningMicroSkillContentInformation,
|
|
391
|
+
setLearningContentInformation,
|
|
392
|
+
setLearningContentTags,
|
|
393
|
+
watchLearningContent,
|
|
394
|
+
};
|