@frontegg/rest-api 3.1.74-alpha.9437937621 → 3.1.74

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/ContextHolder/index.d.ts +27 -108
  2. package/ContextHolder/index.js +50 -155
  3. package/account-settings/index.d.ts +7 -19
  4. package/account-settings/index.js +13 -23
  5. package/applications/index.d.ts +44 -49
  6. package/applications/index.js +37 -51
  7. package/audits/index.d.ts +15 -27
  8. package/audits/index.js +17 -27
  9. package/auth/index.d.ts +768 -817
  10. package/auth/index.js +721 -902
  11. package/auth/secutiry-poilicy/index.d.ts +102 -58
  12. package/auth/secutiry-poilicy/index.js +90 -122
  13. package/auth/utils.d.ts +2 -2
  14. package/auth/utils.js +8 -9
  15. package/connectivity/index.d.ts +26 -125
  16. package/connectivity/index.js +114 -147
  17. package/directory/index.d.ts +22 -31
  18. package/directory/index.js +15 -27
  19. package/entitlements/index.d.ts +8 -14
  20. package/entitlements/index.js +4 -12
  21. package/feature-flags/index.d.ts +2 -8
  22. package/feature-flags/index.js +8 -16
  23. package/fetch.d.ts +24 -0
  24. package/fetch.js +265 -0
  25. package/groups/index.d.ts +49 -73
  26. package/groups/index.js +45 -64
  27. package/impersonate/index.d.ts +6 -15
  28. package/impersonate/index.js +5 -13
  29. package/index.d.ts +108 -154
  30. package/index.js +78 -109
  31. package/interfaces.d.ts +0 -10
  32. package/metadata/index.d.ts +7 -67
  33. package/metadata/index.js +32 -52
  34. package/node/ContextHolder/index.js +50 -155
  35. package/node/account-settings/index.js +16 -27
  36. package/node/applications/index.js +44 -51
  37. package/node/audits/index.js +20 -31
  38. package/node/auth/index.js +1035 -768
  39. package/node/auth/secutiry-poilicy/index.js +136 -125
  40. package/node/auth/utils.js +7 -9
  41. package/node/connectivity/index.js +187 -148
  42. package/node/directory/index.js +20 -29
  43. package/node/entitlements/index.js +5 -18
  44. package/node/feature-flags/index.js +9 -21
  45. package/node/fetch.js +306 -0
  46. package/node/groups/index.js +63 -65
  47. package/node/impersonate/index.js +5 -18
  48. package/node/index.js +71 -116
  49. package/node/metadata/index.js +52 -61
  50. package/node/notifications/index.js +27 -37
  51. package/node/reports/index.js +70 -78
  52. package/node/roles/index.js +51 -56
  53. package/node/security-center/index.js +9 -21
  54. package/node/sub-tenants/index.js +89 -90
  55. package/node/subscriptions/index.js +107 -79
  56. package/node/subscriptions/invoices.js +17 -25
  57. package/node/subscriptions/managedSubscriptions.js +27 -32
  58. package/node/subscriptions/paymentMethods.js +20 -27
  59. package/node/subscriptions/paymentProviders.js +6 -15
  60. package/node/subscriptions/plans.js +9 -17
  61. package/node/subscriptions/providers/index.js +18 -0
  62. package/node/subscriptions/providers/stripe/index.js +21 -26
  63. package/node/subscriptions/subscriptions.js +27 -32
  64. package/node/subscriptions/summaries.js +6 -15
  65. package/node/subscriptions/tenantConfiguration.js +9 -17
  66. package/node/subscriptions/vendorPublicConfigurations.js +6 -15
  67. package/node/teams/index.js +138 -130
  68. package/node/tenants/index.js +60 -65
  69. package/node/user-phone-numbers/index.js +24 -32
  70. package/node/users/index.js +53 -58
  71. package/node/vendor/index.js +6 -17
  72. package/notifications/index.d.ts +16 -22
  73. package/notifications/index.js +22 -33
  74. package/package.json +1 -1
  75. package/reports/index.d.ts +44 -50
  76. package/reports/index.js +62 -75
  77. package/roles/index.d.ts +38 -44
  78. package/roles/index.js +41 -57
  79. package/security-center/index.d.ts +2 -14
  80. package/security-center/index.js +6 -15
  81. package/sub-tenants/index.d.ts +15 -57
  82. package/sub-tenants/index.js +68 -88
  83. package/subscriptions/index.d.ts +11 -56
  84. package/subscriptions/index.js +11 -68
  85. package/subscriptions/invoices.d.ts +13 -16
  86. package/subscriptions/invoices.js +14 -24
  87. package/subscriptions/managedSubscriptions.d.ts +15 -18
  88. package/subscriptions/managedSubscriptions.js +22 -33
  89. package/subscriptions/paymentMethods.d.ts +13 -16
  90. package/subscriptions/paymentMethods.js +17 -26
  91. package/subscriptions/paymentProviders.d.ts +5 -8
  92. package/subscriptions/paymentProviders.js +4 -11
  93. package/subscriptions/plans.d.ts +8 -11
  94. package/subscriptions/plans.js +6 -14
  95. package/subscriptions/providers/index.d.ts +1 -0
  96. package/subscriptions/providers/index.js +1 -0
  97. package/subscriptions/providers/stripe/index.d.ts +21 -24
  98. package/subscriptions/providers/stripe/index.js +16 -27
  99. package/subscriptions/subscriptions.d.ts +21 -24
  100. package/subscriptions/subscriptions.js +22 -33
  101. package/subscriptions/summaries.d.ts +4 -7
  102. package/subscriptions/summaries.js +3 -10
  103. package/subscriptions/tenantConfiguration.d.ts +3 -6
  104. package/subscriptions/tenantConfiguration.js +7 -15
  105. package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
  106. package/subscriptions/vendorPublicConfigurations.js +4 -11
  107. package/teams/index.d.ts +131 -35
  108. package/teams/index.js +93 -122
  109. package/tenants/index.d.ts +37 -25
  110. package/tenants/index.js +46 -62
  111. package/user-phone-numbers/index.d.ts +26 -32
  112. package/user-phone-numbers/index.js +19 -32
  113. package/users/index.d.ts +15 -21
  114. package/users/index.js +44 -60
  115. package/vendor/index.d.ts +6 -12
  116. package/vendor/index.js +4 -11
  117. package/BaseApiClient.d.ts +0 -16
  118. package/BaseApiClient.js +0 -39
  119. package/FetchClient.d.ts +0 -42
  120. package/FetchClient.js +0 -308
  121. package/node/BaseApiClient.js +0 -49
  122. package/node/FetchClient.js +0 -326
