-
Notifications
You must be signed in to change notification settings - Fork 3
/
groups.d.ts
439 lines (437 loc) · 15.2 KB
/
groups.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
import { A as ApiCallOptions } from './global.types-qsBNouXJ.js';
import './auth-types-PkN9CAF_.js';
/**
* An array of role references. Visibility dependant on access level. Must have access to roles to view other users' assigned roles.
*/
type AssignedRoles = {
/** The unique role identitier */
id: string;
/** The role level */
readonly level: "admin" | "user";
/** The role name */
readonly name: string;
/** The type of role */
readonly type: "default" | "custom";
}[];
/**
* An array of role reference identifiers.
*/
type AssignedRolesRefIDs = {
/** The unique role identitier */
id: string;
}[];
/**
* An array of role reference names.
*/
type AssignedRolesRefNames = {
/** The name of the role */
name: string;
}[];
/**
* An error object describing the error.
*/
type Error = {
/** The error code. */
code: string;
/** A human-readable explanation specific to this occurrence of the problem. */
detail?: string;
/** Additional properties relating to the error. */
meta?: unknown;
/** References to the source of the error. */
source?: {
/** The URI query parameter that caused the error. */
parameter?: string;
/** A JSON Pointer to the property that caused the error. */
pointer?: string;
};
/** The HTTP status code. */
status?: number;
/** Summary of the problem. */
title: string;
};
/**
* The error response object describing the error from the handling of an HTTP request.
*/
type Errors = {
/** An array of errors related to the operation. */
errors?: Error[];
/** A unique identifier for tracing the error. */
traceId?: string;
};
/**
* An advanced query filter to be used for complex user querying in the tenant.
*/
type Filter = {
/** The advanced filtering to be applied the query. All conditional statements within this query parameter are case insensitive. */
filter?: string;
};
/**
* represents a Group document
*/
type Group = {
/** An array of role references. Visibility dependant on access level. Must have access to roles to view other users' assigned roles. */
assignedRoles?: AssignedRoles;
/** The timestamp for when the group record was created. */
createdAt: string;
/** Id of user that created role. */
readonly createdBy?: string;
/** A description of a custom group. */
description?: string;
/** The unique identifier for the group */
readonly id: string;
/** The timestamp for when the group record was last updated. */
lastUpdatedAt: string;
/** Contains Links for current document */
links: {
self: {
/** Link to the current group document */
href: string;
};
};
/** The name of the group. */
name: string;
/** The type of provider for the group. */
providerType?: "idp" | "custom";
/** The state of the group. */
status: "active" | "disabled";
/** The tenant identifier associated with the given group */
tenantId: string;
/** Id of user that last updated this role. */
readonly updatedBy?: string;
};
/**
* A JSON Patch document.
*/
type GroupPatch = {
/** The operation to be performed. Currently "replace" is the only supported operation. */
op: "replace";
/** Attribute name of a field of the Groups entity. "Name" and "description" is only available for custom groups. */
path: "assignedRoles" | "name" | "description";
/** The roles to assign to the group (limit of 100 roles per group). */
value: AssignedRolesRefIDs | AssignedRolesRefNames;
};
/**
* An array of JSON Patches for a group.
*/
type GroupPatchSchema = GroupPatch[];
type GroupPostSchema = {
/** The roles to assign to the group (limit of 100 roles per group). */
assignedRoles?: AssignedRolesRefIDs | AssignedRolesRefNames;
/** The description of the group. */
description?: string;
/** The name of the group (maximum length of 256 characters). */
name: string;
/** The type of group provider. Must be "idp" or "custom". Defaults to "idp" if not provided. */
providerType?: "idp" | "custom";
/** The status of the created group within the tenant. Defaults to active if empty. */
status?: "active";
};
/**
* represents a GroupSetting document
*/
type GroupSettings = {
/** Determines if groups should be created on login. */
autoCreateGroups: boolean;
/** Contains Links for current document */
links: {
self: {
/** Link to the current group settings document */
href: string;
};
};
/** Determines if groups should be created on login. */
syncIdpGroups: boolean;
systemGroups?: {
"000000000000000000000001"?: {
/** An array of role references. Visibility dependant on access level. Must have access to roles to view other users' assigned roles. */
assignedRoles?: AssignedRoles;
/** The timestamp for when the Everyone group was created. */
createdAt?: string;
/** For Everyone, this is always `true` and can't be patched. */
enabled?: boolean;
/** The ID of the Everyone group. This value will not change and is immutable. */
id?: "000000000000000000000001";
/** The timestamp for when the Everyone group was last updated. */
lastUpdatedAt?: string;
/** The name of the Everyone group. This value will not change and is immutable. */
name?: "com.qlik.Everyone";
};
};
/** The unique tenant identifier. */
tenantId: string;
};
/**
* A result object when listing groups.
*/
type Groups = {
/** An array of groups. */
data?: Group[];
links?: {
next?: {
/** Link to the next page of items */
href: string;
};
prev?: {
/** Link to the previous page of items */
href: string;
};
self: {
/** Link to the current page of items */
href: string;
};
};
/** Indicates the total number of matching documents. Will only be returned if the query parameter "totalResults" is true. */
totalResults?: number;
};
/**
* A JSON Patch document as defined in http://tools.ietf.org/html/rfc6902.
*/
type SettingsPatch = {
/** The operation to be performed. */
op: "replace";
/** A JSON Pointer. */
path: "/autoCreateGroups" | "/syncIdpGroups" | "/systemGroups/{id}/assignedRoles";
/** The value to be used for this operation. */
value: boolean | AssignedRolesRefIDs | AssignedRolesRefNames;
};
/**
* An array of JSON Patches for the groups settings.
*/
type SettingsPatchSchema = SettingsPatch[];
/**
* Returns a list of groups with cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetGroupsHttpError
*/
declare const getGroups: (query: {
/** The advanced filtering to use for the query. Refer to [RFC 7644](https://datatracker.ietf.org/doc/rfc7644/) for the syntax. Cannot be combined with any of the fields marked as deprecated. All conditional statements within this query parameter are case insensitive. */
filter?: string;
/** The number of groups to retrieve. */
limit?: number;
/** The next page cursor. */
next?: string;
/** The previous page cursor. */
prev?: string;
/** Optional resource field name to sort on, eg. name. Can be prefixed with +/- to determine order, defaults to (+) ascending. */
sort?: string;
/** Return system groups (e.g. Everyone) instead of regular groups. Cannot be combined with any other query parameters. */
systemGroups?: boolean;
/** Whether to return a total match count in the result. Defaults to false. */
totalResults?: boolean;
}, options?: ApiCallOptions) => Promise<GetGroupsHttpResponse>;
type GetGroupsHttpResponse = {
data: Groups;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<GetGroupsHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<GetGroupsHttpResponse>;
};
type GetGroupsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Creates a new group. The maximum number of groups a tenant can have is 10,000. Group names are case-sensitive, and must be unique.
*
* @param body an object with the body content
* @throws CreateGroupHttpError
*/
declare const createGroup: (body: GroupPostSchema, options?: ApiCallOptions) => Promise<CreateGroupHttpResponse>;
type CreateGroupHttpResponse = {
data: Group;
headers: Headers;
status: number;
};
type CreateGroupHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Retrieves a list of groups matching the filter using advanced query string.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws FilterGroupsHttpError
*/
declare const filterGroups: (query: {
/** The number of user entries to retrieve. */
limit?: number;
/** Get users with IDs that are higher than the target user ID. Cannot be used in conjunction with prev. */
next?: string;
/** Get users with IDs that are lower than the target user ID. Cannot be used in conjunction with next. */
prev?: string;
/** The field to sort by, with +/- prefix indicating sort order */
sort?: "name" | "+name" | "-name";
}, body: Filter, options?: ApiCallOptions) => Promise<FilterGroupsHttpResponse>;
type FilterGroupsHttpResponse = {
data: Groups;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<FilterGroupsHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<FilterGroupsHttpResponse>;
};
type FilterGroupsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Returns the tenant's group settings, such as whether automatic group creation and IdP group synchronization are enabled or disabled, and roles assigned to system groups.
*
* @throws GetGroupsSettingsHttpError
*/
declare const getGroupsSettings: (options?: ApiCallOptions) => Promise<GetGroupsSettingsHttpResponse>;
type GetGroupsSettingsHttpResponse = {
data: GroupSettings;
headers: Headers;
status: number;
};
type GetGroupsSettingsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Updates the tenant's group settings, such as whether automatic group creation and IdP group synchronization are enabled or disabled, and roles assigned to system groups.
*
* @param body an object with the body content
* @throws PatchGroupsSettingsHttpError
*/
declare const patchGroupsSettings: (body: SettingsPatchSchema, options?: ApiCallOptions) => Promise<PatchGroupsSettingsHttpResponse>;
type PatchGroupsSettingsHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type PatchGroupsSettingsHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Deletes the requested group.
*
* @param groupId The ID of the group to delete.
* @throws DeleteGroupHttpError
*/
declare const deleteGroup: (groupId: string, options?: ApiCallOptions) => Promise<DeleteGroupHttpResponse>;
type DeleteGroupHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type DeleteGroupHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Returns the requested group.
*
* @param groupId The group's unique identifier
* @throws GetGroupHttpError
*/
declare const getGroup: (groupId: string, options?: ApiCallOptions) => Promise<GetGroupHttpResponse>;
type GetGroupHttpResponse = {
data: Group;
headers: Headers;
status: number;
};
type GetGroupHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Updates the requested group.
*
* @param groupId The ID of the group to update.
* @param body an object with the body content
* @throws PatchGroupHttpError
*/
declare const patchGroup: (groupId: string, body: GroupPatchSchema, options?: ApiCallOptions) => Promise<PatchGroupHttpResponse>;
type PatchGroupHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type PatchGroupHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Clears the cache for groups api requests.
*/
declare function clearCache(): void;
interface GroupsAPI {
/**
* Returns a list of groups with cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetGroupsHttpError
*/
getGroups: typeof getGroups;
/**
* Creates a new group. The maximum number of groups a tenant can have is 10,000. Group names are case-sensitive, and must be unique.
*
* @param body an object with the body content
* @throws CreateGroupHttpError
*/
createGroup: typeof createGroup;
/**
* Retrieves a list of groups matching the filter using advanced query string.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws FilterGroupsHttpError
*/
filterGroups: typeof filterGroups;
/**
* Returns the tenant's group settings, such as whether automatic group creation and IdP group synchronization are enabled or disabled, and roles assigned to system groups.
*
* @throws GetGroupsSettingsHttpError
*/
getGroupsSettings: typeof getGroupsSettings;
/**
* Updates the tenant's group settings, such as whether automatic group creation and IdP group synchronization are enabled or disabled, and roles assigned to system groups.
*
* @param body an object with the body content
* @throws PatchGroupsSettingsHttpError
*/
patchGroupsSettings: typeof patchGroupsSettings;
/**
* Deletes the requested group.
*
* @param groupId The ID of the group to delete.
* @throws DeleteGroupHttpError
*/
deleteGroup: typeof deleteGroup;
/**
* Returns the requested group.
*
* @param groupId The group's unique identifier
* @throws GetGroupHttpError
*/
getGroup: typeof getGroup;
/**
* Updates the requested group.
*
* @param groupId The ID of the group to update.
* @param body an object with the body content
* @throws PatchGroupHttpError
*/
patchGroup: typeof patchGroup;
/**
* Clears the cache for groups api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the groups api
*/
declare const groupsExport: GroupsAPI;
export { type AssignedRoles, type AssignedRolesRefIDs, type AssignedRolesRefNames, type CreateGroupHttpError, type CreateGroupHttpResponse, type DeleteGroupHttpError, type DeleteGroupHttpResponse, type Error, type Errors, type Filter, type FilterGroupsHttpError, type FilterGroupsHttpResponse, type GetGroupHttpError, type GetGroupHttpResponse, type GetGroupsHttpError, type GetGroupsHttpResponse, type GetGroupsSettingsHttpError, type GetGroupsSettingsHttpResponse, type Group, type GroupPatch, type GroupPatchSchema, type GroupPostSchema, type GroupSettings, type Groups, type GroupsAPI, type PatchGroupHttpError, type PatchGroupHttpResponse, type PatchGroupsSettingsHttpError, type PatchGroupsSettingsHttpResponse, type SettingsPatch, type SettingsPatchSchema, clearCache, createGroup, groupsExport as default, deleteGroup, filterGroups, getGroup, getGroups, getGroupsSettings, patchGroup, patchGroupsSettings };