@stackfactor/client-api 1.0.39 → 1.0.41

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 (29) hide show
  1. package/lib/actionNotifications.js +80 -0
  2. package/package.json +4 -4
  3. package/client-api/lib/actionNotifications.js +0 -216
  4. /package/{client-api/index.js → index.js} +0 -0
  5. /package/{client-api/lib → lib}/address.js +0 -0
  6. /package/{client-api/lib → lib}/axiosClient.js +0 -0
  7. /package/{client-api/lib → lib}/config.js +0 -0
  8. /package/{client-api/lib → lib}/constants.js +0 -0
  9. /package/{client-api/lib → lib}/dashboard.js +0 -0
  10. /package/{client-api/lib → lib}/departmentTrainingPlans.js +0 -0
  11. /package/{client-api/lib → lib}/groups.js +0 -0
  12. /package/{client-api/lib → lib}/integration.js +0 -0
  13. /package/{client-api/lib → lib}/integrationConfiguration.js +0 -0
  14. /package/{client-api/lib → lib}/integrations/contentGenerator.js +0 -0
  15. /package/{client-api/lib → lib}/learningContent.js +0 -0
  16. /package/{client-api/lib → lib}/logger.js +0 -0
  17. /package/{client-api/lib → lib}/role.js +0 -0
  18. /package/{client-api/lib → lib}/roleTemplate.js +0 -0
  19. /package/{client-api/lib → lib}/skill.js +0 -0
  20. /package/{client-api/lib → lib}/skillAssessmentTestingSession.js +0 -0
  21. /package/{client-api/lib → lib}/skillAssessments.js +0 -0
  22. /package/{client-api/lib → lib}/skillTemplate.js +0 -0
  23. /package/{client-api/lib → lib}/teams.js +0 -0
  24. /package/{client-api/lib → lib}/tenants.js +0 -0
  25. /package/{client-api/lib → lib}/trainingPlanTemplate.js +0 -0
  26. /package/{client-api/lib → lib}/trainingPlans.js +0 -0
  27. /package/{client-api/lib → lib}/userInformation.js +0 -0
  28. /package/{client-api/lib → lib}/users.js +0 -0
  29. /package/{client-api/lib → lib}/utils.js +0 -0
@@ -0,0 +1,80 @@
1
+ import axios from "./axiosClient";
2
+
3
+ /**
4
+ * Get all permissions
5
+ * @param {String} authToken The authentication token
6
+ */
7
+ export const getAllUserNotifications = (authToken) => {
8
+ return new Promise(function (resolve, reject) {
9
+ const request = axios.get(`api/v1/actionnotifications`, {
10
+ headers: { authorization: authToken },
11
+ });
12
+ request
13
+ .then((response) => {
14
+ resolve(response.data);
15
+ })
16
+ .catch((error) => {
17
+ reject(error);
18
+ });
19
+ });
20
+ };
21
+
22
+ /**
23
+ * Mark notifications as open or viewed
24
+ * @param {Array<String>} ids The id of the notifications to be marked
25
+ * @param {String} status The new status
26
+ * @param {String} authToken The authentication token
27
+ */
28
+ export const markNotifications = (ids, status, authToken) => {
29
+ return new Promise(function (resolve, reject) {
30
+ const request = axios.put(
31
+ `api/v1/actionnotifications/mark`,
32
+ {
33
+ ids: ids,
34
+ status: status,
35
+ },
36
+ { headers: { authorization: authToken } }
37
+ );
38
+ request
39
+ .then((response) => {
40
+ resolve(response.data);
41
+ })
42
+ .catch((error) => {
43
+ reject(error);
44
+ });
45
+ });
46
+ };
47
+
48
+ /**
49
+ * Process a notification
50
+ * @param {String} id The notification id
51
+ * @param {String} action The action to be executed
52
+ * @param {String} comment The comment to be saved in the notification
53
+ * @param {String} authToken The authentication token
54
+ */
55
+ export const processNotification = (id, action, comment, authToken) => {
56
+ return new Promise(function (resolve, reject) {
57
+ const request = axios.put(
58
+ `api/v1/actionnotifications/process`,
59
+ {
60
+ id: id,
61
+ action: action,
62
+ comment: comment,
63
+ },
64
+ { headers: { authorization: authToken } }
65
+ );
66
+ request
67
+ .then((response) => {
68
+ resolve(response.data);
69
+ })
70
+ .catch((error) => {
71
+ reject(error);
72
+ });
73
+ });
74
+ };
75
+
76
+ export default {
77
+ getAllUserNotifications,
78
+ markNotifications,
79
+ processNotification,
80
+ };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": {
8
- "require": "./client-api/index.js",
9
- "import": "./client-api/index.js",
10
- "default": "./client-api/index.js"
8
+ "require": "./index.js",
9
+ "import": "./index.js",
10
+ "default": "./index.js"
11
11
  }
12
12
  },
13
13
  "type": "module",