@@ -1,23 +1,17 @@
1
1
  import { ILoadMessages, IMessage, IUpdateNotificationStatus, IUpdateNotificationIsPinned } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class NotificationsApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Get notifications
7
- */
8
- getNotifications: (params: ILoadMessages) => Promise<Array<IMessage>>;
9
- /**
10
- * Update notification status
11
- */
12
- updateNotificationStatus: (params: IUpdateNotificationStatus) => Promise<void>;
13
- /**
14
- * Update notification pin status
15
- */
16
- updateNotificationIsPinned: (params: IUpdateNotificationIsPinned) => Promise<any>;
17
- /**
18
- * Mark all notifications as read
19
- */
20
- markAllAsRead: () => Promise<void>;
21
- }
22
- declare const _default: NotificationsApi;
23
- export default _default;
2
+ /**
3
+ * get Notifications
4
+ */
5
+ export declare function getNotifications(params: ILoadMessages): Promise<Array<IMessage>>;
6
+ /**
7
+ * update Notification status
8
+ */
9
+ export declare function updateNotificationStatus(params: IUpdateNotificationStatus): Promise<void>;
10
+ /**
11
+ * update Notification pin status
12
+ */
13
+ export declare function updateNotificationIsPinned(params: IUpdateNotificationIsPinned): Promise<any>;
14
+ /**
15
+ * mark all notifications as read
16
+ */
17
+ export declare function markAllAsRead(): Promise<void>;
@@ -1,35 +1,24 @@
1
+ import { Get, Post, Put } from '../fetch';
1
2
  import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class NotificationsApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.getNotifications = async params => {
8
- return this.get(urls.notifications.v1, {
9
- params
10
- });
11
- };
12
-
13
- this.updateNotificationStatus = async params => {
14
- return this.put(`${urls.notifications.v1}/status`, {
15
- params
16
- });
17
- };
18
-
19
- this.updateNotificationIsPinned = async params => {
20
- const {
21
- notificationId,
22
- pinStatus
23
- } = params;
24
- return this.put(`${urls.notifications.v1}/${pinStatus}`, {
25
- notificationId
26
- });
27
- };
28
-
29
- this.markAllAsRead = async () => {
30
- return this.post(`${urls.notifications.v1}/status/mark-all-read`);
31
- };
32
- }
33
-
3
+ export async function getNotifications(params) {
4
+ return Get(urls.notifications.v1, {
5
+ params
6
+ });
34
7
  }
