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