@stackfactor/client-api 1.1.133 → 1.1.135
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/.eslintrc.json +4 -3
- package/declarations/axios.d.ts +1 -0
- package/declarations/html2plaintext.d.ts +1 -0
- package/dist/actionNotifications.d.ts +7 -0
- package/dist/actionNotifications.d.ts.map +1 -0
- package/dist/actionNotifications.js +9 -10
- package/dist/actionNotifications.js.map +1 -0
- package/dist/address.d.ts +5 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +5 -6
- package/dist/address.js.map +1 -0
- package/dist/aiAssistant.d.ts +9 -0
- package/dist/aiAssistant.d.ts.map +1 -0
- package/dist/aiAssistant.js +16 -17
- package/dist/aiAssistant.js.map +1 -0
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +4 -5
- package/dist/avatar.js.map +1 -0
- package/dist/axiosClient.d.ts +32 -0
- package/dist/axiosClient.d.ts.map +1 -0
- package/dist/axiosClient.js +17 -27
- package/dist/axiosClient.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +9 -10
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +70 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -7
- package/dist/constants.js.map +1 -0
- package/dist/dashboard.d.ts +7 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/dist/dashboard.js +9 -10
- package/dist/dashboard.js.map +1 -0
- package/dist/departmentTrainingPlans.d.ts +13 -0
- package/dist/departmentTrainingPlans.d.ts.map +1 -0
- package/dist/departmentTrainingPlans.js +16 -17
- package/dist/departmentTrainingPlans.js.map +1 -0
- package/dist/groups.d.ts +16 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +27 -28
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -17
- package/dist/index.js.map +1 -0
- package/dist/integration.d.ts +95 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +62 -69
- package/dist/integration.js.map +1 -0
- package/dist/integrationConfiguration.d.ts +7 -0
- package/dist/integrationConfiguration.d.ts.map +1 -0
- package/dist/integrationConfiguration.js +10 -11
- package/dist/integrationConfiguration.js.map +1 -0
- package/dist/integrations/contentGenerator.d.ts +27 -0
- package/dist/integrations/contentGenerator.d.ts.map +1 -0
- package/dist/integrations/contentGenerator.js +12 -16
- package/dist/integrations/contentGenerator.js.map +1 -0
- package/dist/learningContent.d.ts +19 -0
- package/dist/learningContent.d.ts.map +1 -0
- package/dist/learningContent.js +30 -31
- package/dist/learningContent.js.map +1 -0
- package/dist/learningPath.d.ts +12 -0
- package/dist/learningPath.d.ts.map +1 -0
- package/dist/learningPath.js +19 -20
- package/dist/learningPath.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -9
- package/dist/logger.js.map +1 -0
- package/dist/microSkillsQuizes.d.ts +6 -0
- package/dist/microSkillsQuizes.d.ts.map +1 -0
- package/dist/microSkillsQuizes.js +8 -9
- package/dist/microSkillsQuizes.js.map +1 -0
- package/dist/quotas.d.ts +6 -0
- package/dist/quotas.d.ts.map +1 -0
- package/dist/quotas.js +7 -8
- package/dist/quotas.js.map +1 -0
- package/dist/role.d.ts +18 -0
- package/dist/role.d.ts.map +1 -0
- package/dist/role.js +32 -33
- package/dist/role.js.map +1 -0
- package/dist/roleTemplate.d.ts +13 -0
- package/dist/roleTemplate.d.ts.map +1 -0
- package/dist/roleTemplate.js +22 -23
- package/dist/roleTemplate.js.map +1 -0
- package/dist/security.d.ts +8 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +11 -12
- package/dist/security.js.map +1 -0
- package/dist/skill.d.ts +22 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +40 -41
- package/dist/skill.js.map +1 -0
- package/dist/skillAssessmentTestingSession.d.ts +10 -0
- package/dist/skillAssessmentTestingSession.d.ts.map +1 -0
- package/dist/skillAssessmentTestingSession.js +15 -16
- package/dist/skillAssessmentTestingSession.js.map +1 -0
- package/dist/skillAssessments.d.ts +10 -0
- package/dist/skillAssessments.d.ts.map +1 -0
- package/dist/skillAssessments.js +15 -16
- package/dist/skillAssessments.js.map +1 -0
- package/dist/skillTemplate.d.ts +15 -0
- package/dist/skillTemplate.d.ts.map +1 -0
- package/dist/skillTemplate.js +26 -27
- package/dist/skillTemplate.js.map +1 -0
- package/dist/talentTransfromation.d.ts +8 -0
- package/dist/talentTransfromation.d.ts.map +1 -0
- package/dist/talentTransfromation.js +11 -12
- package/dist/talentTransfromation.js.map +1 -0
- package/dist/teams.d.ts +15 -0
- package/dist/teams.d.ts.map +1 -0
- package/dist/teams.js +25 -26
- package/dist/teams.js.map +1 -0
- package/dist/tenants.d.ts +6 -0
- package/dist/tenants.d.ts.map +1 -0
- package/dist/tenants.js +7 -8
- package/dist/tenants.js.map +1 -0
- package/dist/trainingPlans.d.ts +16 -0
- package/dist/trainingPlans.d.ts.map +1 -0
- package/dist/trainingPlans.js +19 -20
- package/dist/trainingPlans.js.map +1 -0
- package/dist/trainingPlansProficiencyLevels.d.ts +8 -0
- package/dist/trainingPlansProficiencyLevels.d.ts.map +1 -0
- package/dist/trainingPlansProficiencyLevels.js +9 -10
- package/dist/trainingPlansProficiencyLevels.js.map +1 -0
- package/dist/userInformation.d.ts +7 -0
- package/dist/userInformation.d.ts.map +1 -0
- package/dist/userInformation.js +9 -10
- package/dist/userInformation.js.map +1 -0
- package/dist/users.d.ts +31 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +37 -39
- package/dist/users.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +8 -21
- package/dist/utils.js.map +1 -0
- package/package.json +15 -14
- package/src/lib/actionNotifications.ts +11 -10
- package/src/lib/address.ts +5 -4
- package/src/lib/aiAssistant.ts +25 -24
- package/src/lib/avatar.ts +4 -3
- package/src/lib/axiosClient.ts +22 -9
- package/src/lib/config.ts +11 -10
- package/src/lib/dashboard.ts +11 -10
- package/src/lib/departmentTrainingPlans.ts +29 -32
- package/src/lib/groups.ts +38 -37
- package/src/lib/index.ts +85 -1
- package/src/lib/integration.ts +56 -55
- package/src/lib/integrationConfiguration.ts +15 -14
- package/src/lib/integrations/contentGenerator.ts +10 -9
- package/src/lib/learningContent.ts +56 -55
- package/src/lib/learningPath.ts +32 -31
- package/src/lib/logger.ts +9 -8
- package/src/lib/microSkillsQuizes.ts +11 -10
- package/src/lib/quotas.ts +10 -9
- package/src/lib/role.ts +56 -55
- package/src/lib/roleTemplate.ts +37 -36
- package/src/lib/security.ts +14 -13
- package/src/lib/skill.ts +72 -71
- package/src/lib/skillAssessmentTestingSession.ts +25 -24
- package/src/lib/skillAssessments.ts +25 -24
- package/src/lib/skillTemplate.ts +45 -44
- package/src/lib/talentTransfromation.ts +15 -14
- package/src/lib/teams.ts +35 -34
- package/src/lib/tenants.ts +10 -9
- package/src/lib/trainingPlans.ts +37 -36
- package/src/lib/trainingPlansProficiencyLevels.ts +14 -13
- package/src/lib/userInformation.ts +13 -12
- package/src/lib/users.ts +72 -72
- package/src/lib/utils.ts +7 -16
- package/tsconfig.json +16 -5
- package/dist/exports.js +0 -77
- package/index.d.ts +0 -1
- package/src/lib/exports.ts +0 -85
package/src/lib/learningPath.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
interface LearningPathData {
|
|
4
5
|
data?: object;
|
|
@@ -14,11 +15,11 @@ interface LearningPathData {
|
|
|
14
15
|
* Create learning path and set information
|
|
15
16
|
* @param {Object} data
|
|
16
17
|
* @param {String} token Authorization token
|
|
17
|
-
* @returns {Promise<
|
|
18
|
+
* @returns {Promise<object>}
|
|
18
19
|
*/
|
|
19
20
|
const createLearningPath = (data: object, token: string): Promise<object> => {
|
|
20
21
|
return new Promise((resolve, reject) => {
|
|
21
|
-
|
|
22
|
+
const confirmationRequest = client.put(
|
|
22
23
|
"api/v1/learningpaths",
|
|
23
24
|
{ data: data },
|
|
24
25
|
{
|
|
@@ -26,10 +27,10 @@ const createLearningPath = (data: object, token: string): Promise<object> => {
|
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
confirmationRequest
|
|
29
|
-
.then((response) => {
|
|
30
|
+
.then((response : AxiosResponse) => {
|
|
30
31
|
resolve(response.data);
|
|
31
32
|
})
|
|
32
|
-
.catch((error) => {
|
|
33
|
+
.catch((error : AxiosError) => {
|
|
33
34
|
reject(error);
|
|
34
35
|
});
|
|
35
36
|
});
|
|
@@ -40,7 +41,7 @@ const createLearningPath = (data: object, token: string): Promise<object> => {
|
|
|
40
41
|
* @param {String} id The id of the template to be deleted
|
|
41
42
|
* @param {String} comments The comments for approver
|
|
42
43
|
* @param {String} token Authorization token
|
|
43
|
-
* @returns {Promise<
|
|
44
|
+
* @returns {Promise<object>}
|
|
44
45
|
*/
|
|
45
46
|
const deleteLearningPath = (id: string, comments: string, token: string): Promise<object> => {
|
|
46
47
|
return new Promise((resolve, reject) => {
|
|
@@ -53,10 +54,10 @@ const deleteLearningPath = (id: string, comments: string, token: string): Promis
|
|
|
53
54
|
data: data,
|
|
54
55
|
});
|
|
55
56
|
request
|
|
56
|
-
.then((response) => {
|
|
57
|
+
.then((response : AxiosResponse) => {
|
|
57
58
|
resolve(response.data);
|
|
58
59
|
})
|
|
59
|
-
.catch((error) => {
|
|
60
|
+
.catch((error : AxiosError) => {
|
|
60
61
|
reject(error);
|
|
61
62
|
});
|
|
62
63
|
});
|
|
@@ -66,7 +67,7 @@ const deleteLearningPath = (id: string, comments: string, token: string): Promis
|
|
|
66
67
|
* Discard the training plan draft changes
|
|
67
68
|
* @param {String} id The id of the training plan to be deleted
|
|
68
69
|
* @param {String} token Authorization token
|
|
69
|
-
* @returns {Promise<
|
|
70
|
+
* @returns {Promise<object>}
|
|
70
71
|
*/
|
|
71
72
|
const discardLearningPathChanges = (id: string, token: string): Promise<object> => {
|
|
72
73
|
return new Promise((resolve, reject) => {
|
|
@@ -76,10 +77,10 @@ const discardLearningPathChanges = (id: string, token: string): Promise<object>
|
|
|
76
77
|
data: data,
|
|
77
78
|
});
|
|
78
79
|
request
|
|
79
|
-
.then((response) => {
|
|
80
|
+
.then((response : AxiosResponse) => {
|
|
80
81
|
resolve(response.data);
|
|
81
82
|
})
|
|
82
|
-
.catch((error) => {
|
|
83
|
+
.catch((error : AxiosError) => {
|
|
83
84
|
reject(error);
|
|
84
85
|
});
|
|
85
86
|
});
|
|
@@ -90,21 +91,21 @@ const discardLearningPathChanges = (id: string, token: string): Promise<object>
|
|
|
90
91
|
* @param {String} id The id of the template
|
|
91
92
|
* @param {String} version The version of the template
|
|
92
93
|
* @param {String} token Authorization token
|
|
93
|
-
* @returns {Promise<
|
|
94
|
+
* @returns {Promise<object>}
|
|
94
95
|
*/
|
|
95
96
|
const getLearningPathInformationById = (id: string, version: string, token: string): Promise<object> => {
|
|
96
97
|
return new Promise((resolve, reject) => {
|
|
97
|
-
|
|
98
|
+
const confirmationRequest = client.get(
|
|
98
99
|
`api/v1/learningpaths/${id}/${version}`,
|
|
99
100
|
{
|
|
100
101
|
headers: { authorization: token },
|
|
101
102
|
}
|
|
102
103
|
);
|
|
103
104
|
confirmationRequest
|
|
104
|
-
.then((response) => {
|
|
105
|
+
.then((response : AxiosResponse) => {
|
|
105
106
|
resolve(response.data);
|
|
106
107
|
})
|
|
107
|
-
.catch((error) => {
|
|
108
|
+
.catch((error : AxiosError) => {
|
|
108
109
|
reject(error);
|
|
109
110
|
});
|
|
110
111
|
});
|
|
@@ -130,7 +131,7 @@ const getLearningPathsList = (
|
|
|
130
131
|
includeDeleted: includeDeleted,
|
|
131
132
|
};
|
|
132
133
|
if (list) requestData.list = list;
|
|
133
|
-
|
|
134
|
+
const confirmationRequest = client.post(
|
|
134
135
|
`api/v1/learningpaths`,
|
|
135
136
|
requestData,
|
|
136
137
|
{
|
|
@@ -138,10 +139,10 @@ const getLearningPathsList = (
|
|
|
138
139
|
}
|
|
139
140
|
);
|
|
140
141
|
confirmationRequest
|
|
141
|
-
.then((response) => {
|
|
142
|
+
.then((response : AxiosResponse) => {
|
|
142
143
|
resolve(response.data);
|
|
143
144
|
})
|
|
144
|
-
.catch((error) => {
|
|
145
|
+
.catch((error : AxiosError) => {
|
|
145
146
|
reject(error);
|
|
146
147
|
});
|
|
147
148
|
});
|
|
@@ -152,13 +153,13 @@ const getLearningPathsList = (
|
|
|
152
153
|
* @param {String} id The id of the template to be published
|
|
153
154
|
* @param {String} comments The comments to be include with the request
|
|
154
155
|
* @param {String} token Authorization token
|
|
155
|
-
* @returns {Promise<
|
|
156
|
+
* @returns {Promise<object>}
|
|
156
157
|
*/
|
|
157
158
|
const publishLearningPath = (id: string, comments: string, token: string): Promise<object> => {
|
|
158
159
|
return new Promise((resolve, reject) => {
|
|
159
|
-
|
|
160
|
+
const data: LearningPathData = {};
|
|
160
161
|
if (comments) data.comments = comments;
|
|
161
|
-
|
|
162
|
+
const confirmationRequest = client.post(
|
|
162
163
|
`api/v1/learningpaths/publish/${id}`,
|
|
163
164
|
data,
|
|
164
165
|
{
|
|
@@ -166,10 +167,10 @@ const publishLearningPath = (id: string, comments: string, token: string): Promi
|
|
|
166
167
|
}
|
|
167
168
|
);
|
|
168
169
|
confirmationRequest
|
|
169
|
-
.then((response) => {
|
|
170
|
+
.then((response : AxiosResponse) => {
|
|
170
171
|
resolve(response.data);
|
|
171
172
|
})
|
|
172
|
-
.catch((error) => {
|
|
173
|
+
.catch((error : AxiosError) => {
|
|
173
174
|
reject(error);
|
|
174
175
|
});
|
|
175
176
|
});
|
|
@@ -180,7 +181,7 @@ const publishLearningPath = (id: string, comments: string, token: string): Promi
|
|
|
180
181
|
* @param {String} id The id of the template to be updated
|
|
181
182
|
* @param {Object} data Data used to update the template
|
|
182
183
|
* @param {String} token Authorization token
|
|
183
|
-
* @returns {Promise<
|
|
184
|
+
* @returns {Promise<object>}
|
|
184
185
|
*/
|
|
185
186
|
const setLearningPathInformation = (id: string, data: object, token: string): Promise<object> => {
|
|
186
187
|
return new Promise((resolve, reject) => {
|
|
@@ -188,7 +189,7 @@ const setLearningPathInformation = (id: string, data: object, token: string): Pr
|
|
|
188
189
|
data: data,
|
|
189
190
|
id: id,
|
|
190
191
|
};
|
|
191
|
-
|
|
192
|
+
const confirmationRequest = client.post(
|
|
192
193
|
`api/v1/learningpaths/update/`,
|
|
193
194
|
requestData,
|
|
194
195
|
{
|
|
@@ -196,10 +197,10 @@ const setLearningPathInformation = (id: string, data: object, token: string): Pr
|
|
|
196
197
|
}
|
|
197
198
|
);
|
|
198
199
|
confirmationRequest
|
|
199
|
-
.then((response) => {
|
|
200
|
+
.then((response : AxiosResponse) => {
|
|
200
201
|
resolve(response.data);
|
|
201
202
|
})
|
|
202
|
-
.catch((error) => {
|
|
203
|
+
.catch((error : AxiosError) => {
|
|
203
204
|
reject(error);
|
|
204
205
|
});
|
|
205
206
|
});
|
|
@@ -210,7 +211,7 @@ const setLearningPathInformation = (id: string, data: object, token: string): Pr
|
|
|
210
211
|
* @param {String} id The id of the template to be updated
|
|
211
212
|
* @param {Object} tags The updated tags
|
|
212
213
|
* @param {String} token Authorization token
|
|
213
|
-
* @returns {Promise<
|
|
214
|
+
* @returns {Promise<object>}
|
|
214
215
|
*/
|
|
215
216
|
const setLearningPathTags = (id: string, tags: object, token: string): Promise<object> => {
|
|
216
217
|
return new Promise((resolve, reject) => {
|
|
@@ -218,7 +219,7 @@ const setLearningPathTags = (id: string, tags: object, token: string): Promise<o
|
|
|
218
219
|
tags: tags,
|
|
219
220
|
id: id,
|
|
220
221
|
};
|
|
221
|
-
|
|
222
|
+
const confirmationRequest = client.post(
|
|
222
223
|
`api/v1/learningpaths/updatetags/`,
|
|
223
224
|
requestData,
|
|
224
225
|
{
|
|
@@ -226,10 +227,10 @@ const setLearningPathTags = (id: string, tags: object, token: string): Promise<o
|
|
|
226
227
|
}
|
|
227
228
|
);
|
|
228
229
|
confirmationRequest
|
|
229
|
-
.then((response) => {
|
|
230
|
+
.then((response : AxiosResponse) => {
|
|
230
231
|
resolve(response.data);
|
|
231
232
|
})
|
|
232
|
-
.catch((error) => {
|
|
233
|
+
.catch((error : AxiosError) => {
|
|
233
234
|
reject(error);
|
|
234
235
|
});
|
|
235
236
|
});
|
package/src/lib/logger.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Create comments for a specified element id
|
|
@@ -6,7 +7,7 @@ import { client } from "./axiosClient.js";
|
|
|
6
7
|
* @param {String} elementType
|
|
7
8
|
* @param {Object} data
|
|
8
9
|
* @param {String} token Authorization token
|
|
9
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<object>}
|
|
10
11
|
*/
|
|
11
12
|
const comments = (
|
|
12
13
|
elementId: string,
|
|
@@ -15,7 +16,7 @@ const comments = (
|
|
|
15
16
|
token: string
|
|
16
17
|
): Promise<object> => {
|
|
17
18
|
return new Promise((resolve, reject) => {
|
|
18
|
-
|
|
19
|
+
const confirmationRequest = client.post(
|
|
19
20
|
"api/v1/logger/comments/",
|
|
20
21
|
{
|
|
21
22
|
data: data,
|
|
@@ -27,10 +28,10 @@ const comments = (
|
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
confirmationRequest
|
|
30
|
-
.then((response) => {
|
|
31
|
+
.then((response : AxiosResponse) => {
|
|
31
32
|
resolve(response.data);
|
|
32
33
|
})
|
|
33
|
-
.catch((error) => {
|
|
34
|
+
.catch((error : AxiosError) => {
|
|
34
35
|
reject(error);
|
|
35
36
|
});
|
|
36
37
|
});
|
|
@@ -42,7 +43,7 @@ const comments = (
|
|
|
42
43
|
* @param {Number} page The results page
|
|
43
44
|
* @param {Number} elementsPerPage The number of elements per page
|
|
44
45
|
* @param {String} token
|
|
45
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<object>}
|
|
46
47
|
*/
|
|
47
48
|
const getListByElementId = (
|
|
48
49
|
elementId: string,
|
|
@@ -51,7 +52,7 @@ const getListByElementId = (
|
|
|
51
52
|
token: string
|
|
52
53
|
): Promise<object> => {
|
|
53
54
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
55
|
+
const data: { elementsPerPage?: number, page?: number } = {};
|
|
55
56
|
if (elementsPerPage !== null) data.elementsPerPage = elementsPerPage;
|
|
56
57
|
if (page !== null) data.page = page;
|
|
57
58
|
const getTokensRequest = client.post(`api/v1/logger/${elementId}`, data, {
|
|
@@ -61,7 +62,7 @@ const getListByElementId = (
|
|
|
61
62
|
.then((result) => {
|
|
62
63
|
resolve(result.data);
|
|
63
64
|
})
|
|
64
|
-
.catch((error) => {
|
|
65
|
+
.catch((error : AxiosError) => {
|
|
65
66
|
reject(error);
|
|
66
67
|
});
|
|
67
68
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Get responses for a microskill quiz
|
|
5
6
|
* @param {String} learningContentId
|
|
6
7
|
* @param {String} microSkillId
|
|
7
8
|
* @param {String} token
|
|
8
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<object>}
|
|
9
10
|
*/
|
|
10
11
|
const getResponses = (
|
|
11
12
|
learningContentId: string,
|
|
@@ -13,17 +14,17 @@ const getResponses = (
|
|
|
13
14
|
token: string
|
|
14
15
|
): Promise<object> => {
|
|
15
16
|
return new Promise((resolve, reject) => {
|
|
16
|
-
|
|
17
|
+
const confirmationRequest = client.get(
|
|
17
18
|
`api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
18
19
|
{
|
|
19
20
|
headers: { authorization: token },
|
|
20
21
|
}
|
|
21
22
|
);
|
|
22
23
|
confirmationRequest
|
|
23
|
-
.then((response) => {
|
|
24
|
+
.then((response : AxiosResponse) => {
|
|
24
25
|
resolve(response.data);
|
|
25
26
|
})
|
|
26
|
-
.catch((error) => {
|
|
27
|
+
.catch((error : AxiosError) => {
|
|
27
28
|
reject(error);
|
|
28
29
|
});
|
|
29
30
|
});
|
|
@@ -35,7 +36,7 @@ const getResponses = (
|
|
|
35
36
|
* @param {String} microSkillId
|
|
36
37
|
* @param {Array<Object>} responses
|
|
37
38
|
* @param {String} token Authorization token
|
|
38
|
-
* @returns {Promise<
|
|
39
|
+
* @returns {Promise<object>}
|
|
39
40
|
*/
|
|
40
41
|
const saveResponses = (
|
|
41
42
|
learningContentId: string,
|
|
@@ -44,10 +45,10 @@ const saveResponses = (
|
|
|
44
45
|
token: string
|
|
45
46
|
): Promise<object> => {
|
|
46
47
|
return new Promise((resolve, reject) => {
|
|
47
|
-
|
|
48
|
+
const data = {
|
|
48
49
|
responses: responses,
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
const confirmationRequest = client.post(
|
|
51
52
|
`api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
52
53
|
data,
|
|
53
54
|
{
|
|
@@ -55,10 +56,10 @@ const saveResponses = (
|
|
|
55
56
|
}
|
|
56
57
|
);
|
|
57
58
|
confirmationRequest
|
|
58
|
-
.then((response) => {
|
|
59
|
+
.then((response : AxiosResponse) => {
|
|
59
60
|
resolve(response.data);
|
|
60
61
|
})
|
|
61
|
-
.catch((error) => {
|
|
62
|
+
.catch((error : AxiosError) => {
|
|
62
63
|
reject(error);
|
|
63
64
|
});
|
|
64
65
|
});
|
package/src/lib/quotas.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Get the current quota for the user and tenant
|
|
5
6
|
* @param {String} token
|
|
6
|
-
* @returns {Promise<
|
|
7
|
+
* @returns {Promise<object>}
|
|
7
8
|
*/
|
|
8
9
|
const getAllQuota = (token: string): Promise<object> => {
|
|
9
10
|
return new Promise((resolve, reject) => {
|
|
10
|
-
|
|
11
|
+
const confirmationRequest = client.get(`/api/v1/quotas/getallquota`, {
|
|
11
12
|
headers: { authorization: token },
|
|
12
13
|
});
|
|
13
14
|
confirmationRequest
|
|
14
|
-
.then((response) => {
|
|
15
|
+
.then((response : AxiosResponse) => {
|
|
15
16
|
resolve(response.data);
|
|
16
17
|
})
|
|
17
|
-
.catch((error) => {
|
|
18
|
+
.catch((error : AxiosError) => {
|
|
18
19
|
reject(error);
|
|
19
20
|
});
|
|
20
21
|
});
|
|
@@ -25,7 +26,7 @@ const getAllQuota = (token: string): Promise<object> => {
|
|
|
25
26
|
* @param {String} quotaId
|
|
26
27
|
* @param {Number} value
|
|
27
28
|
* @param {String} token
|
|
28
|
-
* @returns {Promise<
|
|
29
|
+
* @returns {Promise<object>}
|
|
29
30
|
*/
|
|
30
31
|
const increaseQuotaUtilization = (
|
|
31
32
|
quotaId: string,
|
|
@@ -33,7 +34,7 @@ const increaseQuotaUtilization = (
|
|
|
33
34
|
token: string
|
|
34
35
|
): Promise<object> => {
|
|
35
36
|
return new Promise((resolve, reject) => {
|
|
36
|
-
|
|
37
|
+
const confirmationRequest = client.post(
|
|
37
38
|
`/api/v1/quotas/increaseutilization`,
|
|
38
39
|
{
|
|
39
40
|
id: quotaId,
|
|
@@ -44,10 +45,10 @@ const increaseQuotaUtilization = (
|
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
confirmationRequest
|
|
47
|
-
.then((response) => {
|
|
48
|
+
.then((response : AxiosResponse) => {
|
|
48
49
|
resolve(response.data);
|
|
49
50
|
})
|
|
50
|
-
.catch((error) => {
|
|
51
|
+
.catch((error : AxiosError) => {
|
|
51
52
|
reject(error);
|
|
52
53
|
});
|
|
53
54
|
});
|