@frontegg/rest-api 3.1.78 → 3.1.79-alpha.9987430273

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 (122) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +113 -28
  4. package/ContextHolder/index.js +163 -54
  5. package/FetchClient.d.ts +42 -0
  6. package/FetchClient.js +308 -0
  7. package/account-settings/index.d.ts +19 -7
  8. package/account-settings/index.js +23 -13
  9. package/applications/index.d.ts +49 -44
  10. package/applications/index.js +51 -37
  11. package/audits/index.d.ts +27 -15
  12. package/audits/index.js +27 -17
  13. package/auth/index.d.ts +817 -768
  14. package/auth/index.js +902 -721
  15. package/auth/secutiry-poilicy/index.d.ts +58 -102
  16. package/auth/secutiry-poilicy/index.js +122 -90
  17. package/auth/utils.d.ts +2 -2
  18. package/auth/utils.js +9 -8
  19. package/connectivity/index.d.ts +126 -27
  20. package/connectivity/index.js +147 -114
  21. package/directory/index.d.ts +31 -22
  22. package/directory/index.js +27 -15
  23. package/entitlements/index.d.ts +14 -8
  24. package/entitlements/index.js +12 -4
  25. package/feature-flags/index.d.ts +8 -2
  26. package/feature-flags/index.js +16 -8
  27. package/groups/index.d.ts +73 -49
  28. package/groups/index.js +64 -45
  29. package/impersonate/index.d.ts +15 -6
  30. package/impersonate/index.js +13 -5
  31. package/index.d.ts +154 -108
  32. package/index.js +109 -78
  33. package/interfaces.d.ts +10 -0
  34. package/metadata/index.d.ts +67 -7
  35. package/metadata/index.js +52 -32
  36. package/node/BaseApiClient.js +49 -0
  37. package/node/ContextHolder/index.js +163 -54
  38. package/node/FetchClient.js +326 -0
  39. package/node/account-settings/index.js +27 -16
  40. package/node/applications/index.js +51 -44
  41. package/node/audits/index.js +31 -20
  42. package/node/auth/index.js +768 -1035
  43. package/node/auth/secutiry-poilicy/index.js +125 -136
  44. package/node/auth/utils.js +9 -7
  45. package/node/connectivity/index.js +148 -187
  46. package/node/directory/index.js +29 -20
  47. package/node/entitlements/index.js +18 -5
  48. package/node/feature-flags/index.js +21 -9
  49. package/node/groups/index.js +65 -63
  50. package/node/impersonate/index.js +18 -5
  51. package/node/index.js +116 -71
  52. package/node/metadata/index.js +61 -52
  53. package/node/notifications/index.js +37 -27
  54. package/node/reports/index.js +78 -70
  55. package/node/roles/index.js +56 -51
  56. package/node/security-center/index.js +21 -9
  57. package/node/sub-tenants/index.js +90 -89
  58. package/node/subscriptions/index.js +69 -107
  59. package/node/subscriptions/invoices.js +25 -17
  60. package/node/subscriptions/managedSubscriptions.js +32 -27
  61. package/node/subscriptions/paymentMethods.js +27 -20
  62. package/node/subscriptions/paymentProviders.js +15 -6
  63. package/node/subscriptions/plans.js +17 -9
  64. package/node/subscriptions/providers/stripe/index.js +26 -21
  65. package/node/subscriptions/subscriptions.js +32 -27
  66. package/node/subscriptions/summaries.js +15 -6
  67. package/node/subscriptions/tenantConfiguration.js +17 -9
  68. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  69. package/node/teams/index.js +138 -148
  70. package/node/tenants/index.js +65 -60
  71. package/node/user-phone-numbers/index.js +32 -24
  72. package/node/users/index.js +58 -53
  73. package/node/vendor/index.js +17 -6
  74. package/notifications/index.d.ts +22 -16
  75. package/notifications/index.js +33 -22
  76. package/package.json +1 -1
  77. package/reports/index.d.ts +50 -44
  78. package/reports/index.js +75 -62
  79. package/roles/index.d.ts +44 -38
  80. package/roles/index.js +57 -41
  81. package/security-center/index.d.ts +14 -2
  82. package/security-center/index.js +15 -6
  83. package/sub-tenants/index.d.ts +57 -15
  84. package/sub-tenants/index.js +88 -68
  85. package/subscriptions/index.d.ts +56 -11
  86. package/subscriptions/index.js +58 -11
  87. package/subscriptions/invoices.d.ts +16 -13
  88. package/subscriptions/invoices.js +24 -14
  89. package/subscriptions/managedSubscriptions.d.ts +18 -15
  90. package/subscriptions/managedSubscriptions.js +33 -22
  91. package/subscriptions/paymentMethods.d.ts +16 -13
  92. package/subscriptions/paymentMethods.js +26 -17
  93. package/subscriptions/paymentProviders.d.ts +8 -5
  94. package/subscriptions/paymentProviders.js +11 -4
  95. package/subscriptions/plans.d.ts +11 -8
  96. package/subscriptions/plans.js +14 -6
  97. package/subscriptions/providers/stripe/index.d.ts +24 -21
  98. package/subscriptions/providers/stripe/index.js +27 -16
  99. package/subscriptions/subscriptions.d.ts +24 -21
  100. package/subscriptions/subscriptions.js +33 -22
  101. package/subscriptions/summaries.d.ts +7 -4
  102. package/subscriptions/summaries.js +10 -3
  103. package/subscriptions/tenantConfiguration.d.ts +6 -3
  104. package/subscriptions/tenantConfiguration.js +15 -7
  105. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  106. package/subscriptions/vendorPublicConfigurations.js +11 -4
  107. package/teams/index.d.ts +37 -139
  108. package/teams/index.js +130 -99
  109. package/tenants/index.d.ts +25 -37
  110. package/tenants/index.js +62 -46
  111. package/user-phone-numbers/index.d.ts +32 -26
  112. package/user-phone-numbers/index.js +32 -19
  113. package/users/index.d.ts +21 -15
  114. package/users/index.js +60 -44
  115. package/vendor/index.d.ts +12 -6
  116. package/vendor/index.js +11 -4
  117. package/fetch.d.ts +0 -24
  118. package/fetch.js +0 -265
  119. package/node/fetch.js +0 -306
  120. package/node/subscriptions/providers/index.js +0 -18
  121. package/subscriptions/providers/index.d.ts +0 -1
  122. package/subscriptions/providers/index.js +0 -1