@@ -1,216 +0,0 @@
1
- import axios from "./axiosClient";
2
-
3
- /**
4
- * Get all permissions
5
- * @param {String} authToken The authentication token
6
- */
7
- export const getAllUserNotifications = (authToken) => {
8
- return new Promise(function (resolve, reject) {
9
- const request = axios.get(`api/v1/actionnotifications`, {
10
- headers: { authorization: authToken },
11
- });
12
- request
13
- .then((response) => {
14
- resolve(response.data);
15
- })
16
- .catch((error) => {
17
- reject(error);
18
- });
19
- });
20
- };
21
-
22
- /**
23
- * Mark notifications as open or viewed
24
- * @param {Array<String>} ids The id of the notifications to be marked
25
- * @param {String} status The new status
26
- * @param {String} authToken The authentication token
27
- */
28
- export const markNotifications = (ids, status, authToken) => {
29
- return new Promise(function (resolve, reject) {
30
- const request = axios.put(
31
- `api/v1/actionnotifications/mark`,
32
- {
33
- ids: ids,
34
- status: status,
35
- },
36
- { headers: { authorization: authToken } }
37
- );
38
- request
39
- .then((response) => {
40
- resolve(response.data);
41
- })
42
- .catch((error) => {
43
- reject(error);
44
- });
45
- });
46
- };
47
-
48
- /**
49
- * Process a notification
50
- * @param {String} id The notification id
51
- * @param {String} action The action to be executed
52
- * @param {String} comment The comment to be saved in the notification
53
- * @param {String} authToken The authentication token
54
- */
55
- export const processNotification = (id, action, comment, authToken) => {
56
- return new Promise(function (resolve, reject) {
57
- const request = axios.put(
58
- `api/v1/actionnotifications/process`,
59
- {
60
- id: id,
61
- action: action,
62
- comment: comment,
63
- },
64
- { headers: { authorization: authToken } }
65
- );
66
- request
67
- .then((response) => {
68
- resolve(response.data);
69
- })
70
- .catch((error) => {
71
- reject(error);
72
- });
73
- });
74
- };
75
-
76
- /**
77
- * Get groups for current tenant
78
- * @param {String} authToken The authentication token
79
- */
80
- export const getGroups = (authToken) => {
81
- return new Promise(function (resolve, reject) {
82
- const request = axios.get(`api/v1/groups/`, {
83
- headers: { authorization: authToken },
84
- });
85
- request
86
- .then((response) => {
87
- resolve(response.data);
88
- })
89
- .catch((error) => {
90
- reject(error);
91
- });
92
- });
93
- };
94
-
95
- /**
96
- * Get current user permissions
97
- * @param {String} authToken The authentication token
98
- */
99
- export const getUserPermissions = (authToken) => {
100
- return new Promise(function (resolve, reject) {
101
- const request = axios.get(`api/v1/groups/users/getuserpermissions`, {
102
- headers: { authorization: authToken },
103
- });
104
- request
105
- .then((response) => {
106
- resolve(response.data);
107
- })
108
- .catch((error) => {
109
- reject(error);
110
- });
111
- });
112
- };
113
-
114
- /**
115
- * Remove permissions from group
116
- * @param {String} groupId The group Id
117
- * @param {Array<String>} permissions The permissions to be removed from the group
118
- * @param {String} authToken The authentication token
119
- */
120
- export const removePermissionsFromGroup = (groupId, permissions, authToken) => {
121
- return new Promise(function (resolve, reject) {
122
- const request = axios.post(
123
- `api/v1/groups/permissions/remove/`,
124
- {
125
- groupId: groupId,
126
- permissions: permissions,
127
- },
128
- { headers: { authorization: authToken } }
129
- );
130
- request
131
- .then((response) => {
132
- resolve(response.data);
133
- })
134
- .catch((error) => {
135
- reject(error);
136
- });
137
- });
138
- };
139
-
140
- /**
141
- * Remove users from group
142
- * @param {String} groupId The group Id
143
- * @param {Array<String>} users The users to be removed from the group
144
- * @param {String} authToken The authentication token
145
- */
146
- export const removeUsersFromGroup = (groupId, users, authToken) => {
147
- return new Promise(function (resolve, reject) {
148
- const request = axios.post(
149
- `api/v1/groups/users/remove/`,
150
- {
151
- groupId: groupId,
152
- users: users,
153
- },
154
- { headers: { authorization: authToken } }
155
- );
156
- request
157
- .then((response) => {
158
- resolve(response.data);
159
- })
160
- .catch((error) => {
161
- reject(error);
162
- });
163
- });
164
- };
165
-
166
- /*
167
- * Set group as defualt
168
- * @param {String} groupId The group Id
169
- * @param {String} authToken The authentication token
170
- */
171
- export const setDefault = (groupId, authToken) => {
172
- return new Promise(function (resolve, reject) {
173
- const request = axios.put(
174
- `api/v1/groups/setDefault/`,
175
- {
176
- id: groupId,
177
- },
178
- { headers: { authorization: authToken } }
179
- );
180
- request
181
- .then((response) => {
182
- resolve(response.data);
183
- })
184
- .catch((error) => {
185
- reject(error);
186
- });
187
- });
188
- };
189
-
190
- /**
191
- * Update group
192
- * @param {String} groupId The group Id
193
- * @param {string} name The updated name of the group
194
- * @param {string} description The updated description of the group
195
- * @param {String} authToken The authentication token
196
- */
197
- export const updateGroup = (groupId, name, description, authToken) => {
198
- return new Promise(function (resolve, reject) {
199
- const request = axios.patch(
200
- `api/v1/groups/group/`,
201
- {
202
- id: groupId,
203
- name: name,
204
- description: description,
205
- },
206
- { headers: { authorization: authToken } }
207
- );
208
- request
209
- .then((response) => {
210
- resolve(response.data);
211
- })
212
- .catch((error) => {
213
- reject(error);
214
- });
215
- });
216
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes