@frontegg/rest-api 3.1.73 → 3.1.74-alpha.9436935127

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 (125) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +82 -24
  4. package/ContextHolder/index.js +56 -43
  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 +764 -768
  14. package/auth/index.js +875 -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 +10 -9
  19. package/connectivity/index.d.ts +125 -26
  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 +153 -108
  32. package/index.js +108 -79
  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 +60 -44
  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 +746 -1036
  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 +134 -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 +83 -73
  58. package/node/sub-tenants/interfaces.js +10 -1
  59. package/node/subscriptions/index.js +79 -107
  60. package/node/subscriptions/invoices.js +25 -17
  61. package/node/subscriptions/managedSubscriptions.js +32 -27
  62. package/node/subscriptions/paymentMethods.js +27 -20
  63. package/node/subscriptions/paymentProviders.js +15 -6
  64. package/node/subscriptions/plans.js +17 -9
  65. package/node/subscriptions/providers/stripe/index.js +26 -21
  66. package/node/subscriptions/subscriptions.js +32 -27
  67. package/node/subscriptions/summaries.js +15 -6
  68. package/node/subscriptions/tenantConfiguration.js +17 -9
  69. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  70. package/node/teams/index.js +130 -138
  71. package/node/tenants/index.js +65 -60
  72. package/node/user-phone-numbers/index.js +32 -24
  73. package/node/users/index.js +58 -53
  74. package/node/vendor/index.js +17 -6
  75. package/notifications/index.d.ts +22 -16
  76. package/notifications/index.js +33 -22
  77. package/package.json +1 -1
  78. package/reports/index.d.ts +50 -44
  79. package/reports/index.js +75 -62
  80. package/roles/index.d.ts +44 -38
  81. package/roles/index.js +57 -41
  82. package/security-center/index.d.ts +14 -2
  83. package/security-center/index.js +15 -6
  84. package/sub-tenants/index.d.ts +57 -14
  85. package/sub-tenants/index.js +88 -61
  86. package/sub-tenants/interfaces.d.ts +8 -0
  87. package/sub-tenants/interfaces.js +7 -1
  88. package/subscriptions/index.d.ts +56 -11
  89. package/subscriptions/index.js +68 -11
  90. package/subscriptions/invoices.d.ts +16 -13
  91. package/subscriptions/invoices.js +24 -14
  92. package/subscriptions/managedSubscriptions.d.ts +18 -15
  93. package/subscriptions/managedSubscriptions.js +33 -22
  94. package/subscriptions/paymentMethods.d.ts +16 -13
  95. package/subscriptions/paymentMethods.js +26 -17
  96. package/subscriptions/paymentProviders.d.ts +8 -5
  97. package/subscriptions/paymentProviders.js +11 -4
  98. package/subscriptions/plans.d.ts +11 -8
  99. package/subscriptions/plans.js +14 -6
  100. package/subscriptions/providers/stripe/index.d.ts +24 -21
  101. package/subscriptions/providers/stripe/index.js +27 -16
  102. package/subscriptions/subscriptions.d.ts +24 -21
  103. package/subscriptions/subscriptions.js +33 -22
  104. package/subscriptions/summaries.d.ts +7 -4
  105. package/subscriptions/summaries.js +10 -3
  106. package/subscriptions/tenantConfiguration.d.ts +6 -3
  107. package/subscriptions/tenantConfiguration.js +15 -7
  108. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  109. package/subscriptions/vendorPublicConfigurations.js +11 -4
  110. package/teams/index.d.ts +35 -131
  111. package/teams/index.js +122 -93
  112. package/tenants/index.d.ts +25 -37
  113. package/tenants/index.js +63 -47
  114. package/user-phone-numbers/index.d.ts +32 -26
  115. package/user-phone-numbers/index.js +32 -19
  116. package/users/index.d.ts +21 -15
  117. package/users/index.js +60 -44
  118. package/vendor/index.d.ts +12 -6
  119. package/vendor/index.js +11 -4
  120. package/fetch.d.ts +0 -24
  121. package/fetch.js +0 -265
  122. package/node/fetch.js +0 -306
  123. package/node/subscriptions/providers/index.js +0 -18
  124. package/subscriptions/providers/index.d.ts +0 -1
  125. package/subscriptions/providers/index.js +0 -1
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.FetchClient = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _ContextHolder = require("./ContextHolder");
13
+
14
+ var _error = require("./error");
15
+
16
+ var _constants = require("./constants");
17
+
18
+ var _interfaces = require("./interfaces");
19
+
20
+ class FetchClient {
21
+ constructor(appName) {
22
+ this.appName = void 0;
23
+
24
+ this.getFronteggContext = () => {
25
+ return (0, _ContextHolder.getFronteggContext)(this.appName);
26
+ };
27
+
28
+ this.prepareUrl = async (url, params) => {
29
+ const context = this.getFronteggContext().getContext();
30
+ const baseUrl = this.getContextBaseUrl(url);
31
+ const paramsToSend = await this.buildQueryParams(context, params);
32
+ let finalUrl = url.startsWith('http') ? url : `${baseUrl}${url}`;
33
+ const hasKeys = Object.keys(paramsToSend).length > 0;
34
+
35
+ if (paramsToSend && hasKeys) {
36
+ const urlParams = new URLSearchParams(paramsToSend);
37
+ finalUrl += `?${urlParams}`;
38
+ }
39
+
40
+ return finalUrl;
41
+ };
42
+
43
+ this.buildQueryParams = async (context, params) => {
44
+ if (!params) {
45
+ params = {};
46
+ }
47
+
48
+ const additionalQueryParams = await this.getAdditionalQueryParams(context);
49
+
50
+ for (const queryParam of additionalQueryParams) {
51
+ params[queryParam.key] = queryParam.value;
52
+ }
53
+
54
+ const keys = Object.keys(params);
55
+
56
+ for (const key of keys) {
57
+ const value = params[key];
58
+ params[key] = typeof value === 'object' ? JSON.stringify(value) : value;
59
+ }
60
+
61
+ return params;
62
+ };
63
+
64
+ this.getAdditionalQueryParams = async context => {
65
+ let output = [];
66
+
67
+ if (context.additionalQueryParamsResolver) {
68
+ output = await context.additionalQueryParamsResolver();
69
+ }
70
+
71
+ return output;
72
+ };
73
+
74
+ this.getAdditionalHeaders = async context => {
75
+ let output = [];
76
+
77
+ if (context.additionalHeadersResolver) {
78
+ output = await context.additionalHeadersResolver();
79
+ }
80
+
81
+ if (context.tenantResolver) {
82
+ const resolvedTenantResult = await context.tenantResolver();
83
+
84
+ if (!!(resolvedTenantResult != null && resolvedTenantResult.tenant)) {
85
+ output.push({
86
+ key: 'frontegg-login-alias',
87
+ value: resolvedTenantResult.tenant
88
+ });
89
+ }
90
+ }
91
+
92
+ if (context.appId) {
93
+ output.push({
94
+ key: 'frontegg-requested-application-id',
95
+ value: context.appId
96
+ });
97
+ }
98
+
99
+ return output;
100
+ };
101
+
102
+ this.buildRequestHeaders = async contentType => {
103
+ var _context$tokenResolve;
104
+
105
+ const fronteggContext = this.getFronteggContext();
106
+ const context = fronteggContext.getContext();
107
+ const headers = FetchClient.getMetadataHeaders(context);
108
+ const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : fronteggContext.getAccessToken)();
109
+ const requestSource = fronteggContext.getRequestSource();
110
+ const scopedTenant = FetchClient.getScopedTenant();
111
+
112
+ if (contentType) {
113
+ headers[_interfaces.fronteggHeaders.contentType] = contentType;
114
+ }
115
+
116
+ if (requestSource) {
117
+ headers[_interfaces.fronteggHeaders.source] = requestSource;
118
+ }
119
+
120
+ if (authToken) {
121
+ headers.Authorization = `Bearer ${authToken}`;
122
+ }
123
+
124
+ if (scopedTenant) {
125
+ headers[_interfaces.fronteggHeaders.scopedTenant] = scopedTenant;
126
+ }
127
+
128
+ for (const additionalHeader of await this.getAdditionalHeaders(context)) {
129
+ headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
130
+ }
131
+
132
+ return headers;
133
+ };
134
+
135
+ this.sendRequest = async opts => {
136
+ var _opts$method, _ref, _opts$credentials;
137
+
138
+ const context = (0, _ContextHolder.getFronteggContext)(this.appName).getContext();
139
+ const headers = await this.buildRequestHeaders(opts.contentType);
140
+ const url = await this.prepareUrl(opts.url, opts.params);
141
+ const response = await fetch(url, {
142
+ body: opts.body ? opts.contentType === 'application/json' ? JSON.stringify(opts.body) : opts.body : null,
143
+ method: (_opts$method = opts.method) != null ? _opts$method : 'GET',
144
+ headers: (0, _extends2.default)({}, headers, opts.headers),
145
+ credentials: (_ref = (_opts$credentials = opts.credentials) != null ? _opts$credentials : context.requestCredentials) != null ? _ref : 'same-origin'
146
+ });
147
+
148
+ if (response.status === 302) {
149
+ window.location.href = await response.text();
150
+ return new Promise(() => {});
151
+ }
152
+
153
+ if (!response.ok) {
154
+ var _context$logLevel, _context$logLevel2;
155
+
156
+ if (response.status === 413) {
157
+ throw new _error.FronteggApiError('Error request is too large', response.status);
158
+ }
159
+
160
+ let errorMessage;
161
+ let isJsonResponse = true;
162
+
163
+ try {
164
+ errorMessage = await response.text();
165
+ errorMessage = JSON.parse(errorMessage);
166
+ } catch (e) {
167
+ isJsonResponse = false;
168
+ }
169
+
170
+ if (errorMessage.errors) {
171
+ errorMessage = errorMessage.errors.join(', ');
172
+ } else if (typeof errorMessage !== 'string') {
173
+ errorMessage = `Error ${response.status} - ${response.statusText}`;
174
+ }
175
+
176
+ if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
177
+ throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status);
178
+ }
179
+
180
+ if (!opts.responseType || opts.responseType === 'json') {
181
+ try {
182
+ return await response.json();
183
+ } catch (e) {
184
+ return {};
185
+ }
186
+ } else if (opts.responseType === 'blob') {
187
+ const {
188
+ outputFileName
189
+ } = opts.params;
190
+ return await response.blob().then(blob => URL.createObjectURL(blob)).then(url => {
191
+ const tempLink = document.createElement('a');
192
+ tempLink.href = url;
193
+ tempLink.setAttribute('download', outputFileName || 'output');
194
+ tempLink.click();
195
+ });
196
+ } else {
197
+ return await response.text();
198
+ }
199
+ };
200
+
201
+ this.get = async (url, params, opts) => this.sendRequest((0, _extends2.default)({
202
+ url,
203
+ method: 'GET',
204
+ contentType: 'application/json',
205
+ params
206
+ }, opts));
207
+
208
+ this.post = async (url, body, opts) => this.sendRequest((0, _extends2.default)({
209
+ url,
210
+ method: 'POST',
211
+ contentType: 'application/json',
212
+ body
213
+ }, opts));
214
+
215
+ this.patch = async (url, body, opts) => this.sendRequest((0, _extends2.default)({
216
+ url,
217
+ method: 'PATCH',
218
+ contentType: 'application/json',
219
+ body
220
+ }, opts));
221
+
222
+ this.put = async (url, body, opts) => this.sendRequest((0, _extends2.default)({
223
+ url,
224
+ method: 'PUT',
225
+ contentType: 'application/json',
226
+ body
227
+ }, opts));
228
+
229
+ this.delete = async (url, body, opts) => this.sendRequest((0, _extends2.default)({
230
+ url,
231
+ method: 'DELETE',
232
+ contentType: 'application/json',
233
+ body
234
+ }, opts));
235
+
236
+ this.postDownload = async (url, body, params, opts) => this.sendRequest((0, _extends2.default)({
237
+ url,
238
+ method: 'POST',
239
+ contentType: 'application/json',
240
+ responseType: 'blob',
241
+ body,
242
+ params
243
+ }, opts));
244
+
245
+ this.extractHeadersFromOptions = (options = {}) => (0, _extends2.default)({}, options.jwt ? {
246
+ Authorization: options.jwt
247
+ } : {});
248
+
249
+ this.getBaseUrl = (context, url, withFronteggPrefix = true) => {
250
+ return FetchClient.getBaseUrl(context, url, withFronteggPrefix);
251
+ };
252
+
253
+ this.getContextBaseUrl = (url, withFronteggPrefix = true) => {
254
+ const context = this.getFronteggContext().getContext();
255
+ return this.getBaseUrl(context, url, withFronteggPrefix);
256
+ };
257
+
258
+ this.getMetadataHeaders = context => {
259
+ return FetchClient.getMetadataHeaders(context);
260
+ };
261
+
262
+ this.getContextMetadataHeaders = () => {
263
+ const context = this.getFronteggContext().getContext();
264
+ return FetchClient.getMetadataHeaders(context);
265
+ };
266
+
267
+ this.appName = appName;
268
+ }
269
+
270
+ }
271
+
272
+ exports.FetchClient = FetchClient;
273
+
274
+ FetchClient.getBaseUrl = (context, url, withFronteggPrefix = true) => {
275
+ let baseUrl;
276
+
277
+ if (typeof context.baseUrl === 'function') {
278
+ baseUrl = context.baseUrl(url);
279
+ } else {
280
+ baseUrl = context.baseUrl;
281
+ }
282
+
283
+ const prefix = context.urlPrefix || 'frontegg';
284
+ const removePrefix = prefix === 'frontegg' && !withFronteggPrefix;
285
+
286
+ if (!baseUrl.endsWith('/')) {
287
+ baseUrl += '/';
288
+ }
289
+
290
+ if (!baseUrl.endsWith(prefix) && !removePrefix) {
291
+ baseUrl += prefix;
292
+ }
293
+
294
+ return baseUrl;
295
+ };
296
+
297
+ FetchClient.getMetadataHeaders = context => {
298
+ var _context$metadataHead, _context$metadataHead2;
299
+
300
+ const headers = {};
301
+
302
+ if (context != null && (_context$metadataHead = context.metadataHeaders) != null && _context$metadataHead.fronteggSdkVersion) {
303
+ headers[_interfaces.fronteggHeaders.fronteggSdkVersion] = context.metadataHeaders.fronteggSdkVersion;
304
+ }
305
+
306
+ if (context != null && (_context$metadataHead2 = context.metadataHeaders) != null && _context$metadataHead2.framework) {
307
+ headers[_interfaces.fronteggHeaders.frameWork] = context.metadataHeaders.framework;
308
+ }
309
+
310
+ return headers;
311
+ };
312
+
313
+ FetchClient.getScopedTenant = () => {
314
+ const urlParams = new URLSearchParams(window.location.search);
315
+ const scopedTenant = urlParams.get('tenantId');
316
+
317
+ if (scopedTenant) {
318
+ return scopedTenant;
319
+ }
320
+
321
+ return null;
322
+ };
323
+
324
+ var _default = new FetchClient('default');
325
+
326
+ exports.default = _default;
@@ -3,26 +3,37 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getPublicSettings = getPublicSettings;
7
- exports.getSettings = getSettings;
8
- exports.updateSettings = updateSettings;
6
+ exports.default = exports.AccountSettingsApi = void 0;
9
7
 