35
- export default new NotificationsApi('default');
8
+ export async function updateNotificationStatus(params) {
9
+ return Put(`${urls.notifications.v1}/status`, {
10
+ params
11
+ });
12
+ }
13
+ export async function updateNotificationIsPinned(params) {
14
+ const {
15
+ notificationId,
16
+ pinStatus
17
+ } = params;
18
+ return Put(`${urls.notifications.v1}/${pinStatus}`, {
19
+ notificationId
20
+ });
21
+ }
22
+ export async function markAllAsRead() {
23
+ return Post(`${urls.notifications.v1}/status/mark-all-read`);
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.1.74-alpha.9437937621",
3
+ "version": "3.1.74",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -1,51 +1,45 @@
1
1
  import { IDownloadReport, IGetReport, IGetReports, IRenderReport, IRenderReportResponse, IReportRecord, IScheduleReport, ISendReport } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class ReportsApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Get all active tenant reports from reports service by active vendor.
7
- * Optional: pass filters and sort options to reports.
8
- *
9
- * @returns list of reports objects
10
- */
11
- getReports: (body: IGetReports) => Promise<IReportRecord[]>;
12
- /**
13
- * Get report record by id.
14
- *
15
- * @returns list of report object
16
- * @throws exception if report not found.
17
- */
18
- getReport: (body: IGetReport) => Promise<IReportRecord>;
19
- /**
20
- * Render report by id.
21
- * Optional: pass data filters if exists to render report by specific data.
22
- *
23
- * @returns html content of the rendered reports
24
- * @throws exception if report not found or the data api unreached.
25
- */
26
- renderReport: ({ dataFilters, ...body }: IRenderReport) => Promise<IRenderReportResponse>;
27
- /**
28
- * Schedule report by providing cron expression and data filters.
29
- *
30
- * @returns the updated report object
31
- * @throws exception if report not found or the data api unreached.
32
- */
33
- scheduleReport: ({ templateId, dataFilters, ...body }: IScheduleReport) => Promise<IReportRecord>;
34
- /**
35
- * Download report as file in specific format.
36
- * This function will add a href element with url to trigger file download.
37
- * Optional: pass data filters if exists to generate report by specific data.
38
- *
39
- * @throws exception if report not found or the data api unreached.
40
- */
41
- downloadReport: ({ dataFilters, ...body }: IDownloadReport) => Promise<void>;
42
- /**
43
- * Send report to specific email address.
44
- * Optional: pass data filters if exists to send report by specific data.
45
- *
46
- * @throws exception if report not found or the data api unreached.
47
- */
48
- sendReport: (body: ISendReport) => Promise<void>;
49
- }
50
- declare const _default: ReportsApi;
51
- export default _default;
2
+ /**
3
+ * Get all active tenant reports from reports service by active vendor.
4
+ * Optional: pass filters and sort options to reports.
5
+ *
6
+ * @returns list of reports objects
7
+ */
8
+ export declare function getReports(body: IGetReports): Promise<IReportRecord[]>;
9
+ /**
10
+ * Get report record by id.
11
+ *
12
+ * @returns list of report object
13
+ * @throws exception if report not found.
14
+ */
15
+ export declare function getReport(body: IGetReport): Promise<IReportRecord>;
16
+ /**
17
+ * Render report by id.
18
+ * Optional: pass data filters if exists to render report by specific data.
19
+ *
20
+ * @returns html content of the rendered reports
21
+ * @throws exception if report not found or the data api unreached.
22
+ */
23
+ export declare function renderReport({ dataFilters, ...body }: IRenderReport): Promise<IRenderReportResponse>;
24
+ /**
25
+ * schedule report by providing cron expression and data filters.
26
+ *
27
+ * @returns the updated report object
28
+ * @throws exception if report not found or the data api unreached.
29
+ */
30
+ export declare function scheduleReport({ templateId, dataFilters, ...body }: IScheduleReport): Promise<IReportRecord>;
31
+ /**
32
+ * download report as file in specific format.
33
+ * this function will add a href element with url to trigger file download.
34
+ * Optional: pass data filters if exists to generate report by specific data.
35
+ *
36
+ * @throws exception if report not found or the data api unreached.
37
+ */
38
+ export declare function downloadReport({ dataFilters, ...body }: IDownloadReport): Promise<void>;
39
+ /**
40
+ * send report to specific email address.
41
+ * Optional: pass data filters if exists to send report by specific data.
42
+ *
43
+ * @throws exception if report not found or the data api unreached.
44
+ */
45
+ export declare function sendReport(body: ISendReport): Promise<void>;
package/reports/index.js CHANGED
@@ -3,86 +3,73 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["dataFilters"],
4
4
  _excluded2 = ["templateId", "dataFilters"],
