@stackfactor/client-api 1.0.32 → 1.0.34
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 +2 -1
- package/lib/templates.js +0 -148
|
@@ -1,215 +1,216 @@
|
|
|
1
|
-
import
|
|
1
|
+
import axios from "./axiosClient";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Create training plan template and set information
|
|
5
|
+
* @param {Object} data
|
|
6
|
+
* @param {String} token Authorization token
|
|
7
|
+
*/
|
|
8
|
+
export const createTrainingPlanTemplate = (data, token) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
let confirmationRequest = axios.put(
|
|
11
|
+
"api/v1/trainingplantemplates",
|
|
12
|
+
{ data: data },
|
|
13
|
+
{
|
|
14
|
+
headers: { authorization: token },
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
confirmationRequest
|
|
18
|
+
.then((response) => {
|
|
19
|
+
resolve(response.data);
|
|
20
|
+
})
|
|
21
|
+
.catch((error) => {
|
|
22
|
+
reject(error);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
5
26
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.then((response) => {
|
|
22
|
-
resolve(response.data);
|
|
23
|
-
})
|
|
24
|
-
.catch((error) => {
|
|
25
|
-
reject(error);
|
|
26
|
-
});
|
|
27
|
+
/**
|
|
28
|
+
* Delete training plan template
|
|
29
|
+
* @param {String} id The id of the template to be deleted
|
|
30
|
+
* @param {String} comment The comment for approver
|
|
31
|
+
* @param {String} token Authorization token
|
|
32
|
+
*/
|
|
33
|
+
export const deleteTrainingPlanTemplate = (id, comment, token) => {
|
|
34
|
+
return new Promise(function (resolve, reject) {
|
|
35
|
+
const data = {
|
|
36
|
+
id: id,
|
|
37
|
+
};
|
|
38
|
+
if (comment) data.comment = comment;
|
|
39
|
+
const request = axios.delete(`api/v1/trainingplantemplates/`, {
|
|
40
|
+
headers: { authorization: token },
|
|
41
|
+
data: data,
|
|
27
42
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @param {String} token Authorization token
|
|
35
|
-
*/
|
|
36
|
-
deleteTrainingPlanTemplate: (id, comment, token) => {
|
|
37
|
-
return new Promise(function (resolve, reject) {
|
|
38
|
-
const data = {
|
|
39
|
-
id: id,
|
|
40
|
-
};
|
|
41
|
-
if (comment) data.comment = comment;
|
|
42
|
-
const request = axios.delete(`api/v1/trainingplantemplates/`, {
|
|
43
|
-
headers: { authorization: token },
|
|
44
|
-
data: data,
|
|
43
|
+
request
|
|
44
|
+
.then((response) => {
|
|
45
|
+
resolve(response.data);
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
reject(error);
|
|
45
49
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Discard the training plan draft changes
|
|
55
|
+
* @param {String} id The id of the training plan to be deleted
|
|
56
|
+
* @param {String} token Authorization token
|
|
57
|
+
*/
|
|
58
|
+
export const discardTrainingPlanChanges = (id, token) => {
|
|
59
|
+
return new Promise(function (resolve, reject) {
|
|
60
|
+
const data = {};
|
|
61
|
+
const request = axios.get(`api/v1/trainingplantemplates/discard/${id}`, {
|
|
62
|
+
headers: { authorization: token },
|
|
63
|
+
data: data,
|
|
53
64
|
});
|
|
54
|
-
|
|
65
|
+
request
|
|
66
|
+
.then((response) => {
|
|
67
|
+
resolve(response.data);
|
|
68
|
+
})
|
|
69
|
+
.catch((error) => {
|
|
70
|
+
reject(error);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Get traing plan template information
|
|
77
|
+
* @param {String} id The id of the template
|
|
78
|
+
* @param {String} token Authorization token
|
|
79
|
+
*/
|
|
80
|
+
export const getTrainingPlanTemplateInformationById = (id, version, token) => {
|
|
81
|
+
return new Promise(function (resolve, reject) {
|
|
82
|
+
let confirmationRequest = axios.get(
|
|
83
|
+
`api/v1/trainingplantemplates/${id}/${version}`,
|
|
84
|
+
{
|
|
65
85
|
headers: { authorization: token },
|
|
66
|
-
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
confirmationRequest
|
|
89
|
+
.then((response) => {
|
|
90
|
+
resolve(response.data);
|
|
91
|
+
})
|
|
92
|
+
.catch((error) => {
|
|
93
|
+
reject(error);
|
|
67
94
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resolve(response.data);
|
|
71
|
-
})
|
|
72
|
-
.catch((error) => {
|
|
73
|
-
reject(error);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Get traing plan template information
|
|
80
|
-
* @param {String} id The id of the template
|
|
81
|
-
* @param {String} token Authorization token
|
|
82
|
-
*/
|
|
83
|
-
getTrainingPlanTemplateInformationById: (id, version, token) => {
|
|
84
|
-
return new Promise(function (resolve, reject) {
|
|
85
|
-
let confirmationRequest = axios.get(
|
|
86
|
-
`api/v1/trainingplantemplates/${id}/${version}`,
|
|
87
|
-
{
|
|
88
|
-
headers: { authorization: token },
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
confirmationRequest
|
|
92
|
-
.then((response) => {
|
|
93
|
-
resolve(response.data);
|
|
94
|
-
})
|
|
95
|
-
.catch((error) => {
|
|
96
|
-
reject(error);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
},
|
|
95
|
+
});
|
|
96
|
+
};
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Get training plan template list
|
|
100
|
+
* @param {Array<String>} list The filter used to select the skill
|
|
101
|
+
* @param {String} version The version to be retrieved
|
|
102
|
+
* @param {String} token Authorization token
|
|
103
|
+
*/
|
|
104
|
+
export const getTrainingPlanTemplatesList = (
|
|
105
|
+
list,
|
|
106
|
+
version,
|
|
107
|
+
includeDeleted,
|
|
108
|
+
token
|
|
109
|
+
) => {
|
|
110
|
+
return new Promise(function (resolve, reject) {
|
|
111
|
+
const requestData = {
|
|
112
|
+
version: version,
|
|
113
|
+
includeDeleted: includeDeleted,
|
|
114
|
+
};
|
|
115
|
+
if (list) requestData.list = list;
|
|
116
|
+
let confirmationRequest = axios.post(
|
|
117
|
+
`api/v1/trainingplantemplates`,
|
|
118
|
+
requestData,
|
|
119
|
+
{
|
|
120
|
+
headers: { authorization: token },
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
confirmationRequest
|
|
124
|
+
.then((response) => {
|
|
125
|
+
resolve(response.data);
|
|
126
|
+
})
|
|
127
|
+
.catch((error) => {
|
|
128
|
+
reject(error);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Publish training pplan template
|
|
135
|
+
* @param {String} id The id of the template to be published
|
|
136
|
+
* @param {String} comment The comment to be include with the request
|
|
137
|
+
* @param {String} token Authorization token
|
|
138
|
+
*/
|
|
139
|
+
export const publishTrainingPlanTemplate = (id, comment, token) => {
|
|
140
|
+
return new Promise(function (resolve, reject) {
|
|
141
|
+
let data = {};
|
|
142
|
+
if (comment) data.comment = comment;
|
|
143
|
+
let confirmationRequest = axios.post(
|
|
144
|
+
`api/v1/trainingplantemplates/publish/${id}`,
|
|
145
|
+
data,
|
|
146
|
+
{
|
|
147
|
+
headers: { authorization: token },
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
confirmationRequest
|
|
151
|
+
.then((response) => {
|
|
152
|
+
resolve(response.data);
|
|
153
|
+
})
|
|
154
|
+
.catch((error) => {
|
|
155
|
+
reject(error);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
};
|
|
157
159
|
|
|
158
|
-
|
|
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
|
-
|
|
185
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Set training plan template profile information
|
|
162
|
+
* @param {String} id The id of the template to be updated
|
|
163
|
+
* @param {Object} data Data used to update the template
|
|
164
|
+
* @param {String} token Authorization token
|
|
165
|
+
*/
|
|
166
|
+
export const setTrainingPlanTemplateInformation = (id, data, token) => {
|
|
167
|
+
return new Promise(function (resolve, reject) {
|
|
168
|
+
const requestData = {
|
|
169
|
+
data: data,
|
|
170
|
+
id: id,
|
|
171
|
+
};
|
|
172
|
+
let confirmationRequest = axios.post(
|
|
173
|
+
`api/v1/trainingplantemplates/update/`,
|
|
174
|
+
requestData,
|
|
175
|
+
{
|
|
176
|
+
headers: { authorization: token },
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
confirmationRequest
|
|
180
|
+
.then((response) => {
|
|
181
|
+
resolve(response.data);
|
|
182
|
+
})
|
|
183
|
+
.catch((error) => {
|
|
184
|
+
reject(error);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
186
188
|
|
|
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
|
-
|
|
214
|
-
},
|
|
189
|
+
/**
|
|
190
|
+
* Update training plan template tags
|
|
191
|
+
* @param {String} id The id of the template to be updated
|
|
192
|
+
* @param {Object} tags The updated tags
|
|
193
|
+
* @param {String} token Authorization token
|
|
194
|
+
*/
|
|
195
|
+
export const setTrainingPlanTemplateTags = (id, tags, token) => {
|
|
196
|
+
return new Promise(function (resolve, reject) {
|
|
197
|
+
const requestData = {
|
|
198
|
+
tags: tags,
|
|
199
|
+
id: id,
|
|
200
|
+
};
|
|
201
|
+
let confirmationRequest = axios.post(
|
|
202
|
+
`api/v1/trainingplantemplates/updatetags/`,
|
|
203
|
+
requestData,
|
|
204
|
+
{
|
|
205
|
+
headers: { authorization: token },
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
confirmationRequest
|
|
209
|
+
.then((response) => {
|
|
210
|
+
resolve(response.data);
|
|
211
|
+
})
|
|
212
|
+
.catch((error) => {
|
|
213
|
+
reject(error);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
215
216
|
};
|