10
8
  var _constants = require("../constants");
11
9
 
12
- var _fetch = require("../fetch");
10
+ var _BaseApiClient = require("../BaseApiClient");
13
11
 
14
- async function updateSettings(body, options) {
15
- return (0, _fetch.Put)(_constants.urls.tenants.accountSettings.v1, body, {
16
- headers: (0, _fetch.extractHeadersFromOptions)(options)
17
- });
18
- }
12
+ class AccountSettingsApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(appName) {
14
+ super(appName);
15
+
16
+ this.updateSettings = async (body, options) => {
17
+ return this.put(_constants.urls.tenants.accountSettings.v1, body, {
18
+ headers: this.extractHeadersFromOptions(options)
19
+ });
20
+ };
21
+
22
+ this.getSettings = async options => {
23
+ return this.get(_constants.urls.tenants.accountSettings.v1, undefined, {
24
+ headers: this.extractHeadersFromOptions(options)
25
+ });
26
+ };
27
+
28
+ this.getPublicSettings = async () => {
29
+ return this.get(`${_constants.urls.tenants.accountSettings.v1}/public`);
30
+ };
31
+ }
19
32
 
20
- async function getSettings(options) {
21
- return (0, _fetch.Get)(_constants.urls.tenants.accountSettings.v1, undefined, {
22
- headers: (0, _fetch.extractHeadersFromOptions)(options)
23
- });
24
33
  }
