@stackfactor/client-api 1.1.119 → 1.1.121
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/exports.js +2 -2
- package/lib/quotas.js +54 -0
- package/package.json +1 -1
- package/lib/quota.js +0 -25
package/exports.js
CHANGED
|
@@ -26,7 +26,7 @@ import learningContent from "./lib/learningContent.js";
|
|
|
26
26
|
import learningPath from "./lib/learningPath.js";
|
|
27
27
|
import logger from "./lib/logger.js";
|
|
28
28
|
import microSkillsQuizes from "./lib/microSkillsQuizes.js";
|
|
29
|
-
import
|
|
29
|
+
import quotas from "./lib/quotas.js";
|
|
30
30
|
import role from "./lib/role.js";
|
|
31
31
|
import roleTemplate from "./lib/roleTemplate.js";
|
|
32
32
|
import security from "./lib/security.js";
|
|
@@ -65,7 +65,7 @@ export {
|
|
|
65
65
|
microSkillsQuizes,
|
|
66
66
|
PERMISSIONS,
|
|
67
67
|
PERMISSION_DESCRIPTIONS,
|
|
68
|
-
|
|
68
|
+
quotas,
|
|
69
69
|
RESPONSE_TYPE,
|
|
70
70
|
role,
|
|
71
71
|
roleTemplate,
|
package/lib/quotas.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the current quota for the user and tenant
|
|
5
|
+
* @param {String} token
|
|
6
|
+
* @returns {Promise}
|
|
7
|
+
*/
|
|
8
|
+
const getAllQuota = (token) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
let confirmationRequest = client.get(`/api/v1/quotas/getallquota`, {
|
|
11
|
+
headers: { authorization: token },
|
|
12
|
+
});
|
|
13
|
+
confirmationRequest
|
|
14
|
+
.then((response) => {
|
|
15
|
+
resolve(response.data);
|
|
16
|
+
})
|
|
17
|
+
.catch((error) => {
|
|
18
|
+
reject(error);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Increase quota utilization
|
|
25
|
+
* @param {String} quotaId
|
|
26
|
+
* @param {Number} value
|
|
27
|
+
* @param {String} token
|
|
28
|
+
*/
|
|
29
|
+
const increaseQuotaUtilization = (quotaId, value, token) => {
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
|
+
let confirmationRequest = client.post(
|
|
32
|
+
`/api/v1/quotas/increaseutilization`,
|
|
33
|
+
{
|
|
34
|
+
quotaId: quotaId,
|
|
35
|
+
value: value,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
headers: { authorization: token },
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
confirmationRequest
|
|
42
|
+
.then((response) => {
|
|
43
|
+
resolve(response.data);
|
|
44
|
+
})
|
|
45
|
+
.catch((error) => {
|
|
46
|
+
reject(error);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
getAllQuota,
|
|
53
|
+
increaseQuotaUtilization,
|
|
54
|
+
};
|
package/package.json
CHANGED
package/lib/quota.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { client } from "./axiosClient.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the current quota for the user and tenant
|
|
5
|
-
* @param {String} token
|
|
6
|
-
* @returns {Promise}
|
|
7
|
-
*/
|
|
8
|
-
const getAllQuota = (token) => {
|
|
9
|
-
return new Promise(function (resolve, reject) {
|
|
10
|
-
let confirmationRequest = client.get(`/api/v1/quota/getallquota`, {
|
|
11
|
-
headers: { authorization: token },
|
|
12
|
-
});
|
|
13
|
-
confirmationRequest
|
|
14
|
-
.then((response) => {
|
|
15
|
-
resolve(response.data);
|
|
16
|
-
})
|
|
17
|
-
.catch((error) => {
|
|
18
|
-
reject(error);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
getAllQuota,
|
|
25
|
-
};
|