Skip to content

Commit 05d1d03

Browse files
committed
add team management api calls
1 parent a2b1c48 commit 05d1d03

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,48 @@ Retrieves all screenshots previously generate with your account
198198
api.getScreenshotList(function(error, screenshots) {}, offset, limit);
199199
```
200200

201+
### getTeam
202+
Retrieves team information
203+
204+
```javascript
205+
api.getTeam(function(error, data) {});
206+
```
207+
208+
### getUsersInTeam
209+
Get all users in your team
210+
211+
```javascript
212+
api.getUsersInTeam(function(error, users) {});
213+
```
214+
215+
### getUserFromTeam
216+
Retrieves information about a specific user in your team
217+
218+
```javascript
219+
api.getUserFromTeam(userId, function(error, user) {});
220+
```
221+
222+
### createUserInTeam
223+
Add a user to your team. You need ADMIN rights for this.
224+
225+
```javascript
226+
api.createUserInTeam(user, function(error, result) {});
227+
```
228+
229+
### updateUserInTeam
230+
Update a user in your team. You need ADMIN rights for this.
231+
232+
```javascript
233+
api.updateUserInTeam(userId, userData, function(error, result) {});
234+
```
235+
236+
### resetCredentials
237+
Resets credentials for a specific user in your team. You need ADMIN rights for this.
238+
239+
```javascript
240+
api.resetCredentials(userId, function(error, result) {});
241+
```
242+
201243
## Tests
202244

203245
``npm test``

lib/api.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,54 @@ TestingBot.prototype.uploadFile = function(localFilePath, callback) {
293293
});
294294
};
295295

296+
TestingBot.prototype.getTeam = function(callback) {
297+
this.request({
298+
method: 'GET',
299+
url: '/team-management'
300+
}, callback);
301+
};
302+
303+
TestingBot.prototype.getUsersInTeam = function(callback) {
304+
this.request({
305+
method: 'GET',
306+
url: '/team-management/users'
307+
}, callback);
308+
};
309+
310+
TestingBot.prototype.getUserFromTeam = function(userId, callback) {
311+
this.request({
312+
method: 'GET',
313+
url: '/team-management/users/' + userId
314+
}, callback);
315+
};
316+
317+
TestingBot.prototype.createUserInTeam = function(user, callback) {
318+
this.request({
319+
method: 'POST',
320+
url: '/team-management/users/',
321+
data: {
322+
user: user
323+
}
324+
}, callback);
325+
};
326+
327+
TestingBot.prototype.updateUserInTeam = function(userId, userData, callback) {
328+
this.request({
329+
method: 'PUT',
330+
url: '/team-management/users/' + userId,
331+
data: {
332+
user: userData
333+
}
334+
}, callback);
335+
};
336+
337+
TestingBot.prototype.resetCredentials = function(userId, callback) {
338+
this.request({
339+
method: 'POST',
340+
url: '/team-management/users/' + userId + '/reset-keys'
341+
}, callback);
342+
};
343+
296344
TestingBot.prototype.getStorageFile = function(appUrl, callback) {
297345
this.request({
298346
method: 'GET',

0 commit comments

Comments
 (0)