@@ -3,60 +3,69 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAdminBoxMetadata = getAdminBoxMetadata;
7
- exports.getAuditsMetadata = void 0;
8
- exports.getCurrentUserIpMetadata = getCurrentUserIpMetadata;
9
- exports.getSamlMetadata = exports.getNotificationsMetadata = exports.getIpAdressMetadata = void 0;
10
- exports.updateAdminBoxMetadata = updateAdminBoxMetadata;
6
+ exports.default = exports.MetadataApi = void 0;
7
+
8
+ var _BaseApiClient = require("../BaseApiClient");
9
+
10
+ class MetadataApi extends _BaseApiClient.BaseApiClient {
11
+ constructor(appName) {
12
+ super(appName);
13
+
14
+ this.getMetadata = async body => {
15
+ var _data$rows, _data$rows2;
16
+
17
+ const data = await this.get('/metadata', body);
18
+ if (data != null && (_data$rows = data.rows) != null && _data$rows[0]) return data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0];
19
+ throw new Error(`metadata not found: ${body.entityName}`);
20
+ };
21
+
22
+ this.getAdminBoxMetadata = async () => {
23
+ return this.get('/metadata/admin-box');
24
+ };
25
+
26
+ this.updateAdminBoxMetadata = async body => {
27
+ return this.post('/metadata/admin-box', body);
28
+ };
29
+
30
+ this.getIpMetadata = async ip => {
31
+ const data = await this.get(`/metadata/ip/${ip}`);
32
+ if (data) return data;
33
+ throw new Error(`ip metadata not found`);
34
+ };
35
+
36
+ this.getCurrentUserIpMetadata = async () => {
37
+ const data = await this.get(`/metadata/ipme`);
38
+ if (data) return data;
39
+ throw new Error(`ip metadata not found`);
40
+ };
41
+
42
+ this.getNotificationsMetadata = async () => {
43
+ return this.getMetadata({
44
+ entityName: 'notifications'
45
+ });
46
+ };
47
+
48
+ this.getSamlMetadata = async () => {
49
+ return this.getMetadata({
50
+ entityName: 'saml'
51
+ });
52
+ };
53
+
54
+ this.getAuditsMetadata = async () => {
55
+ return this.getMetadata({
56
+ entityName: 'audits'
57
+ });
58
+ };
59
+
60
+ this.getIpAdressMetadata = async ip => {
61
+ return this.getIpMetadata(ip);
62
+ };
63
+ }
11
64
 
