-
Notifications
You must be signed in to change notification settings - Fork 4
/
users.d.ts
607 lines (605 loc) · 21.3 KB
/
users.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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
import { A as ApiCallOptions } from './invoke-fetch-types-BXn-uSF5.js';
import './auth-types-PkN9CAF_.js';
/**
* An array of group references.
*/
type AssignedGroups = {
/** An array of role references. Visibility dependant on access level. Must have access to roles to view other users' assigned roles. */
assignedRoles?: AssignedRoles;
/** The unique group identitier */
id: string;
/** The group name */
readonly name: string;
/** The provider type of the group */
providerType?: "idp" | "custom";
}[];
/**
* An array of group reference names and provider type.
*/
type AssignedGroupsRefNames = {
/** The name of the group */
name: string;
/** The type of provider for the group. */
providerType: "idp" | "custom";
}[];
/**
* 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 scopes assigned to a user
*/
type AssignedScopes = 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;
};
/**
* Error object.
*/
type ErrorItem = {
/** Error code */
code: number;
/** A human-readable explanation specific to this occurrence of the problem (if applicable) */
detail?: string;
/** 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;
};
type ErrorsResponse = {
errors?: ErrorItem[];
};
/**
* 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;
};
/**
* Data list - ResultItem or ErrorItem for each InviteeItem.
*/
type InviteDataResponse = {
data?: (ResultItem | InviteErrorItem)[];
};
/**
* Error object.
*/
type InviteErrorItem = ErrorItem & {
/** Error code - | HTTP Status code | 1001 - Active User | 1002 - Disabled User | 1003 - Default External Dependency Error | */
code?: string;
/** Invitee email */
email: string;
/** Result status = "error" */
status: "error";
};
type InviteItem = {
/** Email address for this invitee. Example - "foo@qlik.com". */
email: string;
/** Optional ISO 639-1 2 letter code for invite language. Defaults to 'en' when missing or not found. */
language?: string;
/** Optional display name for this invitee. Example - "Elvis Presley". */
name?: string;
/** Flag - when true invite message is sent to inactive or invited users. Typically used to force email resend to users who are not yet active. */
resend?: boolean;
};
type InviteRequestData = {
/** List of invitees who should receive an invite email. */
invitees?: InviteItem[];
};
/**
* A JSON Patch document as defined in http://tools.ietf.org/html/rfc6902.
*/
type JSONPatch = {
/** The operation to be performed. The fields `set`, `unset`, and `add` are deprecated. */
op: "replace" | "set" | "unset" | "add" | "renew";
/** A JSON Pointer. The field `roles` is deprecated. */
path: "/name" | "/roles" | "/assignedRoles" | "/inviteExpiry" | "/preferredZoneinfo" | "/preferredLocale" | "/status" | "/assignedGroups";
/** The value to be used for this operation. */
value: string | boolean | unknown[] | RefIDs | RefNames | AssignedGroupsRefNames;
};
/**
* An array of JSON Patch documents
*/
type JSONPatchArray = JSONPatch[];
/**
* An array of entity reference identifiers (e.g. roles, groups).
*/
type RefIDs = {
/** The unique identitier */
id: string;
}[];
/**
* An array of reference names (e.g. roles).
*/
type RefNames = {
/** The name of the entity */
name: string;
}[];
/**
* Invitee result item
*/
type ResultItem = {
/** Email specified for this invitee */
email: string;
/** Result status = {"ok" (new user; email sent) | "exists" (existing user; no email sent)} */
status: "ok" | "exists";
/** IdP generated UUID for this invitee */
subject: string;
/** UserId for this invitee */
userId: string;
};
/**
* A user object.
*/
type User = {
/** An array of group references. */
assignedGroups?: AssignedGroups;
/** An array of role references. Visibility dependant on access level. Must have access to roles to view other users' assigned roles. */
assignedRoles?: AssignedRoles;
/** An array of scopes assigned to a user */
readonly assignedScopes?: AssignedScopes;
/** @deprecated
* Deprecated. Use `createdAt` instead. */
readonly created?: string;
/** The timestamp for when the user record was created. */
readonly createdAt?: string;
/** The email address for the user. */
email?: string;
/** The unique user identifier. */
readonly id: string;
/** The Unix timestamp indicating when the invite will expire. */
readonly inviteExpiry?: number;
/** @deprecated
* Deprecated. Use `lastUpdatedAt` instead. */
readonly lastUpdated?: string;
/** The timestamp for when the user record was last updated. */
readonly lastUpdatedAt?: string;
/** Pagination links to the user. */
readonly links?: {
/** A link to this user. */
self: {
/** URL that defines the resource. */
href: string;
};
};
/** Represents the end-user's language tag. */
locale?: string;
/** The name of the user. */
name: string;
/** A static url linking to the avatar of the user. */
picture?: string;
/** Represents the end-user's preferred language tag. */
preferredLocale?: string;
/** Represents the end-user's preferred time zone. */
preferredZoneinfo?: string;
/** @deprecated
* List of system roles to which the user has been assigned. Only returned when permitted by access control. Deprecated. Use `assignedRoles` instead. */
roles?: ("TenantAdmin" | "Developer" | "AnalyticsAdmin" | "DataAdmin" | "DataSpaceCreator" | "ManagedSpaceCreator" | "SharedSpaceCreator")[];
/** The status of the user within the tenant. */
status?: "active" | "invited" | "disabled" | "deleted" | "provisioned";
/** The unique user identitier from an identity provider. */
subject: string;
/** The tenant that the user belongs too. */
tenantId: string;
/** Represents the end-user's time zone. */
zoneinfo?: string;
};
/**
* The result object for the user count.
*/
type UserCount = {
/** The total number of users in the tenant. */
total: number;
};
type UserPostSchema = {
/** The roles to assign to the user. */
assignedRoles?: RefIDs | RefNames;
/** The email address for the user. This is a required field when inviting a user. */
email?: string;
/** The name of the user. */
name?: string;
/** A static url linking to the avatar of the user. */
picture?: string;
/** @deprecated
* List of system roles to which the user has been assigned. Only returned when permitted by access control. */
roles?: ("TenantAdmin" | "Developer" | "AnalyticsAdmin" | "DataAdmin" | "DataSpaceCreator" | "ManagedSpaceCreator" | "SharedSpaceCreator")[];
/** The status of the created user within the tenant. */
status?: "invited";
/** The unique user identitier from an identity provider. */
subject: string;
/** The tenant that the user will belong too. */
tenantId?: string;
};
type Users = {
/** List of users. */
data?: User[];
/** Pagination links */
links?: {
/** Link information for next page */
next?: {
/** URL to the next page of records */
href: string;
};
/** Link information for previous page */
prev?: {
/** URL to the previous page of records */
href: string;
};
/** Link information for current page */
self: {
/** URL to the current page of records */
href: string;
};
};
/** Indicates the total number of matching documents. Will only be returned if the query parameter "totalResults" is true. */
totalResults?: number;
};
/**
* Returns a list of users using cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetUsersHttpError
*/
declare const getUsers: (query: {
/** @deprecated
* The email to filter by. Deprecated. Use the new `filter` parameter to provide an advanced query filter. */
email?: string;
/** @deprecated
* Get users with IDs that are lower than the target user ID. Cannot be used in conjunction with startingAfter. Deprecated. Use `prev` instead. */
endingBefore?: string;
/** A comma-delimited string of the requested fields per entity. If the 'links' value is omitted, then the entity HATEOAS link will also be omitted. */
fields?: string;
/** 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.
*
* The following fields support the `eq` operator: `id`, `subject`, `name`, `email`, `status`, `clientId`, `assignedRoles.id` `assignedRoles.name`, `assignedGroups.id`, `assignedGroupsAssignedRoles.name`
*
* Additionally, the following fields support the `co` operator: `name`, `email`, `subject`
*
* Queries may be rate limited if they differ greatly from these examples:
*
* ```
* (id eq "62716ab404a7bd8626af9bd6" or id eq "62716ac4c7e500e13ff5fa22") and (status eq "active" or status eq "disabled")
* ```
*
* ```
* name co "query" or email co "query" or subject co "query" or id eq "query" or assignedRoles.name eq "query"
* ```
*
* Any filters for status must be grouped together and applied to the whole query.
*
* Valid:
*
* ```
* (name eq "Bob" or name eq "Alice") and (status eq "active" or status eq "disabled")
* ```
*
* Invalid:
*
* ```
* name eq "Bob" or name eq "Alice" and (status eq "active" or status eq "disabled")
* ``` */
filter?: string;
/** The number of user entries to retrieve. */
limit?: number;
/** Get users that come after this cursor value when sorted. Cannot be used in conjunction with `prev`. */
next?: string;
/** Get users that come before this cursor value when sorted. Cannot be used in conjunction with `next`. */
prev?: string;
/** @deprecated
* The role to filter by. Deprecated. */
role?: string;
/** The field to sort by, with +/- prefix indicating sort order */
sort?: "name" | "+name" | "-name" | "_id" | "+_id" | "-_id" | "id" | "+id" | "-id" | "tenantId" | "+tenantId" | "-tenantId" | "clientId" | "+clientId" | "-clientId" | "status" | "+status" | "-status" | "subject" | "+subject" | "-subject" | "email" | "+email" | "-email" | "inviteExpiry" | "+inviteExpiry" | "-inviteExpiry" | "createdAt" | "+createdAt" | "-createdAt";
/** @deprecated
* The user parameter to sort by. Deprecated. Use `sort` instead. */
sortBy?: "name";
/** @deprecated
* The sort order, either ascending or descending. Deprecated. Use `sort` instead. */
sortOrder?: "asc" | "desc";
/** @deprecated
* Get users with IDs that are higher than the target user ID. Cannot be used in conjunction with endingBefore. Deprecated. Use `next` instead. */
startingAfter?: string;
/** @deprecated
* The status to filter by. Supports multiple values delimited by commas. Deprecated. Use the new `filter` parameter to provide an advanced query filter. */
status?: "active" | "invited" | "disabled" | "deleted" | "provisioned";
/** @deprecated
* The subject to filter by. Deprecated. Use the new `filter` parameter to provide an advanced query filter. */
subject?: string;
/** @deprecated
* The tenant ID to filter by. Deprecated. */
tenantId?: string;
/** Whether to return a total match count in the result. Defaults to false. It will trigger an extra DB query to count, reducing the efficiency of the endpoint. */
totalResults?: boolean;
}, options?: ApiCallOptions) => Promise<GetUsersHttpResponse>;
type GetUsersHttpResponse = {
data: Users;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<GetUsersHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<GetUsersHttpResponse>;
};
type GetUsersHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Creates an invited user.
*
* @param body an object with the body content
* @throws CreateUserHttpError
*/
declare const createUser: (body: UserPostSchema, options?: ApiCallOptions) => Promise<CreateUserHttpResponse>;
type CreateUserHttpResponse = {
data: User;
headers: Headers;
status: number;
};
type CreateUserHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Returns the number of users in a given tenant
*
* @param query an object with query parameters
* @throws CountUsersHttpError
*/
declare const countUsers: (query: {
/** @deprecated
* The tenant ID to filter by. */
tenantId?: string;
}, options?: ApiCallOptions) => Promise<CountUsersHttpResponse>;
type CountUsersHttpResponse = {
data: UserCount;
headers: Headers;
status: number;
};
type CountUsersHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Retrieves a list of users matching the filter using an advanced query string.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws FilterUsersHttpError
*/
declare const filterUsers: (query: {
/** A comma-delimited string of the requested fields per entity. If the 'links' value is omitted, then the entity HATEOAS link will also be omitted. */
fields?: string;
/** 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<FilterUsersHttpResponse>;
type FilterUsersHttpResponse = {
data: Users;
headers: Headers;
status: number;
prev?: (options?: ApiCallOptions) => Promise<FilterUsersHttpResponse>;
next?: (options?: ApiCallOptions) => Promise<FilterUsersHttpResponse>;
};
type FilterUsersHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Invite one or more users by email address.
*
* @param body an object with the body content
* @throws InviteUsersHttpError
*/
declare const inviteUsers: (body: InviteRequestData, options?: ApiCallOptions) => Promise<InviteUsersHttpResponse>;
type InviteUsersHttpResponse = {
data: InviteDataResponse;
headers: Headers;
status: number;
};
type InviteUsersHttpError = {
data: ErrorsResponse;
headers: Headers;
status: number;
};
/**
* Redirects to retrieve the user resource associated with the JWT claims.
*
* @throws GetMyUserHttpError
*/
declare const getMyUser: (options?: ApiCallOptions) => Promise<GetMyUserHttpResponse>;
type GetMyUserHttpResponse = {
data: User;
headers: Headers;
status: number;
};
type GetMyUserHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Deletes the requested user.
*
* @param userId The ID of the user to delete.
* @throws DeleteUserHttpError
*/
declare const deleteUser: (userId: string, options?: ApiCallOptions) => Promise<DeleteUserHttpResponse>;
type DeleteUserHttpResponse = {
data: void;
headers: Headers;
status: number;
};
type DeleteUserHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Returns the requested user.
*
* @param userId The user's unique identifier
* @param query an object with query parameters
* @throws GetUserHttpError
*/
declare const getUser: (userId: string, query: {
/** A comma-delimited string of the requested fields per entity. If the 'links' value is omitted, then the entity HATEOAS link will also be omitted. */
fields?: string;
}, options?: ApiCallOptions) => Promise<GetUserHttpResponse>;
type GetUserHttpResponse = {
data: User & unknown;
headers: Headers;
status: number;
};
type GetUserHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Updates fields for a user resource
*
* @param userId The ID of the user to update.
* @param body an object with the body content
* @throws PatchUserHttpError
*/
declare const patchUser: (userId: string, body: JSONPatchArray, options?: ApiCallOptions) => Promise<PatchUserHttpResponse>;
type PatchUser204HttpResponse = {
data: void;
headers: Headers;
status: 204;
};
type PatchUser207HttpResponse = {
data: Errors;
headers: Headers;
status: 207;
};
type PatchUserHttpResponse = PatchUser204HttpResponse | PatchUser207HttpResponse;
type PatchUserHttpError = {
data: Errors;
headers: Headers;
status: number;
};
/**
* Clears the cache for users api requests.
*/
declare function clearCache(): void;
interface UsersAPI {
/**
* Returns a list of users using cursor-based pagination.
*
* @param query an object with query parameters
* @throws GetUsersHttpError
*/
getUsers: typeof getUsers;
/**
* Creates an invited user.
*
* @param body an object with the body content
* @throws CreateUserHttpError
*/
createUser: typeof createUser;
/**
* Returns the number of users in a given tenant
*
* @param query an object with query parameters
* @throws CountUsersHttpError
*/
countUsers: typeof countUsers;
/**
* Retrieves a list of users matching the filter using an advanced query string.
*
* @param query an object with query parameters
* @param body an object with the body content
* @throws FilterUsersHttpError
*/
filterUsers: typeof filterUsers;
/**
* Invite one or more users by email address.
*
* @param body an object with the body content
* @throws InviteUsersHttpError
*/
inviteUsers: typeof inviteUsers;
/**
* Redirects to retrieve the user resource associated with the JWT claims.
*
* @throws GetMyUserHttpError
*/
getMyUser: typeof getMyUser;
/**
* Deletes the requested user.
*
* @param userId The ID of the user to delete.
* @throws DeleteUserHttpError
*/
deleteUser: typeof deleteUser;
/**
* Returns the requested user.
*
* @param userId The user's unique identifier
* @param query an object with query parameters
* @throws GetUserHttpError
*/
getUser: typeof getUser;
/**
* Updates fields for a user resource
*
* @param userId The ID of the user to update.
* @param body an object with the body content
* @throws PatchUserHttpError
*/
patchUser: typeof patchUser;
/**
* Clears the cache for users api requests.
*/
clearCache: typeof clearCache;
}
/**
* Functions for the users api
*/
declare const usersExport: UsersAPI;
export { type AssignedGroups, type AssignedGroupsRefNames, type AssignedRoles, type AssignedScopes, type CountUsersHttpError, type CountUsersHttpResponse, type CreateUserHttpError, type CreateUserHttpResponse, type DeleteUserHttpError, type DeleteUserHttpResponse, type Error, type ErrorItem, type Errors, type ErrorsResponse, type Filter, type FilterUsersHttpError, type FilterUsersHttpResponse, type GetMyUserHttpError, type GetMyUserHttpResponse, type GetUserHttpError, type GetUserHttpResponse, type GetUsersHttpError, type GetUsersHttpResponse, type InviteDataResponse, type InviteErrorItem, type InviteItem, type InviteRequestData, type InviteUsersHttpError, type InviteUsersHttpResponse, type JSONPatch, type JSONPatchArray, type PatchUser204HttpResponse, type PatchUser207HttpResponse, type PatchUserHttpError, type PatchUserHttpResponse, type RefIDs, type RefNames, type ResultItem, type User, type UserCount, type UserPostSchema, type Users, type UsersAPI, clearCache, countUsers, createUser, usersExport as default, deleteUser, filterUsers, getMyUser, getUser, getUsers, inviteUsers, patchUser };