25
34
 
26
- async function getPublicSettings() {
27
- return (0, _fetch.Get)(`${_constants.urls.tenants.accountSettings.v1}/public`);
28
- }
35
+ exports.AccountSettingsApi = AccountSettingsApi;
36
+
37
+ var _default = new AccountSettingsApi('default');
38
+
39
+ exports.default = _default;
@@ -3,58 +3,65 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.assignUserToApplications = assignUserToApplications;
7
- exports.getApplicationsData = getApplicationsData;
8
- exports.getTenantsApplications = getTenantsApplications;
9
- exports.getUserApplicationsId = getUserApplicationsId;
10
- exports.getUsersApplicationsId = getUsersApplicationsId;
11
- exports.getUsersOfApplications = getUsersOfApplications;
12
- exports.unassignUserFromApplications = unassignUserFromApplications;
6
+ exports.default = exports.ApplicationsApi = void 0;
13
7
 
14
8
  var _constants = require("../constants");
15
9
 
16
- var _fetch = require("../fetch");
10
+ var _BaseApiClient = require("../BaseApiClient");
17
11
 
18
- async function getUserApplicationsId({
19
- userId
20
- }) {
21
- return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/${userId}/apps`);
22
- }
12
+ class ApplicationsApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(appName) {
14
+ super(appName);
23
15
 
24
- async function getUsersApplicationsId({
25
- userIds
26
- }) {
27
- return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/users-apps`, {
28
- userIds: userIds.join(',')
29
- });
30
- }
16
+ this.getUserApplicationsId = async ({
17
+ userId
18
+ }) => {
19
+ return this.get(`${_constants.urls.identity.applications.v1}/${userId}/apps`);
20
+ };
31
21
 