12
- var _fetch = require("../fetch");
13
-
14
- async function getMetadata(body) {
15
- var _data$rows, _data$rows2;
16
-
17
- const data = await (0, _fetch.Get)('/metadata', body);
18
- if (data != null && (_data$rows = data.rows) != null && _data$rows[0]) return data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0];
19
- throw new Error(`metadata not found: ${body.entityName}`);
20
- }
21
-
22
- async function getAdminBoxMetadata() {
23
- return (0, _fetch.Get)('/metadata/admin-box');
24
- }
25
-
26
- async function updateAdminBoxMetadata(body) {
27
- return (0, _fetch.Post)('/metadata/admin-box', body);
28
- }
29
-
30
- async function getIpMetadata(ip) {
31
- const data = await (0, _fetch.Get)(`/metadata/ip/${ip}`);
32
- if (data) return data;
33
- throw new Error(`ip metadata not found`);
34
- }
35
-
36
- async function getCurrentUserIpMetadata() {
37
- const data = await (0, _fetch.Get)(`/metadata/ipme`);
38
- if (data) return data;
39
- throw new Error(`ip metadata not found`);
40
65
  }
41
66
 
42
- const getNotificationsMetadata = async () => getMetadata({
43
- entityName: 'notifications'
44
- });
45
-
46
- exports.getNotificationsMetadata = getNotificationsMetadata;
47
-
48
- const getSamlMetadata = async () => getMetadata({
49
- entityName: 'saml'
50
- });
51
-
52
- exports.getSamlMetadata = getSamlMetadata;
53
-
54
- const getAuditsMetadata = async () => getMetadata({
55
- entityName: 'audits'
56
- });
57
-
58
- exports.getAuditsMetadata = getAuditsMetadata;
67
+ exports.MetadataApi = MetadataApi;
59
68
 
60
- const getIpAdressMetadata = async ip => getIpMetadata(ip);
69
+ var _default = new MetadataApi('default');
61
70
 
62
- exports.getIpAdressMetadata = getIpAdressMetadata;
71
+ exports.default = _default;
@@ -3,37 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getNotifications = getNotifications;
7
- exports.markAllAsRead = markAllAsRead;
8
- exports.updateNotificationIsPinned = updateNotificationIsPinned;
9
- exports.updateNotificationStatus = updateNotificationStatus;
10
-
11
- var _fetch = require("../fetch");
6
+ exports.default = exports.NotificationsApi = void 0;
12
7
 
13
8
  var _constants = require("../constants");
14
9
 
15
- async function getNotifications(params) {
16
- return (0, _fetch.Get)(_constants.urls.notifications.v1, {
17
- params
18
- });
19
- }
10
+ var _BaseApiClient = require("../BaseApiClient");
20
11
 
21
- async function updateNotificationStatus(params) {
22
- return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/status`, {
23
- params
24
- });
25
- }
12
+ class NotificationsApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(appName) {
14
+ super(appName);
15
+
16
+ this.getNotifications = async params => {
17
+ return this.get(_constants.urls.notifications.v1, {
18
+ params
19
+ });
20
+ };
21
+
22
+ this.updateNotificationStatus = async params => {
23
+ return this.put(`${_constants.urls.notifications.v1}/status`, {
24
+ params
25
+ });
26
+ };
27
+
28
+ this.updateNotificationIsPinned = async params => {
29
+ const {
30
+ notificationId,
31
+ pinStatus
32
+ } = params;
33
+ return this.put(`${_constants.urls.notifications.v1}/${pinStatus}`, {
34
+ notificationId
35
+ });
36
+ };
37
+
38
+ this.markAllAsRead = async () => {
39
+ return this.post(`${_constants.urls.notifications.v1}/status/mark-all-read`);
40
+ };
41
+ }
26
42
 
27
- async function updateNotificationIsPinned(params) {
28
- const {
29
- notificationId,
30
- pinStatus
31
- } = params;
32
- return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/${pinStatus}`, {
33
- notificationId
34
- });
35
43
  }
