@stackfactor/client-api 1.0.95 → 1.0.96

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 (2) hide show
  1. package/lib/role.js +54 -0
  2. package/package.json +1 -1
package/lib/role.js CHANGED
@@ -199,6 +199,30 @@ export const getRolesList = (
199
199
  });
200
200
  };
201
201
 
202
+ /**
203
+ * Get role template updates
204
+ * @param {String} id The role id
205
+ * @param {String} token
206
+ * @returns {Promise}
207
+ */
208
+ export const getRoleTemplateUpdates = (id, token) => {
209
+ return new Promise(function (resolve, reject) {
210
+ let confirmationRequest = client.get(
211
+ `api/v1/roles/getroletemplateupdates/${id}`,
212
+ {
213
+ headers: { authorization: token },
214
+ }
215
+ );
216
+ confirmationRequest
217
+ .then((response) => {
218
+ resolve(response.data);
219
+ })
220
+ .catch((error) => {
221
+ reject(error);
222
+ });
223
+ });
224
+ };
225
+
202
226
  /**
203
227
  * Import role templates
204
228
  * @param {Array<String>} data The list of role templates to be imported
@@ -278,6 +302,36 @@ export const setRoleInformation = (id, data, token) => {
278
302
  });
279
303
  };
280
304
 
305
+ /**
306
+ * Set the role information from template
307
+ * @param {String} id The id of the skill to be updated
308
+ * @param {Object} data Data used to update the skill
309
+ * @param {String} token Authorization token
310
+ * @returns {Promise}
311
+ */
312
+ export const setRoleInformationFromTemplate = (id, data, token) => {
313
+ return new Promise(function (resolve, reject) {
314
+ const requestData = {
315
+ data: data,
316
+ id: id,
317
+ };
318
+ let confirmationRequest = client.post(
319
+ `api/v1/roles/updatefromtemplate/`,
320
+ requestData,
321
+ {
322
+ headers: { authorization: token },
323
+ }
324
+ );
325
+ confirmationRequest
326
+ .then((response) => {
327
+ resolve(response.data);
328
+ })
329
+ .catch((error) => {
330
+ reject(error);
331
+ });
332
+ });
333
+ };
334
+
281
335
  /**
282
336
  * Set user roles
283
337
  * @param {String} id The id of the user to be updated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {