@stackfactor/client-api 1.0.31 → 1.0.33
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/index.js +0 -2
- package/lib/actionNotifications.js +202 -226
- package/lib/address.js +21 -27
- package/lib/axiosClient.js +58 -64
- package/lib/config.js +62 -66
- package/lib/dashboard.js +64 -68
- package/lib/departmentTrainingPlans.js +159 -153
- package/lib/groups.js +266 -291
- package/lib/integration.js +307 -312
- package/lib/integrationConfiguration.js +96 -90
- package/lib/integrations/contentGenerator.js +71 -74
- package/lib/learningContent.js +239 -240
- package/lib/logger.js +51 -56
- package/lib/role.js +238 -245
- package/lib/roleTemplate.js +247 -255
- package/lib/skill.js +299 -311
- package/lib/skillAssessmentTestingSession.js +132 -137
- package/lib/skillAssessments.js +125 -129
- package/lib/skillTemplate.js +250 -255
- package/lib/teams.js +261 -257
- package/lib/tenants.js +48 -52
- package/lib/trainingPlanTemplate.js +203 -202
- package/lib/trainingPlans.js +249 -251
- package/lib/userInformation.js +97 -85
- package/lib/users.js +557 -555
- package/lib/utils.js +38 -42
- package/package.json +1 -1
- package/lib/templates.js +0 -148
package/lib/learningContent.js
CHANGED
|
@@ -1,255 +1,254 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
let confirmationRequest = axios.put(
|
|
18
|
-
"api/v1/learningcontent",
|
|
19
|
-
requestData,
|
|
20
|
-
{ headers: { authorization: token } }
|
|
21
|
-
);
|
|
22
|
-
confirmationRequest
|
|
23
|
-
.then((response) => {
|
|
24
|
-
resolve(response.data);
|
|
25
|
-
})
|
|
26
|
-
.catch((error) => {
|
|
27
|
-
reject(error);
|
|
28
|
-
});
|
|
3
|
+
/**
|
|
4
|
+
* Create learning content and set information
|
|
5
|
+
* @param {Object} data Learning content data
|
|
6
|
+
* @param {String} token Authorization token
|
|
7
|
+
* @returns {Promise<Object>} The created learning content
|
|
8
|
+
*/
|
|
9
|
+
export const createLearningContent = (data, token) => {
|
|
10
|
+
return new Promise(function (resolve, reject) {
|
|
11
|
+
const requestData = {
|
|
12
|
+
data: data,
|
|
13
|
+
};
|
|
14
|
+
let confirmationRequest = axios.put("api/v1/learningcontent", requestData, {
|
|
15
|
+
headers: { authorization: token },
|
|
29
16
|
});
|
|
30
|
-
|
|
17
|
+
confirmationRequest
|
|
18
|
+
.then((response) => {
|
|
19
|
+
resolve(response.data);
|
|
20
|
+
})
|
|
21
|
+
.catch((error) => {
|
|
22
|
+
reject(error);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Delete learning content
|
|
29
|
+
* @param {String} id The id of the learning content to be deleted
|
|
30
|
+
* @param {String} comment The comment included with the deletion
|
|
31
|
+
* @param {String} token Authorization token
|
|
32
|
+
* @returns {Promise<Object>} The response from the server
|
|
33
|
+
*/
|
|
34
|
+
export const deleteLearningContent = (id, comment, token) => {
|
|
35
|
+
const data = {
|
|
36
|
+
id: id,
|
|
37
|
+
};
|
|
38
|
+
if (comment) data.comment = comment;
|
|
39
|
+
return new Promise(function (resolve, reject) {
|
|
40
|
+
const request = axios.delete(`api/v1/learningcontent/`, {
|
|
41
|
+
headers: { authorization: token },
|
|
42
|
+
data: data,
|
|
43
|
+
});
|
|
44
|
+
request
|
|
45
|
+
.then((response) => {
|
|
46
|
+
resolve(response.data);
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
reject(error);
|
|
48
50
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
export const discardLearningContentChanges = (id, token) => {
|
|
61
|
+
return new Promise(function (resolve, reject) {
|
|
62
|
+
const data = {};
|
|
63
|
+
const request = axios.get(`api/v1/learningcontent/discard/${id}`, {
|
|
64
|
+
headers: { authorization: token },
|
|
65
|
+
data: data,
|
|
56
66
|
});
|
|
57
|
-
|
|
67
|
+
request
|
|
68
|
+
.then((response) => {
|
|
69
|
+
resolve(response.data);
|
|
70
|
+
})
|
|
71
|
+
.catch((error) => {
|
|
72
|
+
reject(error);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
58
76
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Get the learning content information by id
|
|
79
|
+
* @param {String} id The id of the learning content
|
|
80
|
+
* @param {String} version The version of the learning content
|
|
81
|
+
* @param {String} token Authorization token
|
|
82
|
+
* @returns {Promise<Object>} The response from the server
|
|
83
|
+
*/
|
|
84
|
+
export const getLearningContentInformationById = (id, version, token) => {
|
|
85
|
+
return new Promise(function (resolve, reject) {
|
|
86
|
+
let confirmationRequest = axios.get(
|
|
87
|
+
`api/v1/learningcontent/${id}/${version}`,
|
|
88
|
+
{
|
|
69
89
|
headers: { authorization: token },
|
|
70
|
-
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
confirmationRequest
|
|
93
|
+
.then((response) => {
|
|
94
|
+
resolve(response.data);
|
|
95
|
+
})
|
|
96
|
+
.catch((error) => {
|
|
97
|
+
reject(error);
|
|
71
98
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
resolve(response.data);
|
|
75
|
-
})
|
|
76
|
-
.catch((error) => {
|
|
77
|
-
reject(error);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Get the learning content information by id
|
|
84
|
-
* @param {String} id The id of the learning content
|
|
85
|
-
* @param {String} version The version of the learning content
|
|
86
|
-
* @param {String} token Authorization token
|
|
87
|
-
* @returns {Promise<Object>} The response from the server
|
|
88
|
-
*/
|
|
89
|
-
getLearningContentInformationById: (id, version, token) => {
|
|
90
|
-
return new Promise(function (resolve, reject) {
|
|
91
|
-
let confirmationRequest = axios.get(
|
|
92
|
-
`api/v1/learningcontent/${id}/${version}`,
|
|
93
|
-
{
|
|
94
|
-
headers: { authorization: token },
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
confirmationRequest
|
|
98
|
-
.then((response) => {
|
|
99
|
-
resolve(response.data);
|
|
100
|
-
})
|
|
101
|
-
.catch((error) => {
|
|
102
|
-
reject(error);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
},
|
|
99
|
+
});
|
|
100
|
+
};
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Get the list of available content types
|
|
104
|
+
* @param {Array<String>} filter The filter used to select the learning content
|
|
105
|
+
* @param {String} version The version to be retrieved
|
|
106
|
+
* @param {boolean} includeDeleted When true it will return the deleted records as well
|
|
107
|
+
* @param {String} token Authorization token
|
|
108
|
+
* @returns {Promise<Array<Object>>} The list of available content
|
|
109
|
+
*/
|
|
110
|
+
export const getLearningContentList = (
|
|
111
|
+
filter,
|
|
112
|
+
version,
|
|
113
|
+
includeDeleted,
|
|
114
|
+
token
|
|
115
|
+
) => {
|
|
116
|
+
return new Promise(function (resolve, reject) {
|
|
117
|
+
const requestData = {
|
|
118
|
+
version: version,
|
|
119
|
+
includeDeleted: includeDeleted,
|
|
120
|
+
};
|
|
121
|
+
if (filter) requestData.filter = filter;
|
|
122
|
+
let confirmationRequest = axios.post(
|
|
123
|
+
`api/v1/learningcontent`,
|
|
124
|
+
requestData,
|
|
125
|
+
{
|
|
126
|
+
headers: { authorization: token },
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
confirmationRequest
|
|
130
|
+
.then((response) => {
|
|
131
|
+
resolve(response.data);
|
|
132
|
+
})
|
|
133
|
+
.catch((error) => {
|
|
134
|
+
reject(error);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Publish learning content
|
|
141
|
+
* @param {String} id The id of the content to be published
|
|
142
|
+
* @param {String} comment The comment to be include with the request
|
|
143
|
+
* @param {String} token Authorization token
|
|
144
|
+
* @returns {Promise<Object>} The response from the server
|
|
145
|
+
*/
|
|
146
|
+
export const publishLearningContent = (id, comment, token) => {
|
|
147
|
+
return new Promise(function (resolve, reject) {
|
|
148
|
+
let data = {};
|
|
149
|
+
if (comment) data.comment = comment;
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
151
|
+
let confirmationRequest = axios.post(
|
|
152
|
+
`api/v1/learningcontent/publish/${id}`,
|
|
153
|
+
data,
|
|
154
|
+
{
|
|
155
|
+
headers: { authorization: token },
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
confirmationRequest
|
|
159
|
+
.then((response) => {
|
|
160
|
+
resolve(response.data);
|
|
161
|
+
})
|
|
162
|
+
.catch((error) => {
|
|
163
|
+
reject(error);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Set learning content information
|
|
170
|
+
* @param {String} id The id of the learning content to be updated
|
|
171
|
+
* @param {Object} data Data used to update the learning content
|
|
172
|
+
* @param {String} token Authorization token
|
|
173
|
+
* @returns {Promise<Object>} The updated learning content
|
|
174
|
+
*/
|
|
175
|
+
export const setLearningContentInformation = (id, data, token) => {
|
|
176
|
+
return new Promise(function (resolve, reject) {
|
|
177
|
+
const requestData = {
|
|
178
|
+
data: data,
|
|
179
|
+
id: id,
|
|
180
|
+
};
|
|
181
|
+
let confirmationRequest = axios.post(
|
|
182
|
+
`api/v1/learningcontent/update`,
|
|
183
|
+
requestData,
|
|
184
|
+
{
|
|
185
|
+
headers: { authorization: token },
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
confirmationRequest
|
|
189
|
+
.then((response) => {
|
|
190
|
+
resolve(response.data);
|
|
191
|
+
})
|
|
192
|
+
.catch((error) => {
|
|
193
|
+
reject(error);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Update the learning content tags
|
|
200
|
+
* @param {String} id The id of the learning to be updated
|
|
201
|
+
* @param {Object} tags Updated learning content tags
|
|
202
|
+
* @param {String} token Authorization token
|
|
203
|
+
*/
|
|
204
|
+
export const setLearningContentTags = (id, tags, token) => {
|
|
205
|
+
return new Promise(function (resolve, reject) {
|
|
206
|
+
const requestData = {
|
|
207
|
+
tags: tags,
|
|
208
|
+
id: id,
|
|
209
|
+
};
|
|
210
|
+
let confirmationRequest = axios.post(
|
|
211
|
+
`api/v1/learningcontent/updatetags/`,
|
|
212
|
+
requestData,
|
|
213
|
+
{
|
|
214
|
+
headers: { authorization: token },
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
confirmationRequest
|
|
218
|
+
.then((response) => {
|
|
219
|
+
resolve(response.data);
|
|
220
|
+
})
|
|
221
|
+
.catch((error) => {
|
|
222
|
+
reject(error);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
},
|
|
227
|
+
/**
|
|
228
|
+
* Watch learning content
|
|
229
|
+
* @param {String} id The id of the learning content to be updated
|
|
230
|
+
* @param {Boolean} watch Set to true or false
|
|
231
|
+
* @param {String} token Authorization token
|
|
232
|
+
*/
|
|
233
|
+
export const watchLearningContent = (id, watch, token) => {
|
|
234
|
+
return new Promise(function (resolve, reject) {
|
|
235
|
+
const requestData = {
|
|
236
|
+
id: id,
|
|
237
|
+
watch: watch,
|
|
238
|
+
};
|
|
239
|
+
let confirmationRequest = axios.post(
|
|
240
|
+
`api/v1/learningcontent/watch`,
|
|
241
|
+
requestData,
|
|
242
|
+
{
|
|
243
|
+
headers: { authorization: token },
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
confirmationRequest
|
|
247
|
+
.then((response) => {
|
|
248
|
+
resolve(response.data);
|
|
249
|
+
})
|
|
250
|
+
.catch((error) => {
|
|
251
|
+
reject(error);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
255
254
|
};
|
package/lib/logger.js
CHANGED
|
@@ -1,61 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
elementType: elementType,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
headers: { authorization: token },
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
confirmationRequest
|
|
27
|
-
.then((response) => {
|
|
28
|
-
resolve(response.data);
|
|
29
|
-
})
|
|
30
|
-
.catch((error) => {
|
|
31
|
-
reject(error);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get the list of logger entries for selected element
|
|
38
|
-
* @param {String} elementId
|
|
39
|
-
* @param {Number} page The results page
|
|
40
|
-
* @param {Number} elementsPerPage The number of elements per page
|
|
41
|
-
* @param {String} token
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
getListByElementId: (elementId, page, elementsPerPage, token) => {
|
|
45
|
-
return new Promise(function (resolve, reject) {
|
|
46
|
-
let data = {};
|
|
47
|
-
if (elementsPerPage !== null) data.elementsPerPage = elementsPerPage;
|
|
48
|
-
if (page !== null) data.page = page;
|
|
49
|
-
const getTokensRequest = axios.post(`api/v1/logger/${elementId}`, data, {
|
|
3
|
+
/**
|
|
4
|
+
* Create a comment for a specified element id
|
|
5
|
+
* @param {String} elementId
|
|
6
|
+
* @param {String} elementType
|
|
7
|
+
* @param {Object} data
|
|
8
|
+
* @param {String} token Authorization token
|
|
9
|
+
*/
|
|
10
|
+
export const comment = (elementId, elementType, data, token) => {
|
|
11
|
+
return new Promise(function (resolve, reject) {
|
|
12
|
+
let confirmationRequest = axios.post(
|
|
13
|
+
"api/v1/logger/comment/",
|
|
14
|
+
{
|
|
15
|
+
data: data,
|
|
16
|
+
elementId: elementId,
|
|
17
|
+
elementType: elementType,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
50
20
|
headers: { authorization: token },
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
confirmationRequest
|
|
24
|
+
.then((response) => {
|
|
25
|
+
resolve(response.data);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
reject(error);
|
|
51
29
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the list of logger entries for selected element
|
|
35
|
+
* @param {String} elementId
|
|
36
|
+
* @param {Number} page The results page
|
|
37
|
+
* @param {Number} elementsPerPage The number of elements per page
|
|
38
|
+
* @param {String} token
|
|
39
|
+
*/
|
|
40
|
+
export const getListByElementId = (elementId, page, elementsPerPage, token) => {
|
|
41
|
+
return new Promise(function (resolve, reject) {
|
|
42
|
+
let data = {};
|
|
43
|
+
if (elementsPerPage !== null) data.elementsPerPage = elementsPerPage;
|
|
44
|
+
if (page !== null) data.page = page;
|
|
45
|
+
const getTokensRequest = axios.post(`api/v1/logger/${elementId}`, data, {
|
|
46
|
+
headers: { authorization: token },
|
|
59
47
|
});
|
|
60
|
-
|
|
48
|
+
getTokensRequest
|
|
49
|
+
.then((result) => {
|
|
50
|
+
resolve(result.data);
|
|
51
|
+
})
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
reject(error);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
61
56
|
};
|