36
44
 
37
- async function markAllAsRead() {
38
- return (0, _fetch.Post)(`${_constants.urls.notifications.v1}/status/mark-all-read`);
39
- }
45
+ exports.NotificationsApi = NotificationsApi;
46
+
47
+ var _default = new NotificationsApi('default');
48
+
49
+ exports.default = _default;
@@ -5,92 +5,100 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.downloadReport = downloadReport;
9
- exports.getReport = getReport;
10
- exports.getReports = getReports;
11
- exports.renderReport = renderReport;
12
- exports.scheduleReport = scheduleReport;
13
- exports.sendReport = sendReport;
8
+ exports.default = exports.ReportsApi = void 0;
14
9
 
15
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
11
 
17
12
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
18
13
 
19
- var _fetch = require("../fetch");
20
-
21
14
  var _constants = require("../constants");
22
15
 
16
+ var _BaseApiClient = require("../BaseApiClient");
17
+
23
18
  const _excluded = ["dataFilters"],
24
19
  _excluded2 = ["templateId", "dataFilters"],
25
20
  _excluded3 = ["dataFilters"];
26
21
 
27
- async function getReports(body) {
28
- return (0, _fetch.Get)(`${_constants.urls.reports.service.v2}/tenant-reports`, body);
29
- }
22
+ class ReportsApi extends _BaseApiClient.BaseApiClient {
23
+ constructor(appName) {
24
+ super(appName);
30
25
 
31
- async function getReport(body) {
32
- return (0, _fetch.Get)(`${_constants.urls.reports.service.v2}/${body.id}/tenant-reports`);
33
- }
26
+ this.getReports = async body => {
27
+ return this.get(`${_constants.urls.reports.service.v2}/tenant-reports`, body);
28
+ };
34
29
 
35
- async function renderReport(_ref) {
36
- let {
37
- dataFilters
38
- } = _ref,
39
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
40
- const html = await (0, _fetch.Get)(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
41
- dataFilters: btoa(JSON.stringify(dataFilters || {})),
42
- responseType: 'html'
43
- }), {
44
- responseType: 'plain'
45
- });
46
- return {
47
- html
48
- };
49
- }
30
+ this.getReport = async body => {
31
+ return this.get(`${_constants.urls.reports.service.v2}/${body.id}/tenant-reports`);
32
+ };
50
33
 
51
- async function scheduleReport(_ref2) {
52
- let {
53
- templateId,
54
- dataFilters
55
- } = _ref2,
56
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
57
- return (0, _fetch.Post)(`${_constants.urls.reports.service.v2}/${templateId}/tenant-reports`, (0, _extends2.default)({}, body, {
58
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
59
- }));
60
- }
34
+ this.renderReport = async _ref => {
35
+ let {
36
+ dataFilters
37
+ } = _ref,
38
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
39
+ const html = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
40
+ dataFilters: btoa(JSON.stringify(dataFilters || {})),
41
+ responseType: 'html'
42
+ }), {
43
+ responseType: 'plain'
44
+ });
45
+ return {
46
+ html
47
+ };
48
+ };
61
49
 
