Skip to content

Commit c3db6b8

Browse files
author
Marek Sierociński
authored
Merge pull request #21 from marverix/master
Added access-groups resource
2 parents 2183bc3 + 9017ccd commit c3db6b8

File tree

7 files changed

+132
-8
lines changed

7 files changed

+132
-8
lines changed

dist/cloud-api-client.js

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Bitbar Cloud API Client for JavaScript v0.17.0 | (c) Bitbar Technologies and contributors | https://github.com/bitbar/cloud-api-client-js/blob/master/LICENSE.md */
1+
/* Bitbar Cloud API Client for JavaScript v0.18.0 | (c) Bitbar Technologies and contributors | https://github.com/bitbar/cloud-api-client-js/blob/master/LICENSE.md */
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@bitbar/finka'), require('axios'), require('qs')) :
44
typeof define === 'function' && define.amd ? define(['@bitbar/finka', 'axios', 'qs'], factory) :
@@ -11,7 +11,7 @@
1111

1212
finka();
1313

14-
var version = "0.17.0";
14+
var version = "0.18.0";
1515

1616
/*! *****************************************************************************
1717
Copyright (c) Microsoft Corporation. All rights reserved.
@@ -851,6 +851,38 @@
851851
return APIResourceNotification;
852852
}(APIResource));
853853

854+
var APIResourceAccessGroup = (function (_super) {
855+
__extends(APIResourceAccessGroup, _super);
856+
function APIResourceAccessGroup(parent, id) {
857+
var _this = this;
858+
if (id == null) {
859+
throw new Error('Resource ID cannot be null!');
860+
}
861+
_this = _super.call(this, parent) || this;
862+
_this.push('access-groups', id);
863+
return _this;
864+
}
865+
APIResourceAccessGroup.prototype.users = function () {
866+
return new APIList(this).push('users');
867+
};
868+
APIResourceAccessGroup.prototype.user = function (id) {
869+
if (id == null) {
870+
throw new Error('Resource ID cannot be null!');
871+
}
872+
return new APIResource(this).push('users', id);
873+
};
874+
APIResourceAccessGroup.prototype.resources = function () {
875+
return new APIList(this).push('resources');
876+
};
877+
APIResourceAccessGroup.prototype.resource = function (id) {
878+
if (id == null) {
879+
throw new Error('Resource ID cannot be null!');
880+
}
881+
return new APIResource(this).push('resources', id);
882+
};
883+
return APIResourceAccessGroup;
884+
}(APIResource));
885+
854886
var APIListDeviceTime = (function (_super) {
855887
__extends(APIListDeviceTime, _super);
856888
function APIListDeviceTime(parent) {
@@ -1084,7 +1116,13 @@
10841116
return new APIList(this).push('statistics');
10851117
};
10861118
APIResourceUser.prototype.deviceStatistics = function () {
1087-
return new APIList(this).push('device-statistics');
1119+
return new APIList(this).push('device-statistics');
1120+
};
1121+
APIResourceUser.prototype.accessGroups = function () {
1122+
return new APIList(this).push('access-groups');
1123+
};
1124+
APIResourceUser.prototype.accessGroup = function (id) {
1125+
return new APIResourceAccessGroup(this, id);
10881126
};
10891127
return APIResourceUser;
10901128
}(APIResource));
@@ -1433,7 +1471,13 @@
14331471
return new APIList(this).push('label-groups');
14341472
};
14351473
API.prototype.deviceStatistics = function () {
1436-
return new APIList(this).push('device-statistics');
1474+
return new APIList(this).push('device-statistics');
1475+
};
1476+
API.prototype.accessGroups = function () {
1477+
return new APIList(this).push('access-groups');
1478+
};
1479+
API.prototype.accessGroup = function (id) {
1480+
return new APIResourceAccessGroup(this, id);
14371481
};
14381482
return API;
14391483
}());

dist/cloud-api-client.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitbar/cloud-api-client",
3-
"version": "0.17.0",
3+
"version": "0.18.0",
44
"description": "Bitbar Cloud API Client for JavaScript",
55
"main": "dist/cloud-api-client.js",
66
"types": "dist/index.d.ts",

src/API.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import APIResourceUser from './api/APIResourceUser';
1414
import APIResourceDevice from './api/APIResourceDevice';
1515
import APIResourceDeviceGroup from './api/APIResourceDeviceGroup';
1616
import APIResourceUserSession from './api/APIResourceUserSession';
17+
import APIResourceAccessGroup from './api/APIResourceAccessGroup';
1718

1819
import APIAdminResource from './api/APIAdminResource';
1920

@@ -143,6 +144,17 @@ class API {
143144
public deviceStatistics () {
144145
return new APIList(this).push('device-statistics');
145146
}
147+
148+
// /access-groups
149+
public accessGroups () {
150+
return new APIList(this).push('access-groups');
151+
}
152+
153+
// /access-groups/{id}
154+
public accessGroup (id: number) {
155+
return new APIResourceAccessGroup(this, id);
156+
}
157+
146158
}
147159

148160

src/api/APIResourceAccessGroup.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import APIResource from './APIResource'
2+
import APIList from './APIList'
3+
4+
5+
/**
6+
* APIResourceAccessGroup
7+
*
8+
* @class
9+
* @extends APIResource
10+
*/
11+
class APIResourceAccessGroup extends APIResource {
12+
13+
/**
14+
* /device-groups/{id}
15+
*
16+
* Constructor
17+
*/
18+
constructor (parent: object, id: number) {
19+
if (id == null) {
20+
throw new Error('Resource ID cannot be null!');
21+
}
22+
23+
super(parent);
24+
this.push('access-groups', id);
25+
}
26+
27+
// /access-groups/{id}/users
28+
public users () {
29+
return new APIList(this).push('users');
30+
}
31+
32+
// /access-groups/{id}/users/{id}
33+
public user (id: number) {
34+
if (id == null) {
35+
throw new Error('Resource ID cannot be null!');
36+
}
37+
38+
return new APIResource(this).push('users', id);
39+
}
40+
41+
// /access-groups/{id}/resources
42+
public resources () {
43+
return new APIList(this).push('resources');
44+
}
45+
46+
// /access-groups/{id}/resources/{id}
47+
public resource (id: number) {
48+
if (id == null) {
49+
throw new Error('Resource ID cannot be null!');
50+
}
51+
52+
return new APIResource(this).push('resources', id);
53+
}
54+
55+
}
56+
57+
export default APIResourceAccessGroup

src/api/APIResourceUser.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import APIResourceManualSession from './APIResourceManualSession'
88
import APIResourceProject from './APIResourceProject'
99
import APIResourceFile from './APIResourceFile'
1010
import APIResourceNotification from './APIResourceNotification'
11+
import APIResourceAccessGroup from './APIResourceAccessGroup'
1112

1213
import APIList from './APIList'
1314
import APIListDeviceTime from './APIListDeviceTime'
@@ -245,6 +246,16 @@ class APIResourceUser extends APIResource {
245246
return new APIList(this).push('device-statistics');
246247
}
247248

249+
// /users/{id}/access-groups
250+
public accessGroups () {
251+
return new APIList(this).push('access-groups');
252+
}
253+
254+
// /users/{id}/access-groups/{id}
255+
public accessGroup (id: number) {
256+
return new APIResourceAccessGroup(this, id);
257+
}
258+
248259
}
249260

250261
export default APIResourceUser

0 commit comments

Comments
 (0)