32
- async function getTenantsApplications() {
33
- return (0, _fetch.Get)(_constants.urls.applications.tenant.v1);
34
- }
22
+ this.getUsersApplicationsId = async ({
23
+ userIds
24
+ }) => {
25
+ return this.get(`${_constants.urls.identity.applications.v1}/users-apps`, {
26
+ userIds: userIds.join(',')
27
+ });
28
+ };
35
29
 
36
- async function getApplicationsData({
37
- appIds,
38
- includeFreeAccess = true
39
- }) {
40
- return (0, _fetch.Get)(_constants.urls.applications.v1, {
41
- ids: appIds.join(','),
42
- _includeFreeAccess: includeFreeAccess
43
- });
44
- }
30
+ this.getTenantsApplications = async () => {
31
+ return this.get(_constants.urls.applications.tenant.v1);
32
+ };
45
33
 
46
- async function assignUserToApplications(body) {
47
- return (0, _fetch.Post)(`${_constants.urls.identity.applications.v1}/apps-user`, body);
48
- }
34
+ this.getApplicationsData = async ({
35
+ appIds,
36
+ includeFreeAccess = true
37
+ }) => {
38
+ return this.get(_constants.urls.applications.v1, {
39
+ ids: appIds.join(','),
40
+ _includeFreeAccess: includeFreeAccess
41
+ });
42
+ };
43
+
44
+ this.assignUserToApplications = async body => {
45
+ return this.post(`${_constants.urls.identity.applications.v1}/apps-user`, body);
46
+ };
47
+
48
+ this.unassignUserFromApplications = async body => {
49
+ return this.delete(`${_constants.urls.identity.applications.v1}/user-apps`, body);
50
+ };
51
+
52
+ this.getUsersOfApplications = async ({
53
+ appIds
54
+ }) => {
55
+ return this.get(`${_constants.urls.identity.applications.v1}/apps-users`, {
56
+ appIds: appIds.join(',')
57
+ });
58
+ };
59
+ }
49
60
 