5
5
  _excluded3 = ["dataFilters"];
6
+ import { Get, Post } from '../fetch';
6
7
  import { urls } from '../constants';
7
- import { BaseApiClient } from '../BaseApiClient';
8
- export class ReportsApi extends BaseApiClient {
9
- constructor(appName) {
10
- super(appName);
11
-
12
- this.getReports = async body => {
13
- return this.get(`${urls.reports.service.v2}/tenant-reports`, body);
14
- };
15
-
16
- this.getReport = async body => {
17
- return this.get(`${urls.reports.service.v2}/${body.id}/tenant-reports`);
18
- };
19
-
20
- this.renderReport = async _ref => {
21
- let {
22
- dataFilters
23
- } = _ref,
24
- body = _objectWithoutPropertiesLoose(_ref, _excluded);
25
-
26
- const html = await this.get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
27
- dataFilters: btoa(JSON.stringify(dataFilters || {})),
28
- responseType: 'html'
29
- }), {
30
- responseType: 'plain'
31
- });
32
- return {
33
- html
34
- };
35
- };
36
-
37
- this.scheduleReport = async _ref2 => {
38
- let {
39
- templateId,
40
- dataFilters
41
- } = _ref2,
42
- body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
43
-
44
- return this.post(`${urls.reports.service.v2}/${templateId}/tenant-reports`, _extends({}, body, {
45
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
46
- }));
47
- };
48
-
49
- this.downloadReport = async _ref3 => {
50
- let {
51
- dataFilters
52
- } = _ref3,
53
- body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
8
+ export async function getReports(body) {
9
+ return Get(`${urls.reports.service.v2}/tenant-reports`, body);
10
+ }
11
+ export async function getReport(body) {
12
+ return Get(`${urls.reports.service.v2}/${body.id}/tenant-reports`);
13
+ }
14
+ export async function renderReport(_ref) {
15
+ let {
16
+ dataFilters
17
+ } = _ref,
18
+ body = _objectWithoutPropertiesLoose(_ref, _excluded);
54
19
 
55
- const blob = await this.get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
56
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
57
- }), {
58
- responseType: 'blob'
59
- });
60
- let contentType = 'text/html';
61
- let contentExt = 'html';
20
+ const html = await Get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
21
+ dataFilters: btoa(JSON.stringify(dataFilters || {})),
22
+ responseType: 'html'
23
+ }), {
24
+ responseType: 'plain'
25
+ });
26
+ return {
27
+ html
28
+ };
29
+ }
30
+ export async function scheduleReport(_ref2) {
31
+ let {
32
+ templateId,
33
+ dataFilters
34
+ } = _ref2,
35
+ body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
62
36
 
63
- if (body.responseType === 'pdf') {
64
- contentType = 'application/pdf';
65
- contentExt = 'pdf';
66
- } else if (body.responseType === 'image') {
67
- contentType = 'image/jpeg';
68
- contentExt = 'jpg';
69
- }
37
+ return Post(`${urls.reports.service.v2}/${templateId}/tenant-reports`, _extends({}, body, {
38
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
39
+ }));
40
+ }
41
+ export async function downloadReport(_ref3) {
42
+ let {
43
+ dataFilters
44
+ } = _ref3,
45
+ body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
70
46
 
71
- const newBlob = new Blob([blob], {
72
- type: contentType
73
- });
74
- const fileURL = URL.createObjectURL(newBlob);
75
- const tempLink = document.createElement('a');
76
- tempLink.href = fileURL;
77
- tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
78
- tempLink.click();
79
- setTimeout(tempLink.remove.bind(tempLink));
80
- };
47
+ const blob = await Get(`${urls.reports.trigger.v1}/preview-report`, _extends({}, body, {
48
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
49
+ }), {
50
+ responseType: 'blob'
51
+ });
52
+ let contentType = 'text/html';
53
+ let contentExt = 'html';
81
54
 
