@stackfactor/client-api 1.1.10 → 1.1.12-9.1

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.
Files changed (41) hide show
  1. package/.eslintrc.json +13 -0
  2. package/{exports.js → exports.ts} +14 -0
  3. package/index.ts +1 -0
  4. package/lib/{actionNotifications.js → actionNotifications.ts} +21 -11
  5. package/lib/{address.js → address.ts} +4 -5
  6. package/lib/aiAssistant.ts +197 -0
  7. package/lib/avatar.ts +41 -0
  8. package/lib/axiosClient.ts +92 -0
  9. package/lib/{config.js → config.ts} +20 -9
  10. package/lib/{constants.js → constants.ts} +11 -41
  11. package/lib/{dashboard.js → dashboard.ts} +19 -10
  12. package/lib/{departmentTrainingPlans.js → departmentTrainingPlans.ts} +63 -32
  13. package/lib/{groups.js → groups.ts} +68 -29
  14. package/lib/{integration.js → integration.ts} +103 -47
  15. package/lib/{integrationConfiguration.js → integrationConfiguration.ts} +27 -22
  16. package/lib/integrations/{contentGenerator.js → contentGenerator.ts} +38 -18
  17. package/lib/{learningContent.js → learningContent.ts} +246 -57
  18. package/lib/{learningPath.js → learningPath.ts} +57 -30
  19. package/lib/{logger.js → logger.ts} +18 -8
  20. package/lib/microSkillsQuizes.ts +70 -0
  21. package/lib/quotas.ts +59 -0
  22. package/lib/{role.js → role.ts} +117 -69
  23. package/lib/{roleTemplate.js → roleTemplate.ts} +65 -30
  24. package/lib/security.ts +99 -0
  25. package/lib/{skill.js → skill.ts} +125 -87
  26. package/lib/{skillAssessments.js → skillAssessmentTestingSession.ts} +63 -16
  27. package/lib/skillAssessments.ts +192 -0
  28. package/lib/{skillTemplate.js → skillTemplate.ts} +73 -42
  29. package/lib/talentTransfromation.ts +126 -0
  30. package/lib/{teams.js → teams.ts} +73 -38
  31. package/lib/{tenants.js → tenants.ts} +17 -10
  32. package/lib/{trainingPlans.js → trainingPlans.ts} +159 -56
  33. package/lib/trainingPlansProficiencyLevels.ts +132 -0
  34. package/lib/{userInformation.js → userInformation.ts} +27 -26
  35. package/lib/{users.js → users.ts} +239 -140
  36. package/lib/utils.ts +64 -0
  37. package/package.json +12 -1
  38. package/index.js +0 -3
  39. package/lib/axiosClient.js +0 -85
  40. package/lib/skillAssessmentTestingSession.js +0 -148
  41. package/lib/utils.js +0 -48
@@ -0,0 +1,99 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Get the enabled authentication connections for current organization.
5
+ * @param {String} authToken - Authorization token
6
+ * @returns {Promise<Object>}
7
+ */
8
+ const getAuthConnections = (authToken: string): Promise<object> => {
9
+ return new Promise((resolve, reject) => {
10
+ const getConfigInformationRequest = client.get(
11
+ `api/v1/security/authconnections`,
12
+ { headers: { authorization: authToken } }
13
+ );
14
+ getConfigInformationRequest
15
+ .then((response) => {
16
+ resolve(response.data);
17
+ })
18
+ .catch((error) => {
19
+ reject(error);
20
+ });
21
+ });
22
+ };
23
+
24
+ /**
25
+ * Set the enabled authentication connections for current organization.
26
+ * @param {Object} data - the object containing the updated configuration
27
+ * @param {String} authToken - Authorization token
28
+ * @returns {Promise<Object>}
29
+ */
30
+ const setAuthConnections = (
31
+ data: object,
32
+ authToken: string
33
+ ): Promise<object> => {
34
+ return new Promise((resolve, reject) => {
35
+ const setConfigInformationRequest = client.post(
36
+ `api/v1/security/authconnections`,
37
+ { data: data },
38
+ { headers: { authorization: authToken } }
39
+ );
40
+ setConfigInformationRequest
41
+ .then((response) => {
42
+ resolve(response.data);
43
+ })
44
+ .catch((error) => {
45
+ reject(error);
46
+ });
47
+ });
48
+ };
49
+
50
+ /**
51
+ * Reset the MFA for the user.
52
+ * @param {String} userId
53
+ * @param {String} authToken
54
+ * @returns {Promise<Object>}
55
+ */
56
+ const resetMFA = (userId: string, authToken: string): Promise<object> => {
57
+ return new Promise((resolve, reject) => {
58
+ const resetMFARequest = client.post(
59
+ `api/v1/security/resetmfa`,
60
+ userId ? {} : { userId: userId },
61
+ { headers: { authorization: authToken } }
62
+ );
63
+ resetMFARequest
64
+ .then((response) => {
65
+ resolve(response.data);
66
+ })
67
+ .catch((error) => {
68
+ reject(error);
69
+ });
70
+ });
71
+ };
72
+
73
+ /**
74
+ * Synchronize the authentication connections with Auth0.
75
+ * @param {String} authToken
76
+ * @returns {Promise<Object>}
77
+ */
78
+ const synchronizeWithAuth0 = (authToken: string): Promise<object> => {
79
+ return new Promise((resolve, reject) => {
80
+ const synchronizeRequest = client.get(
81
+ `api/v1/security/synchronizewithauth0`,
82
+ { headers: { authorization: authToken } }
83
+ );
84
+ synchronizeRequest
85
+ .then((response) => {
86
+ resolve(response.data);
87
+ })
88
+ .catch((error) => {
89
+ reject(error);
90
+ });
91
+ });
92
+ };
93
+
94
+ export default {
95
+ getAuthConnections,
96
+ resetMFA,
97
+ setAuthConnections,
98
+ synchronizeWithAuth0,
99
+ };
@@ -4,10 +4,10 @@ import { client } from "./axiosClient.js";
4
4
  * Create skill and set information