50
- async function unassignUserFromApplications(body) {
51
- return (0, _fetch.Delete)(`${_constants.urls.identity.applications.v1}/user-apps`, body);
52
61
  }
53
62
 
54
- async function getUsersOfApplications({
55
- appIds
56
- }) {
57
- return (0, _fetch.Get)(`${_constants.urls.identity.applications.v1}/apps-users`, {
58
- appIds: appIds.join(',')
59
- });
60
- }
63
+ exports.ApplicationsApi = ApplicationsApi;
64
+
65
+ var _default = new ApplicationsApi('default');
66
+
67
+ exports.default = _default;
@@ -5,33 +5,44 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.exportAudits = exportAudits;
9
- exports.getAudits = getAudits;
10
- exports.getAuditsStats = getAuditsStats;
8
+ exports.default = exports.AuditsApi = void 0;
11
9
 
12
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
11
 
14
- var _fetch = require("../fetch");
15
-
16
12
  var _constants = require("../constants");
17
13
 
14
+ var _BaseApiClient = require("../BaseApiClient");
15
+
18
16
  const _excluded = ["endpoint", "headerProps"];
19
17
 
20
- async function getAudits(params) {
21
- return (0, _fetch.Get)(_constants.urls.audits.v1, params);
22
- }
18
+ class AuditsApi extends _BaseApiClient.BaseApiClient {
19
+ constructor(appName) {
20
+ super(appName);
21
+
22
+ this.getAudits = async params => {
23
+ return this.get(_constants.urls.audits.v1, params);
24
+ };
25
+
26
+ this.getAuditsStats = async params => {
27
+ return this.get(`${_constants.urls.audits.v1}/stats`, params);
28
+ };
29
+
30
+ this.exportAudits = async params => {
31
+ const {
32
+ endpoint,
33
+ headerProps
34
+ } = params,
35
+ restParams = (0, _objectWithoutPropertiesLoose2.default)(params, _excluded);
36
+ return this.postDownload(`${_constants.urls.audits.v1}/export/${endpoint}`, {
37
+ properties: headerProps
38
+ }, restParams);
39
+ };
40
+ }
23
41
 
24
- async function getAuditsStats(params) {
25
- return (0, _fetch.Get)(`${_constants.urls.audits.v1}/stats`, params);
26
42
  }
27
43
 
28
- async function exportAudits(params) {
29
- const {
30
- endpoint,
31
- headerProps
32
- } = params,
33
- restParams = (0, _objectWithoutPropertiesLoose2.default)(params, _excluded);
34
- return (0, _fetch.PostDownload)(`${_constants.urls.audits.v1}/export/${endpoint}`, {
35
- properties: headerProps
36
- }, restParams);
37
- }
44
+ exports.AuditsApi = AuditsApi;
45
+
46
+ var _default = new AuditsApi('default');
47
+
48
+ exports.default = _default;