@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/roleTemplate.js
CHANGED
|
@@ -1,272 +1,264 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
let confirmationRequest = axios.put("api/v1/roletemplates", requestData, {
|
|
17
|
-
headers: { authorization: token },
|
|
18
|
-
});
|
|
19
|
-
confirmationRequest
|
|
20
|
-
.then((response) => {
|
|
21
|
-
resolve(response.data);
|
|
22
|
-
})
|
|
23
|
-
.catch((error) => {
|
|
24
|
-
reject(error);
|
|
25
|
-
});
|
|
3
|
+
/**
|
|
4
|
+
* Create role template and set information
|
|
5
|
+
* @param {Object} data
|
|
6
|
+
* @param {String} token Authorization token
|
|
7
|
+
*/
|
|
8
|
+
export const createRoleTemplate = (data, token) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
const requestData = {
|
|
11
|
+
data: data,
|
|
12
|
+
};
|
|
13
|
+
let confirmationRequest = axios.put("api/v1/roletemplates", requestData, {
|
|
14
|
+
headers: { authorization: token },
|
|
26
15
|
});
|
|
27
|
-
|
|
16
|
+
confirmationRequest
|
|
17
|
+
.then((response) => {
|
|
18
|
+
resolve(response.data);
|
|
19
|
+
})
|
|
20
|
+
.catch((error) => {
|
|
21
|
+
reject(error);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Delete role template
|
|
28
|
+
* @param {String} id The id of the template to be deleted
|
|
29
|
+
* @param {String} comment The comment included with the deletion
|
|
30
|
+
* @param {String} token Authorization token
|
|
31
|
+
*/
|
|
32
|
+
export const deleteRoleTemplate = (id, comment, token) => {
|
|
33
|
+
return new Promise(function (resolve, reject) {
|
|
34
|
+
const data = {
|
|
35
|
+
id: id,
|
|
36
|
+
};
|
|
37
|
+
if (comment) data.comment = comment;
|
|
38
|
+
const request = axios.delete(`api/v1/roletemplates/`, {
|
|
39
|
+
headers: { authorization: token },
|
|
40
|
+
data: data,
|
|
41
|
+
});
|
|
42
|
+
request
|
|
43
|
+
.then((response) => {
|
|
44
|
+
resolve(response.data);
|
|
45
|
+
})
|
|
46
|
+
.catch((error) => {
|
|
47
|
+
reject(error);
|
|
44
48
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Discard the role template draft changes
|
|
54
|
+
* @param {String} id The id of the role template to be deleted
|
|
55
|
+
* @param {String} token Authorization token
|
|
56
|
+
*/
|
|
57
|
+
export const discardRoleTemplateChanges = (id, token) => {
|
|
58
|
+
return new Promise(function (resolve, reject) {
|
|
59
|
+
const data = {};
|
|
60
|
+
const request = axios.get(`api/v1/roletemplates/discard/${id}`, {
|
|
61
|
+
headers: { authorization: token },
|
|
62
|
+
data: data,
|
|
52
63
|
});
|
|
53
|
-
|
|
64
|
+
request
|
|
65
|
+
.then((response) => {
|
|
66
|
+
resolve(response.data);
|
|
67
|
+
})
|
|
68
|
+
.catch((error) => {
|
|
69
|
+
reject(error);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
54
73
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Get role template information
|
|
76
|
+
* @param {String} id The id of the template
|
|
77
|
+
* @param {String} token Authorization token
|
|
78
|
+
*/
|
|
79
|
+
export const getRoleTemplateInformationById = (id, version, token) => {
|
|
80
|
+
return new Promise(function (resolve, reject) {
|
|
81
|
+
let confirmationRequest = axios.get(
|
|
82
|
+
`api/v1/roletemplates/${id}/${version}`,
|
|
83
|
+
{
|
|
64
84
|
headers: { authorization: token },
|
|
65
|
-
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
confirmationRequest
|
|
88
|
+
.then((response) => {
|
|
89
|
+
resolve(response.data);
|
|
90
|
+
})
|
|
91
|
+
.catch((error) => {
|
|
92
|
+
reject(error);
|
|
66
93
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
resolve(response.data);
|
|
70
|
-
})
|
|
71
|
-
.catch((error) => {
|
|
72
|
-
reject(error);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Get role template information
|
|
79
|
-
* @param {String} id The id of the template
|
|
80
|
-
* @param {String} token Authorization token
|
|
81
|
-
*/
|
|
82
|
-
getRoleTemplateInformationById: (id, version, token) => {
|
|
83
|
-
return new Promise(function (resolve, reject) {
|
|
84
|
-
let confirmationRequest = axios.get(
|
|
85
|
-
`api/v1/roletemplates/${id}/${version}`,
|
|
86
|
-
{
|
|
87
|
-
headers: { authorization: token },
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
confirmationRequest
|
|
91
|
-
.then((response) => {
|
|
92
|
-
resolve(response.data);
|
|
93
|
-
})
|
|
94
|
-
.catch((error) => {
|
|
95
|
-
reject(error);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
},
|
|
94
|
+
});
|
|
95
|
+
};
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
requestData,
|
|
116
|
-
{
|
|
117
|
-
headers: { authorization: token },
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
confirmationRequest
|
|
121
|
-
.then((response) => {
|
|
122
|
-
resolve(response.data);
|
|
123
|
-
})
|
|
124
|
-
.catch((error) => {
|
|
125
|
-
reject(error);
|
|
126
|
-
});
|
|
97
|
+
/**
|
|
98
|
+
* Get role template list
|
|
99
|
+
* @param {Array<String>} filter The list of integrations to be received
|
|
100
|
+
* @param {boolean} includeDeleted When true it will return the deleted records as well
|
|
101
|
+
* @param {String} token Authorization token
|
|
102
|
+
*/
|
|
103
|
+
export const getRoleTemplateList = (filter, version, includeDeleted, token) => {
|
|
104
|
+
return new Promise(function (resolve, reject) {
|
|
105
|
+
const requestData = {
|
|
106
|
+
version: version,
|
|
107
|
+
includeDeleted: includeDeleted,
|
|
108
|
+
};
|
|
109
|
+
if (filter) requestData.filter = filter;
|
|
110
|
+
let confirmationRequest = axios.post(`api/v1/roletemplates`, requestData, {
|
|
111
|
+
headers: { authorization: token },
|
|
127
112
|
});
|
|
128
|
-
|
|
113
|
+
confirmationRequest
|
|
114
|
+
.then((response) => {
|
|
115
|
+
resolve(response.data);
|
|
116
|
+
})
|
|
117
|
+
.catch((error) => {
|
|
118
|
+
reject(error);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Import role templates
|
|
125
|
+
* @param {Array<String>} data The list of role templates to be imported
|
|
126
|
+
* @param {String} token
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
export const importRoleTemplates = (data, token) => {
|
|
130
|
+
return new Promise(function (resolve, reject) {
|
|
131
|
+
const requestData = {
|
|
132
|
+
data: data,
|
|
133
|
+
};
|
|
134
|
+
let confirmationRequest = axios.post(
|
|
135
|
+
`api/v1/roletemplates/import`,
|
|
136
|
+
requestData,
|
|
137
|
+
{
|
|
138
|
+
headers: { authorization: token },
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
confirmationRequest
|
|
149
142
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
143
|
+
.then((response) => {
|
|
144
|
+
resolve(response.data);
|
|
145
|
+
})
|
|
146
|
+
.catch((error) => {
|
|
147
|
+
reject(error);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
158
151
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Publish template
|
|
154
|
+
* @param {number} id The id of the template to be published
|
|
155
|
+
* @param {String} comment The comment to be include with the request
|
|
156
|
+
* @param {String} token Authorization token
|
|
157
|
+
*/
|
|
158
|
+
export const publishTemplate = (id, comment, token) => {
|
|
159
|
+
return new Promise(function (resolve, reject) {
|
|
160
|
+
let data = {};
|
|
161
|
+
if (comment) data.comment = comment;
|
|
162
|
+
let confirmationRequest = axios.post(
|
|
163
|
+
`api/v1/roletemplates/publish/${id}`,
|
|
164
|
+
data,
|
|
165
|
+
{
|
|
166
|
+
headers: { authorization: token },
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
confirmationRequest
|
|
170
|
+
.then((response) => {
|
|
171
|
+
resolve(response.data);
|
|
172
|
+
})
|
|
173
|
+
.catch((error) => {
|
|
174
|
+
reject(error);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
};
|
|
185
178
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Set template profile information
|
|
181
|
+
* @param {String} id The id of the template to be updated
|
|
182
|
+
* @param {Object} data Data used to update the template
|
|
183
|
+
* @param {String} token Authorization token
|
|
184
|
+
*/
|
|
185
|
+
export const setTemplateInformation = (id, data, token) => {
|
|
186
|
+
return new Promise(function (resolve, reject) {
|
|
187
|
+
const requestData = {
|
|
188
|
+
data: data,
|
|
189
|
+
id: id,
|
|
190
|
+
};
|
|
191
|
+
let confirmationRequest = axios.post(
|
|
192
|
+
`api/v1/roletemplates/update`,
|
|
193
|
+
requestData,
|
|
194
|
+
{
|
|
195
|
+
headers: { authorization: token },
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
confirmationRequest
|
|
199
|
+
.then((response) => {
|
|
200
|
+
resolve(response.data);
|
|
201
|
+
})
|
|
202
|
+
.catch((error) => {
|
|
203
|
+
reject(error);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
214
207
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Update the role template tags
|
|
210
|
+
* @param {String} id The id of the template to be updated
|
|
211
|
+
* @param {Object} tags Updated template tags
|
|
212
|
+
* @param {String} token Authorization token
|
|
213
|
+
*/
|
|
214
|
+
export const setTemplateTags = (id, tags, token) => {
|
|
215
|
+
return new Promise(function (resolve, reject) {
|
|
216
|
+
const requestData = {
|
|
217
|
+
tags: tags,
|
|
218
|
+
id: id,
|
|
219
|
+
};
|
|
220
|
+
let confirmationRequest = axios.post(
|
|
221
|
+
`api/v1/roletemplates/updatetags/`,
|
|
222
|
+
requestData,
|
|
223
|
+
{
|
|
224
|
+
headers: { authorization: token },
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
confirmationRequest
|
|
228
|
+
.then((response) => {
|
|
229
|
+
resolve(response.data);
|
|
230
|
+
})
|
|
231
|
+
.catch((error) => {
|
|
232
|
+
reject(error);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
};
|
|
243
236
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
},
|
|
237
|
+
/**
|
|
238
|
+
* Watch role template
|
|
239
|
+
* @param {String} id The id of the skill to be updated
|
|
240
|
+
* @param {Boolean} watch Set to true or false
|
|
241
|
+
* @param {String} token Authorization token
|
|
242
|
+
*/
|
|
243
|
+
export const watchRoleTemplate = (id, watch, token) => {
|
|
244
|
+
return new Promise(function (resolve, reject) {
|
|
245
|
+
const requestData = {
|
|
246
|
+
id: id,
|
|
247
|
+
watch: watch,
|
|
248
|
+
};
|
|
249
|
+
let confirmationRequest = axios.post(
|
|
250
|
+
`api/v1/roletemplates/watch`,
|
|
251
|
+
requestData,
|
|
252
|
+
{
|
|
253
|
+
headers: { authorization: token },
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
confirmationRequest
|
|
257
|
+
.then((response) => {
|
|
258
|
+
resolve(response.data);
|
|
259
|
+
})
|
|
260
|
+
.catch((error) => {
|
|
261
|
+
reject(error);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
272
264
|
};
|