62
- async function downloadReport(_ref3) {
63
- let {
64
- dataFilters
65
- } = _ref3,
66
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
67
- const blob = await (0, _fetch.Get)(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
68
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
69
- }), {
70
- responseType: 'blob'
71
- });
72
- let contentType = 'text/html';
73
- let contentExt = 'html';
74
-
75
- if (body.responseType === 'pdf') {
76
- contentType = 'application/pdf';
77
- contentExt = 'pdf';
78
- } else if (body.responseType === 'image') {
79
- contentType = 'image/jpeg';
80
- contentExt = 'jpg';
50
+ this.scheduleReport = async _ref2 => {
51
+ let {
52
+ templateId,
53
+ dataFilters
54
+ } = _ref2,
55
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
56
+ return this.post(`${_constants.urls.reports.service.v2}/${templateId}/tenant-reports`, (0, _extends2.default)({}, body, {
57
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
58
+ }));
59
+ };
60
+
61
+ this.downloadReport = async _ref3 => {
62
+ let {
63
+ dataFilters
64
+ } = _ref3,
65
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
66
+ const blob = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
67
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
68
+ }), {
69
+ responseType: 'blob'
70
+ });
71
+ let contentType = 'text/html';
72
+ let contentExt = 'html';
73
+
74
+ if (body.responseType === 'pdf') {
75
+ contentType = 'application/pdf';
76
+ contentExt = 'pdf';
77
+ } else if (body.responseType === 'image') {
78
+ contentType = 'image/jpeg';
79
+ contentExt = 'jpg';
80
+ }
81
+
82
+ const newBlob = new Blob([blob], {
83
+ type: contentType
84
+ });
85
+ const fileURL = URL.createObjectURL(newBlob);
86
+ const tempLink = document.createElement('a');
87
+ tempLink.href = fileURL;
88
+ tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
89
+ tempLink.click();
90
+ setTimeout(tempLink.remove.bind(tempLink));
91
+ };
92
+
93
+ this.sendReport = async body => {
94
+ return this.post(`${_constants.urls.reports.trigger.v1}/tenant-reports`, body);
95
+ };
81
96
  }
82
97
 
83
- const newBlob = new Blob([blob], {
84
- type: contentType
85
- });
86
- const fileURL = URL.createObjectURL(newBlob);
87
- const tempLink = document.createElement('a');
88
- tempLink.href = fileURL;
89
- tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
90
- tempLink.click();
91
- setTimeout(tempLink.remove.bind(tempLink));
92
98
  }
93
99
 
94
- async function sendReport(body) {
95
- return (0, _fetch.Post)(`${_constants.urls.reports.trigger.v1}/tenant-reports`, body);
96
- }
100
+ exports.ReportsApi = ReportsApi;
101
+
102
+ var _default = new ReportsApi('default');
103
+
104
+ exports.default = _default;
@@ -5,72 +5,77 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.addRole = addRole;
9
- exports.addRoleV2 = addRoleV2;
10
- exports.attachPermissionToRoles = attachPermissionToRoles;
11
- exports.attachPermissionsToRole = attachPermissionsToRole;
12
- exports.deleteRole = deleteRole;
13
- exports.getPermissionCategories = getPermissionCategories;
14
- exports.getPermissions = getPermissions;
15
- exports.getRoles = getRoles;
16
- exports.updateRole = updateRole;
8
+ exports.default = exports.RolesApi = void 0;
17
9
 
18
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
19
11
 
20
- var _fetch = require("../fetch");
21
-
22
12
  var _constants = require("../constants");
23
13
 
14
+ var _BaseApiClient = require("../BaseApiClient");
15
+
24
16
  const _excluded = ["roleId"],
25
17
  _excluded2 = ["roleId"],
26
18
  _excluded3 = ["permissionId"];
27
19
 