5
5
  * @param {Object} data
6
6
  * @param {String} token Authorization token
7
- * @returns {Promise}
7
+ * @returns {Promise<Object>}
8
8
  */
9
- export const createSkill = (data, token) => {
10
- return new Promise(function (resolve, reject) {
9
+ const createSkill = (data: object, token: string): Promise<object> => {
10
+ return new Promise((resolve, reject) => {
11
11
  let confirmationRequest = client.put(
12
12
  "api/v1/skills",
13
13
  { data: data },
@@ -27,12 +27,15 @@ export const createSkill = (data, token) => {
27
27
 
28
28
  /**
29
29
  * Create skills from templates
30
- * @param {Array<String>} templateIds,
30
+ * @param {Array<String>} templateIds
31
31
  * @param {String} token Authorization token
32
- * @returns {Promise}
32
+ * @returns {Promise<Object>}
33
33
  */
34
- export const createSkillsFromTemplates = (templateIds, token) => {
35
- return new Promise(function (resolve, reject) {
34
+ const createSkillsFromTemplates = (
35
+ templateIds: string[],
36
+ token: string
37
+ ): Promise<object> => {
38
+ return new Promise((resolve, reject) => {
36
39
  const requestData = {
37
40
  templateIds: templateIds,
38
41
  };
@@ -58,11 +61,15 @@ export const createSkillsFromTemplates = (templateIds, token) => {
58
61
  * @param {String} id The id of the skill to be deleted
59
62
  * @param {String} comments The comments included with the deletion
60
63
  * @param {String} token Authorization token
61
- * @returns {Promise}
64
+ * @returns {Promise<Object>}
62
65
  */
63
- export const deleteSkill = (id, comments, token) => {
64
- return new Promise(function (resolve, reject) {
65
- const data = {
66
+ const deleteSkill = (
67
+ id: string,
68
+ comments: string,
69
+ token: string
70
+ ): Promise<object> => {
71
+ return new Promise((resolve, reject) => {
72
+ const data: { id: string; comments?: string } = {
66
73
  id: id,
67
74
  };
68
75
  if (comments) data.comments = comments;
@@ -82,12 +89,12 @@ export const deleteSkill = (id, comments, token) => {
82
89
 
83
90
  /**
84
91
  * Discard the skill draft changes
85
- * @param {String} id The id of the skill to be deleted
92
+ * @param {String} id The id of the skill to be discarded
86
93
  * @param {String} token Authorization token
87
- * @returns {Promise}
94
+ * @returns {Promise<Object>}
88
95
  */
89
- export const discardSkillChanges = (id, token) => {
90
- return new Promise(function (resolve, reject) {
96
+ const discardSkillChanges = (id: string, token: string): Promise<object> => {
97
+ return new Promise((resolve, reject) => {
91
98
  const data = {};
92
99
  const request = client.get(`api/v1/skills/discard/${id}`, {
93
100
  headers: { authorization: token },
@@ -105,16 +112,15 @@ export const discardSkillChanges = (id, token) => {
105
112
 
106
113
  /**
107
114
  * Get the list of imported skill templates
108
- * @param {String} token
109
- * @returns {Promise}
115
+ * @param {String} token Authorization token
116
+ * @returns {Promise<Object>}
110
117
  */
111
- export const getImportedSkillTemplates = (token) => {
112
- return new Promise(function (resolve, reject) {
118
+ const getImportedSkillTemplates = (token: string): Promise<object> => {
119
+ return new Promise((resolve, reject) => {
113
120
  const request = client.get(`api/v1/skills/getimportedskilltemplates`, {
114
121
  headers: { authorization: token },
115
122
  });
116
123
  request
117
-
118
124
  .then((response) => {
119
125
  resolve(response.data);
120
126
  })
@@ -127,13 +133,18 @@ export const getImportedSkillTemplates = (token) => {
127
133
  /**
128
134
  * Get the skill related roles
129
135
  * @param {String} id
130
- * @param {String} token
131
- * @returns {Promise}
136
+ * @param {String} token Authorization token
137
+ * @param {Boolean} includeRoleInformation
138
+ * @returns {Promise<Object>}
132
139
  */
133
- export const getSkillRelatedRoles = (id, token) => {
134
- return new Promise(function (resolve, reject) {
140
+ const getSkillRelatedRoles = (
141
+ id: string,
142
+ token: string,
143
+ includeRoleInformation = false
144
+ ): Promise<object> => {
145
+ return new Promise((resolve, reject) => {
135
146
  let confirmationRequest = client.get(
136
- `api/v1/skills/getskillrelatedroles/${id}`,
147
+ `api/v1/skills/getskillrelatedroles/${id}/${includeRoleInformation}`,
137
148
  {
138
149
  headers: { authorization: token },
139
150
  }
@@ -151,11 +162,14 @@ export const getSkillRelatedRoles = (id, token) => {
151
162
  /**
152
163
  * Get skill required assessment type
153
164
  * @param {String} id
154
- * @param {String} token
155
- * @returns {Promise}
165
+ * @param {String} token Authorization token
166
+ * @returns {Promise<Object>}
156
167
  */
157
- export const getSkillRequiredAssessmentType = (id, token) => {
158
- return new Promise(function (resolve, reject) {
168
+ const getSkillRequiredAssessmentType = (
169
+ id: string,
170
+ token: string
171
+ ): Promise<object> => {
172
+ return new Promise((resolve, reject) => {
159
173
  let confirmationRequest = client.get(
160
174
  `api/v1/skills/getrequiredassessmenttype/${id}`,
161
175
  {
@@ -173,20 +187,20 @@ export const getSkillRequiredAssessmentType = (id, token) => {
173
187
  };
174
188
 
175
189
  /**
176
- * Get skill skill information
190
+ * Get skill information
177
191
  * @param {String} id The id of the skill
178
192
  * @param {String} version The version of the skill
179
193
  * @param {Boolean} returnNullIfVersionNotFound When true it will return null if the version is not found
180
194
  * @param {String} token Authorization token
181
- * @returns {Promise}
195
+ * @returns {Promise<Object>}
182
196
  */
183
- export const getSkillInformationById = (
184
- id,
185
- version,
186
- returnNullIfVersionNotFound,
187
- token
188
- ) => {
189
- return new Promise(function (resolve, reject) {
197
+ const getSkillInformationById = (
198
+ id: string,
199
+ version: string,
200
+ returnNullIfVersionNotFound: boolean,
201
+ token: string
202
+ ): Promise<object> => {
203
+ return new Promise((resolve, reject) => {
190
204
  let confirmationRequest = client.get(
191
205
  `api/v1/skills/skill/${id}/${version}/${returnNullIfVersionNotFound}`,
192
206
  {
@@ -211,22 +225,23 @@ export const getSkillInformationById = (
211
225
  * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
212
226
  * @param {Boolean} namesOnly Return only the names of the skills
213
227
  * @param {String} token Authorization token
214
- * @returns {Promise}
228
+ * @returns {Promise<Object>}
215
229
  */
216
- export const getSkillList = (
217
- filter,
218
- version,
219
- includeDeleted,
220
- returnDefaultIfVersionNotAvailable,
221
- namesOnly,
222
- token
223
- ) => {
224
- return new Promise(function (resolve, reject) {
230
+ const getSkillList = (
231
+ filter: string[],
232
+ version: string,
233
+ includeDeleted: boolean,
234
+ returnDefaultIfVersionNotAvailable: boolean,
235
+ namesOnly: boolean,
236
+ token: string
237
+ ): Promise<object> => {
238
+ return new Promise((resolve, reject) => {
225
239
  const requestData = {
226
240
  includeDeleted: includeDeleted,
227
241
  namesOnly: namesOnly,
228
242
  returnDefaultIfVersionNotAvailable: returnDefaultIfVersionNotAvailable,
229
243
  version: version,
244
+ filter: filter,
230
245
  };
231
246
  if (filter) requestData.filter = filter;
232
247
  let confirmationRequest = client.post(`api/v1/skills`, requestData, {
@@ -248,15 +263,15 @@ export const getSkillList = (
248
263
  * @param {Number} maxDepth How many levels down in the organization the skills will be loaded
249
264
  * @param {Boolean} returnNullIfVersionNotFound Return null if the version is not found
250
265
  * @param {String} token Authorization token
251
- * @returns {Promise}
266
+ * @returns {Promise<Object>}
252
267
  */
253
- export const getTeamSkillsById = (
254
- teamId,
255
- maxDepth,
256
- returnNullIfVersionNotFound,
257
- token
258
- ) => {
259
- return new Promise(function (resolve, reject) {
268
+ const getTeamSkillsById = (
269
+ teamId: string,
270
+ maxDepth: number,
271
+ returnNullIfVersionNotFound: boolean,
272
+ token: string
273
+ ): Promise<object> => {
274
+ return new Promise((resolve, reject) => {
260
275
  let confirmationRequest = client.get(
261
276
  `api/v1/skills/getteambyid/${teamId}/${maxDepth}/${returnNullIfVersionNotFound}`,
262
277
  {
@@ -277,10 +292,13 @@ export const getTeamSkillsById = (
277
292
  * Get current user team skills
278
293
  * @param {Number} maxDepth How many levels down in the organization the skills will be loaded
279
294
  * @param {String} token Authorization token
280
- * @returns {Promise}
295
+ * @returns {Promise<Object>}
281
296
  */
282
- export const getCurrentUserTeamSkills = (maxDepth, token) => {
283
- return new Promise(function (resolve, reject) {
297
+ const getCurrentUserTeamSkills = (
298
+ maxDepth: number,
299
+ token: string
300
+ ): Promise<object> => {
301
+ return new Promise((resolve, reject) => {
284
302
  let confirmationRequest = client.get(
285
303
  `api/v1/skills/getcurrentuserteam/${maxDepth}`,
286
304
  {
@@ -300,11 +318,14 @@ export const getCurrentUserTeamSkills = (maxDepth, token) => {
300
318
  /**
301
319
  * Get skill template updates
302
320
  * @param {String} id The skill id
303
- * @param {String} token
304
- * @returns {Promise}
321
+ * @param {String} token Authorization token
322
+ * @returns {Promise<Object>}
305
323
  */
306
- export const getSkillTemplateUpdates = (id, token) => {
307
- return new Promise(function (resolve, reject) {
324
+ const getSkillTemplateUpdates = (
325
+ id: string,
326
+ token: string
327
+ ): Promise<object> => {
328
+ return new Promise((resolve, reject) => {
308
329
  let confirmationRequest = client.get(
309
330
  `api/v1/skills/getskilltemplateupdates/${id}`,
310
331
  {
@@ -325,11 +346,15 @@ export const getSkillTemplateUpdates = (id, token) => {
325
346
  * Import skill templates
326
347
  * @param {Array<String>} data The list of role templates to be imported
327
348
  * @param {Boolean} publish If true the imported templates will be published
328
- * @param {String} token
329
- * @returns {Promise}
349
+ * @param {String} token Authorization token
350
+ * @returns {Promise<Object>}
330
351
  */
331
- export const importSkillTemplates = (data, publish, token) => {
332
- return new Promise(function (resolve, reject) {
352
+ const importSkillTemplates = (
353
+ data: string[],
354
+ publish: boolean,
355
+ token: string
356
+ ): Promise<object> => {
357
+ return new Promise((resolve, reject) => {
333
358
  const requestData = {
334
359
  data: data,
335
360
  publish: publish,
@@ -342,7 +367,6 @@ export const importSkillTemplates = (data, publish, token) => {
342
367
  }
343
368
  );
344
369
  confirmationRequest
345
-
346
370
  .then((response) => {
347
371
  resolve(response.data);
348
372
  })
@@ -357,11 +381,15 @@ export const importSkillTemplates = (data, publish, token) => {
357
381
  * @param {String} id The id of the skill to be published
358
382
  * @param {String} comments The comments to be include with the request
359
383
  * @param {String} token Authorization token
360
- * @returns {Promise}
384
+ * @returns {Promise<Object>}
361
385
  */
362
- export const publishSkill = (id, comments, token) => {
363
- return new Promise(function (resolve, reject) {
364
- let data = {};
386
+ const publishSkill = (
387
+ id: string,
388
+ comments: string,
389
+ token: string
390
+ ): Promise<object> => {
391
+ return new Promise((resolve, reject) => {
392
+ let data: { comments?: string } = {};
365
393
  if (comments) data.comments = comments;
366
394
  let confirmationRequest = client.post(`api/v1/skills/publish/${id}`, data, {
367
395
  headers: { authorization: token },
@@ -381,10 +409,14 @@ export const publishSkill = (id, comments, token) => {
381
409
  * @param {String} id The id of the skill to be updated
382
410
  * @param {Object} data Data used to update the skill
383
411
  * @param {String} token Authorization token
384
- * @returns {Promise}
412
+ * @returns {Promise<Object>}
385
413
  */
386
- export const setSkillInformation = (id, data, token) => {
387
- return new Promise(function (resolve, reject) {
414
+ const setSkillInformation = (
415
+ id: string,
416
+ data: object,
417
+ token: string
418
+ ): Promise<object> => {
419
+ return new Promise((resolve, reject) => {
388
420
  const requestData = {
389
421
  data: data,
390
422
  id: id,
@@ -411,10 +443,14 @@ export const setSkillInformation = (id, data, token) => {
411
443
  * @param {String} id The id of the skill to be updated
412
444
  * @param {Object} data Data used to update the skill
413
445
  * @param {String} token Authorization token
414
- * @returns {Promise}
446
+ * @returns {Promise<Object>}
415
447
  */
416
- export const setSkillInformationFromTemplate = (id, data, token) => {
417
- return new Promise(function (resolve, reject) {
448
+ const setSkillInformationFromTemplate = (
449
+ id: string,
450
+ data: object,
451
+ token: string
452
+ ): Promise<object> => {
453
+ return new Promise((resolve, reject) => {
418
454
  const requestData = {
419
455
  data: data,
420
456
  id: id,
@@ -440,10 +476,10 @@ export const setSkillInformationFromTemplate = (id, data, token) => {
440
476
  * Validate skill information
441
477
  * @param {String} id The id of the skill to be updated
442
478
  * @param {String} token Authorization token
443
- * @returns {Promise}
479
+ * @returns {Promise<Object>}
444
480
  */
445
- export const validateSkill = (id, token) => {
446
- return new Promise(function (resolve, reject) {
481
+ const validateSkill = (id: string, token: string): Promise<object> => {
482
+ return new Promise((resolve, reject) => {
447
483
  const requestData = {
448
484
  id: id,
449
485
  };
@@ -469,10 +505,14 @@ export const validateSkill = (id, token) => {
469
505
  * @param {String} id The id of the skill to be updated
470
506
  * @param {Boolean} watch Set to true or false
471
507
  * @param {String} token Authorization token
472
- * @returns {Promise}
508
+ * @returns {Promise<Object>}
473
509
  */
474
- export const watchSkill = (id, watch, token) => {
475
- return new Promise(function (resolve, reject) {
510
+ const watchSkill = (
511
+ id: string,
512
+ watch: boolean,
513
+ token: string
514
+ ): Promise<object> => {
515
+ return new Promise((resolve, reject) => {
476
516
  const requestData = {
477
517
  id: id,
478
518
  watch: watch,
@@ -490,7 +530,7 @@ export const watchSkill = (id, watch, token) => {
490
530
  });
491
531
  };
492
532
 
493
- const skill = {
533
+ export default {
494
534
  createSkill,
495
535
  createSkillsFromTemplates,
496
536
  deleteSkill,
@@ -510,5 +550,3 @@ const skill = {
510
550
  validateSkill,
511
551
  watchSkill,
512
552
  };
513
-
514
- export default skill;
@@ -6,9 +6,15 @@ import { client } from "./axiosClient.js";
6
6
  * @param {Object} data
7
7
  * @param {String} comments
8
8
  * @param {String} token Authorization token
9
+ * @returns {Promise<Object>}
9
10
  */
10
- export const addEntry = (id, data, comments, token) => {
11
- return new Promise(function (resolve, reject) {
11
+ const addEntry = (
12
+ id: string,
13
+ data: object,
14
+ comments: string,
15
+ token: string
16
+ ): Promise<object> => {
17
+ return new Promise((resolve, reject) => {
12
18
  const requestData = {
13
19
  comments: comments,
14
20
  data: data,
@@ -37,9 +43,15 @@ export const addEntry = (id, data, comments, token) => {
37
43
  * @param {String} comments
38
44
  * @param {String} userId
39
45
  * @param {String} token Authorization token
46
+ * @returns {Promise<Object>}
40
47
  */
41
- export const create = (data, comments, userId, token) => {
42
- return new Promise(function (resolve, reject) {
48
+ const create = (
49
+ data: object,
50
+ comments: string,
51
+ userId: string,
52
+ token: string
53
+ ): Promise<object> => {
54
+ return new Promise((resolve, reject) => {
43
55
  const requestData = {
44
56
  comments: comments,
45
57
  data: data,
@@ -67,10 +79,15 @@ export const create = (data, comments, userId, token) => {
67
79
  * @param {number} id The id of the skill to be deleted
68
80
  * @param {String} comments The comments included with the deletion
69
81
  * @param {String} token Authorization token
82
+ * @returns {Promise<Object>}
70
83
  */
71
- export const deleteSkillAssessment = (id, comments, token) => {
72
- return new Promise(function (resolve, reject) {
73
- const data = {
84
+ const deleteSkillAssessment = (
85
+ id: number,
86
+ comments: string,
87
+ token: string
88
+ ): Promise<object> => {
89
+ return new Promise((resolve, reject) => {
90
+ const data: { id: number, comments?: string } = {
74
91
  id: id,
75
92
  };
76
93
  if (comments) data.comments = comments;
@@ -92,9 +109,10 @@ export const deleteSkillAssessment = (id, comments, token) => {
92
109
  * Get skill assessment by id
93
110
  * @param {String} id
94
111
  * @param {String} token
112
+ * @returns {Promise<Object>}
95
113
  */
96
- export const getById = (id, token) => {
97
- return new Promise(function (resolve, reject) {
114
+ const getById = (id: string, token: string): Promise<object> => {
115
+ return new Promise((resolve, reject) => {
98
116
  let confirmationRequest = client.get(`api/v1/skillassessments/${id}`, {
99
117
  headers: { authorization: token },
100
118
  });
@@ -108,14 +126,44 @@ export const getById = (id, token) => {
108
126
  });
109
127
  };
110
128
 
129
+ /**
130
+ * Get skill assessment by user and skill
131
+ * @param {String} userId
132
+ * @param {String} skillId
133
+ * @param {String} token
134
+ * @returns {Promise<Object>} The skill assessment
135
+ */
136
+ const getByUserAndSkill = (
137
+ userId: string,
138
+ skillId: string,
139
+ token: string
140
+ ): Promise<object> => {
141
+ return new Promise((resolve, reject) => {
142
+ let confirmationRequest = client.get(
143
+ `api/v1/skillassessments/getbyuserandskill/${userId}/${skillId}`,
144
+ {
145
+ headers: { authorization: token },
146
+ }
147
+ );
148
+ confirmationRequest
149
+ .then((response) => {
150
+ resolve(response.data);
151
+ })
152
+ .catch((error) => {
153
+ reject(error);
154
+ });
155
+ });
156
+ };
157
+
111
158
  /**
112
159
  * Get list
113
- * @param {Object} userId The user used to select the skill
160
+ * @param {String} userId The user used to select the skill
114
161
  * @param {String} token Authorization token
162
+ * @returns {Promise<Object>}
115
163
  */
116
- export const getList = (userId, token) => {
117
- return new Promise(function (resolve, reject) {
118
- const requestData = {};
164
+ const getList = (userId: string, token: string): Promise<object> => {
165
+ return new Promise((resolve, reject) => {
166
+ const requestData: { userId?: string } = {};
119
167
  if (userId) requestData.userId = userId;
120
168
  let confirmationRequest = client.post(
121
169
  `api/v1/skillassessments`,
@@ -134,12 +182,11 @@ export const getList = (userId, token) => {
134
182
  });
135
183
  };
136
184
 
137
- const skillAssessments = {
185
+ export default {
138
186
  addEntry,
139
187
  create,
140
188
  deleteSkillAssessment,
141
189
  getById,
190
+ getByUserAndSkill,
142
191
  getList,
143
192
  };
144
-
145
- export default skillAssessments;