@stackfactor/client-api 1.0.40 → 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.
- package/lib/actionNotifications.js +4 -140
- package/package.json +1 -1
|
@@ -73,144 +73,8 @@ export const processNotification = (id, action, comment, authToken) => {
|
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
});
|
|
76
|
+
export default {
|
|
77
|
+
getAllUserNotifications,
|
|
78
|
+
markNotifications,
|
|
79
|
+
processNotification,
|
|
216
80
|
};
|