82
- this.sendReport = async body => {
83
- return this.post(`${urls.reports.trigger.v1}/tenant-reports`, body);
84
- };
55
+ if (body.responseType === 'pdf') {
56
+ contentType = 'application/pdf';
57
+ contentExt = 'pdf';
58
+ } else if (body.responseType === 'image') {
59
+ contentType = 'image/jpeg';
60
+ contentExt = 'jpg';
85
61
  }
86
62
 
63
+ const newBlob = new Blob([blob], {
64
+ type: contentType
65
+ });
66
+ const fileURL = URL.createObjectURL(newBlob);
67
+ const tempLink = document.createElement('a');
68
+ tempLink.href = fileURL;
69
+ tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
70
+ tempLink.click();
71
+ setTimeout(tempLink.remove.bind(tempLink));
87
72
  }
88
- export default new ReportsApi('default');
73
+ export async function sendReport(body) {
74
+ return Post(`${urls.reports.trigger.v1}/tenant-reports`, body);
75
+ }
package/roles/index.d.ts CHANGED
@@ -1,45 +1,39 @@
1
1
  import { IRole, IRolePermission, IRolePermissionCategory, IAddRole, IDeleteRole, IUpdateRole, IAttachPermissionsToRole, IAttachPermissionToRoles, IAddRoleV2 } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class RolesApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Gets tenant related roles
