@frontegg/rest-api 3.1.76-alpha.9502349697 → 3.1.76-alpha.9762981322

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 +30 -108
  2. package/ContextHolder/index.js +57 -153
  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 +27 -126
  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 +57 -153
  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 -69
  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 -58
  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
package/fetch.js ADDED
@@ -0,0 +1,265 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { ContextHolder } from './ContextHolder';
3
+ import { fronteggHeaders } from './interfaces';
4
+ import { FronteggApiError } from './error';
5
+ import { GENERIC_ERROR_MESSAGE } from './constants';
6
+ export function getBaseUrl(context, url, withFronteggPrefix = true) {
7
+ let baseUrl;
8
+
9
+ if (typeof context.baseUrl === 'function') {
10
+ baseUrl = context.baseUrl(url);
11
+ } else {
12
+ baseUrl = context.baseUrl;
13
+ }
14
+
15
+ const prefix = context.urlPrefix || 'frontegg';
16
+ const removePrefix = prefix === 'frontegg' && !withFronteggPrefix;
17
+
18
+ if (!baseUrl.endsWith('/')) {
19
+ baseUrl += '/';
20
+ }
21
+
22
+ if (!baseUrl.endsWith(prefix) && !removePrefix) {
23
+ baseUrl += prefix;
24
+ }
25
+
26
+ return baseUrl;
27
+ }
28
+
29
+ async function prepareUrl(context, url, params) {
30
+ const baseUrl = getBaseUrl(context, url);
31
+ const paramsToSend = await 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
+ export function getMetadataHeaders(context) {
44
+ var _context$metadataHead, _context$metadataHead2;
45
+
46
+ const headers = {};
47
+
48
+ if (context != null && (_context$metadataHead = context.metadataHeaders) != null && _context$metadataHead.fronteggSdkVersion) {
49
+ headers[fronteggHeaders.fronteggSdkVersion] = context.metadataHeaders.fronteggSdkVersion;
50
+ }
51
+
52
+ if (context != null && (_context$metadataHead2 = context.metadataHeaders) != null && _context$metadataHead2.framework) {
53
+ headers[fronteggHeaders.frameWork] = context.metadataHeaders.framework;
54
+ }
55
+
56
+ return headers;
57
+ }
58
+ export function getScopedTenant() {
59
+ const urlParams = new URLSearchParams(window.location.search);
60
+ const scopedTenant = urlParams.get('tenantId');
61
+
62
+ if (scopedTenant) {
63
+ return scopedTenant;
64
+ }
65
+
66
+ return null;
67
+ }
68
+
69
+ async function buildRequestHeaders(context, contentType) {
70
+ var _context$tokenResolve;
71
+
72
+ const headers = getMetadataHeaders(context);
73
+ const authToken = await ((_context$tokenResolve = context == null ? void 0 : context.tokenResolver) != null ? _context$tokenResolve : ContextHolder.getAccessToken)();
74
+ const requestSource = ContextHolder.getRequestSource();
75
+ const scopedTenant = getScopedTenant();
76
+
77
+ if (contentType) {
78
+ headers[fronteggHeaders.contentType] = contentType;
79
+ }
80
+
81
+ if (requestSource) {
82
+ headers[fronteggHeaders.source] = requestSource;
83
+ }
84
+
85
+ if (authToken) {
86
+ headers.Authorization = `Bearer ${authToken}`;
87
+ }
88
+
89
+ if (scopedTenant) {
90
+ headers[fronteggHeaders.scopedTenant] = scopedTenant;
91
+ }
92
+
93
+ for (const additionalHeader of await getAdditionalHeaders(context)) {
94
+ headers[`${additionalHeader.key}`] = `${additionalHeader.value}`;
95
+ }
96
+
97
+ return headers;
98
+ }
99
+
100
+ async function buildQueryParams(context, params) {
101
+ if (!params) {
102
+ params = {};
103
+ }
104
+
105
+ const additionalQueryParams = await getAdditionalQueryParams(context);
106
+
107
+ for (const queryParam of additionalQueryParams) {
108
+ params[queryParam.key] = queryParam.value;
109
+ }
110
+
111
+ const keys = Object.keys(params);
112
+
113
+ for (const key of keys) {
114
+ const value = params[key];
115
+ params[key] = typeof value === 'object' ? JSON.stringify(value) : value;
116
+ }
117
+
118
+ return params;
119
+ }
120
+
121
+ async function getAdditionalQueryParams(context) {
122
+ let output = [];
123
+
124
+ if (context.additionalQueryParamsResolver) {
125
+ output = await context.additionalQueryParamsResolver();
126
+ }
127
+
128
+ return output;
129
+ }
130
+
131
+ async function getAdditionalHeaders(context) {
132
+ let output = [];
133
+
134
+ if (context.additionalHeadersResolver) {
135
+ output = await context.additionalHeadersResolver();
136
+ }
137
+
138
+ if (context.tenantResolver) {
139
+ const resolvedTenantResult = await context.tenantResolver();
140
+
141
+ if (!!(resolvedTenantResult != null && resolvedTenantResult.tenant)) {
142
+ output.push({
143
+ key: 'frontegg-login-alias',
144
+ value: resolvedTenantResult.tenant
145
+ });
146
+ }
147
+ }
148
+
149
+ if (context.appId) {
150
+ output.push({
151
+ key: 'frontegg-requested-application-id',
152
+ value: context.appId
153
+ });
154
+ }
155
+
156
+ return output;
157
+ }
158
+
159
+ const sendRequest = async opts => {
160
+ var _opts$method, _ref, _opts$credentials;
161
+
162
+ const context = ContextHolder.getContext();
163
+ const headers = await buildRequestHeaders(context, opts.contentType);
164
+ const url = await prepareUrl(context, opts.url, opts.params);
165
+ const response = await fetch(url, {
166
+ body: opts.body ? opts.contentType === 'application/json' ? JSON.stringify(opts.body) : opts.body : null,
167
+ method: (_opts$method = opts.method) != null ? _opts$method : 'GET',
168
+ headers: _extends({}, headers, opts.headers),
169
+ credentials: (_ref = (_opts$credentials = opts.credentials) != null ? _opts$credentials : context.requestCredentials) != null ? _ref : 'same-origin'
170
+ });
171
+
172
+ if (response.status === 302) {
173
+ window.location.href = await response.text();
174
+ return new Promise(() => {});
175
+ }
176
+
177
+ if (!response.ok) {
178
+ var _context$logLevel, _context$logLevel2;
179
+
180
+ if (response.status === 413) {
181
+ throw new FronteggApiError('Error request is too large', response.status);
182
+ }
183
+
184
+ let errorMessage;
185
+ let isJsonResponse = true;
186
+
187
+ try {
188
+ errorMessage = await response.text();
189
+ errorMessage = JSON.parse(errorMessage);
190
+ } catch (e) {
191
+ isJsonResponse = false;
192
+ }
193
+
194
+ if (errorMessage.errors) {
195
+ errorMessage = errorMessage.errors.join(', ');
196
+ } else if (typeof errorMessage !== 'string') {
197
+ errorMessage = `Error ${response.status} - ${response.statusText}`;
198
+ }
199
+
200
+ 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);
201
+ throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status);
202
+ }
203
+
204
+ if (!opts.responseType || opts.responseType === 'json') {
205
+ try {
206
+ return await response.json();
207
+ } catch (e) {
208
+ return {};
209
+ }
210
+ } else if (opts.responseType === 'blob') {
211
+ const {
212
+ outputFileName
213
+ } = opts.params;
214
+ return await response.blob().then(blob => URL.createObjectURL(blob)).then(url => {
215
+ const tempLink = document.createElement('a');
216
+ tempLink.href = url;
217
+ tempLink.setAttribute('download', outputFileName || 'output');
218
+ tempLink.click();
219
+ });
220
+ } else {
221
+ return await response.text();
222
+ }
223
+ };
224
+
225
+ export const Get = async (url, params, opts) => sendRequest(_extends({
226
+ url,
227
+ method: 'GET',
228
+ contentType: 'application/json',
229
+ params
230
+ }, opts));
231
+ export const Post = async (url, body, opts) => sendRequest(_extends({
232
+ url,
233
+ method: 'POST',
234
+ contentType: 'application/json',
235
+ body
236
+ }, opts));
237
+ export const Patch = async (url, body, opts) => sendRequest(_extends({
238
+ url,
239
+ method: 'PATCH',
240
+ contentType: 'application/json',
241
+ body
242
+ }, opts));
243
+ export const Put = async (url, body, opts) => sendRequest(_extends({
244
+ url,
245
+ method: 'PUT',
246
+ contentType: 'application/json',
247
+ body
248
+ }, opts));
249
+ export const Delete = async (url, body, opts) => sendRequest(_extends({
250
+ url,
251
+ method: 'DELETE',
252
+ contentType: 'application/json',
253
+ body
254
+ }, opts));
255
+ export const PostDownload = async (url, body, params, opts) => sendRequest(_extends({
256
+ url,
257
+ method: 'POST',
258
+ contentType: 'application/json',
259
+ responseType: 'blob',
260
+ body,
261
+ params
262
+ }, opts));
263
+ export const extractHeadersFromOptions = (options = {}) => _extends({}, options.jwt ? {
264
+ Authorization: options.jwt
265
+ } : {});
package/groups/index.d.ts CHANGED
@@ -1,73 +1,49 @@
1
- import { ICreateGroup, ICreateGroupResponse, IGetGroup, IGetGroupQueryOptions, IGetGroupsByIds, IGroupConfigResponse, IGroupResponse, IUpdateGroup, IUpdateGroupConfig, IUpdateGroupRoles, IUpdateGroupUsers } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class GroupsApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Get group by given id
7
- * @param groupId - The ID of the group to retrieve
8
- * @param query - Optional query parameters
9
- */
10
- getGroupById: ({ groupId }: IGetGroup, query?: IGetGroupQueryOptions | undefined) => Promise<IGroupResponse>;
11
- /**
12
- * Get all tenant groups
13
- * @param query - Optional query parameters
14
- */
15
- getGroups: (query?: IGetGroupQueryOptions | undefined) => Promise<IGroupResponse[]>;
16
- /**
17
- * Get groups by ids
18
- * @param body - Request body containing group IDs
19
- * @param params - Optional query parameters
20
- */
21
- getGroupsByIds: (body: IGetGroupsByIds, params?: IGetGroupQueryOptions | undefined) => Promise<IGroupResponse[]>;
22
- /**
23
- * Create new group
24
- * @param body - Request body to create a group
25
- */
26
- createGroup: (body: ICreateGroup) => Promise<ICreateGroupResponse>;
27
- /**
28
- * Update existing group by Id
29
- * @param groupId - The ID of the group to update
30
- * @param body - Request body containing update data
31
- */
32
- updateGroup: ({ groupId, ...body }: IUpdateGroup) => Promise<void>;
33
- /**
34
- * Delete existing group by Id
35
- * @param groupId - The ID of the group to delete
36
- */
37
- deleteGroup: (groupId: string) => Promise<void>;
38
- /**
39
- * Add roles to existing group
40
- * @param groupId - The ID of the group
41
- * @param body - Request body containing roles to add
42
- */
43
- addRolesToGroup: (groupId: string, body: IUpdateGroupRoles) => Promise<void>;
44
- /**
45
- * Delete roles from existing group
46
- * @param groupId - The ID of the group
47
- * @param body - Request body containing roles to delete
48
- */
49
- deleteRolesFromGroup: (groupId: string, body: IUpdateGroupRoles) => Promise<void>;
50
- /**
51
- * Add users to existing group
52
- * @param groupId - The ID of the group
53
- * @param body - Request body containing users to add
54
- */
55
- addUsersToGroup: (groupId: string, body: IUpdateGroupUsers) => Promise<void>;
56
- /**
57
- * Delete users from existing group
58
- * @param groupId - The ID of the group
59
- * @param body - Request body containing users to delete
60
- */
61
- deleteUsersFromGroup: (groupId: string, body: IUpdateGroupUsers) => Promise<void>;
62
- /**
63
- * Get or create default groups configuration
64
- */
65
- getGroupConfiguration: () => Promise<IGroupConfigResponse>;
66
- /**
67
- * Create or update groups configuration
68
- * @param body - Request body to update group configuration
69
- */
70
- updateGroupConfiguration: (body: IUpdateGroupConfig) => Promise<IGroupConfigResponse>;
71
- }
72
- declare const _default: GroupsApi;
73
- export default _default;
1
+ import { ICreateGroup, ICreateGroupResponse, IGetGroup, IGetGroupQueryOptions, IGetGroupsByIds, IGroupConfigResponse, IGroupResponse, IUpdateGroup, IUpdateGroupConfig, IUpdateGroupRoles, IUpdateGroupUsers } from "./interfaces";
2
+ /**
3
+ * Get group by given id
4
+ */
5
+ export declare function getGroupById({ groupId }: IGetGroup, query?: IGetGroupQueryOptions): Promise<IGroupResponse>;
6
+ /**
7
+ * Get all tenant groups
8
+ */
9
+ export declare function getGroups(query?: IGetGroupQueryOptions): Promise<IGroupResponse[]>;
10
+ /**
11
+ * Get groups by ids
12
+ */
13
+ export declare function getGroupsByIds(body: IGetGroupsByIds, params?: IGetGroupQueryOptions): Promise<IGroupResponse[]>;
14
+ /**
15
+ * Create new group
16
+ */
17
+ export declare function createGroup(body: ICreateGroup): Promise<ICreateGroupResponse>;
18
+ /**
19
+ * Update existing group by Id
20
+ */
21
+ export declare function updateGroup({ groupId, ...body }: IUpdateGroup): Promise<void>;
22
+ /**
23
+ * Delete existing group by Id
24
+ */
25
+ export declare function deleteGroup(groupId: string): Promise<void>;
26
+ /**
27
+ * Add roles to existing group
28
+ */
29
+ export declare function addRolesToGroup(groupId: string, body: IUpdateGroupRoles): Promise<void>;
30
+ /**
31
+ * Delete roles from existing group
32
+ */
33
+ export declare function deleteRolesFromGroup(groupId: string, body: IUpdateGroupRoles): Promise<void>;
34
+ /**
35
+ * Add users to existing group
36
+ */
37
+ export declare function addUsersToGroup(groupId: string, body: IUpdateGroupUsers): Promise<void>;
38
+ /**
39
+ * Delete users from existing group
40
+ */
41
+ export declare function deleteUsersFromGroup(groupId: string, body: IUpdateGroupUsers): Promise<void>;
42
+ /**
43
+ * Get or create default groups configuration
44
+ */
45
+ export declare function getGroupConfiguration(): Promise<IGroupConfigResponse>;
46
+ /**
47
+ * Create or update groups configuration
48
+ */
49
+ export declare function updateGroupConfiguration(body: IUpdateGroupConfig): Promise<IGroupConfigResponse>;
package/groups/index.js CHANGED
@@ -1,69 +1,50 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["groupId"];
4
- import { urls } from '../constants';
5
- import { BaseApiClient } from '../BaseApiClient';
6
- export class GroupsApi extends BaseApiClient {
7
- constructor(appName) {
8
- super(appName);
9
-
10
- this.getGroupById = async ({
11
- groupId
12
- }, query) => {
13
- return this.get(`${urls.identity.groups.v1}/${groupId}`, _extends({}, query));
14
- };
15
-
16
- this.getGroups = async query => {
17
- return this.get(`${urls.identity.groups.v1}`, _extends({}, query));
18
- };
19
-
20
- this.getGroupsByIds = async (body, params) => {
21
- return this.post(`${urls.identity.groups.getByIds.v1}`, body, {
22
- params
23
- });
24
- };
25
-
26
- this.createGroup = async body => {
27
- return this.post(`${urls.identity.groups.v1}`, body);
28
- };
29
-
30
- this.updateGroup = async _ref => {
31
- let {
32
- groupId
33
- } = _ref,
34
- body = _objectWithoutPropertiesLoose(_ref, _excluded);
35
-
36
- return this.patch(`${urls.identity.groups.v1}/${groupId}`, body);
37
- };
38
-
39
- this.deleteGroup = async groupId => {
40
- return this.delete(`${urls.identity.groups.v1}/${groupId}`);
41
- };
42
-
43
- this.addRolesToGroup = async (groupId, body) => {
44
- return this.post(`${urls.identity.groups.v1}/${groupId}/roles`, body);
45
- };
46
-
47
- this.deleteRolesFromGroup = async (groupId, body) => {
48
- return this.delete(`${urls.identity.groups.v1}/${groupId}/roles`, body);
49
- };
50
-
51
- this.addUsersToGroup = async (groupId, body) => {
52
- return this.post(`${urls.identity.groups.v1}/${groupId}/users`, body);
53
- };
54
-
55
- this.deleteUsersFromGroup = async (groupId, body) => {
56
- return this.delete(`${urls.identity.groups.v1}/${groupId}/users`, body);
57
- };
58
-
59
- this.getGroupConfiguration = async () => {
60
- return this.get(`${urls.identity.groups.configurations.v1}`);
61
- };
62
-
63
- this.updateGroupConfiguration = async body => {
64
- return this.post(`${urls.identity.groups.configurations.v1}`, body);
65
- };
66
- }
4
+ import { urls } from "../constants";
5
+ import { Delete, Get, Patch, Post } from "../fetch";
6
+ export async function getGroupById({
7
+ groupId
8
+ }, query) {
9
+ return Get(`${urls.identity.groups.v1}/${groupId}`, _extends({}, query));
10
+ }
11
+ export async function getGroups(query) {
12
+ return Get(`${urls.identity.groups.v1}`, _extends({}, query));
13
+ }
14
+ export async function getGroupsByIds(body, params) {
15
+ return Post(`${urls.identity.groups.getByIds.v1}`, body, {
16
+ params
17
+ });
18
+ }
19
+ export async function createGroup(body) {
20
+ return Post(`${urls.identity.groups.v1}`, body);
21
+ }
22
+ export async function updateGroup(_ref) {
23
+ let {
24
+ groupId
25
+ } = _ref,
26
+ body = _objectWithoutPropertiesLoose(_ref, _excluded);
67
27
 
28
+ return Patch(`${urls.identity.groups.v1}/${groupId}`, body);
29
+ }
30
+ export async function deleteGroup(groupId) {
31
+ return Delete(`${urls.identity.groups.v1}/${groupId}`);
32
+ }
33
+ export async function addRolesToGroup(groupId, body) {
34
+ return Post(`${urls.identity.groups.v1}/${groupId}/roles`, body);
35
+ }
36
+ export async function deleteRolesFromGroup(groupId, body) {
37
+ return Delete(`${urls.identity.groups.v1}/${groupId}/roles`, body);
38
+ }
39
+ export async function addUsersToGroup(groupId, body) {
40
+ return Post(`${urls.identity.groups.v1}/${groupId}/users`, body);
41
+ }
42
+ export async function deleteUsersFromGroup(groupId, body) {
43
+ return Delete(`${urls.identity.groups.v1}/${groupId}/users`, body);
44
+ }
45
+ export async function getGroupConfiguration() {
46
+ return Get(`${urls.identity.groups.configurations.v1}`);
68
47
  }
69
- export default new GroupsApi('default');
48
+ export async function updateGroupConfiguration(body) {
49
+ return Post(`${urls.identity.groups.configurations.v1}`, body);
50
+ }
@@ -1,17 +1,8 @@
1
- import { IImpersonate, IImpersonateResponse } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
1
+ import { IImpersonate, IImpersonateResponse } from "./interfaces";
3
2
  /**
4
- * UsersApi class provides methods for handling user and impersonation-related API requests.
3
+ * impersonating user should be called after creating actor token that contains information about impersonation.
4
+ * ``impersonate`` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
5
+ *
6
+ * @throws exception if impersonation failed
5
7
  */
6
- export declare class ImpersonateApi extends BaseApiClient {
7
- constructor(appName: string);
8
- /**
9
- * Impersonating user should be called after creating actor token that contains information about impersonation.
10
- * `impersonate` should contain impersonated user info (userId, tenantId, and vendorId) and the actor token that was created for him to perform impersonation.
11
- *
12
- * @throws exception if impersonation failed
13
- */
14
- impersonate: (body: IImpersonate) => Promise<IImpersonateResponse>;
15
- }
16
- declare const _default: ImpersonateApi;
17
- export default _default;
8
+ export declare function impersonate(body: IImpersonate): Promise<IImpersonateResponse>;
@@ -1,13 +1,5 @@
1
- import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class ImpersonateApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.impersonate = async body => {
8
- return this.post(`${urls.identity.impersonate.v1}`, body);
9
- };
10
- }
11
-
12
- }
13
- export default new ImpersonateApi('default');
1
+ import { urls } from "../constants";
2
+ import { Post } from "../fetch";
3
+ export async function impersonate(body) {
4
+ return Post(`${urls.identity.impersonate.v1}`, body);
5
+ }