@stackfactor/client-api 1.0.0
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/LICENSE +201 -0
- package/index.js +22 -0
- package/lib/actionNotifications.js +243 -0
- package/lib/address.js +29 -0
- package/lib/axios.js +216 -0
- package/lib/config.js +77 -0
- package/lib/dashboard.js +75 -0
- package/lib/departmentTrainingPlans.js +163 -0
- package/lib/groups.js +314 -0
- package/lib/integration.js +337 -0
- package/lib/integrationConfiguration.js +94 -0
- package/lib/integrations/contentgenerator.js +79 -0
- package/lib/logger.js +61 -0
- package/lib/role.js +266 -0
- package/lib/roleTemplate.js +243 -0
- package/lib/skill.js +338 -0
- package/lib/skillAssessmentTestingSession.js +143 -0
- package/lib/skillAssessments.js +139 -0
- package/lib/skillTemplate.js +248 -0
- package/lib/teams.js +277 -0
- package/lib/templateDocument.js +131 -0
- package/lib/templatePhase.js +134 -0
- package/lib/templateRelease.js +98 -0
- package/lib/templates.js +159 -0
- package/lib/tenants.js +60 -0
- package/lib/trainingPlanTemplate.js +215 -0
- package/lib/trainingPlans.js +267 -0
- package/lib/userInformation.js +89 -0
- package/lib/users.js +622 -0
- package/lib/utils.js +27 -0
- package/package.json +24 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
axios: axios,
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create role template and set information
|
|
8
|
+
* @param {Object} data
|
|
9
|
+
* @param {String} token Authorization token
|
|
10
|
+
*/
|
|
11
|
+
createRoleTemplate(data, token) {
|
|
12
|
+
return new Promise(function (resolve, reject) {
|
|
13
|
+
const requestData = {
|
|
14
|
+
data: data,
|
|
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
|
+
});
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Delete role template
|
|
31
|
+
* @param {String} id The id of the template to be deleted
|
|
32
|
+
* @param {String} comment The comment included with the deletion
|
|
33
|
+
* @param {String} token Authorization token
|
|
34
|
+
*/
|
|
35
|
+
deleteRoleTemplate(id, comment, token) {
|
|
36
|
+
return new Promise(function (resolve, reject) {
|
|
37
|
+
const data = {
|
|
38
|
+
id: id,
|
|
39
|
+
};
|
|
40
|
+
if (comment) data.comment = comment;
|
|
41
|
+
const request = axios.delete(`api/v1/roletemplates/`, {
|
|
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
|
+
/**
|
|
56
|
+
* Discard the role template draft changes
|
|
57
|
+
* @param {String} id The id of the role template to be deleted
|
|
58
|
+
* @param {String} token Authorization token
|
|
59
|
+
*/
|
|
60
|
+
discardRoleTemplateChanges(id, token) {
|
|
61
|
+
return new Promise(function (resolve, reject) {
|
|
62
|
+
const data = {};
|
|
63
|
+
const request = axios.get(`api/v1/roletemplates/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
|
+
/**
|
|
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
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get role template list
|
|
102
|
+
* @param {Array<String>} filter The list of integrations to be received
|
|
103
|
+
* @param {boolean} includeDeleted When true it will return the deleted records as well
|
|
104
|
+
* @param {String} token Authorization token
|
|
105
|
+
*/
|
|
106
|
+
getRoleTemplateList(filter, version, includeDeleted, token) {
|
|
107
|
+
return new Promise(function (resolve, reject) {
|
|
108
|
+
const requestData = {
|
|
109
|
+
version: version,
|
|
110
|
+
includeDeleted: includeDeleted,
|
|
111
|
+
};
|
|
112
|
+
if (filter) requestData.filter = filter;
|
|
113
|
+
let confirmationRequest = axios.post(
|
|
114
|
+
`api/v1/roletemplates`,
|
|
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
|
+
});
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Publish template
|
|
132
|
+
* @param {number} id The id of the template to be published
|
|
133
|
+
* @param {String} comment The comment to be include with the request
|
|
134
|
+
* @param {String} token Authorization token
|
|
135
|
+
*/
|
|
136
|
+
publishTemplate(id, comment, token) {
|
|
137
|
+
return new Promise(function (resolve, reject) {
|
|
138
|
+
let data = {};
|
|
139
|
+
if (comment) data.comment = comment;
|
|
140
|
+
let confirmationRequest = axios.post(
|
|
141
|
+
`api/v1/roletemplates/publish/${id}`,
|
|
142
|
+
data,
|
|
143
|
+
{
|
|
144
|
+
headers: { authorization: token },
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
confirmationRequest
|
|
148
|
+
.then((response) => {
|
|
149
|
+
resolve(response.data);
|
|
150
|
+
})
|
|
151
|
+
.catch((error) => {
|
|
152
|
+
reject(error);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Set template profile information
|
|
159
|
+
* @param {String} id The id of the template to be updated
|
|
160
|
+
* @param {Object} data Data used to update the template
|
|
161
|
+
* @param {String} token Authorization token
|
|
162
|
+
*/
|
|
163
|
+
setTemplateInformation(id, data, token) {
|
|
164
|
+
return new Promise(function (resolve, reject) {
|
|
165
|
+
const requestData = {
|
|
166
|
+
data: data,
|
|
167
|
+
id: id,
|
|
168
|
+
};
|
|
169
|
+
let confirmationRequest = axios.post(
|
|
170
|
+
`api/v1/roletemplates/update`,
|
|
171
|
+
requestData,
|
|
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
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Update the role template tags
|
|
188
|
+
* @param {String} id The id of the template to be updated
|
|
189
|
+
* @param {Object} tags Updated template tags
|
|
190
|
+
* @param {String} token Authorization token
|
|
191
|
+
*/
|
|
192
|
+
setTemplateTags(id, tags, token) {
|
|
193
|
+
return new Promise(function (resolve, reject) {
|
|
194
|
+
const requestData = {
|
|
195
|
+
tags: tags,
|
|
196
|
+
id: id,
|
|
197
|
+
};
|
|
198
|
+
let confirmationRequest = axios.post(
|
|
199
|
+
`api/v1/roletemplates/updatetags/`,
|
|
200
|
+
requestData,
|
|
201
|
+
{
|
|
202
|
+
headers: { authorization: token },
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
confirmationRequest
|
|
206
|
+
.then((response) => {
|
|
207
|
+
resolve(response.data);
|
|
208
|
+
})
|
|
209
|
+
.catch((error) => {
|
|
210
|
+
reject(error);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Watch role template
|
|
217
|
+
* @param {String} id The id of the skill to be updated
|
|
218
|
+
* @param {Boolean} watch Set to true or false
|
|
219
|
+
* @param {String} token Authorization token
|
|
220
|
+
*/
|
|
221
|
+
watchRoleTemplate(id, watch, token) {
|
|
222
|
+
return new Promise(function (resolve, reject) {
|
|
223
|
+
const requestData = {
|
|
224
|
+
id: id,
|
|
225
|
+
watch: watch,
|
|
226
|
+
};
|
|
227
|
+
let confirmationRequest = axios.post(
|
|
228
|
+
`api/v1/roletemplates/watch`,
|
|
229
|
+
requestData,
|
|
230
|
+
{
|
|
231
|
+
headers: { authorization: token },
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
confirmationRequest
|
|
235
|
+
.then((response) => {
|
|
236
|
+
resolve(response.data);
|
|
237
|
+
})
|
|
238
|
+
.catch((error) => {
|
|
239
|
+
reject(error);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
};
|
package/lib/skill.js
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-undef
|
|
4
|
+
export default {
|
|
5
|
+
axios: axios,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Create skill and set information
|
|
9
|
+
* @param {Object} data
|
|
10
|
+
* @param {String} token Authorization token
|
|
11
|
+
*/
|
|
12
|
+
createSkill(data, token) {
|
|
13
|
+
return new Promise(function (resolve, reject) {
|
|
14
|
+
let confirmationRequest = axios.put(
|
|
15
|
+
"api/v1/skills",
|
|
16
|
+
{ data: data },
|
|
17
|
+
{
|
|
18
|
+
headers: { authorization: token },
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
confirmationRequest
|
|
22
|
+
.then((response) => {
|
|
23
|
+
resolve(response.data);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create skills from templates
|
|
33
|
+
* @param {Array<String>} templateIds,
|
|
34
|
+
* @param {String} token Authorization token
|
|
35
|
+
*/
|
|
36
|
+
createSkillsFromTemplates(templateIds, token) {
|
|
37
|
+
return new Promise(function (resolve, reject) {
|
|
38
|
+
const requestData = {
|
|
39
|
+
templateIds: templateIds,
|
|
40
|
+
};
|
|
41
|
+
let confirmationRequest = axios.put(
|
|
42
|
+
"api/v1/skills/createfromtemplate/",
|
|
43
|
+
requestData,
|
|
44
|
+
{
|
|
45
|
+
headers: { authorization: token },
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
confirmationRequest
|
|
49
|
+
.then((response) => {
|
|
50
|
+
resolve(response.data);
|
|
51
|
+
})
|
|
52
|
+
.catch((error) => {
|
|
53
|
+
reject(error);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Delete skill
|
|
60
|
+
* @param {String} id The id of the skill to be deleted
|
|
61
|
+
* @param {String} comment The comment included with the deletion
|
|
62
|
+
* @param {String} token Authorization token
|
|
63
|
+
*/
|
|
64
|
+
deleteSkill(id, comment, token) {
|
|
65
|
+
return new Promise(function (resolve, reject) {
|
|
66
|
+
const data = {
|
|
67
|
+
id: id,
|
|
68
|
+
};
|
|
69
|
+
if (comment) data.comment = comment;
|
|
70
|
+
const request = axios.delete(`api/v1/skills/`, {
|
|
71
|
+
headers: { authorization: token },
|
|
72
|
+
data: data,
|
|
73
|
+
});
|
|
74
|
+
request
|
|
75
|
+
.then((response) => {
|
|
76
|
+
resolve(response.data);
|
|
77
|
+
})
|
|
78
|
+
.catch((error) => {
|
|
79
|
+
reject(error);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Discard the skill draft changes
|
|
86
|
+
* @param {String} id The id of the skill to be deleted
|
|
87
|
+
* @param {String} token Authorization token
|
|
88
|
+
*/
|
|
89
|
+
discardSkillChanges(id, token) {
|
|
90
|
+
return new Promise(function (resolve, reject) {
|
|
91
|
+
const data = {};
|
|
92
|
+
const request = axios.get(`api/v1/skills/discard/${id}`, {
|
|
93
|
+
headers: { authorization: token },
|
|
94
|
+
data: data,
|
|
95
|
+
});
|
|
96
|
+
request
|
|
97
|
+
.then((response) => {
|
|
98
|
+
resolve(response.data);
|
|
99
|
+
})
|
|
100
|
+
.catch((error) => {
|
|
101
|
+
reject(error);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get the skill related roles
|
|
108
|
+
* @param {String} id
|
|
109
|
+
* @param {String} token
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
getSkillRelatedRoles(id, token) {
|
|
113
|
+
return new Promise(function (resolve, reject) {
|
|
114
|
+
let confirmationRequest = axios.get(
|
|
115
|
+
`api/v1/skills/getskillrelatedroles/${id}`,
|
|
116
|
+
{
|
|
117
|
+
headers: { authorization: token },
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
confirmationRequest
|
|
121
|
+
.then((response) => {
|
|
122
|
+
resolve(response.data);
|
|
123
|
+
})
|
|
124
|
+
.catch((error) => {
|
|
125
|
+
reject(error);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get skill required assessment type
|
|
132
|
+
* @param {String} id
|
|
133
|
+
* @param {String} token
|
|
134
|
+
*/
|
|
135
|
+
getSkillRequiredAssessmentType(id, token) {
|
|
136
|
+
return new Promise(function (resolve, reject) {
|
|
137
|
+
let confirmationRequest = axios.get(
|
|
138
|
+
`api/v1/skills/getrequiredassessmenttype/${id}`,
|
|
139
|
+
{
|
|
140
|
+
headers: { authorization: token },
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
confirmationRequest
|
|
144
|
+
.then((response) => {
|
|
145
|
+
resolve(response.data);
|
|
146
|
+
})
|
|
147
|
+
.catch((error) => {
|
|
148
|
+
reject(error);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Get skill skill information
|
|
155
|
+
* @param {String} id The id of the skill
|
|
156
|
+
* @param {String} token Authorization token
|
|
157
|
+
*/
|
|
158
|
+
getSkillInformationById(id, version, token) {
|
|
159
|
+
return new Promise(function (resolve, reject) {
|
|
160
|
+
let confirmationRequest = axios.get(
|
|
161
|
+
`api/v1/skills/skill/${id}/${version}`,
|
|
162
|
+
{
|
|
163
|
+
headers: { authorization: token },
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
confirmationRequest
|
|
167
|
+
.then((response) => {
|
|
168
|
+
resolve(response.data);
|
|
169
|
+
})
|
|
170
|
+
.catch((error) => {
|
|
171
|
+
reject(error);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get skill list
|
|
178
|
+
* @param {Array<String>} filter The filter used to select the skill
|
|
179
|
+
* @param {String} version The version to be retrieved
|
|
180
|
+
* @param {Boolean} includeDeleted If true it will return deleted records as well
|
|
181
|
+
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
182
|
+
* @param {String} token Authorization token
|
|
183
|
+
*/
|
|
184
|
+
getSkillList(
|
|
185
|
+
filter,
|
|
186
|
+
version,
|
|
187
|
+
includeDeleted,
|
|
188
|
+
returnDefaultIfVersionNotAvailable,
|
|
189
|
+
token
|
|
190
|
+
) {
|
|
191
|
+
return new Promise(function (resolve, reject) {
|
|
192
|
+
const requestData = {
|
|
193
|
+
version: version,
|
|
194
|
+
includeDeleted: includeDeleted,
|
|
195
|
+
returnDefaultIfVersionNotAvailable: returnDefaultIfVersionNotAvailable,
|
|
196
|
+
};
|
|
197
|
+
if (filter) requestData.filter = filter;
|
|
198
|
+
let confirmationRequest = axios.post(`api/v1/skills`, requestData, {
|
|
199
|
+
headers: { authorization: token },
|
|
200
|
+
});
|
|
201
|
+
confirmationRequest
|
|
202
|
+
.then((response) => {
|
|
203
|
+
resolve(response.data);
|
|
204
|
+
})
|
|
205
|
+
.catch((error) => {
|
|
206
|
+
reject(error);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get skills for team by id
|
|
213
|
+
* @param {String} teamId The ID of the team for which skills will be loaded
|
|
214
|
+
* @param {*} maxDepth How many levels down in the organization the skills will be loaded
|
|
215
|
+
* @param {*} token Authorization token
|
|
216
|
+
*/
|
|
217
|
+
getTeamSkillsById(teamId, maxDepth, token) {
|
|
218
|
+
return new Promise(function (resolve, reject) {
|
|
219
|
+
let confirmationRequest = axios.get(
|
|
220
|
+
`api/v1/skills/getteambyid/${teamId}/${maxDepth}`,
|
|
221
|
+
{
|
|
222
|
+
headers: { authorization: token },
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
confirmationRequest
|
|
226
|
+
.then((response) => {
|
|
227
|
+
resolve(response.data);
|
|
228
|
+
})
|
|
229
|
+
.catch((error) => {
|
|
230
|
+
reject(error);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get current user team skills
|
|
237
|
+
* @param {*} maxDepth How many levels down in the organization the skills will be loaded
|
|
238
|
+
* @param {*} token Authorization token
|
|
239
|
+
*/
|
|
240
|
+
getCurrentUserTeamSkills(maxDepth, token) {
|
|
241
|
+
return new Promise(function (resolve, reject) {
|
|
242
|
+
let confirmationRequest = axios.get(
|
|
243
|
+
`api/v1/skills/getcurrentuserteam/${maxDepth}`,
|
|
244
|
+
{
|
|
245
|
+
headers: { authorization: token },
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
confirmationRequest
|
|
249
|
+
.then((response) => {
|
|
250
|
+
resolve(response.data);
|
|
251
|
+
})
|
|
252
|
+
.catch((error) => {
|
|
253
|
+
reject(error);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Publish skill
|
|
260
|
+
* @param {String} id The id of the skill to be published
|
|
261
|
+
* @param {String} comment The comment to be include with the request
|
|
262
|
+
* @param {String} token Authorization token
|
|
263
|
+
*/
|
|
264
|
+
publishSkill(id, comment, token) {
|
|
265
|
+
return new Promise(function (resolve, reject) {
|
|
266
|
+
let data = {};
|
|
267
|
+
if (comment) data.comment = comment;
|
|
268
|
+
let confirmationRequest = axios.post(
|
|
269
|
+
`api/v1/skills/publish/${id}`,
|
|
270
|
+
data,
|
|
271
|
+
{
|
|
272
|
+
headers: { authorization: token },
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
confirmationRequest
|
|
276
|
+
.then((response) => {
|
|
277
|
+
resolve(response.data);
|
|
278
|
+
})
|
|
279
|
+
.catch((error) => {
|
|
280
|
+
reject(error);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Set skill information
|
|
287
|
+
* @param {String} id The id of the skill to be updated
|
|
288
|
+
* @param {Object} data Data used to update the skill
|
|
289
|
+
* @param {String} token Authorization token
|
|
290
|
+
*/
|
|
291
|
+
setSkillInformation(id, data, token) {
|
|
292
|
+
return new Promise(function (resolve, reject) {
|
|
293
|
+
const requestData = {
|
|
294
|
+
data: data,
|
|
295
|
+
id: id,
|
|
296
|
+
};
|
|
297
|
+
let confirmationRequest = axios.post(
|
|
298
|
+
`api/v1/skills/update/`,
|
|
299
|
+
requestData,
|
|
300
|
+
{
|
|
301
|
+
headers: { authorization: token },
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
confirmationRequest
|
|
305
|
+
.then((response) => {
|
|
306
|
+
resolve(response.data);
|
|
307
|
+
})
|
|
308
|
+
.catch((error) => {
|
|
309
|
+
reject(error);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Watch skill
|
|
316
|
+
* @param {String} id The id of the skill to be updated
|
|
317
|
+
* @param {Boolean} watch Set to true or false
|
|
318
|
+
* @param {String} token Authorization token
|
|
319
|
+
*/
|
|
320
|
+
watchSkill(id, watch, token) {
|
|
321
|
+
return new Promise(function (resolve, reject) {
|
|
322
|
+
const requestData = {
|
|
323
|
+
id: id,
|
|
324
|
+
watch: watch,
|
|
325
|
+
};
|
|
326
|
+
let confirmationRequest = axios.post(`api/v1/skills/watch`, requestData, {
|
|
327
|
+
headers: { authorization: token },
|
|
328
|
+
});
|
|
329
|
+
confirmationRequest
|
|
330
|
+
.then((response) => {
|
|
331
|
+
resolve(response.data);
|
|
332
|
+
})
|
|
333
|
+
.catch((error) => {
|
|
334
|
+
reject(error);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
},
|
|
338
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import axios from "./axios";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line no-undef
|
|
4
|
+
export default {
|
|
5
|
+
axios: axios,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* End an existing testing session
|
|
9
|
+
* @param {String} testingSessionId
|
|
10
|
+
* @param {String} token Authorization token
|
|
11
|
+
*/
|
|
12
|
+
endSession(testingSessionId, token) {
|
|
13
|
+
return new Promise(function (resolve, reject) {
|
|
14
|
+
let confirmationRequest = axios.put(
|
|
15
|
+
"api/v1/skillassessmenttestingsession/endsession",
|
|
16
|
+
{ id: testingSessionId },
|
|
17
|
+
{
|
|
18
|
+
headers: { authorization: token },
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
confirmationRequest
|
|
22
|
+
.then((response) => {
|
|
23
|
+
resolve(response.data);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* End an existing testing session
|
|
33
|
+
* @param {String} testingSessionId
|
|
34
|
+
* @param {Array<String>} selectedAnswers
|
|
35
|
+
* @param {String} token Authorization token
|
|
36
|
+
*/
|
|
37
|
+
getNextStep(testingSessionId, selectedAnswers, token) {
|
|
38
|
+
return new Promise(function (resolve, reject) {
|
|
39
|
+
let data = {
|
|
40
|
+
id: testingSessionId,
|
|
41
|
+
};
|
|
42
|
+
if (selectedAnswers) data.selectedAnswers = selectedAnswers;
|
|
43
|
+
let confirmationRequest = axios.post(
|
|
44
|
+
`api/v1/skillassessmenttestingsession/getnextstep`,
|
|
45
|
+
data,
|
|
46
|
+
{
|
|
47
|
+
headers: { authorization: token },
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
confirmationRequest
|
|
51
|
+
.then((response) => {
|
|
52
|
+
resolve(response.data);
|
|
53
|
+
})
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
reject(error);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get skill assessment by user and skill
|
|
62
|
+
* @param {String} userId
|
|
63
|
+
* @param {String} skillId
|
|
64
|
+
* @param {String} token
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
getSkillTestAssessment(userId, skillId, token) {
|
|
68
|
+
return new Promise(function (resolve, reject) {
|
|
69
|
+
let confirmationRequest = axios.post(
|
|
70
|
+
`api/v1/skillassessmenttestingsession/getbyuserandskill`,
|
|
71
|
+
{
|
|
72
|
+
userId: userId,
|
|
73
|
+
skillId: skillId,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
headers: { authorization: token },
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
confirmationRequest
|
|
80
|
+
.then((response) => {
|
|
81
|
+
resolve(response.data);
|
|
82
|
+
})
|
|
83
|
+
.catch((error) => {
|
|
84
|
+
reject(error);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Pause skill assessment
|
|
91
|
+
* @param {String} testingSessionId
|
|
92
|
+
* @param {String} token
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
pause(testingSessionId, token) {
|
|
96
|
+
return new Promise(function (resolve, reject) {
|
|
97
|
+
let confirmationRequest = axios.post(
|
|
98
|
+
`api/v1/skillassessmenttestingsession/pausesession`,
|
|
99
|
+
{
|
|
100
|
+
id: testingSessionId,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
headers: { authorization: token },
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
confirmationRequest
|
|
107
|
+
.then((response) => {
|
|
108
|
+
resolve(response.data);
|
|
109
|
+
})
|
|
110
|
+
.catch((error) => {
|
|
111
|
+
reject(error);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Start a new test skill test assessment session
|
|
118
|
+
* @param {String} skillId
|
|
119
|
+
* @param {Boolean} saveSession
|
|
120
|
+
* @param {String} token
|
|
121
|
+
*/
|
|
122
|
+
startSession(skillId, saveSession, token) {
|
|
123
|
+
return new Promise(function (resolve, reject) {
|
|
124
|
+
let confirmationRequest = axios.post(
|
|
125
|
+
"api/v1/skillassessmenttestingsession/startsession",
|
|
126
|
+
{
|
|
127
|
+
saveSession: saveSession,
|
|
128
|
+
skillId: skillId,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
headers: { authorization: token },
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
confirmationRequest
|
|
135
|
+
.then((response) => {
|
|
136
|
+
resolve(response.data);
|
|
137
|
+
})
|
|
138
|
+
.catch((error) => {
|
|
139
|
+
reject(error);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
};
|