7
- */
8
- getRoles: () => Promise<IRole[]>;
9
- /**
10
- * Adds tenant related roles
11
- * @param body - IAddRole
12
- */
13
- addRole: (body: IAddRole) => Promise<IRole>;
14
- /**
15
- * Deletes role given role ID
16
- */
17
- deleteRole: ({ roleId }: IDeleteRole) => Promise<void>;
18
- /**
19
- * Updates role using a given role ID and IUpdateRole object
20
- */
21
- updateRole: ({ roleId, ...body }: IUpdateRole) => Promise<IRole>;
22
- /**
23
- * Attaches permissions to role given a role ID
24
- */
25
- attachPermissionsToRole: ({ roleId, ...body }: IAttachPermissionsToRole) => Promise<IRole>;
26
- /**
27
- * Gets all vendor permissions
28
- */
29
- getPermissions: () => Promise<IRolePermission[]>;
30
- /**
31
- * Associate permission to roles
32
- */
33
- attachPermissionToRoles: ({ permissionId, ...body }: IAttachPermissionToRoles) => Promise<IRolePermission>;
34
- /**
35
- * Gets all vendor categories including the permissions
36
- */
37
- getPermissionCategories: () => Promise<IRolePermissionCategory[]>;
38
- /**
39
- * Adds tenant related roles v2
40
- * @param body - IAddRoleV2
41
- */
42
- addRoleV2: (body: IAddRoleV2) => Promise<IRole>;
43
- }
44
- declare const _default: RolesApi;
45
- export default _default;
2
+ /**
3
+ * Gets tenant related roles
4
+ */
5
+ export declare function getRoles(): Promise<IRole[]>;
6
+ /**
7
+ * Adds tenant related roles
8
+ * @param body: IAddRole
9
+ */
10
+ export declare function addRole(body: IAddRole): Promise<IRole>;
11
+ /**
12
+ * Deletes role given role ID
13
+ */
14
+ export declare function deleteRole({ roleId }: IDeleteRole): Promise<void>;
15
+ /**
16
+ * Updates role using a given role ID and IUpdateRole object
17
+ */
18
+ export declare function updateRole({ roleId, ...body }: IUpdateRole): Promise<IRole>;
19
+ /**
20
+ * Attaches permissions to role given a role ID
21
+ */
22
+ export declare function attachPermissionsToRole({ roleId, ...body }: IAttachPermissionsToRole): Promise<IRole>;
23
+ /**
24
+ * Gets all vendor permissions
25
+ */
26
+ export declare function getPermissions(): Promise<IRolePermission[]>;
27
+ /**
28
+ * Associate permission to roles
29
+ */
30
+ export declare function attachPermissionToRoles({ permissionId, ...body }: IAttachPermissionToRoles): Promise<IRolePermission>;
31
+ /**
32
+ * Gets all vendor categories including the permissions
33
+ */
34
+ export declare function getPermissionCategories(): Promise<IRolePermissionCategory[]>;
35
+ /**
36
+ * Adds tenant related roles v2
37
+ * @param body: IAddRoleV2
38
+ */
39
+ export declare function addRoleV2(body: IAddRoleV2): Promise<IRole>;
package/roles/index.js CHANGED
@@ -2,65 +2,49 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  const _excluded = ["roleId"],
3
3
  _excluded2 = ["roleId"],
4
4
  _excluded3 = ["permissionId"];
5
+ import { Delete, Get, Patch, Post, Put } from '../fetch';
5
6
  import { urls } from '../constants';