28
- async function getRoles() {
29
- return (0, _fetch.Get)(_constants.urls.identity.roles.v1);
30
- }
20
+ class RolesApi extends _BaseApiClient.BaseApiClient {
21
+ constructor(appName) {
22
+ super(appName);
31
23
 
32
- async function addRole(body) {
33
- return (0, _fetch.Post)(_constants.urls.identity.roles.v1, body);
34
- }
24
+ this.getRoles = async () => {
25
+ return this.get(_constants.urls.identity.roles.v1);
26
+ };
35
27
 
36
- async function deleteRole({
37
- roleId
38
- }) {
39
- return (0, _fetch.Delete)(`${_constants.urls.identity.roles.v1}/${roleId}`);
40
- }
28
+ this.addRole = async body => {
29
+ return this.post(_constants.urls.identity.roles.v1, body);
30
+ };
41
31
 
42
- async function updateRole(_ref) {
43
- let {
44
- roleId
45
- } = _ref,
46
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
47
- return (0, _fetch.Patch)(`${_constants.urls.identity.roles.v1}/${roleId}`, body);
48
- }
32
+ this.deleteRole = async ({
33
+ roleId
34
+ }) => {
35
+ return this.delete(`${_constants.urls.identity.roles.v1}/${roleId}`);
36
+ };
49
37
 
50
- async function attachPermissionsToRole(_ref2) {
51
- let {
52
- roleId
53
- } = _ref2,
54
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
55
- return (0, _fetch.Put)(`${_constants.urls.identity.roles.v1}/${roleId}/permissions`, body);
56
- }
38
+ this.updateRole = async _ref => {
39
+ let {
40
+ roleId
41
+ } = _ref,
42
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
43
+ return this.patch(`${_constants.urls.identity.roles.v1}/${roleId}`, body);
44
+ };
57
45
 
58
- async function getPermissions() {
59
- return (0, _fetch.Get)(_constants.urls.identity.permissions.v1);
60
- }
46
+ this.attachPermissionsToRole = async _ref2 => {
47
+ let {
48
+ roleId
49
+ } = _ref2,
50
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
51
+ return this.put(`${_constants.urls.identity.roles.v1}/${roleId}/permissions`, body);
52
+ };
61
53
 
62
- async function attachPermissionToRoles(_ref3) {
63
- let {
64
- permissionId
65
- } = _ref3,
66
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
67
- return (0, _fetch.Put)(`${_constants.urls.identity.permissions.v1}/${permissionId}/roles`, body);
68
- }
54
+ this.getPermissions = async () => {
55
+ return this.get(_constants.urls.identity.permissions.v1);
56
+ };
57
+
58
+ this.attachPermissionToRoles = async _ref3 => {
59
+ let {
60
+ permissionId
61
+ } = _ref3,
62
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
63
+ return this.put(`${_constants.urls.identity.permissions.v1}/${permissionId}/roles`, body);
64
+ };
65
+
66
+ this.getPermissionCategories = async () => {
67
+ return this.get(`${_constants.urls.identity.permissions.v1}/categories`);
68
+ };
69
+
70
+ this.addRoleV2 = async body => {
71
+ return this.post(_constants.urls.identity.roles.v2, body);
72
+ };
73
+ }
69
74
 
70
- async function getPermissionCategories() {
71
- return (0, _fetch.Get)(`${_constants.urls.identity.permissions.v1}/categories`);
72
75
  }
73
76
 
74
- async function addRoleV2(body) {
75
- return (0, _fetch.Post)(_constants.urls.identity.roles.v2, body);
76
- }
77
+ exports.RolesApi = RolesApi;
78
+
79
+ var _default = new RolesApi('default');
80
+
81
+ exports.default = _default;
@@ -3,17 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getInsights = getInsights;
7
- exports.getRecommendations = getRecommendations;
8
-
9
- var _fetch = require("../fetch");
6
+ exports.default = exports.SecurityCenterApi = void 0;
10
7
 
11
8
  var _constants = require("../constants");
12
9
 
13
- async function getRecommendations() {
14
- return (0, _fetch.Get)(_constants.urls.securityCenter.recommendations.v1);
10
+ var _BaseApiClient = require("../BaseApiClient");
11
+
12
+ class SecurityCenterApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(appName) {
14
+ super(appName);
15
+
16
+ this.getRecommendations = async () => {
17
+ return this.get(_constants.urls.securityCenter.recommendations.v1);
18
+ };
19
+
20
+ this.getInsights = async () => {
21
+ return this.get(_constants.urls.securityCenter.insights.v1);
22
+ };
23
+ }
24
+
15
25
  }
16
26
 
17
- async function getInsights() {
18
- return (0, _fetch.Get)(_constants.urls.securityCenter.insights.v1);
19
- }
27
+ exports.SecurityCenterApi = SecurityCenterApi;
28
+
29
+ var _default = new SecurityCenterApi('default');
30
+
31
+ exports.default = _default;