|
| 1 | +import { |
| 2 | + DataFabricDirectoryAssignOptions, |
| 3 | + DataFabricDirectoryAssignmentResult, |
| 4 | + DataFabricDirectoryEntityTypeInput, |
| 5 | + DataFabricDirectoryEntry, |
| 6 | + DataFabricDirectoryGetAllOptions, |
| 7 | + DataFabricDirectoryListOptions, |
| 8 | + DataFabricDirectoryListResponse, |
| 9 | +} from './directory.types'; |
| 10 | + |
| 11 | +export interface DataFabricDirectoryServiceModel { |
| 12 | + /** |
| 13 | + * Lists one page of Data Fabric directory principals and their current roles. |
| 14 | + * |
| 15 | + * Returns directory entries with external IDs, principal metadata, and |
| 16 | + * assigned Data Fabric roles. |
| 17 | + * |
| 18 | + * @param options - Optional offset paging options |
| 19 | + * @returns Promise resolving to {@link DataFabricDirectoryListResponse} |
| 20 | + * |
| 21 | + * @example |
| 22 | + * ```typescript |
| 23 | + * import { DataFabricDirectory } from '@uipath/uipath-typescript/entities'; |
| 24 | + * |
| 25 | + * const directory = new DataFabricDirectory(sdk); |
| 26 | + * const page = await directory.list({ skip: 0, top: 50 }); |
| 27 | + * const firstPrincipal = page.results[0]; |
| 28 | + * ``` |
| 29 | + */ |
| 30 | + list(options?: DataFabricDirectoryListOptions): Promise<DataFabricDirectoryListResponse>; |
| 31 | + |
| 32 | + /** |
| 33 | + * Lists all Data Fabric directory principals and their current roles. |
| 34 | + * |
| 35 | + * Follows the Data Fabric directory top/skip pagination and returns |
| 36 | + * normalized entries. Entries without assigned roles include an empty |
| 37 | + * `roles` array. |
| 38 | + * |
| 39 | + * @param options - Optional page-size options |
| 40 | + * @returns Promise resolving to an array of {@link DataFabricDirectoryEntry} |
| 41 | + * |
| 42 | + * @example |
| 43 | + * ```typescript |
| 44 | + * import { DataFabricDirectory } from '@uipath/uipath-typescript/entities'; |
| 45 | + * |
| 46 | + * const directory = new DataFabricDirectory(sdk); |
| 47 | + * const principals = await directory.getAll({ pageSize: 100 }); |
| 48 | + * ``` |
| 49 | + */ |
| 50 | + getAll(options?: DataFabricDirectoryGetAllOptions): Promise<DataFabricDirectoryEntry[]>; |
| 51 | + |
| 52 | + /** |
| 53 | + * Assigns Data Fabric roles to one or more principals. |
| 54 | + * |
| 55 | + * The Data Fabric API replaces the role set for each principal, so this |
| 56 | + * method preserves existing roles by default and posts the union of current |
| 57 | + * and requested role IDs. |
| 58 | + * |
| 59 | + * Role IDs can be discovered with `DataFabricRoles.getAll()`. Set |
| 60 | + * `preserveExisting: false` only when intentionally replacing a principal's |
| 61 | + * Data Fabric role set. |
| 62 | + * |
| 63 | + * @param principalIds - Principal external ID or IDs |
| 64 | + * @param principalType - Principal type |
| 65 | + * @param roleIds - Data Fabric role IDs to assign |
| 66 | + * @param options - Optional assignment behavior |
| 67 | + * @returns Promise resolving to assignment results per principal |
| 68 | + * |
| 69 | + * @example |
| 70 | + * ```typescript |
| 71 | + * import { DataFabricDirectory, DataFabricRoles } from '@uipath/uipath-typescript/entities'; |
| 72 | + * |
| 73 | + * const roles = new DataFabricRoles(sdk); |
| 74 | + * const directory = new DataFabricDirectory(sdk); |
| 75 | + * |
| 76 | + * const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter'); |
| 77 | + * if (!dataWriter) { |
| 78 | + * throw new Error('DataWriter role not found'); |
| 79 | + * } |
| 80 | + * |
| 81 | + * await directory.assignRoles('<identity-group-id>', 'Group', [dataWriter.id]); |
| 82 | + * ``` |
| 83 | + * |
| 84 | + * @example |
| 85 | + * ```typescript |
| 86 | + * await directory.assignRoles('<identity-user-id>', 'User', ['<role-id>'], { |
| 87 | + * preserveExisting: false, |
| 88 | + * }); |
| 89 | + * ``` |
| 90 | + */ |
| 91 | + assignRoles( |
| 92 | + principalIds: string | string[], |
| 93 | + principalType: DataFabricDirectoryEntityTypeInput, |
| 94 | + roleIds: string[], |
| 95 | + options?: DataFabricDirectoryAssignOptions |
| 96 | + ): Promise<DataFabricDirectoryAssignmentResult[]>; |
| 97 | +} |
0 commit comments