6
- import { BaseApiClient } from '../BaseApiClient';
7
- export class RolesApi extends BaseApiClient {
8
- constructor(appName) {
9
- super(appName);
10
-
11
- this.getRoles = async () => {
12
- return this.get(urls.identity.roles.v1);
13
- };
14
-
15
- this.addRole = async body => {
16
- return this.post(urls.identity.roles.v1, body);
17
- };
18
-
19
- this.deleteRole = async ({
20
- roleId
21
- }) => {
22
- return this.delete(`${urls.identity.roles.v1}/${roleId}`);
23
- };
24
-
25
- this.updateRole = async _ref => {
26
- let {
27
- roleId
28
- } = _ref,
29
- body = _objectWithoutPropertiesLoose(_ref, _excluded);
30
-
31
- return this.patch(`${urls.identity.roles.v1}/${roleId}`, body);
32
- };
33
-
34
- this.attachPermissionsToRole = async _ref2 => {
35
- let {
36
- roleId
37
- } = _ref2,
38
- body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
39
-
40
- return this.put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
41
- };
42
-
43
- this.getPermissions = async () => {
44
- return this.get(urls.identity.permissions.v1);
45
- };
46
-
47
- this.attachPermissionToRoles = async _ref3 => {
48
- let {
49
- permissionId
50
- } = _ref3,
51
- body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
52
-
53
- return this.put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
54
- };
7
+ export async function getRoles() {
8
+ return Get(urls.identity.roles.v1);
9
+ }
10
+ export async function addRole(body) {
11
+ return Post(urls.identity.roles.v1, body);
12
+ }
13
+ export async function deleteRole({
14
+ roleId
15
+ }) {
16
+ return Delete(`${urls.identity.roles.v1}/${roleId}`);
17
+ }
18
+ export async function updateRole(_ref) {
19
+ let {
20
+ roleId
21
+ } = _ref,
22
+ body = _objectWithoutPropertiesLoose(_ref, _excluded);
55
23
 
56
- this.getPermissionCategories = async () => {
57
- return this.get(`${urls.identity.permissions.v1}/categories`);
58
- };
24
+ return Patch(`${urls.identity.roles.v1}/${roleId}`, body);
25
+ }
26
+ export async function attachPermissionsToRole(_ref2) {
27
+ let {
28
+ roleId
29
+ } = _ref2,
30
+ body = _objectWithoutPropertiesLoose(_ref2, _excluded2);
59
31
 
60
- this.addRoleV2 = async body => {
61
- return this.post(urls.identity.roles.v2, body);
62
- };
63
- }
32
+ return Put(`${urls.identity.roles.v1}/${roleId}/permissions`, body);
33
+ }
34
+ export async function getPermissions() {
35
+ return Get(urls.identity.permissions.v1);
36
+ }
37
+ export async function attachPermissionToRoles(_ref3) {
38
+ let {
39
+ permissionId
40
+ } = _ref3,
41
+ body = _objectWithoutPropertiesLoose(_ref3, _excluded3);
64
42
 
43
+ return Put(`${urls.identity.permissions.v1}/${permissionId}/roles`, body);
44
+ }
45
+ export async function getPermissionCategories() {
46
+ return Get(`${urls.identity.permissions.v1}/categories`);
65
47
  }
66
- export default new RolesApi('default');
48
+ export async function addRoleV2(body) {
49
+ return Post(urls.identity.roles.v2, body);
50
+ }
@@ -1,15 +1,3 @@
1
1
  import { GetInsightsResponse, GetRecommendationsResponse } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class SecurityCenterApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Get security center recommendations.
7
- */
8
- getRecommendations: () => Promise<GetRecommendationsResponse>;
9
- /**
10
- * Get security center insights.
11
- */
12
- getInsights: () => Promise<GetInsightsResponse>;
13
- }
14
- declare const _default: SecurityCenterApi;
15
- export default _default;
2
+ export declare function getRecommendations(): Promise<GetRecommendationsResponse>;
3
+ export declare function getInsights(): Promise<GetInsightsResponse>;
@@ -1,17 +1,8 @@
1
+ import { Get } from '../fetch';
1
2
  import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class SecurityCenterApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.getRecommendations = async () => {
8
- return this.get(urls.securityCenter.recommendations.v1);
9
- };
10
-
11
- this.getInsights = async () => {
12
- return this.get(urls.securityCenter.insights.v1);
13
- };
14
- }
15
-
3
+ export async function getRecommendations() {
4
+ return Get(urls.securityCenter.recommendations.v1);
16
5
  }
17
- export default new SecurityCenterApi('default');
6
+ export async function getInsights() {
7
+ return Get(urls.securityCenter.insights.v1);
8
+ }