|
| 1 | +/** |
| 2 | + * Integration Service — Elements models |
| 3 | + * |
| 4 | + * Read-only catalog/metadata APIs — no entity binding. |
| 5 | + */ |
| 6 | + |
| 7 | +import { |
| 8 | + ElementObject, |
| 9 | + ElementActivity, |
| 10 | + ElementObjectMetadataResponse, |
| 11 | + ElementEventObject, |
| 12 | + ElementEventObjectMetadataResponse, |
| 13 | + ElementObjectsGetOptions, |
| 14 | + ElementActivitiesGetOptions, |
| 15 | + ElementObjectMetadataGetOptions, |
| 16 | + ElementEventObjectsGetOptions, |
| 17 | + ElementEventObjectMetadataGetOptions, |
| 18 | +} from './elements.types'; |
| 19 | + |
| 20 | +/** |
| 21 | + * Service for inspecting connector elements (objects, activities, trigger events, |
| 22 | + * field schemas) on UiPath Integration Service. |
| 23 | + * |
| 24 | + * The Elements API powers design-time tooling — every connector exposes a |
| 25 | + * catalog of *objects* (resources like `contacts`, `messages`), *activities* |
| 26 | + * (curated operations like `Send Email`), and *event objects* (trigger sources |
| 27 | + * like `New Message`). Each can be inspected statically (connector-only) or |
| 28 | + * scoped to a connection instance (which enriches the response with custom |
| 29 | + * fields discovered from the live system). |
| 30 | + * |
| 31 | + * ### Usage |
| 32 | + * |
| 33 | + * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize) |
| 34 | + * |
| 35 | + * ```typescript |
| 36 | + * import { Elements } from '@uipath/uipath-typescript/is-elements'; |
| 37 | + * |
| 38 | + * const elements = new Elements(sdk); |
| 39 | + * const objects = await elements.getObjects('uipath-slack'); |
| 40 | + * ``` |
| 41 | + */ |
| 42 | +export interface ElementsServiceModel { |
| 43 | + /** |
| 44 | + * List objects (resources) exposed by a connector. |
| 45 | + * |
| 46 | + * @param elementKey - Connector key (e.g. `uipath-slack`) |
| 47 | + * @param options - Filtering options (type, subtype, hasEvents, hasBulk) |
| 48 | + * @returns Promise resolving to an array of {@link ElementObject} |
| 49 | + * @example |
| 50 | + * ```typescript |
| 51 | + * import { Elements } from '@uipath/uipath-typescript/is-elements'; |
| 52 | + * |
| 53 | + * const elements = new Elements(sdk); |
| 54 | + * |
| 55 | + * const objects = await elements.getObjects('uipath-slack'); |
| 56 | + * for (const obj of objects) { |
| 57 | + * console.log(`${obj.name} — ${obj.displayName}`); |
| 58 | + * } |
| 59 | + * ``` |
| 60 | + * |
| 61 | + * @example |
| 62 | + * ```typescript |
| 63 | + * // Only objects that support events |
| 64 | + * const eventCapable = await elements.getObjects('uipath-slack', { hasEvents: true }); |
| 65 | + * ``` |
| 66 | + */ |
| 67 | + getObjects(elementKey: string, options?: ElementObjectsGetOptions): Promise<ElementObject[]>; |
| 68 | + |
| 69 | + /** |
| 70 | + * List curated activities exposed by a connector. |
| 71 | + * |
| 72 | + * @param elementKey - Connector key |
| 73 | + * @param options - Optional `version` to pin to a specific connector schema |
| 74 | + * @returns Promise resolving to an array of {@link ElementActivity} |
| 75 | + * @example |
| 76 | + * ```typescript |
| 77 | + * const activities = await elements.getActivities('uipath-slack'); |
| 78 | + * for (const activity of activities) { |
| 79 | + * console.log(`${activity.name}: ${activity.operation} on ${activity.objectName}`); |
| 80 | + * } |
| 81 | + * ``` |
| 82 | + */ |
| 83 | + getActivities(elementKey: string, options?: ElementActivitiesGetOptions): Promise<ElementActivity[]>; |
| 84 | + |
| 85 | + /** |
| 86 | + * Get metadata for a single connector object (field schema, supported methods, |
| 87 | + * parameters). Connection-independent — returns the standard schema only. |
| 88 | + * |
| 89 | + * @param elementKey - Connector key |
| 90 | + * @param objectName - Object name (e.g. `messages`) |
| 91 | + * @param options - Optional `version`, `hydrateParameters`, `includeParentArray` |
| 92 | + * @returns Promise resolving to an {@link ElementObjectMetadataResponse} |
| 93 | + * @example |
| 94 | + * ```typescript |
| 95 | + * const meta = await elements.getObjectMetadata('uipath-slack', 'messages'); |
| 96 | + * console.log(`Fields: ${Object.keys(meta.fields ?? {}).length}`); |
| 97 | + * ``` |
| 98 | + */ |
| 99 | + getObjectMetadata( |
| 100 | + elementKey: string, |
| 101 | + objectName: string, |
| 102 | + options?: ElementObjectMetadataGetOptions, |
| 103 | + ): Promise<ElementObjectMetadataResponse>; |
| 104 | + |
| 105 | + /** |
| 106 | + * List event objects (trigger sources) for a connector's event operation. |
| 107 | + * |
| 108 | + * @param elementKey - Connector key |
| 109 | + * @param operationName - Event operation name (e.g. `INDEX_COMPLETED`) |
| 110 | + * @param options - Optional `version` |
| 111 | + * @returns Promise resolving to an array of {@link ElementEventObject} |
| 112 | + * @example |
| 113 | + * ```typescript |
| 114 | + * const events = await elements.getEventObjects('uipath-slack', 'NEW_MESSAGE'); |
| 115 | + * ``` |
| 116 | + */ |
| 117 | + getEventObjects( |
| 118 | + elementKey: string, |
| 119 | + operationName: string, |
| 120 | + options?: ElementEventObjectsGetOptions, |
| 121 | + ): Promise<ElementEventObject[]>; |
| 122 | + |
| 123 | + /** |
| 124 | + * Get metadata for a single event object. |
| 125 | + * |
| 126 | + * @param elementKey - Connector key |
| 127 | + * @param operationName - Event operation name |
| 128 | + * @param objectName - Event object name |
| 129 | + * @param options - Optional `version`, `allFields`, `includeParentArray` |
| 130 | + * @returns Promise resolving to an {@link ElementEventObjectMetadataResponse} |
| 131 | + * @example |
| 132 | + * ```typescript |
| 133 | + * const meta = await elements.getEventObjectMetadata( |
| 134 | + * 'uipath-slack', |
| 135 | + * 'NEW_MESSAGE', |
| 136 | + * 'channels', |
| 137 | + * ); |
| 138 | + * ``` |
| 139 | + */ |
| 140 | + getEventObjectMetadata( |
| 141 | + elementKey: string, |
| 142 | + operationName: string, |
| 143 | + objectName: string, |
| 144 | + options?: ElementEventObjectMetadataGetOptions, |
| 145 | + ): Promise<ElementEventObjectMetadataResponse>; |
| 146 | + |
| 147 | + /** |
| 148 | + * List objects exposed by a connection instance (includes connector custom |
| 149 | + * fields discovered from the live system). |
| 150 | + * |
| 151 | + * @param connectionId - Connection GUID |
| 152 | + * @param elementKey - Connector key |
| 153 | + * @param options - Filtering options |
| 154 | + * @returns Promise resolving to an array of {@link ElementObject} |
| 155 | + * @example |
| 156 | + * ```typescript |
| 157 | + * const objects = await elements.getInstanceObjects('<connectionId>', 'uipath-slack'); |
| 158 | + * ``` |
| 159 | + */ |
| 160 | + getInstanceObjects( |
| 161 | + connectionId: string, |
| 162 | + elementKey: string, |
| 163 | + options?: ElementObjectsGetOptions, |
| 164 | + ): Promise<ElementObject[]>; |
| 165 | + |
| 166 | + /** |
| 167 | + * Get instance-scoped metadata for a single object — includes connector |
| 168 | + * custom fields discovered from the live system. |
| 169 | + * |
| 170 | + * @param connectionId - Connection GUID |
| 171 | + * @param elementKey - Connector key |
| 172 | + * @param objectName - Object name |
| 173 | + * @param options - Optional `version`, `hydrateParameters`, `includeParentArray` |
| 174 | + * @returns Promise resolving to an {@link ElementObjectMetadataResponse} |
| 175 | + * @example |
| 176 | + * ```typescript |
| 177 | + * const meta = await elements.getInstanceObjectMetadata( |
| 178 | + * '<connectionId>', |
| 179 | + * 'uipath-salesforce', |
| 180 | + * 'Account', |
| 181 | + * ); |
| 182 | + * ``` |
| 183 | + */ |
| 184 | + getInstanceObjectMetadata( |
| 185 | + connectionId: string, |
| 186 | + elementKey: string, |
| 187 | + objectName: string, |
| 188 | + options?: ElementObjectMetadataGetOptions, |
| 189 | + ): Promise<ElementObjectMetadataResponse>; |
| 190 | + |
| 191 | + /** |
| 192 | + * List event objects for a connection instance. |
| 193 | + * |
| 194 | + * @param connectionId - Connection GUID |
| 195 | + * @param elementKey - Connector key |
| 196 | + * @param operationName - Event operation name |
| 197 | + * @param options - Optional `version` |
| 198 | + * @returns Promise resolving to an array of {@link ElementEventObject} |
| 199 | + * @example |
| 200 | + * ```typescript |
| 201 | + * const events = await elements.getInstanceEventObjects( |
| 202 | + * '<connectionId>', |
| 203 | + * 'uipath-slack', |
| 204 | + * 'NEW_MESSAGE', |
| 205 | + * ); |
| 206 | + * ``` |
| 207 | + */ |
| 208 | + getInstanceEventObjects( |
| 209 | + connectionId: string, |
| 210 | + elementKey: string, |
| 211 | + operationName: string, |
| 212 | + options?: ElementEventObjectsGetOptions, |
| 213 | + ): Promise<ElementEventObject[]>; |
| 214 | + |
| 215 | + /** |
| 216 | + * Get instance-scoped metadata for a single event object. |
| 217 | + * |
| 218 | + * @param connectionId - Connection GUID |
| 219 | + * @param elementKey - Connector key |
| 220 | + * @param operationName - Event operation name |
| 221 | + * @param objectName - Event object name |
| 222 | + * @param options - Optional `version`, `allFields`, `includeParentArray` |
| 223 | + * @returns Promise resolving to an {@link ElementEventObjectMetadataResponse} |
| 224 | + * @example |
| 225 | + * ```typescript |
| 226 | + * const meta = await elements.getInstanceEventObjectMetadata( |
| 227 | + * '<connectionId>', |
| 228 | + * 'uipath-slack', |
| 229 | + * 'NEW_MESSAGE', |
| 230 | + * 'channels', |
| 231 | + * ); |
| 232 | + * ``` |
| 233 | + */ |
| 234 | + getInstanceEventObjectMetadata( |
| 235 | + connectionId: string, |
| 236 | + elementKey: string, |
| 237 | + operationName: string, |
| 238 | + objectName: string, |
| 239 | + options?: ElementEventObjectMetadataGetOptions, |
| 240 | + ): Promise<ElementEventObjectMetadataResponse>; |
| 241 | +} |
0 commit comments