@stackfactor/client-api 1.1.2 → 1.1.4

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.
@@ -78,6 +78,42 @@ export const discardLearningContentChanges = (id, token) => {
78
78
  });
79
79
  };
80
80
 
81
+ /**
82
+ * Generate the learning activity content
83
+ * @param {String} skillId
84
+ * @param {String} microSkillId
85
+ * @param {String} learningActivityId
86
+ * @param {List<String>} sections
87
+ */
88
+ export const generateLearningActivityContent = (
89
+ skillId,
90
+ microSkillId,
91
+ learningActivityId,
92
+ sections
93
+ ) => {
94
+ return new Promise(function (resolve, reject) {
95
+ const data = {
96
+ microSkillId: microSkillId,
97
+ learningActivityId: learningActivityId,
98
+ sections: sections,
99
+ };
100
+ const request = client.get(
101
+ `api/v1/learningcontent/generatelearningactivitycontent/${skillId}`,
102
+ {
103
+ headers: { authorization: token },
104
+ data: data,
105
+ }
106
+ );
107
+ request
108
+ .then((response) => {
109
+ resolve(response.data);
110
+ })
111
+ .catch((error) => {
112
+ reject(error);
113
+ });
114
+ });
115
+ };
116
+
81
117
  /**
82
118
  * Get the learning content information by id
83
119
  * @param {String} id The id of the learning content
@@ -199,6 +235,44 @@ export const setLearningContentInformation = (id, data, token) => {
199
235
  });
200
236
  };
201
237
 
238
+ /**
239
+ * Set the content for a specific learning activity
240
+ * @param {String} id
241
+ * @param {String} learningActivityId
242
+ * @param {String} operation
243
+ * @param {Object} data
244
+ * @param {String} token
245
+ * @returns {Promise<String>} OK word if the operation was succesful
246
+ */
247
+ export const setLearningActivityInformation = (
248
+ id,
249
+ learningActivityId,
250
+ operation,
251
+ data,
252
+ token
253
+ ) => {
254
+ return new Promise(function (resolve, reject) {
255
+ const requestData = {
256
+ data: data,
257
+ operation: operation,
258
+ };
259
+ let confirmationRequest = client.post(
260
+ `api/v1/learningcontent/updateactivity/${id}/${learningActivityId}`,
261
+ requestData,
262
+ {
263
+ headers: { authorization: token },
264
+ }
265
+ );
266
+ confirmationRequest
267
+ .then((response) => {
268
+ resolve(response.data);
269
+ })
270
+ .catch((error) => {
271
+ reject(error);
272
+ });
273
+ });
274
+ };
275
+
202
276
  /**
203
277
  * Update the learning content tags
204
278
  * @param {String} id The id of the learning to be updated
@@ -264,6 +338,7 @@ const learningContent = {
264
338
  getLearningContentInformationById,
265
339
  getLearningContentList,
266
340
  publishLearningContent,
341
+ setLearningActivityInformation,
267
342
  setLearningContentInformation,
268
343
  setLearningContentTags,
269
344
  watchLearningContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {