@stackfactor/client-api 1.1.53 → 1.1.54
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/lib/trainingPlans.js +25 -11
- package/package.json +1 -1
package/lib/trainingPlans.js
CHANGED
|
@@ -7,7 +7,7 @@ import { client } from "./axiosClient.js";
|
|
|
7
7
|
* @param {Boolean} saveAsDraft Save as draft flag
|
|
8
8
|
* @param {String} token Authorization token
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
const createTrainingPlan = (data, type, saveAsDraft, token) => {
|
|
11
11
|
return new Promise(function (resolve, reject) {
|
|
12
12
|
const requestData = {
|
|
13
13
|
data: {
|
|
@@ -35,7 +35,7 @@ export const createTrainingPlan = (data, type, saveAsDraft, token) => {
|
|
|
35
35
|
* @param {String} comments The comments for approver
|
|
36
36
|
* @param {String} token Authorization token
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
const deleteTrainingPlan = (id, comments, token) => {
|
|
39
39
|
return new Promise(function (resolve, reject) {
|
|
40
40
|
const data = {
|
|
41
41
|
id: id,
|
|
@@ -60,7 +60,7 @@ export const deleteTrainingPlan = (id, comments, token) => {
|
|
|
60
60
|
* @param {String} id The id of the training plan to be deleted
|
|
61
61
|
* @param {String} token Authorization token
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
const discardTrainingPlanChanges = (id, token) => {
|
|
64
64
|
return new Promise(function (resolve, reject) {
|
|
65
65
|
const request = client.get(`api/v1/trainingplans/discard/${id}`, {
|
|
66
66
|
headers: { authorization: token },
|
|
@@ -83,7 +83,7 @@ export const discardTrainingPlanChanges = (id, token) => {
|
|
|
83
83
|
* @param {Boolean} saveBaseline If set to true it will save the baseline
|
|
84
84
|
* @param {String} token Authorization token
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
const generateNewBaseline = (
|
|
87
87
|
id,
|
|
88
88
|
data,
|
|
89
89
|
returnMinimized,
|
|
@@ -119,7 +119,7 @@ export const generateNewBaseline = (
|
|
|
119
119
|
* @param {String} id The id of the training plan
|
|
120
120
|
* @param {String} token Authorization token
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
const getTrainingPlanById = (id, version, token) => {
|
|
123
123
|
return new Promise(function (resolve, reject) {
|
|
124
124
|
let confirmationRequest = client.get(
|
|
125
125
|
`api/v1/trainingplans/${id}/${version}`,
|
|
@@ -141,7 +141,7 @@ export const getTrainingPlanById = (id, version, token) => {
|
|
|
141
141
|
* Get tasks summary for a recipient across all of the training plans
|
|
142
142
|
* @param {String} token Authorization token
|
|
143
143
|
*/
|
|
144
|
-
|
|
144
|
+
const getAllTrainingPlansTasksSummary = async (token = null) => {
|
|
145
145
|
return new Promise(function (resolve, reject) {
|
|
146
146
|
let confirmationRequest = client.get(`api/v1/trainingplans/taskssummary`, {
|
|
147
147
|
headers: token ? { authorization: token } : {},
|
|
@@ -165,7 +165,7 @@ export const getAllTrainingPlansTasksSummary = async (token = null) => {
|
|
|
165
165
|
* @param {Boolean} returnDefaultIfVersionNotAvailable If set to true it will load the draft information if the plan was never published
|
|
166
166
|
* @param {String} token Authorization token
|
|
167
167
|
*/
|
|
168
|
-
|
|
168
|
+
const getListOfTrainingPlans = (
|
|
169
169
|
users,
|
|
170
170
|
types,
|
|
171
171
|
version,
|
|
@@ -204,7 +204,7 @@ export const getListOfTrainingPlans = (
|
|
|
204
204
|
* @param {String} comments The comments to be include with the request
|
|
205
205
|
* @param {String} token Authorization token
|
|
206
206
|
*/
|
|
207
|
-
|
|
207
|
+
const publishTrainingPlan = (id, comments, token) => {
|
|
208
208
|
return new Promise(function (resolve, reject) {
|
|
209
209
|
let data = {};
|
|
210
210
|
if (comments) data.comments = comments;
|
|
@@ -231,7 +231,7 @@ export const publishTrainingPlan = (id, comments, token) => {
|
|
|
231
231
|
* @param {Object} data The updated data
|
|
232
232
|
* @param {String} token Authorization token
|
|
233
233
|
*/
|
|
234
|
-
|
|
234
|
+
const updateTrainingPlan = (planId, data, saveAsDraft, token) => {
|
|
235
235
|
return new Promise(function (resolve, reject) {
|
|
236
236
|
const requestData = {
|
|
237
237
|
data: data,
|
|
@@ -262,7 +262,7 @@ export const updateTrainingPlan = (planId, data, saveAsDraft, token) => {
|
|
|
262
262
|
* @param {String} token
|
|
263
263
|
* @returns {Promise<Object>}
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
const updateTrainingPlanTaskStatus = (id, status, token) => {
|
|
266
266
|
return new Promise(function (resolve, reject) {
|
|
267
267
|
let data = {
|
|
268
268
|
id: id,
|
|
@@ -289,7 +289,7 @@ export const updateTrainingPlanTaskStatus = (id, status, token) => {
|
|
|
289
289
|
* @param {Function} failCallBack
|
|
290
290
|
* @returns {Object} An object containing the task information
|
|
291
291
|
*/
|
|
292
|
-
|
|
292
|
+
const updateActivities = (planId, data, token) => {
|
|
293
293
|
return new Promise(function (resolve, reject) {
|
|
294
294
|
let confirmationRequest = client.post(
|
|
295
295
|
`api/v1/trainingplans/${planId}/activities`,
|
|
@@ -307,3 +307,17 @@ export const updateActivities = (planId, data, token) => {
|
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
+
|
|
311
|
+
export default {
|
|
312
|
+
createTrainingPlan,
|
|
313
|
+
deleteTrainingPlan,
|
|
314
|
+
discardTrainingPlanChanges,
|
|
315
|
+
generateNewBaseline,
|
|
316
|
+
getAllTrainingPlansTasksSummary,
|
|
317
|
+
getTrainingPlanById,
|
|
318
|
+
getListOfTrainingPlans,
|
|
319
|
+
publishTrainingPlan,
|
|
320
|
+
updateTrainingPlan,
|
|
321
|
+
updateTrainingPlanTaskStatus,
|
|
322
|
+
updateActivities,
|
|
323
|
+
};
|